Skip to content

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

Remove obsolete toolbar helpers

Henriette Darge7a64597a7ac7
diff --git a/app/helpers/toolbar_helper.rb b/app/helpers/toolbar_helper.rb
deleted file mode 100644
index b8ec2dec5ab..00000000000
--- a/app/helpers/toolbar_helper.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-module ToolbarHelper
- include ERB::Util
- include ActionView::Helpers::OutputSafetyHelper
-
- def toolbar(title:, title_extra: nil, title_class: nil, subtitle: "", link_to: nil, html: {})
- classes = ["toolbar-container", html[:class]].compact.join(" ")
- content_tag :div, class: classes do
- toolbar = content_tag :div, class: "toolbar" do
- dom_title(title, link_to, title_class:, title_extra:) + dom_toolbar do
- yield if block_given?
- end
- end
- next toolbar if subtitle.blank?
-
- toolbar + content_tag(:p, subtitle, class: "subtitle")
- end
- end
-
- def editable_toolbar(form:, field_name:, html: {})
- container_classes = ["toolbar-container -editable", html[:class]].compact.join(" ")
- content_tag :div, class: container_classes do
- content_tag :div, class: "toolbar" do
- concat(editable_toolbar_title(form, field_name))
- concat(dom_toolbar { yield if block_given? })
- end
- end
- end
-
- def breadcrumb_toolbar(*elements, subtitle: "", html: {}, &)
- toolbar(title: safe_join(elements, " &raquo ".html_safe), subtitle:, html:, &)
- end
-
- protected
-
- def editable_toolbar_title(form, field_name)
- new_element = form.object.new_record?
-
- content_tag :div, class: "title-container" do
- form.text_field field_name,
- class: "toolbar--editable-toolbar -border-on-hover-only",
- placeholder: t(:label_page_title),
- "aria-label": t(:label_page_title),
- autocomplete: "off",
- required: true,
- autofocus: new_element,
- no_label: true
- end
- end
-
- def dom_title(raw_title, link_to = nil, title_class: nil, title_extra: nil)
- title = "".html_safe
- title << raw_title
-
- if link_to.present?
- title << ": "
- title << link_to
- end
-
- content_tag :div, class: "title-container" do
- opts = {}
-
- opts[:class] = title_class if title_class.present?
-
- content_tag(:h2, title, opts) + (
- title_extra.presence || ""
- )
- end
- end
-
- def dom_toolbar(&)
- return "" unless block_given?
-
- content_tag(:ul, class: "toolbar-items", &)
- end
-end
diff --git a/app/views/enumerations/_form.html.erb b/app/views/enumerations/_form.html.erb
deleted file mode 100644
index b4dff252fca..00000000000
--- a/app/views/enumerations/_form.html.erb
+++ /dev/null
@@ -1,54 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-
-<%#
- needs locals:
- f: labelled form builder
-%>
-
-<%= error_messages_for :enumeration %>
-<section class="form--section">
- <%= f.hidden_field "type" %>
- <div class="form--field -required"><%= f.text_field "name", required: true, container_class: "-middle" %></div>
- <div class="form--field"><%= f.check_box "active" %></div>
-
- <% if @enumeration.class.can_have_default_value? %>
- <div class="form--field"><%= f.check_box "is_default" %></div>
- <% end %>
-
- <% if @enumeration.class.colored? %>
- <%= render partial: "/colors/color_autocomplete_field",
- locals: {
- form: f,
- object: @enumeration,
- type: "enumeration",
- label: @enumeration.color_label
- } %>
- <% end %>
-</section>
diff --git a/app/views/enumerations/destroy.html.erb b/app/views/enumerations/destroy.html.erb
deleted file mode 100644
index 340579df0e8..00000000000
--- a/app/views/enumerations/destroy.html.erb
+++ /dev/null
@@ -1,43 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-<%= breadcrumb_toolbar link_to(t(@enumeration.option_name), enumerations_path), @enumeration %>
-<%= styled_form_tag({}, method: :delete) do %>
- <section class="form--section">
- <p><strong><%= t(:text_enumeration_destroy_question, count: @enumeration.objects_count) %></strong></p>
- <div class="form--field">
- <%= styled_label_tag "reassign_to_id", t(:text_enumeration_category_reassign_to) %>
- <div class="form--field-container">
- <%= styled_select_tag "reassign_to_id", options_from_collection_for_select(@enumerations, "id", "name") %>
- </div>
- </div>
- </section>
- <%= styled_submit_tag t(:button_apply), class: "-primary" %>
- <%= link_to t(:button_cancel), { controller: "/enumerations", action: "index" },
- class: "button" %>
-<% end %>
diff --git a/app/views/enumerations/edit.html.erb b/app/views/enumerations/edit.html.erb
deleted file mode 100644
index 1ccbc16c211..00000000000
--- a/app/views/enumerations/edit.html.erb
+++ /dev/null
@@ -1,53 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-
-<% html_title t(:label_administration), "#{t(:label_edit)} #{Enumeration.model_name.human} #{h @enumeration.name}" %>
-
-<%=
- render(Primer::OpenProject::PageHeader.new) do |header|
- header.with_title { h @enumeration.name }
- header.with_breadcrumbs(
- [
- { href: admin_index_path, text: t(:label_administration) },
- { href: enumerations_path, text: t(:label_enumerations) },
- nested_breadcrumb_element(t(@enumeration.option_name), @enumeration.name)
- ],
- selected_item_font_weight: :normal
- )
- end
-%>
-
-<%= labelled_tabular_form_for @enumeration do |f| %>
- <%= render partial: "form", locals: { f: f } %>
- <%= styled_button_tag t(:button_save), class: "-primary -with-icon icon-checkmark" %>
-<% end %>
-
-<%= styled_form_tag(enumeration_path(@enumeration), method: :delete) do %>
- <%= styled_submit_tag t(:button_delete) %>
-<% end %>
diff --git a/app/views/enumerations/index.html.erb b/app/views/enumerations/index.html.erb
deleted file mode 100644
index 8b863c002ed..00000000000
--- a/app/views/enumerations/index.html.erb
+++ /dev/null
@@ -1,44 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-<% html_title t(:label_administration), t(:label_enumerations) %>
-
-<%=
- render(Primer::OpenProject::PageHeader.new) do |header|
- header.with_title { t(:label_enumerations) }
- header.with_breadcrumbs(
- [{ href: admin_index_path, text: t(:label_administration) },
- t(:label_enumerations)]
- )
- end
-%>
-
-<% enumeration_classes.each do |klass| %>
- <h3 class="-no-border"><%= t(klass::OptionName) %></h3>
- <%= render(::Enumerations::TableComponent.new(rows: klass.shared, enumeration: klass)) %>
-<% end %>
diff --git a/app/views/enumerations/new.html.erb b/app/views/enumerations/new.html.erb
deleted file mode 100644
index 8149ec27660..00000000000
--- a/app/views/enumerations/new.html.erb
+++ /dev/null
@@ -1,47 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-
-<% html_title t(:label_administration), t(:label_enumeration_new) %>
-
-<%=
- render(Primer::OpenProject::PageHeader.new) do |header|
- header.with_title { t(:label_enumeration_new) }
- header.with_breadcrumbs(
- [{ href: admin_index_path, text: t(:label_administration) },
- { href: enumerations_path, text: t(:label_enumerations) },
- nested_breadcrumb_element(t(@enumeration.option_name), t(:label_enumeration_new))],
- selected_item_font_weight: :normal
- )
- end
-%>
-
-<%= labelled_tabular_form_for @enumeration do |f| %>
- <%= render partial: "form", locals: { f: f } %>
- <%= styled_button_tag t(:button_create), class: "-primary -with-icon icon-checkmark" %>
-<% end %>
diff --git a/app/views/users/_toolbar.html.erb b/app/views/users/_toolbar.html.erb
deleted file mode 100644
index 413812148e8..00000000000
--- a/app/views/users/_toolbar.html.erb
+++ /dev/null
@@ -1,69 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-<%= breadcrumb_toolbar(@user.name) do %>
- <li class="toolbar-item">
- <%= link_to user_path(@user), class: "button" do %>
- <%= op_icon("button--icon icon-user") %>
- <span class="button--text"><%= t(:label_profile) %></span>
- <% end %>
- </li>
- <% if current_user.allowed_globally?(:create_user) && current_user.id != @user.id %>
- <li class="toolbar-item hidden-for-tablet">
- <%= form_for(
- @user,
- url: { action: :resend_invitation },
- method: :post
- ) do |_form| %>
- <button class="button" title="<%= t(:tooltip_resend_invitation) %>">
- <%= op_icon("button--icon icon-mail1") %>
- <span class="button--text"><%= t(:label_send_invitation) %></span>
- </button>
- <% end %>
- </li>
- <% end %>
- <% if current_user.admin? %>
- <% unless current_user.id == @user.id %>
- <li class="toolbar-item">
- <%= form_for @user,
- url: { action: :change_status },
- method: :post do %>
- <%= change_user_status_buttons(@user) %>
- <% end %>
- </li>
- <% end %>
- <% if Setting.users_deletable_by_admins? %>
- <li class="toolbar-item">
- <%= link_to deletion_info_user_path(@user), class: "button" do %>
- <%= op_icon("button--icon icon-delete") %>
- <span class="button--text"><%= t(:button_delete) %></span>
- <% end %>
- </li>
- <% end %>
- <% end %>
-<% end %>
diff --git a/app/views/wiki/_page_form.html.erb b/app/views/wiki/_page_form.html.erb
index 907fbb0ceee..774bacb8320 100644
--- a/app/views/wiki/_page_form.html.erb
+++ b/app/views/wiki/_page_form.html.erb
@@ -2,11 +2,9 @@
<% resource = ::API::V3::WikiPages::WikiPageRepresenter.new(@page, current_user: current_user, embed_links: true) %>
-<%= editable_toolbar(form: f, field_name: :title) do %>
- <li class="toolbar-item">
- <opce-zen-mode-toggle-button></opce-zen-mode-toggle-button>
- </li>
-<% end %>
+<div class="form--field -required">
+ <%= f.text_field :title, label: t(:label_page_title) %>
+</div>
<div class="attributes-group wiki--content--attribute ckeditor--content-scrollable form--field -visible-overflow">
<%= f.text_area :text,
diff --git a/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb b/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
index c5b7e6c3a71..720762c2c47 100644
--- a/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
+++ b/modules/ldap_groups/app/views/ldap_groups/synchronized_filters/show.html.erb
@@ -47,15 +47,15 @@
</section>
<section class="admin--edit-section">
- <%= toolbar(title: t("ldap_groups.synchronized_groups.plural")) do %>
- <li class="toolbar-item">
- <%= link_to(
- { action: :synchronize },
- class: "button"
- ) do %>
- <span class="button--text"><%= t("ldap_groups.label_synchronize") %></span>
- <% end %>
- </li>
- <% end %>
+ <%=
+ render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
+ subhead.with_heading(size: :medium) { t("ldap_groups.synchronized_groups.plural") }
+ subhead.with_actions do
+ render(Primer::Beta::Button.new(tag: :a, href: synchronize_ldap_groups_synchronized_filter_path(@filter))) do
+ t("ldap_groups.label_synchronize")
+ end
+ end
+ end
+ %>
<%= render ::LdapGroups::SynchronizedGroups::TableComponent.new(rows: @filter.groups, show_inline_create: false, deletable: false) %>
</section>
diff --git a/spec/helpers/toolbar_helper_spec.rb b/spec/helpers/toolbar_helper_spec.rb
deleted file mode 100644
index 47402f3bdbd..00000000000
--- a/spec/helpers/toolbar_helper_spec.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-require "spec_helper"
-
-RSpec.describe ToolbarHelper do
- describe ".toolbar" do
- it "creates a default toolbar" do
- result = toolbar title: "Title"
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>Title</h2>
- </div>
- <ul class="toolbar-items"></ul>
- </div>
- </div>
- }
- end
-
- it "is able to add a subtitle" do
- result = toolbar title: "Title", subtitle: "lorem"
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>Title</h2>
- </div>
- <ul class="toolbar-items"></ul>
- </div>
- <p class="subtitle">lorem</p>
- </div>
- }
- end
-
- it "is able to add a link_to" do
- result = toolbar title: "Title", link_to: link_to("foobar", user_path("1234"))
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>Title: <a href="/users/1234">foobar</a></h2>
- </div>
- <ul class="toolbar-items"></ul>
- </div>
- </div>
- }
- end
-
- it "escapes the title" do
- result = toolbar title: '</h2><script>alert("foobar!");</script>'
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>&lt;/h2&gt;&lt;script&gt;alert(&quot;foobar!&quot;);&lt;/script&gt;</h2>
- </div>
- <ul class="toolbar-items"></ul>
- </div>
- </div>
- }
- end
-
- it "includes capsulate html" do
- result = toolbar title: "Title" do
- content_tag :li do
- content_tag :p, "paragraph", data: { number: 2 }
- end
- end
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>Title</h2>
- </div>
- <ul class="toolbar-items">
- <li>
- <p data-number="2">paragraph</p>
- </li>
- </ul>
- </div>
- </div>
- }
- end
- end
-
- describe ".breadcrumb_toolbar" do
- it "escapes properly" do
- result = breadcrumb_toolbar '</h2><script>alert("foobar!");</script>',
- link_to("foobar", user_path("1234"))
-
- expect(result).to be_html_eql %{
- <div class="toolbar-container">
- <div class="toolbar">
- <div class="title-container">
- <h2>&lt;/h2&gt;&lt;script&gt;alert(&quot;foobar!&quot;);&lt;/script&gt; &raquo <a href="/users/1234">foobar</a></h2>
- </div>
- <ul class="toolbar-items"></ul>
- </div>
- </div>
- }
- end
- end
-end