diff --git a/README.md b/README.md index 308f5c7..4774aa6 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ This plugin uses [FontAwesome icons 4.7](https://fontawesome.com/v4.7.0/) ### 🆕 Changelog +* **v 0.7.1** : Fixed incorrect DOM structure if user has read only access to the issue (#61 #64) * **v 0.7.0** : Category filter by project added (#55) and prevent dialog closing when using fa-pencil selector (#59) * **v 0.6.9** : Category field support (Github request #54) * **v 0.6.8** : Checkboxes custom fields fixed (#53) diff --git a/init.rb b/init.rb index 2f7cc9f..d23fa4c 100644 --- a/init.rb +++ b/init.rb @@ -6,7 +6,7 @@ Redmine::Plugin.register :redmine_issue_dynamic_edit do name 'Redmine Dynamic edit Issue plugin' author 'Hugo Zilliox' description 'Allows users to dynamically update issue attributes in detailed view without refreshing the page (JIRA style)' - version '0.7.0' + version '0.7.1' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end diff --git a/lib/details_issue_hooks.rb b/lib/details_issue_hooks.rb index 76c664b..fc9aaa3 100644 --- a/lib/details_issue_hooks.rb +++ b/lib/details_issue_hooks.rb @@ -11,13 +11,17 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener def view_layouts_base_html_head(context) return unless current_is_detail_page(context) - stylesheet_link_tag('issue_dynamic_edit.css', :plugin => :redmine_issue_dynamic_edit) + if User.current.allowed_to?(:edit_issues, context[:project]) + stylesheet_link_tag('issue_dynamic_edit.css', :plugin => :redmine_issue_dynamic_edit) + end end def view_layouts_base_body_bottom(context) return unless current_is_detail_page(context) - javascript_include_tag('issue_dynamic_edit_configuration_file.js', 'issue_dynamic_edit.js', :plugin => :redmine_issue_dynamic_edit) + if User.current.allowed_to?(:edit_issues, context[:project]) + javascript_include_tag('issue_dynamic_edit_configuration_file.js', 'issue_dynamic_edit.js', :plugin => :redmine_issue_dynamic_edit) + end end def view_issues_show_details_bottom(context = {}) @@ -55,7 +59,8 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener allRequiredFieldsFilled ) o << "" - o << "" + o << "" statuses.each do |s| if (s != issue.status) o << "" @@ -64,7 +69,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener end end - o << " " + o << "" + o << " " + o << "" end # Users dropdown @@ -74,7 +81,8 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener !readOnlyAttributes.include?('assigned_to_id') ) o << "" - o << "" + o << "" assignables.each do |u| if (u != issue.assigned_to) @@ -84,7 +92,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener end end - o << " " + o << "" + o << " " + o << "" end # Priorities dropdown @@ -92,7 +102,8 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener if !priorities.empty? && !(readOnlyAttributes.include? 'priority_id') o << "" - o << "" + o << "" priorities.each do |p| if (p != issue.priority) @@ -102,7 +113,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener end end - o << " " + o << "" + o << " " + o << "" end # Categories dropdown @@ -110,7 +123,8 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener if !categories.empty? && !(readOnlyAttributes.include? 'category_id') o << "" - o << "" + o << "" categories.each do |c| if (c != issue.category) @@ -120,14 +134,18 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener end end - o << " " + o << "" + o << " " + o << "" end # %done dropdown if ! readOnlyAttributes.include?('done_ratio') percent = 0 o << "" - o << "" + o << "" + loop do if percent == issue.done_ratio o << "" @@ -139,7 +157,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener break if percent == 110 end - o << " " + o << "" + o << " " + o << "" end # Estimated_time dropdown @@ -198,34 +218,35 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << "
" o << "
" o << "" + + # JS Part at the end of the edit block + o << "\n" + + o << "\n" + + # closing the display none div parent + o << "" end end - o << "\n" - - o << "\n" - - # closing the display none div parent - o << "" - return o - + end end end