From ce0d9a57f09a1cd49c760cc659a1966474dfc30a Mon Sep 17 00:00:00 2001 From: Zacharie Date: Mon, 22 Jun 2020 16:18:32 +0200 Subject: [PATCH] Issue #1193 : Design fixes --- admin/tags.php | 5 +- admin/themes/default/js/group_list.js | 10 + admin/themes/default/js/tags.js | 18 +- admin/themes/default/template/group_list.tpl | 4 +- admin/themes/default/template/tags.tpl | 30 +-- admin/themes/default/theme.css | 186 ++++++++++--------- 6 files changed, 145 insertions(+), 108 deletions(-) diff --git a/admin/tags.php b/admin/tags.php index db90f6bcd..d218420aa 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -72,12 +72,13 @@ foreach ($orphan_tags as $tag) if (count($orphan_tag_names) > 0) { $warning_tags = sprintf( - l10n('You have %d orphan tags: %s.'), + l10n('You have %d orphan tags %s.'), count($orphan_tag_names), '' - .l10n('See details').'' + .l10n('Review').'' ); } diff --git a/admin/themes/default/js/group_list.js b/admin/themes/default/js/group_list.js index d4021e51d..fd1e0ad68 100644 --- a/admin/themes/default/js/group_list.js +++ b/admin/themes/default/js/group_list.js @@ -11,6 +11,11 @@ $(".CloseGroupPopup").click(function () { $(".Group_details-popup-container").hide(); }); +//Number On Badge +function updateBadge() { + $('.badge-number').html($('.GroupContainer').length - 2) //Less the add group div and the template +} + /*------- Add User toggle and reduces height of user list when add user form is visible -------*/ @@ -87,6 +92,7 @@ jQuery(document).ready(function () { groupBox = createGroup(group) groupBox.prependTo(".groups") setupGroupBox(groupBox); + updateBadge(); } else { $("#addGroupForm .groupError").html(str_name_taken); $("#addGroupForm .groupError").fadeIn(); @@ -282,6 +288,7 @@ var deleteGroup = function (id) { $(".DeleteGroupList div[data-id="+id+"]").remove() $("#MergeOptionsChoices option[value="+ id +"]").remove() } + updateBadge(); }, error: function (err) { console.log(err); @@ -429,6 +436,7 @@ var duplicateAction = function(id) { let groupbox = createGroup(group) groupbox.insertAfter($("#group-"+id)); setupGroupBox(groupbox); + updateBadge(); } }, error: function (err) { @@ -608,6 +616,7 @@ $('.ConfirmMergeButton').on("click", function() { $("#group-"+dest_grp + " .group_number_users").html( number + " " + ((number > 1)? str_members_default:str_member_default) ); + updateBadge(); } }) }; @@ -659,6 +668,7 @@ $('.ConfirmDeleteButton').on("click", function() { }, ...jConfirm_alert_options }); + updateBadge(); } }, error: function (err) { diff --git a/admin/themes/default/js/tags.js b/admin/themes/default/js/tags.js index 8b915c8a0..3d22e0228 100644 --- a/admin/themes/default/js/tags.js +++ b/admin/themes/default/js/tags.js @@ -30,6 +30,11 @@ $('.tag-warning p a').on('click', () => { }) }) +//Number On Badge +function updateBadge() { + $('.badge-number').html($('.tag-box').length) +} + //Add a tag $('.add-tag-container').on('click', function() { $('#add-tag').addClass('input-mode'); @@ -87,6 +92,7 @@ function addTag(name) { newTag = createTagBox(data.result.id, name); $('.tag-container').prepend(newTag); setupTagbox(newTag); + updateBadge() resolve(); } else { reject(str_already_exist.replace('%s', name)); @@ -231,6 +237,8 @@ function removeTag(id, name) { if (data.stat === "ok") { $('.tag-box[data-id='+id+']').remove(); } + updateBadge() + hideLastTags() } }) }, @@ -302,6 +310,8 @@ function duplicateTag(id, name) { newTag.find('.tag-dropdown-action.manage').show(); } setupTagbox(newTag); + updateBadge() + hideLastTags() resolve(data); } }, @@ -505,8 +515,8 @@ function removeSelectedTags() { url: "ws.php?format=json&method=pwg.tags.delete", type: "POST", data: { - tag_id: ids, - pwg_token: pwg_token + 'pwg_token': pwg_token, + 'tag_id': ids }, success: function (raw_data) { data = jQuery.parseJSON(raw_data); @@ -515,6 +525,8 @@ function removeSelectedTags() { $('.tag-box[data-id='+id+']').remove(); }) updateListItem(); + updateBadge() + hideLastTags() } } }) @@ -570,6 +582,8 @@ function mergeGroups(destination_id, merge_ids) { } $(".tag-box").attr("data-selected", '0'); updateListItem(); + updateBadge() + hideLastTags() } } }) diff --git a/admin/themes/default/template/group_list.tpl b/admin/themes/default/template/group_list.tpl index 223b085e4..78db8f813 100644 --- a/admin/themes/default/template/group_list.tpl +++ b/admin/themes/default/template/group_list.tpl @@ -95,7 +95,7 @@ var rootUrl = '{$ROOT_URL}'
-

{'Group manager'|@translate}

+

{'Group management'|@translate} {count($groups)}

@@ -239,4 +239,4 @@ var rootUrl = '{$ROOT_URL}'
- \ No newline at end of file + diff --git a/admin/themes/default/template/tags.tpl b/admin/themes/default/template/tags.tpl index 1573cf538..5ea81023a 100644 --- a/admin/themes/default/template/tags.tpl +++ b/admin/themes/default/template/tags.tpl @@ -35,8 +35,8 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}' {'Edit'|@translate} - {'Delete'|@translate} {'Duplicate'|@translate} + {'Delete'|@translate} @@ -53,7 +53,7 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}' {/function}
-

{'Manage tags'|@translate}

+

{'Tag Manager'|@translate} {count($all_tags)}

@@ -75,7 +75,7 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'
- + @@ -100,24 +100,26 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'
- -