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

Add upsale page for attribute help texts

Oliver Günther8a3ff8ec5287
diff --git a/app/assets/images/enterprise/attribute-help-texts.png b/app/assets/images/enterprise/attribute-help-texts.png
new file mode 100644
index 00000000000..93f80cb6fd9
Binary files /dev/null and b/app/assets/images/enterprise/attribute-help-texts.png differ
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index 87672b834fe..4357c3c678e 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -31,9 +31,9 @@ class AttributeHelpTextsController < ApplicationController
menu_item :attribute_help_texts
before_action :require_admin
+ before_action :require_ee_token, except: %i[upsale]
before_action :find_entry, only: %i(edit update destroy)
before_action :find_type_scope
- before_action :require_enterprise_token_grant
def new
@attribute_help_text = AttributeHelpText.new type: @attribute_scope
@@ -41,6 +41,8 @@ class AttributeHelpTextsController < ApplicationController
def edit; end
+ def upsale; end
+
def update
call = ::AttributeHelpTexts::UpdateService
.new(user: current_user, model: @attribute_help_text)
@@ -86,6 +88,12 @@ class AttributeHelpTextsController < ApplicationController
protected
+ def require_ee_token
+ unless EnterpriseToken.allows_to?(:attribute_help_texts)
+ redirect_to upsale_attribute_help_texts_path
+ end
+ end
+
def default_breadcrumb
if action_name == 'index'
t('attribute_help_texts.label_plural')
@@ -130,8 +138,4 @@ class AttributeHelpTextsController < ApplicationController
@attribute_scope = AttributeHelpText.const_get(submodule)
end
-
- def require_enterprise_token_grant
- render_404 unless EnterpriseToken.allows_to?(:attribute_help_texts)
- end
end
diff --git a/app/views/attribute_help_texts/upsale.html.erb b/app/views/attribute_help_texts/upsale.html.erb
new file mode 100644
index 00000000000..7545b7a778f
--- /dev/null
+++ b/app/views/attribute_help_texts/upsale.html.erb
@@ -0,0 +1,38 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2022 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(:'attribute_help_texts.label_plural') %>
+
+<%= render template: 'common/upsale',
+ locals: {
+ feature_title: t(:'attribute_help_texts.label_plural'),
+ feature_description: t('attribute_help_texts.enterprise.description'),
+ feature_reference: 'enterprise-attribute-help-texts',
+ feature_image: 'enterprise/attribute-help-texts.png'
+ } %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 627fa034ccf..e73b3222612 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -269,9 +269,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
{ controller: '/attribute_help_texts' },
caption: :'attribute_help_texts.label_plural',
icon: 'icon2 icon-help2',
- if: Proc.new {
- User.current.admin? && EnterpriseToken.allows_to?(:attribute_help_texts)
- }
+ if: Proc.new { User.current.admin? }
menu.push :enumerations,
{ controller: '/enumerations' },
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 0ca7b246fb4..08db2497ca0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -106,6 +106,8 @@ en:
show_preview: 'Preview text'
add_new: 'Add help text'
edit: "Edit help text for %{attribute_caption}"
+ enterprise:
+ description: 'Hovering on a sidebar menu item displays attribute help text that help you and your users better understand what each item does.'
auth_sources:
index:
diff --git a/config/routes.rb b/config/routes.rb
index 3fb0e2bf94f..6d94943e17a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -351,7 +351,9 @@ OpenProject::Application.routes.draw do
post 'design/themes' => 'custom_styles#update_themes', as: 'update_design_themes'
resource :custom_style, only: %i[update show create], path: 'design'
- resources :attribute_help_texts, only: %i(index new create edit update destroy)
+ resources :attribute_help_texts, only: %i(index new create edit update destroy) do
+ get :upsale, to: 'attribute_help_texts#upsale', on: :collection, as: :upsale
+ end
resources :groups, except: %i[show] do
member do
diff --git a/spec/controllers/attribute_help_texts_controller_spec.rb b/spec/controllers/attribute_help_texts_controller_spec.rb
index 832867d59c7..96ff7be9f2a 100644
--- a/spec/controllers/attribute_help_texts_controller_spec.rb
+++ b/spec/controllers/attribute_help_texts_controller_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe AttributeHelpTextsController, type: :controller do
let(:user) { build_stubbed :admin }
let(:model) { build :work_package_help_text }
- let(:relation_columns_allowed) { true }
+ let(:enterprise_token) { true }
let(:find_expectation) do
allow(AttributeHelpText)
@@ -13,7 +13,7 @@ describe AttributeHelpTextsController, type: :controller do
end
before do
- with_enterprise_token(relation_columns_allowed ? :attribute_help_texts : nil)
+ with_enterprise_token(enterprise_token ? :attribute_help_texts : nil)
login_as user
end
@@ -30,10 +30,10 @@ describe AttributeHelpTextsController, type: :controller do
end
context 'with help texts disallowed by the enterprise token' do
- let(:relation_columns_allowed) { false }
+ let(:enterprise_token) { false }
- it 'returns 404' do
- expect(response.status).to be 404
+ it 'redirects to upsale' do
+ expect(response).to redirect_to upsale_attribute_help_texts_path
end
end
end
@@ -53,10 +53,10 @@ describe AttributeHelpTextsController, type: :controller do
end
context 'with help texts disallowed by the enterprise token' do
- let(:relation_columns_allowed) { false }
+ let(:enterprise_token) { false }
- it 'returns 404' do
- expect(response.status).to be 404
+ it 'redirects to upsale' do
+ expect(response).to redirect_to upsale_attribute_help_texts_path
end
end
@@ -135,14 +135,14 @@ describe AttributeHelpTextsController, type: :controller do
end
context 'with help texts disallowed by the enterprise token' do
- let(:relation_columns_allowed) { false }
+ let(:enterprise_token) { false }
before do
call
end
- it 'returns 404' do
- expect(response.status).to be 404
+ it 'redirects to upsale' do
+ expect(response).to redirect_to upsale_attribute_help_texts_path
end
end
end
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index ab21ec7a772..a57b4fbc544 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -35,11 +35,11 @@ describe 'Attribute help texts', js: true do
let(:modal) { Components::AttributeHelpTextModal.new(instance) }
let(:editor) { Components::WysiwygEditor.new }
let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }
- let(:relation_columns_allowed) { true }
+ let(:enterprise_token) { true }
describe 'Work package help texts' do
before do
- with_enterprise_token(relation_columns_allowed ? :attribute_help_texts : nil)
+ with_enterprise_token(enterprise_token ? :attribute_help_texts : nil)
login_as(admin)
visit attribute_help_texts_path
@@ -152,12 +152,11 @@ describe 'Attribute help texts', js: true do
end
context 'with help texts disallowed by the enterprise token' do
- let(:relation_columns_allowed) { false }
+ let(:enterprise_token) { false }
it 'hides CRUD to attribute help texts' do
- expect(page)
- .to have_selector(".errorExplanation",
- text: "The page you were trying to access doesn't exist or has been removed.")
+ expect(page).to have_current_path /upsale/
+ expect(page).to have_text I18n.t('attribute_help_texts.enterprise.description')
end
end
end
diff --git a/spec/features/menu_items/admin_menu_item_spec.rb b/spec/features/menu_items/admin_menu_item_spec.rb
index a558b958ef7..9ad032651e1 100644
--- a/spec/features/menu_items/admin_menu_item_spec.rb
+++ b/spec/features/menu_items/admin_menu_item_spec.rb
@@ -44,8 +44,8 @@ describe 'Admin menu items', js: true do
visit admin_index_path
expect(page).to have_selector('[data-qa-selector="menu-blocks--container"]')
- expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 17)
- expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 18) # All plus 'overview'
+ expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 18)
+ expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 19) # All plus 'overview'
end
end
@@ -57,10 +57,10 @@ describe 'Admin menu items', js: true do
visit admin_index_path
expect(page).to have_selector('[data-qa-selector="menu-blocks--container"]')
- expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 16)
+ expect(page).to have_selector('[data-qa-selector="menu-block"]', count: 17)
expect(page).not_to have_selector('[data-qa-selector="menu-block"]', text: I18n.t('timelines.admin_menu.colors'))
- expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 17) # All plus 'overview'
+ expect(page).to have_selector('[data-qa-selector="op-menu--item-action"]', count: 18) # All plus 'overview'
expect(page).not_to have_selector('[data-qa-selector="op-menu--item-action"]', text: I18n.t('timelines.admin_menu.colors'))
end
end