diff --git a/README.md b/README.md index b1c62950..6bb84dae 100644 --- a/README.md +++ b/README.md @@ -134,8 +134,8 @@ DMSF is designed to act as project module, so it must be checked as an enabled m Search will now automatically search DMSF content when a Redmine search is performed, additionally a "Documents" and "Folders" check box will be visible, allowing you to search DMSF content exclusively. -Linking DMSF files from Wiki entries ------------------------------------- +Linking DMSF files from Wiki entries (macros) +--------------------------------------------- Link to a document with id 17: `{{dmsf(17)}}` @@ -185,8 +185,8 @@ Approval workflow status of a document with id 8: `{{dmsfw(8)}}` The DMSF document/revision id can be found in document details. -Linking DMSF folders from Wiki entries --------------------------------------- +Linking DMSF folders from Wiki entries (macros) +----------------------------------------------- Link to a folder with id 5: `{{dmsff(5)}}` @@ -234,11 +234,51 @@ There's a patch (tested with Redmine 3.4.2) that helps you to modify all help fi `patch -p0 < plugins/redmine_dmsf/extra/help_files_dmsf.diff` +Hooks +----- + +You can implement these hooks in your plugin and extend DMSF functionality in certain events. + +E.g. + + class DmsfUploadControllerHooks < Redmine::Hook::Listener + + def dmsf_upload_controller_after_commit(context={}) + context[:controller].flash[:info] = 'Okay' + end + + end + +**dmsf_upload_controller_after_commit** + +Called after all uploaded files are commited. + +parameters: *files* + +**dmsf_helper_upload_after_commit** + +Called after an individual file is commited. The controller is not available. + +Parameters: *file* + +**dmsf_workflow_controller_before_approval** + +Called before an approval. If the hook returns false, the approval is not recorded. + +parameters: *revision*, *step_action* + +**dmsf_files_controller_before_view** + +Allows a preview of the file by an external plugin. If the hook returns true, the file is not sent by DMSF. It is +expected that the file is sent by the hook. + +parameters: *file* Setup / Upgrade --------------- -You can either clone the master branch or download the latest zipped version. Before installing ensure that the Redmine instance is stopped. +You can either clone the master branch or download the latest zipped version. Before installing ensure that the Redmine +instance is stopped. git clone git@github.com:danmunn/redmine_dmsf.git diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index b2590f23..f72df4f3 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -132,6 +132,7 @@ class DmsfUploadController < ApplicationController def commit_files_internal(commited_files) @files, failed_uploads = DmsfUploadHelper.commit_files_internal(commited_files, @project, @folder, self) + call_hook :dmsf_upload_controller_after_commit, { files: @files } respond_to do |format| format.js format.api { render_validation_errors(failed_uploads) unless failed_uploads.empty? } diff --git a/app/views/dmsf/_main.html.erb b/app/views/dmsf/_main.html.erb index 923748ca..d5a9024c 100644 --- a/app/views/dmsf/_main.html.erb +++ b/app/views/dmsf/_main.html.erb @@ -130,3 +130,7 @@ }); <% end %> <% end %> + +<% late_javascript_tag do %> + "$('#ajax-indicator').hide();" +<% end %> \ No newline at end of file diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index 7af56843..04599d06 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -45,7 +45,7 @@ <% end %> <% end %>
- <%= submit_tag l(:label_upload), class: 'button-positive' %> + <%= submit_tag l(:label_upload), class: 'button-positive', onclick: "$('#ajax-indicator').show();" %>
<% end %> <% end %>