Skip to content

Commit

Permalink
Editing of locked folder #1557
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jan 30, 2025
1 parent 8817721 commit 59cf433
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/dmsf_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def index

def show
@system_folder = @folder&.system
@locked_for_user = @folder&.locked_for_user?
@locked = @folder&.locked?
@folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)
@trash_enabled = @folder_manipulation_allowed && @file_manipulation_allowed
Expand Down
4 changes: 2 additions & 2 deletions app/models/dmsf_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def self.visible_folders(folders, project)
def css_classes(trash)
classes = []
if trash
if title.match?(/^\./)
if system
classes << 'dmsf-system'
else
classes << 'hascontextmenu'
Expand All @@ -581,7 +581,7 @@ def css_classes(trash)
else
classes << 'dmsf-child'
end
if title.match?(/^\./)
if system
classes << 'dmsf-system'
else
classes << 'hascontextmenu'
Expand Down
6 changes: 3 additions & 3 deletions app/views/dmsf/_main.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% html_title l(:dmsf) %>
<% if @project %>
<div class="contextual">
<% unless @locked_for_user || @system_folder %>
<% unless @locked || @system_folder %>
<% if @file_manipulation_allowed %>
<%= link_to sprite_icon('add', l(:label_document_new)),
multi_dmsf_upload_path(id: @project, folder_id: @folder), class: 'icon icon-add',
Expand All @@ -38,7 +38,7 @@
system_folder: @system_folder,
folder: @folder,
project: @project,
locked_for_user: @locked_for_user,
locked: @locked,
file_manipulation_allowed: @file_manipulation_allowed,
trash_enabled: @trash_enabled,
notifications: @notifications } %>
Expand All @@ -49,7 +49,7 @@
system_folder: @system_folder,
folder: @folder,
project: @project,
locked_for_user: @locked_for_user,
locked: @locked,
file_manipulation_allowed: @file_manipulation_allowed,
trash_enabled: @trash_enabled,
notifications: @notifications} %>
Expand Down
4 changes: 4 additions & 0 deletions app/views/dmsf/_path.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<%= link_to h(path_element.title), dmsf_folder_path(id: @project, folder_id: path_element) %>
<% end %>
<% end %>
<% if folder.locked? && !(filename || title) %>
<%= content_tag('span', sprite_icon('unlock', nil, icon_only: true, size: '12'),
title: l(:title_locked_by_user, user: folder.locked_by)) %>
<% end %>
<% else %>
<% if @project %>
<%= link_to l(:link_documents), dmsf_folder_path(id: @project) %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/dmsf_context_menus/_main.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
title: l(:link_edit, title: l(:link_documents)),
class: 'icon icon-edit',
data: { cy: 'button__edit--dmsf' } %>
<% elsif !locked_for_user %>
<% elsif !locked %>
<%= link_to sprite_icon('edit', l(:button_edit)),
edit_dmsf_path(id: project, folder_id: folder, redirect_to_folder_id: folder.id),
title: l(:link_edit, title: h(folder.title)),
class: 'icon icon-edit',
data: { cy: 'button__edit--dmsf' } %>
<% end %>
<% if folder && (!locked_for_user || User.current.allowed_to?(:force_file_unlock, project)) %>
<% if folder && (!locked || User.current.allowed_to?(:force_file_unlock, project)) %>
<% if folder.locked? %>
<%= link_to_if folder.unlockable?,
sprite_icon('unlock', l(:button_unlock)),
Expand All @@ -47,8 +47,8 @@
data: { cy: 'button__lock--dmsf' } %>
<% end %>
<% end %>
<% if notifications %>
<% if !locked_for_user && ((folder && folder.notification) || (!folder && project.dmsf_notification)) %>
<% if notifications && !locked %>
<% if ((folder && folder.notification) || (!folder && project.dmsf_notification)) %>
<%= link_to sprite_icon('email', l(:label_notifications_off)),
notify_deactivate_dmsf_path(id: project, folder_id: folder),
title: l(:title_notifications_active_deactivate),
Expand All @@ -62,7 +62,7 @@
data: { cy: 'button__notifications-on--dmsf' } %>
<% end %>
<% end %>
<% if file_manipulation_allowed && !locked_for_user %>
<% if file_manipulation_allowed && !locked %>
<%= link_to sprite_icon('link', l(:label_link_from)),
new_dmsf_link_path(project_id: project.id, dmsf_folder_id: folder ? folder.id : folder,
type: 'link_from'),
Expand Down

0 comments on commit 59cf433

Please sign in to comment.