diff --git a/app/views/groups/_form.html.erb b/app/views/groups/_form.html.erb index 723b9f2..fc0b062 100644 --- a/app/views/groups/_form.html.erb +++ b/app/views/groups/_form.html.erb @@ -1,6 +1,7 @@ <%= error_messages_for @group %>
+ <%= call_hook(:view_groups_form_top, :group => @group, :form => f) %>

<%= f.text_field :name, :required => true, :size => 60, :disabled => !@group.safe_attribute?('name') %>

<% unless @group.builtin? %> @@ -16,4 +17,5 @@ <% @group.custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :group, value %>

<% end %> + <%= call_hook(:view_groups_form_bottom, :group => @group, :form => f) %>
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index a97b854..261e1d0 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -28,6 +28,7 @@ <% if @issue.safe_attribute? 'subject' %>

<%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true %>

<% end %> +<%= call_hook(:view_issues_form_after_subject, { :issue => @issue, :form => f }) %> <% if @issue.safe_attribute? 'description' %>

@@ -44,10 +45,12 @@

<%= wikitoolbar_for 'issue_description', preview_issue_path(:project_id => @issue.project, :issue_id => @issue.id) %> <% end %> +<%= call_hook(:view_issues_form_after_description, { :issue => @issue, :form => f }) %>
<%= render :partial => 'issues/attributes' %>
+<%= call_hook(:view_issues_form_after_attributes, { :issue => @issue, :form => f }) %> <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %> <% end %> diff --git a/app/views/issues/_form_custom_fields.html.erb b/app/views/issues/_form_custom_fields.html.erb index fddcd74..2da460f 100644 --- a/app/views/issues/_form_custom_fields.html.erb +++ b/app/views/issues/_form_custom_fields.html.erb @@ -1,6 +1,7 @@ <% custom_field_values = @issue.editable_custom_field_values %> <% custom_field_values_full_width = custom_field_values.select { |value| value.custom_field.full_width_layout? } %> <% custom_field_values -= custom_field_values_full_width %> +<%= call_hook(:view_issues_form_custom_fields_top, { :issue => @issue, :custom_field_values => custom_field_values }) %> <% if custom_field_values.present? %>
@@ -22,3 +23,4 @@

<%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

<%= wikitoolbar_for "issue_custom_field_values_#{value.custom_field_id}", preview_issue_path(:project_id => @issue.project, :issue_id => @issue.id) if value.custom_field.full_text_formatting? %> <% end %> +<%= call_hook(:view_issues_form_custom_fields_bottom, { :issue => @issue, :custom_field_values => custom_field_values }) %> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 33c8010..2e865c3 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -2,6 +2,7 @@
+<%= call_hook(:view_projects_form_top, :project => @project, :form => f) %>

<%= f.text_field :name, :required => true, :size => 60 %>

<%= f.textarea :description, :rows => 8, :class => 'wiki-edit', :data => wiki_textarea_stimulus_attributes %>

@@ -42,6 +43,7 @@ <%= hidden_field_tag 'project[enabled_module_names][]', '' %> <% end %> +<%= call_hook(:view_projects_form_bottom, :project => @project, :form => f) %> <% unless @project.identifier_frozen? %> diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb index c355d89..9a9dc4b 100644 --- a/app/views/trackers/_form.html.erb +++ b/app/views/trackers/_form.html.erb @@ -4,6 +4,7 @@
+<%= call_hook(:view_trackers_form_top, :tracker => @tracker, :form => f) %>

<%= f.text_field :name, :required => true %>

<%= f.select :default_status_id, IssueStatus.sorted.map {|s| [s.name, s.id]}, @@ -42,6 +43,7 @@

<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %>

<% end %> +<%= call_hook(:view_trackers_form_bottom, :tracker => @tracker, :form => f) %>
<%= submit_tag l(@tracker.new_record? ? :button_create : :button_save), class: "mobile-hide" %> diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 07ecbf2..275ee06 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -2,6 +2,7 @@
+<%= call_hook(:view_users_form_top, :user => @user, :form => f) %>
@@ -60,6 +61,7 @@

<% end -%>
+<%= call_hook(:view_users_form_after_authentication, :user => @user, :form => f) %>

<% if @user.new_record? %> <%= submit_tag l(:button_create) %> @@ -75,6 +77,7 @@ <%=l(:field_mail_notification)%> <%= render :partial => 'users/mail_notifications' %> +<%= call_hook(:view_users_form_after_mail_notifications, :user => @user, :form => f) %>

<%=l(:label_auto_watch_on)%> @@ -86,6 +89,7 @@ <%= render :partial => 'users/preferences' %> <%= call_hook(:view_users_form_preferences, :user => @user, :form => f) %>
+<%= call_hook(:view_users_form_bottom, :user => @user, :form => f) %>
diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index 6211976..6aaed70 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -2,6 +2,7 @@ <%= error_messages_for 'version' %>
+<%= call_hook(:view_versions_form_top, :version => @version, :form => f) %>

<%= f.text_field :name, :maxlength => 60, :size => 60, :required => true %>

<%= f.text_field :description, :size => 60 %>

<% unless @version.new_record? %> @@ -17,5 +18,5 @@ <% @version.visible_custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :version, value %>

<% end %> - +<%= call_hook(:view_versions_form_bottom, :version => @version, :form => f) %>
diff --git a/doc/HOOKS b/doc/HOOKS index 9cedec8..c5b486e 100644 --- a/doc/HOOKS +++ b/doc/HOOKS @@ -181,6 +181,16 @@ view_documents_show_contextual Context: :document, :project Called in: app/views/documents/show.html.erb +view_groups_form_bottom + Since: 7.1.0 + Context: :group, :form + Called in: app/views/groups/_form.html.erb + +view_groups_form_top + Since: 7.1.0 + Context: :group, :form + Called in: app/views/groups/_form.html.erb + view_groups_memberships_table_header Since: - Context: :group @@ -226,6 +236,31 @@ view_issues_edit_top Context: :issue, :form Called in: app/views/issues/_edit.html.erb +view_issues_form_after_attributes + Since: 7.1.0 + Context: :issue, :form + Called in: app/views/issues/_form.html.erb + +view_issues_form_after_description + Since: 7.1.0 + Context: :issue, :form + Called in: app/views/issues/_form.html.erb + +view_issues_form_after_subject + Since: 7.1.0 + Context: :issue, :form + Called in: app/views/issues/_form.html.erb + +view_issues_form_custom_fields_bottom + Since: 7.1.0 + Context: :issue, :custom_field_values + Called in: app/views/issues/_form_custom_fields.html.erb + +view_issues_form_custom_fields_top + Since: 7.1.0 + Context: :issue, :custom_field_values + Called in: app/views/issues/_form_custom_fields.html.erb + view_issues_form_details_bottom Since: - Context: :issue, :form @@ -441,6 +476,16 @@ view_projects_form Context: :project, :form Called in: app/views/projects/_form.html.erb +view_projects_form_bottom + Since: 7.1.0 + Context: :project, :form + Called in: app/views/projects/_form.html.erb + +view_projects_form_top + Since: 7.1.0 + Context: :project, :form + Called in: app/views/projects/_form.html.erb + view_projects_index_contextual Since: 7.1.0 Context: :query @@ -554,16 +599,46 @@ view_timelog_index_contextual Context: :project, :query Called in: app/views/timelog/index.html.erb +view_trackers_form_bottom + Since: 7.1.0 + Context: :tracker, :form + Called in: app/views/trackers/_form.html.erb + +view_trackers_form_top + Since: 7.1.0 + Context: :tracker, :form + Called in: app/views/trackers/_form.html.erb + view_users_form Since: - Context: :user, :form Called in: app/views/users/_form.html.erb +view_users_form_after_authentication + Since: 7.1.0 + Context: :user, :form + Called in: app/views/users/_form.html.erb + +view_users_form_after_mail_notifications + Since: 7.1.0 + Context: :user, :form + Called in: app/views/users/_form.html.erb + +view_users_form_bottom + Since: 7.1.0 + Context: :user, :form + Called in: app/views/users/_form.html.erb + view_users_form_preferences Since: - Context: :user, :form Called in: app/views/users/_form.html.erb +view_users_form_top + Since: 7.1.0 + Context: :user, :form + Called in: app/views/users/_form.html.erb + view_users_index_actions_menu Since: 7.1.0 Context: :query @@ -594,6 +669,16 @@ view_users_sidebar_queries_bottom Context: - Called in: app/views/users/index.html.erb +view_versions_form_bottom + Since: 7.1.0 + Context: :version, :form + Called in: app/views/versions/_form.html.erb + +view_versions_form_top + Since: 7.1.0 + Context: :version, :form + Called in: app/views/versions/_form.html.erb + view_versions_index_actions_menu Since: 7.1.0 Context: :project diff --git a/test/integration/lib/redmine/view_hooks_test.rb b/test/integration/lib/redmine/view_hooks_test.rb index a599a9f..74d2c06 100644 --- a/test/integration/lib/redmine/view_hooks_test.rb +++ b/test/integration/lib/redmine/view_hooks_test.rb @@ -33,11 +33,19 @@ class ViewHooksTest < Redmine::IntegrationTest '/issues/1' => %w( view_issues_show_contextual view_issues_show_actions_menu view_issues_show_top view_issues_show_details_end view_issues_show_bottom), + '/projects/ecookbook/issues/new' => %w( + view_issues_form_after_subject view_issues_form_after_description view_issues_form_after_attributes + view_issues_form_custom_fields_top view_issues_form_custom_fields_bottom), + '/projects/ecookbook/settings' => %w(view_projects_form_top view_projects_form_bottom), '/projects?display_type=list' => %w(view_projects_index_contextual), '/users' => %w(view_users_index_contextual view_users_index_actions_menu), '/users/2' => %w(view_users_show_contextual), - '/users/2/edit' => %w(view_layouts_base_title_after), + '/users/2/edit' => %w( + view_layouts_base_title_after view_users_form_top view_users_form_after_authentication + view_users_form_after_mail_notifications view_users_form_bottom), '/groups/10' => %w(view_groups_show_contextual), + '/groups/10/edit' => %w(view_groups_form_top view_groups_form_bottom), + '/versions/2/edit' => %w(view_versions_form_top view_versions_form_bottom), '/projects/ecookbook/roadmap' => %w(view_versions_index_contextual view_versions_index_actions_menu), '/projects/ecookbook/wiki' => %w(view_wiki_show_contextual view_wiki_show_actions_menu), '/projects/ecookbook/news' => %w(view_news_index_contextual), @@ -47,6 +55,7 @@ class ViewHooksTest < Redmine::IntegrationTest '/projects/ecookbook/boards/1' => %w(view_boards_show_contextual), '/boards/1/topics/1' => %w(view_messages_show_contextual), '/projects/ecookbook/time_entries' => %w(view_timelog_index_contextual view_timelog_index_actions_menu), + '/trackers/1/edit' => %w(view_trackers_form_top view_trackers_form_bottom), '/admin/plugins' => %w(view_layouts_base_title_after) }