mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
fix #1699 we use user_prefs for the user view selector now
This commit is contained in:
@@ -211,10 +211,6 @@ $( document ).ready(function() {
|
||||
|
||||
/*View manager*/
|
||||
|
||||
if (!$.cookie("pwg_user_manager_view")) {
|
||||
$.cookie("pwg_user_manager_view", "line");
|
||||
}
|
||||
|
||||
if ($("#displayCompact").is(":checked")) {
|
||||
setDisplayCompact();
|
||||
};
|
||||
@@ -233,9 +229,7 @@ $( document ).ready(function() {
|
||||
if ($(".addAlbum").hasClass("input-mode")) {
|
||||
$(".addAlbum p").hide();
|
||||
}
|
||||
|
||||
$.cookie("pwg_user_manager_view", "compact");
|
||||
|
||||
set_view_selector('compact');
|
||||
});
|
||||
|
||||
$("#displayLine").change(function () {
|
||||
@@ -244,8 +238,7 @@ $( document ).ready(function() {
|
||||
if ($(".addAlbum").hasClass("input-mode")) {
|
||||
$(".addAlbum p").hide();
|
||||
}
|
||||
|
||||
$.cookie("pwg_user_manager_view", "line");
|
||||
set_view_selector('line');
|
||||
});
|
||||
|
||||
$("#displayTile").change(function () {
|
||||
@@ -254,13 +247,12 @@ $( document ).ready(function() {
|
||||
if ($(".addAlbum").hasClass("input-mode")) {
|
||||
$(".addAlbum p").show();
|
||||
}
|
||||
|
||||
$.cookie("pwg_user_manager_view", "tile");
|
||||
set_view_selector('tile');
|
||||
});
|
||||
|
||||
/* Pagination */
|
||||
|
||||
if ($.cookie("pwg_user_manager_view") === "compact") {
|
||||
if (view_selector === "compact") {
|
||||
if (per_page < 10) {
|
||||
per_page = 10
|
||||
update_pagination_menu();
|
||||
@@ -285,6 +277,18 @@ $( document ).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function set_view_selector(view_type) {
|
||||
$.ajax({
|
||||
url: "ws.php?format=json&method=pwg.users.preferences.set",
|
||||
type: "POST",
|
||||
dataType: "JSON",
|
||||
data: {
|
||||
param: 'user-manager-view',
|
||||
value: view_type,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function setDisplayTile() {
|
||||
$(".user-container-wrapper").removeClass("compactView").removeClass("lineView").addClass("tileView");
|
||||
$(".user-header-col").addClass("hide");
|
||||
@@ -786,11 +790,11 @@ function selectionMode(isSelection) {
|
||||
$(".in-selection-mode").show();
|
||||
$(".not-in-selection-mode").hide();
|
||||
|
||||
if ($.cookie("pwg_user_manager_view") === "tile") {
|
||||
if (view_selector === "tile") {
|
||||
$(".user-container-email").show();
|
||||
}
|
||||
|
||||
if ($.cookie("pwg_user_manager_view") !== "tile" || $.cookie("pwg_user_manager_view") === "line") {
|
||||
if (view_selector === "compact") {
|
||||
$(".user-container-email").css({
|
||||
display: "none"
|
||||
})
|
||||
@@ -802,7 +806,7 @@ function selectionMode(isSelection) {
|
||||
$(".in-selection-mode").hide();
|
||||
$(".not-in-selection-mode").show();
|
||||
|
||||
if ($.cookie("pwg_user_manager_view") === "tile" || $.cookie("pwg_user_manager_view") === "line") {
|
||||
if (view_selector === "tile" || view_selector === "line") {
|
||||
$(".user-container-email").css({
|
||||
display: "flex"
|
||||
})
|
||||
|
||||
@@ -35,6 +35,10 @@ const show_str = '{'Show'|@translate}';
|
||||
const user_added_str = '{'User %s added'|@translate}';
|
||||
const str_popin_update_btn = '{'Update'|@translate}';
|
||||
|
||||
const view_selector = '{$view_selector}';
|
||||
|
||||
console.log(view_selector);
|
||||
|
||||
months = [
|
||||
"{'Jan'|@translate}",
|
||||
"{'Feb'|@translate}",
|
||||
@@ -190,7 +194,7 @@ $(document).ready(function() {
|
||||
<div class="user-manager-header">
|
||||
|
||||
<div class="UserViewSelector">
|
||||
<input type="radio" name="layout" class="switchLayout" id="displayCompact" {if $smarty.cookies.pwg_user_manager_view == 'compact'}checked{/if}/><label for="displayCompact"><span class="icon-th-large firstIcon tiptip" title="{'Compact View'|translate}"></span></label><input type="radio" name="layout" class="switchLayout tiptip" id="displayLine" {if $smarty.cookies.pwg_user_manager_view == 'line' || !$smarty.cookies.pwg_user_manager_view}checked{/if}/><label for="displayLine"><span class="icon-th-list tiptip" title="{'Line View'|translate}"></span></label><input type="radio" name="layout" class="switchLayout" id="displayTile" {if $smarty.cookies.pwg_user_manager_view == 'tile'}checked{/if}/><label for="displayTile"><span class="icon-pause lastIcon tiptip" title="{'Tile View'|translate}"></span></label>
|
||||
<input type="radio" name="layout" class="switchLayout" id="displayCompact" {if $view_selector == 'compact'}checked{/if}/><label for="displayCompact"><span class="icon-th-large firstIcon tiptip" title="{'Compact View'|translate}"></span></label><input type="radio" name="layout" class="switchLayout tiptip" id="displayLine" {if $view_selector == 'line'}checked{/if}/><label for="displayLine"><span class="icon-th-list tiptip" title="{'Line View'|translate}"></span></label><input type="radio" name="layout" class="switchLayout" id="displayTile" {if $view_selector == 'tile'}checked{/if}/><label for="displayTile"><span class="icon-pause lastIcon tiptip" title="{'Tile View'|translate}"></span></label>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;justify-content:space-between; flex-grow:1;">
|
||||
|
||||
@@ -171,6 +171,7 @@ $template->assign('groups_arr_id', implode(',', $groups_arr_id));
|
||||
$template->assign('groups_arr_name', implode(',', $groups_arr_name));
|
||||
$template->assign('guest_id', $conf["guest_id"]);
|
||||
|
||||
$template->assign('view_selector', userprefs_get_param('user-manager-view', 'line'));
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | html code display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user