#557 UI for watching documents
This commit is contained in:
parent
4faef673b0
commit
e028d1f83c
@ -92,6 +92,9 @@ def dmsf_init
|
|||||||
pmap.permission :display_system_folders,
|
pmap.permission :display_system_folders,
|
||||||
read: true
|
read: true
|
||||||
# Watchers
|
# Watchers
|
||||||
|
pmap.permission :view_dmsf_file_watchers, {}, read: true
|
||||||
|
pmap.permission :add_dmsf_file_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]}
|
||||||
|
pmap.permission :delete_dmsf_file_watchers, { watchers: :destroy}
|
||||||
pmap.permission :view_dmsf_folder_watchers, {}, read: true
|
pmap.permission :view_dmsf_folder_watchers, {}, read: true
|
||||||
pmap.permission :add_dmsf_folder_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]}
|
pmap.permission :add_dmsf_folder_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]}
|
||||||
pmap.permission :delete_dmsf_folder_watchers, { watchers: :destroy}
|
pmap.permission :delete_dmsf_folder_watchers, { watchers: :destroy}
|
||||||
|
|||||||
@ -36,6 +36,8 @@ class DmsfFilesController < ApplicationController
|
|||||||
helper :dmsf_workflows
|
helper :dmsf_workflows
|
||||||
helper :dmsf
|
helper :dmsf
|
||||||
helper :queries
|
helper :queries
|
||||||
|
helper :watchers
|
||||||
|
helper :context_menus
|
||||||
|
|
||||||
include QueriesHelper
|
include QueriesHelper
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,9 @@
|
|||||||
(Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
|
(Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] != 'WEBDAV_READ_WRITE') %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li>
|
||||||
|
<%= render partial: 'dmsf_context_menus/watch', locals: { object: dmsf_file } %>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= context_menu_link l(:button_delete),
|
<%= context_menu_link l(:button_delete),
|
||||||
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) : dmsf_file_path(id: dmsf_file,
|
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) : dmsf_file_path(id: dmsf_file,
|
||||||
|
|||||||
@ -72,14 +72,9 @@
|
|||||||
disabled: !email_allowed %>
|
disabled: !email_allowed %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li>
|
||||||
<% watched = Watcher.any_watched?([dmsf_folder], User.current) %>
|
<%= render partial: 'dmsf_context_menus/watch', locals: { object: dmsf_folder } %>
|
||||||
<% css = [watcher_css([dmsf_folder]), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') %>
|
</li>
|
||||||
<% text = watched ? l(:button_unwatch) : l(:button_watch) %>
|
|
||||||
<% url = watch_path(object_type: dmsf_folder.class.to_s.underscore, object_id: dmsf_folder, back_url: back_url) %>
|
|
||||||
<% method = watched ? 'delete' : 'post' %>
|
|
||||||
<%= context_menu_link text, url, method: method, class: css, disabled: !User.current.logged? %>
|
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<%= context_menu_link l(:button_delete),
|
<%= context_menu_link l(:button_delete),
|
||||||
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) :
|
dmsf_link ? dmsf_link_path(id: dmsf_link, folder_id: folder, back_url: back_url) :
|
||||||
|
|||||||
@ -60,15 +60,7 @@
|
|||||||
class: 'icon dmsf-icon-link' %>
|
class: 'icon dmsf-icon-link' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= render partial: 'dmsf_context_menus/watch', locals: { object: folder ? folder : project } %>
|
||||||
<% object = folder ? folder : project %>
|
|
||||||
<% watched = Watcher.any_watched?([object], User.current) %>
|
|
||||||
<% css = [watcher_css([object]), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') %>
|
|
||||||
<% text = watched ? l(:button_unwatch) : l(:button_watch) %>
|
|
||||||
<% url = watch_path(object_type: object.class.to_s.underscore, object_id: object.id) %>
|
|
||||||
<% method = watched ? 'delete' : 'post' %>
|
|
||||||
<%= context_menu_link text, url, method: method, class: css, disabled: !User.current.logged? %>
|
|
||||||
|
|
||||||
<% if trash_enabled %>
|
<% if trash_enabled %>
|
||||||
<%= link_to l(:link_trash_bin), trash_dmsf_path(project), title: l(:link_trash_bin), class: 'icon icon-del' %>
|
<%= link_to l(:link_trash_bin), trash_dmsf_path(project), title: l(:link_trash_bin), class: 'icon icon-del' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
@ -39,5 +39,6 @@
|
|||||||
<%= link_to "#{l(:button_copy)}/#{l(:button_move)}", copy_file_path(id: file, back_url: back_url),
|
<%= link_to "#{l(:button_copy)}/#{l(:button_move)}", copy_file_path(id: file, back_url: back_url),
|
||||||
title: l(:title_copy), class: 'icon icon-copy' %>
|
title: l(:title_copy), class: 'icon icon-copy' %>
|
||||||
<%= link_to l(:button_download), view_dmsf_file_path(file, disposition: 'attachment'), class: 'icon icon-download' %>
|
<%= link_to l(:button_download), view_dmsf_file_path(file, disposition: 'attachment'), class: 'icon icon-download' %>
|
||||||
|
<%= render partial: 'dmsf_context_menus/watch', locals: { object: file } %>
|
||||||
<%= delete_link(dmsf_file_path(id: file, details: true),
|
<%= delete_link(dmsf_file_path(id: file, details: true),
|
||||||
back_url: dmsf_folder_path(id: file.project, folder_id: file.dmsf_folder)) if file_delete_allowed %>
|
back_url: dmsf_folder_path(id: file.project, folder_id: file.dmsf_folder)) if file_delete_allowed %>
|
||||||
|
|||||||
30
app/views/dmsf_context_menus/_watch.html.erb
Normal file
30
app/views/dmsf_context_menus/_watch.html.erb
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<%
|
||||||
|
# encoding: utf-8
|
||||||
|
#
|
||||||
|
# Redmine plugin for Document Management System "Features"
|
||||||
|
#
|
||||||
|
# Copyright © 2011-22 Karel Pičman <karel.picman@kontron.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# Watch/unwatch menu's item
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% watched = Watcher.any_watched?([object], User.current) %>
|
||||||
|
<% css = [watcher_css([object]), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') %>
|
||||||
|
<% text = watched ? l(:button_unwatch) : l(:button_watch) %>
|
||||||
|
<% url = watch_path(object_type: object.class.to_s.underscore, object_id: object.id) %>
|
||||||
|
<% method = watched ? 'delete' : 'post' %>
|
||||||
|
<%= context_menu_link text, url, method: method, class: css, disabled: !User.current.logged? %>
|
||||||
@ -171,6 +171,14 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<span class="pagination"><%= pagination_links_full @revision_pages, @revision_count %></span>
|
<span class="pagination"><%= pagination_links_full @revision_pages, @revision_count %></span>
|
||||||
|
|
||||||
|
<% if @file.watchers.present? %>
|
||||||
|
<% content_for :sidebar do %>
|
||||||
|
<div id="watchers">
|
||||||
|
<%= render partial: 'watchers/watchers', locals: { watched: @file } %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= late_javascript_tag do %>
|
<%= late_javascript_tag do %>
|
||||||
$('a.delete-revision').click(function(event) {
|
$('a.delete-revision').click(function(event) {
|
||||||
if(!window.confirm('<%= l(:text_are_you_sure) %>')) {
|
if(!window.confirm('<%= l(:text_are_you_sure) %>')) {
|
||||||
|
|||||||
@ -427,9 +427,13 @@ en:
|
|||||||
|
|
||||||
label_project_watchers: Watchers
|
label_project_watchers: Watchers
|
||||||
label_dmsf_folder_watchers: Watchers
|
label_dmsf_folder_watchers: Watchers
|
||||||
permission_view_dmsf_folder_watchers: View watchers
|
label_dmsf_file_watchers: Watchers
|
||||||
permission_add_dmsf_folder_watchers: Add watchers
|
permission_view_dmsf_folder_watchers: View folder's watchers
|
||||||
permission_delete_dmsf_folder_watchers: Delete watchers
|
permission_add_dmsf_folder_watchers: Add folder's watchers
|
||||||
|
permission_delete_dmsf_folder_watchers: Delete folder's watchers
|
||||||
|
permission_view_dmsf_file_watchers: View document's watchers
|
||||||
|
permission_add_dmsf_file_watchers: Add document's watchers
|
||||||
|
permission_delete_dmsf_file_watchers: Delete document's watchers
|
||||||
permission_view_project_watchers: View project's watchers
|
permission_view_project_watchers: View project's watchers
|
||||||
permission_add_project_watchers: Add project's watchers
|
permission_add_project_watchers: Add project's watchers
|
||||||
permission_delete_project_watchers: Delete project's watchers
|
permission_delete_project_watchers: Delete project's watchers
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user