From c7d469b70f0a3f865d60b10bdce8c5178b9b1e23 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 16 May 2017 10:50:40 +0200 Subject: [PATCH] #48 System folder of closed issue have got a lighter colour --- app/models/dmsf_folder.rb | 20 ++++++++++++-------- app/views/dmsf/_dmsf_rows.erb | 1 + app/views/dmsf/_list_view.erb | 2 +- assets/images/folder_system_closed.png | Bin 0 -> 393 bytes assets/stylesheets/redmine_dmsf.css | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 assets/images/folder_system_closed.png diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index fa311b79..a0787be6 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -104,14 +104,8 @@ class DmsfFolder < ActiveRecord::Base return true if (User.current.admin? || folder.nil?) # System folder? if folder && folder.system - if (!allow_system || !User.current.allowed_to?(:display_system_folders, folder.project)) - return false - end - issue_id = folder.title.to_i - if issue_id > 0 - issue = Issue.find_by_id issue_id - return false unless issue && issue.visible?(User.current) - end + return false if (!allow_system || !User.current.allowed_to?(:display_system_folders, folder.project)) + return false unless self.issue && self.issue.visible?(User.current) end # Permissions? if !folder.dmsf_folder || permissions?(folder.dmsf_folder, allow_system) @@ -530,6 +524,16 @@ class DmsfFolder < ActiveRecord::Base l(:title_unlock_file) end + def issue + unless @issue + if self.system + issue_id = self.title.to_i + @issue = Issue.find_by_id(issue_id) if issue_id > 0 + end + end + @issue + end + private def self.directory_subtree(tree, folder, level, current_folder) diff --git a/app/views/dmsf/_dmsf_rows.erb b/app/views/dmsf/_dmsf_rows.erb index 82c9d88a..7faa3748 100644 --- a/app/views/dmsf/_dmsf_rows.erb +++ b/app/views/dmsf/_dmsf_rows.erb @@ -20,6 +20,7 @@ <% if obj.is_a? DmsfFolder %> <% classes << ' dmsf_system' if obj.system %> + <% classes << ' dmsf_system_closed' if obj.issue && obj.issue.closed? %> class="dir <%= classes %>"> <%= render(:partial => 'dir', :locals => { diff --git a/app/views/dmsf/_list_view.erb b/app/views/dmsf/_list_view.erb index 499d0463..06b910a5 100644 --- a/app/views/dmsf/_list_view.erb +++ b/app/views/dmsf/_list_view.erb @@ -65,7 +65,7 @@ <% @subfolders.each do |subfolder| %> - + <%= render(:partial => 'dir', :locals => { :project => @project, diff --git a/assets/images/folder_system_closed.png b/assets/images/folder_system_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..41b29fce4e70ea0e792761cdb6b661f7255da62f GIT binary patch literal 393 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPts{n_-Rj?TsKLZ1!n5T^Y7=*6`LOY zXL+21>v_MfKg-HXmqs$?_on{;QBWpun(g<}Rr!k_yc0WpccV3XrOuB7X=iSI)m|_u zWo2S{@D#VRZAVMyI5c>O{yDL3SD)|_1;2ol*UJ?p7B}oz(BTrNV^qd)WPy;&0xdxe zrN>Ge!UCrnuqO3O$~MMNH+;vs|V3pT7UlMqlLSEpO-taYUX#Qv&UbX lPH2Dpmpy8MS@89r(o+r6FZAxzIROkb22WQ%mvv4FO#pj)o*MuF literal 0 HcmV?d00001 diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css index b0d7b4c8..a8b23830 100644 --- a/assets/stylesheets/redmine_dmsf.css +++ b/assets/stylesheets/redmine_dmsf.css @@ -208,6 +208,7 @@ div.dmsf_revision_inner_box .attribute .label { /* File types */ .dmsf_gray .icon-folder { background-image: url(../images/folder_gray.png); } .dmsf_system .icon-folder { background-image: url(../images/folder_system.png); } +.dmsf_system_closed .icon-folder { background-image: url(../images/folder_system_closed.png); } .icon-file.filetype-doc, .icon-file.filetype-docx { background-image: url(../images/filetypes/doc.png); } .icon-file.filetype-xls, .icon-file.filetype-xlsx { background-image: url(../images/filetypes/xls.png); }