Skip to content

Commit

Permalink
T1069 Manage Categories
Browse files Browse the repository at this point in the history
Summary:
- rename tags to categories wherever the user can see it
- adjust categories layout to more closely match /users

Test Plan: run the tests

Reviewers: shadowhand, seth

Subscribers: rjmackay

Maniphest Tasks: T1069

Differential Revision: https://phabricator.ushahidi.com/D593
  • Loading branch information
aMoniker committed Jan 9, 2015
1 parent c044320 commit d28616e
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 114 deletions.
46 changes: 44 additions & 2 deletions app/controllers/tags/tags.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
module.exports = ['$scope', '$translate', 'TagEndpoint', function($scope, $translate, TagEndpoint) {
module.exports = [
'$scope',
'$translate',
'$q',
'TagEndpoint',
function(
$scope,
$translate,
$q,
TagEndpoint
) {

$translate('tag.manage_tags').then(function(manageTagsTranslation){
$scope.title = manageTagsTranslation;
});

$scope.tags = TagEndpoint.query();
$scope.refreshView = function() {
$scope.tags = TagEndpoint.query();
$scope.selectedTags = [];
};
$scope.refreshView();

$scope.deleteTags = function() {
$translate('notify.tag.bulk_destroy_confirm', {
count: $scope.selectedTags.length
}).then(function(message) {
if (window.confirm(message)) {
var calls = [];
angular.forEach($scope.selectedTags, function(tagId) {
calls.push( TagEndpoint.delete({ id: tagId }).$promise );
});
$q.all(calls).then($scope.refreshView);
}
});
};

$scope.isToggled = function(tag) {
return $scope.selectedTags.indexOf(tag.id) > -1;
};

$scope.toggleTag = function(tag) {
var idx = $scope.selectedTags.indexOf(tag.id);
if (idx > -1) {
$scope.selectedTags.splice(idx, 1);
} else {
$scope.selectedTags.push(tag.id);
}
};

}];
66 changes: 33 additions & 33 deletions app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"query" : "Query",
"request_body" : "Request Body",
"reset" : "Reset",
"tags" : "Tags",
"tags" : "Categories",
"users" : "Users"
},
"app": {
Expand Down Expand Up @@ -95,7 +95,7 @@
"back" : "Back",
"click_images_to_zoom" : "Click images to zoom",
"count_posts" : "__count__ <span>posts</span>",
"count_tags" : "__count__ <span>tags</span>",
"count_tags" : "__count__ <span>categories</span>",
"count_users" : "__count__ <span>users</span>",
"disable" : "Disable",
"edit_profile" : "Edit Profile",
Expand Down Expand Up @@ -129,7 +129,7 @@
"set" : "Set",
"sets" : "Sets",
"settings" : "Settings",
"tags" : "Tags",
"tags" : "Categories",
"unselect_all" : "Unselect All",
"until_time" : "Until Time",
"users" : "Users",
Expand All @@ -141,16 +141,16 @@
"search" : {
"nav" : {
"location" : "Location",
"tags" : "Tags",
"tags" : "Categories",
"date" : "Date",
"keyword" : "Keyword"
},
"location" : {
"select_a_location" : "Select a location"
},
"tags" : {
"select_tags" : "Select tags",
"tag_actions" : "Tag Actions",
"select_tags" : "Select categories",
"tag_actions" : "Category Actions",
"select" : "select",
"edit" : "edit"
},
Expand Down Expand Up @@ -178,7 +178,7 @@
"workspace": {
"posts" : "posts",
"users" : "users",
"tags" : "tags",
"tags" : "categories",
"accordion" : {
"posts" : "Posts",
"settings" : "Settings",
Expand All @@ -202,7 +202,7 @@
"edited_by" : "Edited by",
"export" : "Export",
"number_of_posts_shown" : "Number of posts shown",
"other_posts_tagged" : "Other posts tagged",
"other_posts_tagged" : "Other posts categorized",
"post_details" : "Post Details",
"post_history" : "Post History",
"private" : "Private",
Expand All @@ -223,7 +223,7 @@
"respond" : "Respond",
"send" : "Send",
"more" : "more",
"posts_with_same_tags" : " posts with same tags",
"posts_with_same_tags" : " posts with same categories",
"post_actions" : {
"post_actions" : "Post Actions",
"select" : "select",
Expand All @@ -243,7 +243,7 @@
}
},
"about" : "About",
"tags" : "Tags"
"tags" : "Categories"

},
"filter_sort" : {
Expand Down Expand Up @@ -281,7 +281,7 @@
"published" : "published",
"unpublished" : "unpublished",
"read_more" : "&nbsp;... Read&nbsp;More",
"tags" : "Tags",
"tags" : "Categories",
"post_actions" : {
"post_actions" : "Post Actions",
"select" : "select",
Expand All @@ -297,7 +297,7 @@
"add_a_photo" : "Add a photo",
"add_to_sets" : "Add to sets",
"add_to_set" : "Add to set",
"choose_a_tag" : "Choose a tag",
"choose_a_tag" : "Choose a category",
"click_or_tap_button_to_change" : "Click or tap button to change",
"create_set" : "Create Set",
"description" : "Description",
Expand All @@ -307,37 +307,37 @@
"photo" : "Photo",
"private" : "Private",
"public" : "Public",
"separate_tags_with_commas" : "Separate tags with commas",
"separate_tags_with_commas" : "Separate categories with commas",
"this_set_is_private_by_default" : "This set is *Private* by default",
"visibility" : "Visibility"
},
"tag": {
"add_tag" : "Add Tag",
"create_tag" : "Create Tag",
"manage_tags" : "Manage Tags",
"edit_tag" : "Edit Tag",
"tag": { // named 'tags' in code, and 'categories' for user display
"add_tag" : "Add Category",
"create_tag" : "Create Category",
"manage_tags" : "Manage Categories",
"edit_tag" : "Edit Category",
"no_description_given" : "No description given",
"number_of_tags_shown" : "Number of tags shown",
"sort_tags_by" : "Sort tags by",
"update_tag" : "Update Tag",
"number_of_tags_shown" : "Number of categories shown",
"sort_tags_by" : "Sort categories by",
"update_tag" : "Update Category",
"unselect_all" : "Unselect all",
"add_tag" : "Add tag",
"add_tag" : "Add category",
"delete" : "Delete",
"tag_actions" : "Tag Actions",
"number_of_tags_shown" : "Number of tags shown",
"tag_actions" : "Category Actions",
"number_of_tags_shown" : "Number of categories shown",
"sort_users_by" : "Sort users by",
"filter_sort" : {
"properties" : {
"sort" : "Sort by",
"date_time_created" : "Date/Time Created",
"username_a_z" : "Username A-Z",
"tag_a_z" : "Tag A-Z",
"id" : "ID"
}
}
},
"tool": {
"manage_forms" : "Manage Forms",
"manage_tags" : "Manage Tags",
"manage_tags" : "Manage Categories",
"manage_users" : "Manage Users",
"map_settings" : "Map Settings",
"site_settings" : "Site Settings",
Expand Down Expand Up @@ -420,7 +420,7 @@
"destroy_success" : "Deleted resource",
"destroy_error" : "Unable to delete resource, please try again",
"destroy_cancelled" : "Delete cancelled",
"bulk_destroy_confirm" : "Are you sure you want to delete __count__ resources?",
"bulk_destroy_confirm" : "Are you sure you want to delete {{count}} resources?",
"bulk_destroy_success" : "Deleted resource",
"bulk_destroy_error" : "Unable to delete resource, please try again",
"bulk_destroy_cancelled" : "Delete cancelled"
Expand All @@ -435,13 +435,13 @@
"destroy_confirm" : "Are you sure you want to delete this post?",
"destroy_success" : "Post deleted",
"destroy_error" : "Unable to delete post, please try again",
"bulk_destroy_confirm" : "Are you sure you want to delete __count__ posts?"
"bulk_destroy_confirm" : "Are you sure you want to delete {{count}} posts?"
},
"tag" : {
"destroy_confirm" : "Are you sure you want to delete this tag?",
"destroy_success" : "Tag deleted",
"destroy_error" : "Unable to delete tag, please try again",
"bulk_destroy_confirm" : "Are you sure you want to delete __count__ tags?"
"destroy_confirm" : "Are you sure you want to delete this category?",
"destroy_success" : "Category deleted",
"destroy_error" : "Unable to delete category, please try again",
"bulk_destroy_confirm" : "Are you sure you want to delete {{count}} categories?"
},
"user" : {
"destroy_confirm" : "Are you sure you want to delete this user?",
Expand All @@ -455,6 +455,6 @@
"default" : "No records found.",
"post" : "No posts found.",
"user" : "No users found.",
"tag" : "No tags found."
"tag" : "No categories found."
}
}
2 changes: 1 addition & 1 deletion app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function($routeProvider, $locationProvider) {
controller: require('./controllers/admin/map-settings.js'),
templateUrl: 'templates/admin/map-settings.html'
})
.when('/tags', {
.when('/categories', {
controller: require('./controllers/tags/tags.js'),
templateUrl: 'templates/tags/tags.html'
});
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ gulp.task('watch', [], function() {
livereload.listen();
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch('bower_components/font-awesome/fonts/fontawesome*', ['font']);
gulp.watch('app/**/*.js', ['browserify']);
gulp.watch(['app/**/*.js', 'app/locales/*.json'], ['browserify']);
});

/**
Expand Down
31 changes: 30 additions & 1 deletion sass/pages/tags/_tags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/*
* HEADER...............header title and action styles
* FITLER BAR...............delete category, add category
* TAG LIST...............tag description and actions
*/

Expand Down Expand Up @@ -46,12 +47,40 @@



/*------------------------------------*\
$FITLER BAR
\*------------------------------------*/

.filter-bar-wrapper {

.filter-bar {

li {

&.add-tag {
@include button($black);
color: $white;
float: right;
}
}
}
}



/*------------------------------------*\
$TAG LIST
\*------------------------------------*/

.tag-list .list-view__item {
padding: 30px 30px 30px 55px;
}

.list-view-details--tag {
@include span-columns(12);
margin-top: 10px;
color: $base-font-color;

.list-view-header {
margin-bottom: 0;
}
}
Loading

0 comments on commit d28616e

Please sign in to comment.