Skip to content

Commit

Permalink
Issue #1193 : Design fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacharieg committed Jun 22, 2020
1 parent df9a4ef commit bd0e70f
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 101 deletions.
5 changes: 3 additions & 2 deletions admin/tags.php
Expand Up @@ -72,12 +72,13 @@
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),
'<a
data-tags=\'["'.implode('" ,"', $orphan_tag_names).'"]\'
class="icon-eye"
data-url="'.get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token().'">'
.l10n('See details').'</a>'
.l10n('Review').'</a>'
);
}

Expand Down
10 changes: 10 additions & 0 deletions admin/themes/default/js/group_list.js
Expand Up @@ -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
-------*/
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -281,6 +287,7 @@ var deleteGroup = function (id) {
$(".DeleteGroupList div[data-id="+id+"]").remove()
$("#MergeOptionsChoices option[value="+ id +"]").remove()
}
updateBadge();
},
error: function (err) {
console.log(err);
Expand Down Expand Up @@ -428,6 +435,7 @@ var duplicateAction = function(id) {
let groupbox = createGroup(group)
groupbox.insertAfter($("#group-"+id));
setupGroupBox(groupbox);
updateBadge();
}
},
error: function (err) {
Expand Down Expand Up @@ -607,6 +615,7 @@ $('.ConfirmMergeButton').on("click", function() {
$("#group-"+dest_grp + " .group_number_users").html(
number + " " + ((number > 1)? str_members_default:str_member_default)
);
updateBadge();
}
})
};
Expand Down Expand Up @@ -658,6 +667,7 @@ $('.ConfirmDeleteButton').on("click", function() {
},
...jConfirm_alert_options
});
updateBadge();
}
},
error: function (err) {
Expand Down
18 changes: 16 additions & 2 deletions admin/themes/default/js/tags.js
Expand Up @@ -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');
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -231,6 +237,8 @@ function removeTag(id, name) {
if (data.stat === "ok") {
$('.tag-box[data-id='+id+']').remove();
}
updateBadge()
hideLastTags()
}
})
},
Expand Down Expand Up @@ -302,6 +310,8 @@ function duplicateTag(id, name) {
newTag.find('.tag-dropdown-action.manage').show();
}
setupTagbox(newTag);
updateBadge()
hideLastTags()
resolve(data);
}
},
Expand Down Expand Up @@ -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);
Expand All @@ -515,6 +525,8 @@ function removeSelectedTags() {
$('.tag-box[data-id='+id+']').remove();
})
updateListItem();
updateBadge()
hideLastTags()
}
}
})
Expand Down Expand Up @@ -570,6 +582,8 @@ function mergeGroups(destination_id, merge_ids) {
}
$(".tag-box").attr("data-selected", '0');
updateListItem();
updateBadge()
hideLastTags()
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion admin/themes/default/template/group_list.tpl
Expand Up @@ -94,7 +94,7 @@ var rootUrl = '{$ROOT_URL}'


<div class="titrePage">
<h2>{'Group management'|@translate}</h2>
<h2>{'Group management'|@translate} <span class="badge-number"> {count($groups)}</span></h2>
</div>

<div class="selection-mode-group-manager">
Expand Down
30 changes: 16 additions & 14 deletions admin/themes/default/template/tags.tpl
Expand Up @@ -35,8 +35,8 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'
<a class='tag-dropdown-action icon-eye view' href="{$tag_U_VIEW}" {if !$has_image} style='display:none' {/if}>{'View in gallery'|@translate}</a>
<a class='tag-dropdown-action icon-picture manage' href="{$tag_U_EDIT}" {if !$has_image} style='display:none' {/if}>{'Manage photos'|@translate}</a>
<a class='tag-dropdown-action icon-pencil edit'> {'Edit'|@translate}</a>
<a class='tag-dropdown-action icon-trash delete'> {'Delete'|@translate}</a>
<a class='tag-dropdown-action icon-docs duplicate'> {'Duplicate'|@translate}</a>
<a class='tag-dropdown-action icon-trash delete'> {'Delete'|@translate}</a>
</div>
<span class="select-checkbox in-selection-mode">
<i class="icon-ok"> </i>
Expand All @@ -53,7 +53,7 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'
{/function}

<div class="titrePage">
<h2>{'Manage tags'|@translate}</h2>
<h2>{'Tag Manager'|@translate} <span class="badge-number"> {count($all_tags)}</span> </h2>
</div>

<div class="selection-mode-group-manager">
Expand All @@ -75,7 +75,7 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'

</div>
<div class="selection-other-tags"></div>
<button id="MergeSelectionMode" class="icon-object-group unavailable">{'Merge'|@translate}</button>
<button id="MergeSelectionMode" class="icon-object-group unavailable" title="{'At least 2 selected tags are needed to merge'|@translate}">{'Merge'|@translate}</button>
<button id="DeleteSelectionMode" class="icon-trash-1">{'Delete'|@translate}</button>
</div>

Expand All @@ -100,24 +100,26 @@ var str_others_tags_available = '{'%s other tags available...'|@translate}'
</div>
<form id='add-tag' class='not-in-selection-mode'>
<span class='icon-cancel'></span>
<span class='icon-plus-circled icon-validate'></span>
<label class='add-tag-container'>
<label class='add-tag-label icon-plus-circled'>
<p>{'Add a tag'|@translate}</p>
<input type='text' id='add-tag-input' placeholder="{'Add a tag'|@translate}">
<input type='submit' hidden>
<div class='add-tag-container'>
<input type='text' id='add-tag-input' placeholder="{'New tag'|@translate}">
<input type='submit' hidden>
<span class='icon-plus-circled icon-validate'></span>
</div>
</label>
</form>
<div class='selection-controller in-selection-mode'>
<p>{'Select:'|@translate}</p>
<a id="selectAll" class="icon-star">{'All'|@translate}</a>
<a id="selectNone" class="icon-star-empty">{'None'|@translate}</a>
<a id="selectInvert" class="icon-exchange">{'Invert'|@translate}</a>
<p>{'Select'|@translate}</p>
<a id="selectAll">{'All'|@translate}</a>
<a id="selectNone">{'None'|@translate}</a>
<a id="selectInvert">{'Invert'|@translate}</a>
</div>
{if $warning_tags != ""}
<div class='tag-warning tag-info icon-attention'><p> {$warning_tags} </p></div>
<div class='tag-warning tag-info icon-attention not-in-selection-mode'><p> {$warning_tags} </p></div>
{/if}
<div class='tag-message tag-info icon-ok' {if $message_tags != ""}style='display:flex'{/if}> <p> {$message_tags} </p> </div>
<div class='tag-error tag-info icon-cancel'> <p> </p> </div>
<div class='tag-message tag-info icon-ok not-in-selection-mode' {if $message_tags != ""}style='display:flex'{/if}> <p> {$message_tags} </p> </div>
<div class='tag-error tag-info icon-cancel not-in-selection-mode'> <p> </p> </div>
</div>

<div class='tag-container'>
Expand Down

0 comments on commit bd0e70f

Please sign in to comment.