mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 19:53:19 +08:00
Merge pull request #7467 from ivanscinote/SCI-10453-ik
Save navigator state per user [SCI-10453]
This commit is contained in:
commit
74ce54f832
3 changed files with 7 additions and 5 deletions
|
@ -19,10 +19,10 @@ class NavigationsController < ApplicationController
|
|||
end
|
||||
|
||||
def navigator_state
|
||||
session[:navigator_collapsed] = params[:state] == 'collapsed'
|
||||
current_user.update_simple_setting(key: 'navigator_collapsed', value: params[:state] == 'collapsed')
|
||||
|
||||
width = params[:width].to_i
|
||||
session[:navigator_width] = width if width.positive?
|
||||
current_user.update_simple_setting(key: 'navigator_width', value: width) if width.positive?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -61,10 +61,10 @@
|
|||
<%= javascript_include_tag 'vue_navigation_top_menu' %>
|
||||
<%= javascript_include_tag 'vue_legacy_datetime_picker' %>
|
||||
|
||||
<style> :root { --navigator-navigation-width: <%= session[:navigator_width] || Constants::DEFAULT_NAV_WIDTH %>px; } </style>
|
||||
<style> :root { --navigator-navigation-width: <%= (user_signed_in? && current_user.settings[:navigator_width]) || Constants::DEFAULT_NAV_WIDTH %>px; } </style>
|
||||
</head>
|
||||
<body
|
||||
class="<%= yield :body_class %> <%= 'navigator-collapsed' if !@navigator || session[:navigator_collapsed] %> <%= 'w-[98%]' if params[:controller] == 'label_templates' && params[:action] == 'show'%>"
|
||||
class="<%= yield :body_class %> <%= 'navigator-collapsed' if !@navigator || (user_signed_in? && current_user.settings[:navigator_collapsed]) %> <%= 'w-[98%]' if params[:controller] == 'label_templates' && params[:action] == 'show'%>"
|
||||
<% if user_signed_in? && current_team.present? %>
|
||||
data-current-team-id="<%= current_team.id %>"
|
||||
data-atwho-users-url="<%= atwho_users_team_path(current_team) %>"
|
||||
|
@ -85,7 +85,7 @@
|
|||
<div class="sci--layout"
|
||||
data-grey-background="<%= show_grey_background? %>"
|
||||
data-breadcrumbs-collapsed="<%= !@breadcrumbs_items.present? %>"
|
||||
data-navigator-collapsed="<%= !@navigator || session[:navigator_collapsed] %>"
|
||||
data-navigator-collapsed="<%= !@navigator || current_user.settings[:navigator_collapsed] %>"
|
||||
data-left-navigation-collapsed=<%= !user_signed_in? %>
|
||||
>
|
||||
<div class="sci--layout-navigation-top" >
|
||||
|
|
|
@ -657,6 +657,8 @@ class Extends
|
|||
task_step_states
|
||||
results_order
|
||||
repository_export_file_type
|
||||
navigator_collapsed
|
||||
navigator_width
|
||||
).freeze
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue