OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Move "Create" button to toolbar on pages with rendered tabs. Thus the button is shown at the top and easily available.
Henriette Dargea52105d97078
diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rbindex 339e2897e27..e580af44602 100644--- a/app/helpers/tabs_helper.rb+++ b/app/helpers/tabs_helper.rb@@ -32,13 +32,17 @@ module TabsHelper# Renders tabs and their contentdef render_tabs(tabs, form = nil)if tabs.any?- selected_tab = tabs.detect { |t| t[:name] == params[:tab] } if params[:tab].present?- render partial: 'common/tabs', locals: { f: form, tabs: tabs, selected_tab: selected_tab || tabs.first }+ selected = selected_tab(tabs)+ render partial: 'common/tabs', locals: { f: form, tabs: tabs, selected_tab: selected }elsecontent_tag 'p', I18n.t(:label_no_data), class: 'nodata'endend+ def selected_tab(tabs)+ tabs.detect { |t| t[:name] == params[:tab] } || tabs.first+ end+# Render tabs from the ui/extensible tabs managerdef render_extensible_tabs(key, params = {})tabs = ::OpenProject::Ui::ExtensibleTabs.enabled_tabs(key).map do |tab|diff --git a/app/views/attribute_help_texts/_tab.html.erb b/app/views/attribute_help_texts/_tab.html.erbindex 648e80cd207..e616a5129ff 100644--- a/app/views/attribute_help_texts/_tab.html.erb+++ b/app/views/attribute_help_texts/_tab.html.erb@@ -66,13 +66,3 @@<% else %><%= no_results_box %><% end %>--<div class="generic-table--action-buttons">- <%= link_to new_attribute_help_text_path(name: tab[:name]),- { class: 'attribute-help-texts--create-button button -alt-highlight',- aria: {label: t(:'attribute_help_texts.add_new')},- title: t(:'attribute_help_texts.add_new')} do %>- <%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= t('activerecord.models.attribute_help_text') %></span>- <% end %>-</div>\ No newline at end of filediff --git a/app/views/attribute_help_texts/index.html.erb b/app/views/attribute_help_texts/index.html.erbindex b1d4c8bba9a..12ee83f9b69 100644--- a/app/views/attribute_help_texts/index.html.erb+++ b/app/views/attribute_help_texts/index.html.erb@@ -26,18 +26,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<%= render_tabs [- {- name: 'WorkPackage',- partial: 'attribute_help_texts/tab',- path: attribute_help_texts_path(tab: 'WorkPackage'),- label: :label_work_package- },- {- name: 'Project',- partial: 'attribute_help_texts/tab',- path: attribute_help_texts_path(tab: 'Project'),- label: Project.model_name.human- }- ]-%>++<% tabs = [+ {+ name: 'WorkPackage',+ partial: 'attribute_help_texts/tab',+ path: attribute_help_texts_path(tab: 'WorkPackage'),+ label: :label_work_package+ },+ {+ name: 'Project',+ partial: 'attribute_help_texts/tab',+ path: attribute_help_texts_path(tab: 'Project'),+ label: Project.model_name.human+ }+] %>+++<%= toolbar title: t(:'attribute_help_texts.label_plural') do %>+ <li class="toolbar-item">+ <%= link_to new_attribute_help_text_path(name: selected_tab(tabs)[:name]),+ { class: 'attribute-help-texts--create-button button -alt-highlight',+ aria: {label: t(:'attribute_help_texts.add_new')},+ title: t(:'attribute_help_texts.add_new')} do %>+ <%= op_icon('button--icon icon-add') %>+ <span class="button--text"><%= t('activerecord.models.attribute_help_text') %></span>+ <% end %>+ </li>+<% end %>++<%= render_tabs tabs %>diff --git a/app/views/custom_fields/_tab.html.erb b/app/views/custom_fields/_tab.html.erbindex c54b02a655f..fe9ed0e1891 100644--- a/app/views/custom_fields/_tab.html.erb+++ b/app/views/custom_fields/_tab.html.erb@@ -164,15 +164,6 @@ See COPYRIGHT and LICENSE files for more details.</table></div></div>- <div class="generic-table--action-buttons">- <%= link_to new_custom_field_path(type: tab[:name]),- { class: 'button -alt-highlight',- aria: {label: t(:label_custom_field_new)},- title: t(:label_custom_field_new)} do %>- <%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= t('activerecord.models.custom_field') %></span>- <% end %>- </div><% else %><%= no_results_box(action_url: new_custom_field_path(type: tab[:name]), display_action: true) %><% end %>diff --git a/app/views/custom_fields/index.html.erb b/app/views/custom_fields/index.html.erbindex 7963909192d..bf9173027b9 100644--- a/app/views/custom_fields/index.html.erb+++ b/app/views/custom_fields/index.html.erb@@ -26,7 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<%= toolbar title: t(:label_custom_field_plural) %>+<%= toolbar title: t(:label_custom_field_plural) do %>+ <li class="toolbar-item">+ <%= link_to new_custom_field_path(type: selected_tab(custom_fields_tabs)[:name]),+ { class: 'button -alt-highlight',+ aria: {label: t(:label_custom_field_new)},+ title: t(:label_custom_field_new)} do %>+ <%= op_icon('button--icon icon-add') %>+ <span class="button--text"><%= t('activerecord.models.custom_field') %></span>+ <% end %>+ </li>+<% end %><%= render_tabs custom_fields_tabs %>