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
Adapt tests to new tab row structure
Henriette Dinger57529d73c4c2
diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rbindex b3f1b22e978..3b9018fe347 100644--- a/app/helpers/tabs_helper.rb+++ b/app/helpers/tabs_helper.rb@@ -29,10 +29,10 @@module TabsHelper# Renders tabs and their content- def render_tabs(tabs)+ def 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: { tabs: tabs, selected_tab: selected_tab || tabs.first }+ render partial: 'common/tabs', locals: { f: form, tabs: tabs, selected_tab: selected_tab || tabs.first }elsecontent_tag 'p', l(:label_no_data), class: 'nodata'enddiff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erbindex c2ffc2c1678..2d2d2aa2906 100644--- a/app/views/common/_tabs.html.erb+++ b/app/views/common/_tabs.html.erb@@ -34,6 +34,6 @@ See docs/COPYRIGHT.rdoc for more details.<content-tabs></content-tabs><%= content_tag 'div',- render(partial: selected_tab[:partial], locals: { tab: selected_tab } ),+ render(partial: selected_tab[:partial], locals: { f: f, tab: selected_tab } ),id: "tab-content-#{selected_tab[:name]}",class: 'tab-content' %>diff --git a/app/views/types/edit.html.erb b/app/views/types/edit.html.erbindex d03ac00f3b9..b6ae85f8c4d 100644--- a/app/views/types/edit.html.erb+++ b/app/views/types/edit.html.erb@@ -36,6 +36,12 @@ See docs/COPYRIGHT.rdoc for more details.<%= breadcrumb_toolbar @type.name %></div>-<%= render_tabs types_tabs %>+<%= form_for @type,+ url: update_type_tab_path(id: @type.id, tab: @tab),+ builder: TabularFormBuilder,+ lang: current_language do |f| %>++ <%= render_tabs types_tabs, f %>+<% end %><%= error_messages_for 'type' %>diff --git a/app/views/types/form/_form_configuration.html.erb b/app/views/types/form/_form_configuration.html.erbindex 5762f6baac1..1abfcf013b2 100644--- a/app/views/types/form/_form_configuration.html.erb+++ b/app/views/types/form/_form_configuration.html.erb@@ -27,73 +27,68 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= form_for @type,- url: update_type_tab_path(id: @type.id, tab: @tab),- builder: TabularFormBuilder,- lang: current_language do |f| %>- <% form_attributes = form_configuration_groups(@type) %>+<% form_attributes = form_configuration_groups(@type) %>- <section class="form--section">- <div>- <div class="grid-block -visible-overflow wrap">- <div class="grid-content -visible-overflow small-12 large-10">- <div class="notification-box -info">- <div class="notification-box--content">- <p><%= t('text_form_configuration') %></p>- <br>- <p><%= t('text_custom_field_hint_activate_per_project') %></p>- </div>+<section class="form--section">+ <div>+ <div class="grid-block -visible-overflow wrap">+ <div class="grid-content -visible-overflow small-12 large-10">+ <div class="notification-box -info">+ <div class="notification-box--content">+ <p><%= t('text_form_configuration') %></p>+ <br>+ <p><%= t('text_custom_field_hint_activate_per_project') %></p></div>+ </div>- <% if EnterpriseToken.show_banners? %>- <div class="notification-box upsale-notification">- <div class="notification-box--content">- <h3><%= t('admin.enterprise.upgrade_to_ee') %></h3>- <%= image_tag "enterprise_edition.png", class: "widget-box--teaser-image" %>+ <% if EnterpriseToken.show_banners? %>+ <div class="notification-box upsale-notification">+ <div class="notification-box--content">+ <h3><%= t('admin.enterprise.upgrade_to_ee') %></h3>+ <%= image_tag "enterprise_edition.png", class: "widget-box--teaser-image" %>- <p><%= t('ee.upsale.form_configuration.description') %></p>+ <p><%= t('ee.upsale.form_configuration.description') %></p>- <ul class="">- <li>- <%= t('ee.upsale.form_configuration.add_groups') %>- </li>- <li>- <%= t('ee.upsale.form_configuration.rename_groups') %>- </li>- </ul>- <p>- <br/>- <b><%= t('homescreen.blocks.upsale.become_hero') %></b> <%= t('homescreen.blocks.upsale.you_contribute') %>- </p>- <%= link_to("#{OpenProject::Static::Links.links[:upsale][:href]}/?utm_source=unknown&utm_medium=community-edition&utm_campaign=form-configuration",- { class: 'button -alt-highlight',- aria: { label: t('admin.enterprise.order') },- target: '_blank',- title: t('admin.enterprise.order') }) do %>- <%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= t('admin.enterprise.order') %></span>- <% end %>- </div>+ <ul class="">+ <li>+ <%= t('ee.upsale.form_configuration.add_groups') %>+ </li>+ <li>+ <%= t('ee.upsale.form_configuration.rename_groups') %>+ </li>+ </ul>+ <p>+ <br/>+ <b><%= t('homescreen.blocks.upsale.become_hero') %></b> <%= t('homescreen.blocks.upsale.you_contribute') %>+ </p>+ <%= link_to("#{OpenProject::Static::Links.links[:upsale][:href]}/?utm_source=unknown&utm_medium=community-edition&utm_campaign=form-configuration",+ { class: 'button -alt-highlight',+ aria: { label: t('admin.enterprise.order') },+ target: '_blank',+ title: t('admin.enterprise.order') }) do %>+ <%= op_icon('button--icon icon-add') %>+ <span class="button--text"><%= t('admin.enterprise.order') %></span>+ <% end %></div>- <% end %>- <% no_filter_query = ::API::V3::Queries::QueryParamsRepresenter.new(Query.new_default.tap { |q| q.filters = [] }).to_json %>- <%= f.hidden_field :attribute_groups, value: '', class: 'admin-type-form--hidden-field' %>- <%= content_tag('admin-type-form-configuration',- '',- data: {- 'active-groups': form_attributes[:actives],- 'inactive-attributes': form_attributes[:inactives],- 'no-filter-query': no_filter_query- }) %>- </div>+ </div>+ <% end %>+ <% no_filter_query = ::API::V3::Queries::QueryParamsRepresenter.new(Query.new_default.tap { |q| q.filters = [] }).to_json %>+ <%= f.hidden_field :attribute_groups, value: '', class: 'admin-type-form--hidden-field' %>+ <%= content_tag('admin-type-form-configuration',+ '',+ data: {+ 'active-groups': form_attributes[:actives],+ 'inactive-attributes': form_attributes[:inactives],+ 'no-filter-query': no_filter_query+ }) %></div></div>- </section>+ </div>+</section>- <div class="grid-block">- <div class="generic-table--action-buttons">- <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),- class: 'form-configuration--save -highlight -with-icon icon-checkmark' %>- </div>+<div class="grid-block">+ <div class="generic-table--action-buttons">+ <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),+ class: 'form-configuration--save -highlight -with-icon icon-checkmark' %></div>-<% end %>+</div>diff --git a/app/views/types/form/_projects.html.erb b/app/views/types/form/_projects.html.erbindex 51f7d14d25f..613650f58c2 100644--- a/app/views/types/form/_projects.html.erb+++ b/app/views/types/form/_projects.html.erb@@ -27,40 +27,35 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= form_for @type,- url: update_type_tab_path(id: @type.id, tab: @tab),- builder: TabularFormBuilder,- lang: current_language do |f| %>- <section class="form--section">- <div class="grid-block wrap">- <div class="grid-content small-12 large-6">- <% if @projects.any? %>- <fieldset class="form--fieldset" id="type_project_ids">- <legend class="form--fieldset-legend" >- <%= t('types.edit.enabled_projects') %>- </legend>- <div>- <div class="form--fieldset-control">- <span class="form--fieldset-control-container">- (<%= check_all_links 'type_project_ids' %>)- </span>- </div>- <%= project_nested_ul(@projects) do |p|- content_tag('label',- check_box_tag('type[project_ids][]', p.id, @type.projects.include?(p), id: nil) +- ' ' + h(p), class: 'form--label-with-check-box')- end %>- <%= hidden_field_tag('type[project_ids][]', '', id: nil) %>+<section class="form--section">+ <div class="grid-block wrap">+ <div class="grid-content small-12 large-6">+ <% if @projects.any? %>+ <fieldset class="form--fieldset" id="type_project_ids">+ <legend class="form--fieldset-legend" >+ <%= t('types.edit.enabled_projects') %>+ </legend>+ <div>+ <div class="form--fieldset-control">+ <span class="form--fieldset-control-container">+ (<%= check_all_links 'type_project_ids' %>)+ </span></div>- <% end %>- </div>+ <%= project_nested_ul(@projects) do |p|+ content_tag('label',+ check_box_tag('type[project_ids][]', p.id, @type.projects.include?(p), id: nil) ++ ' ' + h(p), class: 'form--label-with-check-box')+ end %>+ <%= hidden_field_tag('type[project_ids][]', '', id: nil) %>+ </div>+ <% end %></div>- </section>+ </div>+</section>- <div class="grid-block">- <div class="generic-table--action-buttons">- <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),- class: '-highlight -with-icon icon-checkmark' %>- </div>+<div class="grid-block">+ <div class="generic-table--action-buttons">+ <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),+ class: '-highlight -with-icon icon-checkmark' %></div>-<% end %>+</div>diff --git a/app/views/types/form/_settings.html.erb b/app/views/types/form/_settings.html.erbindex 17ebaa9f5b7..8f8ae0951cf 100644--- a/app/views/types/form/_settings.html.erb+++ b/app/views/types/form/_settings.html.erb@@ -27,55 +27,51 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= form_for @type,- url: update_type_tab_path(id: @type.id, tab: @tab),- builder: TabularFormBuilder,- lang: current_language do |f| %>- <div class="grid-block">- <div class="grid-content">- <!--[form:type]-->- <div class="form--field -required -wide-label"><%= f.text_field :name, required: true, disabled: @type.is_standard?, container_class: '-middle' %></div>- <div class="form--field -wide-label"><%= f.check_box :is_in_roadmap %></div>- <%= render partial: '/colors/color_autocomplete_field',- locals: {- form: f,- object: @type,- type: 'type',- allow_bright_colors: false,- highlight_text_inline: true,- label: t('types.edit.type_color_text'),- form_field_class: '-wide-label',- container_class: '-slim'- } %>- <div class="form--field -wide-label"><%= f.check_box :is_default %></div>- <div class="form--field -wide-label"><%= f.check_box :is_milestone %></div>- <% if @type.new_record? && @types.any? %>- <div class="form--field -wide-label">- <%= styled_label_tag 'copy_workflow_from', t(:label_copy_workflow_from) %>- <%= styled_select_tag(:copy_workflow_from,- options_from_collection_for_select(@types, :id, :name, params[:copy_workflow_from]),- include_blank: true,- container_class: '-slim') %>- </div>- <% end %>+<div class="grid-block">+ <div class="grid-content">+ <!--[form:type]-->+ <div class="form--field -required -wide-label"><%= f.text_field :name, required: true, disabled: @type.is_standard?, container_class: '-middle' %></div>+ <div class="form--field -wide-label"><%= f.check_box :is_in_roadmap %></div>+ <%= render partial: '/colors/color_autocomplete_field',+ locals: {+ form: f,+ object: @type,+ type: 'type',+ allow_bright_colors: false,+ highlight_text_inline: true,+ label: t('types.edit.type_color_text'),+ form_field_class: '-wide-label',+ container_class: '-slim'+ } %>+ <div class="form--field -wide-label"><%= f.check_box :is_default %></div>+ <div class="form--field -wide-label"><%= f.check_box :is_milestone %></div>- <div class="form--field">- <%= f.text_area :description,- class: 'wiki-edit wiki-toolbar',- container_class: '-xxwide',- with_text_formatting: true %>+ <% if @type.new_record? && @types.any? %>+ <div class="form--field -wide-label">+ <%= styled_label_tag 'copy_workflow_from', t(:label_copy_workflow_from) %>+ <%= styled_select_tag(:copy_workflow_from,+ options_from_collection_for_select(@types, :id, :name, params[:copy_workflow_from]),+ include_blank: true,+ container_class: '-slim') %></div>+ <% end %>- <!--[eoform:type]-->-+ <div class="form--field">+ <%= f.text_area :description,+ class: 'wiki-edit wiki-toolbar',+ container_class: '-xxwide',+ with_text_formatting: true %></div>++ <!--[eoform:type]-->+</div>+</div>- <div class="grid-block">- <div class="generic-table--action-buttons">- <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),- class: '-highlight -with-icon icon-checkmark' %>- </div>+<div class="grid-block">+ <div class="generic-table--action-buttons">+ <%= styled_button_tag t(@type.new_record? ? :button_create : :button_save),+ class: '-highlight -with-icon icon-checkmark' %></div>-<% end %>+</div>diff --git a/modules/global_roles/spec/features/global_role_assignment_spec.rb b/modules/global_roles/spec/features/global_role_assignment_spec.rbindex 9f09584c50f..25d180bf4a4 100644--- a/modules/global_roles/spec/features/global_role_assignment_spec.rb+++ b/modules/global_roles/spec/features/global_role_assignment_spec.rb@@ -57,8 +57,8 @@ describe 'Global role: Global role assignment', type: :feature, js: true doit 'allows global roles management' do# When I go to the edit page of the user called "bob"visit edit_user_path user- # And I click on "tab-global_roles"- page.find('#tab-global_roles').click+ # And I click on "Global Roles"+ click_link 'Global Roles'# Then I should see "global_role1" within "#table_principal_roles"page.within('#table_principal_roles') doexpect(page).to have_text 'global_role1'diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rbindex b68ddec2d94..48995e80262 100644--- a/modules/meeting/app/controllers/meeting_contents_controller.rb+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb@@ -38,6 +38,8 @@ class MeetingContentsController < ApplicationControllerhelper :watchershelper :meetings+ helper_method :gon+before_action :find_meeting, :find_contentbefore_action :authorizediff --git a/modules/meeting/spec/features/meetings_copy_spec.rb b/modules/meeting/spec/features/meetings_copy_spec.rbindex 8c3fdbfc123..a256d741595 100644--- a/modules/meeting/spec/features/meetings_copy_spec.rb+++ b/modules/meeting/spec/features/meetings_copy_spec.rb@@ -28,7 +28,7 @@require 'spec_helper'-describe 'Meetings copy', type: :feature do+describe 'Meetings copy', type: :feature, js: true dolet(:project) { FactoryBot.create :project, enabled_module_names: %w[meetings] }let(:user) doFactoryBot.create(:user,diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rbindex 8683c25fc67..f491752740b 100644--- a/modules/meeting/spec/features/meetings_show_spec.rb+++ b/modules/meeting/spec/features/meetings_show_spec.rb@@ -96,7 +96,7 @@ describe 'Meetings', type: :feature, js: true doit 'can not edit the minutes' dovisit meeting_path(meeting)- find('#tab-minutes').click+ click_link 'Minutes'expect(page).to have_no_selector('.meeting_minutes', text: 'Edit')expect(page).to have_selector('.meeting_minutes', text: 'There is currently nothing to display')enddiff --git a/spec/features/groups/group_memberships_spec.rb b/spec/features/groups/group_memberships_spec.rbindex ad39108d525..8f8a12a998e 100644--- a/spec/features/groups/group_memberships_spec.rb+++ b/spec/features/groups/group_memberships_spec.rb@@ -28,7 +28,7 @@require 'spec_helper'-feature 'group memberships through groups page', type: :feature do+feature 'group memberships through groups page', type: :feature, js: true dolet!(:project) { FactoryBot.create :project, name: 'Project 1', identifier: 'project1' }let(:admin) { FactoryBot.create :admin }@@ -48,7 +48,7 @@ feature 'group memberships through groups page', type: :feature dogroup.add_member! peterend- scenario 'adding a user to a group adds the user to the project as well', js: true do+ scenario 'adding a user to a group adds the user to the project as well' domembers_page.visit!expect(members_page).not_to have_user 'Hannibal Smith'@@ -83,7 +83,7 @@ feature 'group memberships through groups page', type: :feature doexpect(members_page).not_to have_user 'Hannibal Smith'end- scenario 'removing the group from a project', js: true do+ scenario 'removing the group from a project' dogroup_page.visit!group_page.open_projects_tab!expect(group_page).to have_project 'Project 1'diff --git a/spec/support/pages/admin/users/edit.rb b/spec/support/pages/admin/users/edit.rbindex c9aeaeed76d..ed297c37474 100644--- a/spec/support/pages/admin/users/edit.rb+++ b/spec/support/pages/admin/users/edit.rb@@ -43,7 +43,9 @@ module Pagesenddef open_projects_tab!- click_on 'tab-memberships'+ within('.content--tabs') do+ click_on 'Projects'+ endenddef add_to_project!(project_name, as:)diff --git a/spec/support/pages/groups.rb b/spec/support/pages/groups.rbindex 592000614df..65c6daf083a 100644--- a/spec/support/pages/groups.rb+++ b/spec/support/pages/groups.rb@@ -77,11 +77,15 @@ module Pagesenddef open_users_tab!- click_on 'tab-users'+ within('.content--tabs') do+ click_on 'Users'+ endenddef open_projects_tab!- click_on 'tab-memberships'+ within('.content--tabs') do+ click_on 'Projects'+ endenddef add_to_project!(project_name, as:)