-
- <%= styled_button_tag t(:button_save),
- data: { test_selector: "color-theme-button", confirm: (t("admin.custom_styles.theme_warning") if @current_theme.blank?) } %>
-
-
+ <%= styled_button_tag t(:button_save),
+ data: { test_selector: "color-theme-button", confirm: (t("admin.custom_styles.theme_warning") if @current_theme.blank?) } %>
+
+
+ <% end %>
+
+ <%= render_tabs design_tabs %>
<% end %>
-
-<%= render_tabs design_tabs %>
diff --git a/app/views/custom_styles/upsell.html.erb b/app/views/custom_styles/upsell.html.erb
deleted file mode 100644
index 1a52da276ec..00000000000
--- a/app/views/custom_styles/upsell.html.erb
+++ /dev/null
@@ -1,35 +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_custom_style) %>
-
-<%= render EnterpriseEdition::UpsellPageComponent.new(
- :define_custom_style,
- video: "enterprise/custom-design.mp4"
-) %>
diff --git a/app/views/notifications/date_alerts.html.erb b/app/views/notifications/date_alerts.html.erb
index cffa0b85e96..9342b13b74f 100644
--- a/app/views/notifications/date_alerts.html.erb
+++ b/app/views/notifications/date_alerts.html.erb
@@ -1,6 +1,7 @@
<% html_title t("js.notifications.title") %>
-<%= render EnterpriseEdition::UpsellPageComponent.new(
+<%= render EnterpriseEdition::BannerComponent.new(
:date_alerts,
+ variant: :large,
video: "enterprise/date-alert-notifications.mp4"
) %>
diff --git a/app/views/notifications/share_upsell.html.erb b/app/views/notifications/share_upsell.html.erb
index f0f0e53abcf..7b69492146a 100644
--- a/app/views/notifications/share_upsell.html.erb
+++ b/app/views/notifications/share_upsell.html.erb
@@ -1,6 +1,7 @@
<% html_title t("js.notifications.title") %>
-<%= render EnterpriseEdition::UpsellPageComponent.new(
+<%= render EnterpriseEdition::BannerComponent.new(
:work_package_sharing,
+ variant: :large,
video: "enterprise/share-work-package.mp4"
) %>
diff --git a/app/views/placeholder_users/index.html.erb b/app/views/placeholder_users/index.html.erb
index d8b2ae5f1be..cc69db743fe 100644
--- a/app/views/placeholder_users/index.html.erb
+++ b/app/views/placeholder_users/index.html.erb
@@ -61,6 +61,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= render PlaceholderUsers::TableComponent.new(rows: @placeholder_users) %>
<% else %>
- <%= render EnterpriseEdition::UpsellPageComponent.new(:placeholder_users,
- video: "enterprise/placeholder_users.mp4") %>
+ <%= render EnterpriseEdition::BannerComponent.new(:placeholder_users,
+ variant: :large,
+ video: "enterprise/placeholder_users.mp4") %>
<% end %>
diff --git a/app/views/projects/settings/work_packages/internal_comments/show.html.erb b/app/views/projects/settings/work_packages/internal_comments/show.html.erb
index 3de506cad8a..94104dd8cdd 100644
--- a/app/views/projects/settings/work_packages/internal_comments/show.html.erb
+++ b/app/views/projects/settings/work_packages/internal_comments/show.html.erb
@@ -40,5 +40,9 @@ See COPYRIGHT and LICENSE files for more details.
<%= render(Projects::Settings::WorkPackages::Activities::Form.new(f)) %>
<% end %>
<% else %>
- <%= render(EnterpriseEdition::UpsellPageComponent.new(:internal_comments, video: "enterprise/internal_comments.mp4")) %>
+ <%= render(EnterpriseEdition::BannerComponent.new(
+ :internal_comments,
+ variant: :large,
+ video: "enterprise/internal_comments.mp4"
+ )) %>
<% end %>
diff --git a/app/views/work_packages/share_upsell.html.erb b/app/views/work_packages/share_upsell.html.erb
index 30e9557e1cf..126fb565d70 100644
--- a/app/views/work_packages/share_upsell.html.erb
+++ b/app/views/work_packages/share_upsell.html.erb
@@ -1,6 +1,7 @@
<% html_title t(:label_work_package_plural) %>
-<%= render EnterpriseEdition::UpsellPageComponent.new(
+<%= render EnterpriseEdition::BannerComponent.new(
:work_package_sharing,
+ variant: :large,
video: "enterprise/share-work-package.mp4"
) %>
diff --git a/config/routes.rb b/config/routes.rb
index 8c44afb5e3d..4b509d4b114 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -494,7 +494,6 @@ Rails.application.routes.draw do
delete "design/export_cover" => "custom_styles#export_cover_delete", as: "custom_style_export_cover_delete"
delete "design/favicon" => "custom_styles#favicon_delete", as: "custom_style_favicon_delete"
delete "design/touch_icon" => "custom_styles#touch_icon_delete", as: "custom_style_touch_icon_delete"
- get "design/upsell" => "custom_styles#upsell", as: "custom_style_upsell"
post "design/colors" => "custom_styles#update_colors", as: "update_design_colors"
post "design/themes" => "custom_styles#update_themes", as: "update_design_themes"
post "design/export_cover_text_color" => "custom_styles#update_export_cover_text_color",
diff --git a/lookbook/previews/open_project/enterprise_edition/upsell_page_component_preview.rb b/lookbook/previews/open_project/enterprise_edition/upsell_page_component_preview.rb
deleted file mode 100644
index da3f0869987..00000000000
--- a/lookbook/previews/open_project/enterprise_edition/upsell_page_component_preview.rb
+++ /dev/null
@@ -1,83 +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.
-# ++
-
-module OpenProject
- module EnterpriseEdition
- # @logical_path OpenProject/EnterpriseEdition
- class UpsellPageComponentPreview < Lookbook::Preview
- # Render a full-screen upsell page, with optional video or image features.
- # The easiest way to render the banner component is to provide a feature key and
- # have the assorted data structures match the expectations.
- # The text will be fetched from the i18n files:
- # ```
- # en:
- # ee:
- # # Title used unless it is overwritten for the specific feature
- # title: "Enterprise add-on"
- # upsell:
- # [feature_key]:
- # # Title used for this feature only. If this is missing, the default title is used.
- # title: "A splendid feature"
- # # Could also be description_html if necessary
- # description: "This is a splendid feature that you should use. It just might transform your life."
- # # An unordered list of features
- # features:
- # some_key: "Some feature"
- # some_other_key: "Some other feature"
- # ```
- # You can also provide a custom i18n_scope to change the place where the component looks for
- # title, description, and features.
- #
- # To provide a video or image, use the respective `video:` or `image:` tags.
- # If none or provided, a default image will be used.
- #
- # The href is inferred from `OpenProject::Static::Links.enterprise_features[feature_key][:href]`.
- # @display min_height 450px
- def default
- render ::EnterpriseEdition::UpsellPageComponent.new(:customize_life_cycle)
- end
-
- def video
- render(
- ::EnterpriseEdition::UpsellPageComponent
- .new(:date_alerts,
- video: "enterprise/date-alert-notifications.mp4")
- )
- end
-
- def image
- render(
- ::EnterpriseEdition::UpsellPageComponent
- .new(:ldap_groups, image: "enterprise/ldap-groups.jpg")
- )
- end
- end
- end
-end
diff --git a/modules/ldap_groups/app/views/ldap_groups/synchronized_groups/upsell.html.erb b/modules/ldap_groups/app/views/ldap_groups/synchronized_groups/upsell.html.erb
index b33c817c721..71a17742434 100644
--- a/modules/ldap_groups/app/views/ldap_groups/synchronized_groups/upsell.html.erb
+++ b/modules/ldap_groups/app/views/ldap_groups/synchronized_groups/upsell.html.erb
@@ -1,3 +1,6 @@
<% html_title(t(:label_administration), t("ldap_groups.synchronized_groups.plural")) -%>
-<%= render EnterpriseEdition::UpsellPageComponent.new(:ldap_groups, image: "enterprise/ldap-groups.jpg") %>
+<%= render EnterpriseEdition::BannerComponent.new(
+ :ldap_groups,
+ variant: :inline, # TODO
+) %>
diff --git a/modules/storages/app/views/storages/admin/storages/upsell.html.erb b/modules/storages/app/views/storages/admin/storages/upsell.html.erb
index ccc2dd19e9d..8e607c17a14 100644
--- a/modules/storages/app/views/storages/admin/storages/upsell.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/upsell.html.erb
@@ -1,5 +1,8 @@
<% html_title(t(:label_administration), t("storages.upsell.title")) -%>
-<%= render EnterpriseEdition::UpsellPageComponent.new(:one_drive_sharepoint_file_storage,
- video: "enterprise/one_drive_sharepoint_integration.mp4",
- i18n_scope: "storages.upsell") %>
+<%= render EnterpriseEdition::BannerComponent.new(
+ :one_drive_sharepoint_file_storage,
+ variant: :large,
+ video: "enterprise/one_drive_sharepoint_integration.mp4",
+ i18n_scope: "storages.upsell"
+) %>
diff --git a/modules/team_planner/app/views/team_planner/team_planner/upsell.html.erb b/modules/team_planner/app/views/team_planner/team_planner/upsell.html.erb
index 82b8e48522f..af19c305c51 100644
--- a/modules/team_planner/app/views/team_planner/team_planner/upsell.html.erb
+++ b/modules/team_planner/app/views/team_planner/team_planner/upsell.html.erb
@@ -1,8 +1,9 @@
<% html_title(t(:label_administration), t("ee.upsell.team_planner_view.title")) -%>
<%=
- render EnterpriseEdition::UpsellPageComponent.new(
+ render EnterpriseEdition::BannerComponent.new(
:team_planner_view,
+ variant: :large,
video: "enterprise/team-planner-animation.mp4"
)
%>
diff --git a/spec/controllers/custom_actions_controller_spec.rb b/spec/controllers/custom_actions_controller_spec.rb
index aa99353f8fe..e3473ab68a6 100644
--- a/spec/controllers/custom_actions_controller_spec.rb
+++ b/spec/controllers/custom_actions_controller_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
actions: { assigned_to: 1 } } }
end
- shared_examples_for "read requires enterprise token" do
+ shared_examples_for "requires enterprise token" do
context "without an enterprise token", with_ee: false do
before do
login_as(admin)
@@ -47,23 +47,8 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
call
end
- it "renders enterprise_token" do
- expect(response).to render_template "custom_actions/upsell"
- end
- end
- end
-
- shared_examples_for "write requires enterprise token" do
- context "without an enterprise token", with_ee: false do
- before do
- login_as(admin)
-
- call
- end
-
- it "renders enterprise_token" do
- expect(response.response_code)
- .to be 403
+ it "redirects to index" do
+ expect(response).to redirect_to action: :index
end
end
end
@@ -115,8 +100,19 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
end
+ context "without an enterprise token", with_ee: false do
+ before do
+ login_as(admin)
+
+ call
+ end
+
+ it "renders ok" do
+ expect(response.response_code).to be 200
+ end
+ end
+
it_behaves_like "403 for non admins"
- it_behaves_like "read requires enterprise token"
end
describe "#new" do
@@ -150,7 +146,7 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
it_behaves_like "403 for non admins"
- it_behaves_like "read requires enterprise token"
+ it_behaves_like "requires enterprise token"
end
describe "#create" do
@@ -214,7 +210,7 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
it_behaves_like "403 for non admins"
- it_behaves_like "write requires enterprise token"
+ it_behaves_like "requires enterprise token"
end
describe "#edit" do
@@ -274,7 +270,7 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
it_behaves_like "403 for non admins"
- it_behaves_like "read requires enterprise token"
+ it_behaves_like "requires enterprise token"
end
describe "#update" do
@@ -368,7 +364,7 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
it_behaves_like "403 for non admins"
- it_behaves_like "write requires enterprise token"
+ it_behaves_like "requires enterprise token"
end
describe "#destroy" do
@@ -420,7 +416,23 @@ RSpec.describe CustomActionsController, with_ee: %i[custom_actions] do
end
end
+ context "for admins without an enterprise token", with_ee: false do
+ before do
+ allow(action)
+ .to receive(:destroy)
+ .and_return(true)
+
+ login_as(admin)
+
+ call
+ end
+
+ it "redirects to index" do
+ expect(response).to redirect_to action: :index
+ expect(action).to have_received(:destroy)
+ end
+ end
+
it_behaves_like "403 for non admins"
- it_behaves_like "write requires enterprise token"
end
end
diff --git a/spec/controllers/custom_styles_controller_spec.rb b/spec/controllers/custom_styles_controller_spec.rb
index dac72bf7936..8e333d6fcfc 100644
--- a/spec/controllers/custom_styles_controller_spec.rb
+++ b/spec/controllers/custom_styles_controller_spec.rb
@@ -53,8 +53,8 @@ RSpec.describe CustomStylesController do
allow(EnterpriseToken).to receive(:active_tokens).and_return([])
end
- it "redirects to #upsell" do
- expect(subject).to redirect_to action: :upsell
+ it "renders show" do
+ expect(subject).to redirect_to action: :show, tab: "interface"
end
end
end
@@ -95,6 +95,24 @@ RSpec.describe CustomStylesController do
end
end
+ describe "#create", with_ee: false do
+ let(:custom_style) { CustomStyle.new }
+ let(:params) do
+ {
+ custom_style: { logo: "foo", favicon: "bar", icon_touch: "yay" }
+ }
+ end
+
+ before do
+ post :create, params:
+ end
+
+ it "renders a 403" do
+ expect(response).to have_http_status(:forbidden)
+ expect(flash[:error][:message]).to match /You need the basic enterprise plan to perform this action/
+ end
+ end
+
describe "#update", with_ee: %i[define_custom_style] do
let(:custom_style) { build(:custom_style_with_logo) }
let(:params) do