From ac119a1a2ec45d654fd1f9eb560fd7efcc3e9d48 Mon Sep 17 00:00:00 2001 From: Hannah Date: Mon, 20 Apr 2020 09:48:38 +0200 Subject: [PATCH] Template changes for group manager, includes new scripts to do : take out what is written and automatize the process to get the different info from groups and users --- admin/themes/default/template/group_list.tpl | 777 ++++++++++++++++--- 1 file changed, 668 insertions(+), 109 deletions(-) diff --git a/admin/themes/default/template/group_list.tpl b/admin/themes/default/template/group_list.tpl index 22d85a0d6..d985f2569 100644 --- a/admin/themes/default/template/group_list.tpl +++ b/admin/themes/default/template/group_list.tpl @@ -1,20 +1,6 @@ {footer_script} {literal} $(document).ready(function() { - /** - * Add group - */ - jQuery("#addGroup").click(function() { - jQuery("#addGroupForm").toggle(); - jQuery("input[name=groupname]").focus(); - return false; - }); - - jQuery("#addGroupClose").click(function() { - jQuery("#addGroupForm").hide(); - return false; - }); - $('.groups input').change(function () { $(this).parent('p').toggleClass('group_select'); }); $(".grp_action").hide(); $("input.group_selection").click(function() { @@ -34,7 +20,7 @@ $(document).ready(function() { $(this).toggle(); }); - if (nbSelected<2) { + if (nbSelected2) { $("#two_to_select").show(); $("#two_atleast").hide(); } @@ -54,8 +40,185 @@ $(document).ready(function() { $("#applyActionBlock").hide(); } }); + }); +/*------- +Group Popup +-------*/ + +$(".group_details_popup_trigger").click(function(){ + $('.Group_details-popup-container').show(); +}); + +$(".CloseGroupPopup").click(function(){ + $('.Group_details-popup-container').hide(); +}); + + +/*------- +Add User toggle and reduces height of user list when add user form is visible +-------*/ + +$('#form-btn').click(function(){ + $('#cancel').show(); + $('#addUserLabel').show() + $('#input-user-name').show(); + $('#UserSubmit').show(); + $('#form-btn').hide(); + $(".groups .list_user").css("max-height","100px"); +}); + +$('#cancel').click(function(){ + $('#cancel').hide(); + $('#addUserLabel').hide() + $('#input-user-name').hide(); + $('#UserSubmit').hide(); + $('#form-btn').show(); + $(".groups .list_user").css("max-height","200px"); +}); + +/*------- +Add Group toggle +-------*/ + +$('#addGroup').click(function(){ + $('#addGroupForm').css('display', 'inline-block'); + $('#showAddGroup').css('display', 'none'); +}); + +$('#addGroupClose').click(function(){ + $('#addGroupForm').css('display', 'none'); + $('#showAddGroup').css('display', 'inline-block'); +}); + +/*------- +User List group pop-in +-------*/ + +var modalUL = document.getElementById("UserList"); + +var btn = document.getElementById("UserListTrigger"); + +var close = document.getElementsByClassName("CloseUserList")[0]; + +btn.onclick = function() { + modalUL.style.visibility = "visible"; +} + +close.onclick = function() { + modalUL.style.visibility = "hidden"; +} + +/*------- +Selection mode toggle actions, +changes "..." in group block to checkbox, +disables group actions in selection mode +-------*/ + +$(function () { + $("#toggleSelectionMode").click(function () { + if ($(this).is(":checked")) { + $("#selection-mode-block").show(); + $(".group-dropdown-options").css('display', 'none'); + $(".Group-checkbox").css('display','block'); + $(".GroupManagerButtons").addClass("DisableInSelectionMode"); + $("#group_name").attr('contenteditable', false); + $(".icon-pencil").addClass("DisableInSelectionMode"); + $("label").css("cursor","default") + } else { + $("#selection-mode-block").hide(); + $(".group-dropdown-options").css('display', 'block'); + $(".Group-checkbox").css('display','none'); + $(".Group-checkbox-container input").prop("checked", false); + $('#group-1 li').removeClass("OrangeBackground"); + $('.groups .icon-users-1:first-child').removeClass("GreyBackground"); + $(".GroupManagerButtons").removeClass("DisableInSelectionMode"); + $("#group_name").attr('contenteditable', true); + $(".icon-pencil").removeClass("DisableInSelectionMode"); + $("label").css("cursor","pointer") + } + }); + }); + + +/*------- +Change background color of group block if checked in selection mode +-------*/ + +$(".Group-checkbox-container input[type='checkbox']").change(function(){ +if($(this).is(":checked")){ + $('#group-1 li').addClass("OrangeBackground"); + $('.groups .icon-users-1:first-child').addClass("GreyBackground"); + $('.groups .group_number_users').addClass("GreyFont"); +}else{ + $('#group-1 li').removeClass("OrangeBackground"); + $('.groups .icon-users-1:first-child').removeClass("GreyBackground"); +} }); + +/*------- +Display group name in selection list +-------*/ +/* +$(function () { + $("#Group-Checkbox-selection").click(function () { + if ($(this).is(":checked")) { + $('.SelectionModeGroup').show(); + $('#nothing-selected').hide(); + }else{ + $('.SelectionModeGroup').hide(); + $('#nothing-selected').show(); + } + )}; +}); +*/ + +/*------- +show group options in "..." on click +-------*/ + +$(".group-dropdown-options").click(function GroupOptions(){ + $("#GroupOptions").toggle(); + }); + +$(document).mouseup(function (e) { + if ($(e.target).closest("#GroupOptions").length + === 0) { + $("#GroupOptions").hide(); + } + }); + +/*------- +Merge Options in selection mode +-------*/ + +function MergeOptions(){ + document.getElementById("MergeOptionsBlock").style.display = "block"; + document.getElementById("DeleteSelectionMode").style.display = "none"; + document.getElementById("MergeSelectionMode").style.display = "none"; +}; + +/*------- +Cancel Merge options +-------*/ + +function CancelAction(){ + document.getElementById("MergeOptionsBlock").style.display = "none"; + document.getElementById("ConfirmGroupAction").style.display = "none"; + document.getElementById("DeleteSelectionMode").style.display = "block"; + document.getElementById("MergeSelectionMode").style.display = "block"; +}; + +/*------- +Display deletion confirmation +-------*/ + +function DeleteValidation(){ + document.getElementById("ConfirmGroupAction").style.display = "block"; + document.getElementById("DeleteSelectionMode").style.display = "none"; + document.getElementById("MergeSelectionMode").style.display = "none"; +}; + {/literal} {/footer_script} @@ -65,124 +228,520 @@ $(document).ready(function() {

{'Group management'|@translate}

-

- {'Add group'|translate} -

+
+ +

Selection mode

+
- +
+

You are about to delete [4] groups, are you sure?

+ + No, I have changed my mind +
+ + + +
-
- {'Action'|@translate} -
{'No group selected, no action possible.'|@translate}
-
- \ No newline at end of file + +
\ No newline at end of file