#1080 GUI switcher

This commit is contained in:
Karel Pičman 2020-01-28 15:58:35 +01:00
parent 3115725be3
commit 6ba154d868
20 changed files with 74 additions and 2 deletions

View File

@ -49,7 +49,10 @@ def dmsf_init
{:dmsf => [:show]},
:read => true
pmap.permission :user_preferences,
{:dmsf_state => [:user_pref_save]}
{
dmsf_state: [:user_pref_save],
dmsf: [:switch_rlf]
}
pmap.permission :view_dmsf_files,
{:dmsf => [:entries_operation, :entries_email, :download_email_entries, :tag_changed, :add_email,
:append_email, :autocomplete_for_user],

View File

@ -55,7 +55,23 @@ class DmsfController < ApplicationController
end
end
def switch_rlf
rlf = params[:rlf] == 'true'
cookie_options = {
value: !rlf,
expires: 1.year.from_now,
path: (RedmineApp::Application.config.relative_url_root || '/'),
secure: request.ssl?,
httponly: true
}
cookies[:dmsf_switch_rlf] = cookie_options
Rails.logger.info ">>> RLF set: #{cookies[:dmsf_switch_rlf]}"
redirect_to dmsf_folder_path(id: @project, folder_id: @folder)
end
def show
Rails.logger.info ">>> RLF get: #{cookies[:dmsf_switch_rlf]}"
get_display_params
if (@folder && @folder.deleted?) || (params[:folder_title].present? && !@folder)
render_404
@ -582,6 +598,7 @@ class DmsfController < ApplicationController
end
def get_display_params
@rlf = cookies[:dmsf_switch_rlf]
@system_folder = @folder && @folder.system
@folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)

View File

@ -24,7 +24,10 @@
<% html_title l(:dmsf) %>
<div class="contextual">
<% if @folder_manipulation_allowed && !@system_folder %>
<%= link_to(l(:button_switch), switch_rlf_dmsf_path(id: @project, rlf: @rlf),
title: l(:label_switch_rlf),
class: 'icon icon-plugins') %>
<% if @folder_manipulation_allowed && !@system_folder %>
<% if @folder.nil? %>
<%= link_to(l(:button_edit), edit_root_dmsf_path(:id => @project),
:title => l(:link_edit, :title => l(:link_documents)),

View File

@ -413,6 +413,9 @@ cs:
label_inherited_permissions: Zděděná práva
label_switch_rlf: Přepni do/z Redmine vzhledu
button_switch: Přepni vzhled
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ de:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ en:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ es:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ fr:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ hu:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ it: # Italian strings thx 2 Matteo Arceci!
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ ja:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: 自分がロック中の文書

View File

@ -413,6 +413,9 @@ ko:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ nl:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ pl:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ pt-BR:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ ru:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ sl:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ zh-TW:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -413,6 +413,9 @@ zh:
label_inherited_permissions: Inherited permissions
label_switch_rlf: Switch Redmine look and feel design
button_switch: Switch design
easy_pages:
modules:
dmsf_locked_documents: My locked documents

View File

@ -44,6 +44,7 @@ if Redmine::Plugin.installed? :redmine_dmsf
get '/projects/:id/dmsf/lock', :controller => 'dmsf', :action => 'lock', :as => 'lock_dmsf'
get '/projects/:id/dmsf/unlock', :controller => 'dmsf', :action => 'unlock', :as => 'unlock_dmsf'
get '/projects/:id/dmsf/', :controller => 'dmsf', :action => 'show', :as => 'dmsf_folder'
get '/projects/:id/dmsf/rlf', controller: 'dmsf', action: 'switch_rlf', as: 'switch_rlf_dmsf'
get '/projects/:id/dmsf/new', :controller => 'dmsf', :action => 'new', :as => 'new_dmsf'
get '/projects/:id/dmsf/edit', :controller => 'dmsf', :action => 'edit', :as => 'edit_dmsf'
get '/projects/:id/dmsf/edit/root', :controller => 'dmsf', :action => 'edit_root', :as => 'edit_root_dmsf'