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

Primerise the HelpMenu and the onboarding welcome video dialog

Henriette Darge375758b32a2f
diff --git a/app/components/enterprise_trials/welcome_dialog_component.html.erb b/app/components/enterprise_trials/welcome_dialog_component.html.erb
index 08138b66da1..3c7029043b5 100644
--- a/app/components/enterprise_trials/welcome_dialog_component.html.erb
+++ b/app/components/enterprise_trials/welcome_dialog_component.html.erb
@@ -16,7 +16,7 @@
render(Primer::Beta::Text.new(color: :subtle)) { I18n.t("ee.trial.welcome_description") }
end
flex.with_row(mt: 2) do
- content_tag :div, class: "onboarding--video iframe-target-wrapper" do
+ content_tag :div, class: "onboarding--video" do
content_tag(:iframe,
"",
frameborder: "0",
diff --git a/app/components/onboarding/video_dialog_component.html.erb b/app/components/onboarding/video_dialog_component.html.erb
new file mode 100644
index 00000000000..30269834f5f
--- /dev/null
+++ b/app/components/onboarding/video_dialog_component.html.erb
@@ -0,0 +1,42 @@
+<%=
+ render(
+ Primer::Alpha::Dialog.new(
+ id: "onboarding-video-dialog",
+ title:,
+ size: :xlarge
+ )
+ ) do |dialog|
+ dialog.with_header(variant: :large)
+ dialog.with_body do
+ component_collection do |body|
+ body.with_component(
+ render(Primer::Beta::Text.new) { I18n.t("onboarding.text_getting_started_description") }
+ )
+ body.with_component(
+ render(Primer::BaseComponent.new(tag: :div, classes: "onboarding--video")) do
+ render(
+ Primer::BaseComponent.new(
+ tag: :iframe,
+ frameborder: "0",
+ height: "430",
+ width: "100%",
+ src: iframe_src,
+ allowfullscreen: true
+ )
+ )
+ end
+ )
+ end
+ end
+
+ dialog.with_footer do
+ render(
+ Primer::Beta::Button.new(
+ data: { "close-dialog-id": "onboarding-video-dialog" }
+ )
+ ) do
+ I18n.t(:button_close)
+ end
+ end
+ end
+%>
diff --git a/app/components/onboarding/video_dialog_component.rb b/app/components/onboarding/video_dialog_component.rb
new file mode 100644
index 00000000000..72497c5782b
--- /dev/null
+++ b/app/components/onboarding/video_dialog_component.rb
@@ -0,0 +1,44 @@
+# 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 Onboarding
+ class VideoDialogComponent < ApplicationComponent
+ include OpTurbo::Streamable
+ include OpPrimer::ComponentHelpers
+
+ def title
+ I18n.t("onboarding.welcome", app_title: Setting.app_title)
+ end
+
+ def iframe_src
+ OpenProject::Configuration.onboarding_video_url
+ end
+ end
+end
diff --git a/app/controllers/onboarding_controller.rb b/app/controllers/onboarding_controller.rb
index 5ac689d35c6..281ed9b2e87 100644
--- a/app/controllers/onboarding_controller.rb
+++ b/app/controllers/onboarding_controller.rb
@@ -27,7 +27,9 @@
#++
class OnboardingController < ApplicationController
- no_authorization_required! :user_settings
+ include OpTurbo::ComponentStream
+
+ no_authorization_required! :user_settings, :onboarding_video_dialog
def user_settings
@user = User.current
@@ -47,4 +49,8 @@ class OnboardingController < ApplicationController
uri.query_values = {}
redirect_to uri.to_s
end
+
+ def onboarding_video_dialog
+ respond_with_dialog Onboarding::VideoDialogComponent.new
+ end
end
diff --git a/app/views/onboarding/_menu_item.html.erb b/app/views/onboarding/_menu_item.html.erb
deleted file mode 100644
index c479d074765..00000000000
--- a/app/views/onboarding/_menu_item.html.erb
+++ /dev/null
@@ -1,40 +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.
-
-++#%>
-<li
- class="op-menu--item"
- data-augmented-model-wrapper
- data-activation-selector=".onboarding-modal--activation-link"
- data-modal-iframe-url="<%= OpenProject::Configuration.onboarding_video_url %>"
- data-modal-class-name="onboarding-modal">
- <%= link_to t(:label_introduction_video),
- "",
- title: t(:label_introduction_video),
- class: "op-menu--item-action onboarding-modal--activation-link" %>
- <%= render partial: "/onboarding/onboarding_video_modal" %>
-</li>
diff --git a/app/views/onboarding/_onboarding_video_modal.html.erb b/app/views/onboarding/_onboarding_video_modal.html.erb
deleted file mode 100644
index 13786211e7d..00000000000
--- a/app/views/onboarding/_onboarding_video_modal.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.
-
-++#%>
-
-<div class="modal-delivery-element">
- <div class="spot-modal--header">
- <span class="spot-icon spot-icon_user"></span>
- <span id="spotModalTitle"><%= I18n.t("onboarding.welcome", app_title: Setting.app_title) %></span>
- </div>
- <div class="spot-divider"></div>
- <div class="onboarding--main spot-modal--body spot-container">
- <div class="onboarding--video-block">
- <div class="onboarding--video-text">
- <span><%= I18n.t("onboarding.text_getting_started_description") %></span>
- </div>
- <div class="onboarding--video iframe-target-wrapper">
- </div>
- </div>
- </div>
-
- <div class="onboarding--footer spot-action-bar">
- <div class="spot-action-bar--right">
- <button
- class="button button_no-margin spot-action-bar--action spot-modal--cancel-button"
- dynamic-content-modal-close-button
- title=<%= t(:button_close) %>><%= t(:button_close) %></button>
- </div>
- </div>
-</div>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 8072c10c93f..3aeb47664f4 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -67,10 +67,9 @@ Redmine::MenuManager.map :top_menu do |menu|
menu.push :help,
OpenProject::Static::Links.help_link,
last: true,
- caption: "",
+ caption: I18n.t("label_help"),
icon: "question",
html: { accesskey: OpenProject::AccessKeys.key_for(:help),
- title: I18n.t("label_help"),
target: "_blank" }
end
diff --git a/config/routes.rb b/config/routes.rb
index a605e1dec90..b6fc9e405a2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -878,6 +878,7 @@ Rails.application.routes.draw do
scope controller: "onboarding" do
patch "user_settings", action: "user_settings"
+ get "onboarding_video_dialog", action: "onboarding_video_dialog"
end
resources :colors do
diff --git a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
index d4307e3ab16..21768e0327d 100644
--- a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
+++ b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
@@ -31,8 +31,6 @@ import { DOCUMENT } from '@angular/common';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { DynamicContentModalComponent } from 'core-app/shared/components/modals/modal-wrapper/dynamic-content.modal';
-const iframeSelector = '.iframe-target-wrapper';
-
/**
* This service takes modals that are rendered by the rails backend,
* and re-renders them with the angular op-modal service
@@ -80,17 +78,11 @@ export class OpModalWrapperAugmentService {
private show(element:JQuery) {
// Set modal class name
const modalClassName = element.data('modalClassName');
- // Append CSP-whitelisted IFrame for onboarding
- const iframeUrl = element.data('modalIframeUrl');
// Set template from wrapped element
const wrappedElement = element.find('.modal-delivery-element');
let modalBody = wrappedElement.html();
- if (iframeUrl) {
- modalBody = this.appendIframe(wrappedElement, iframeUrl);
- }
-
this.opModalService.show(
DynamicContentModalComponent,
this.injector,
@@ -100,19 +92,4 @@ export class OpModalWrapperAugmentService {
},
);
}
-
- private appendIframe(body:JQuery<HTMLElement>, url:string) {
- const iframe = jQuery('<iframe frameborder="0" height="350" allowfullscreen>></iframe>');
- iframe.attr('src', url);
-
- const iframeParent = body.find(iframeSelector);
- if (iframeParent.find('iframe').length > 0) {
- // Make sure we don't initialize the iframe multiple times
- return body.html();
- }
-
- iframeParent.append(iframe);
-
- return body.html();
- }
}
diff --git a/lib/redmine/menu_manager/top_menu/help_menu.rb b/lib/redmine/menu_manager/top_menu/help_menu.rb
index fa96472d25e..c1704eade92 100644
--- a/lib/redmine/menu_manager/top_menu/help_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/help_menu.rb
@@ -37,9 +37,14 @@ module Redmine::MenuManager::TopMenu::HelpMenu
EnterpriseToken.active?]
OpenProject::Cache.fetch(cache_key) do
if OpenProject::Static::Links.help_link_overridden?
- content_tag("li",
- render_single_menu_node(item, nil, "op-app-menu"),
- class: "op-app-menu--item op-app-help op-app-help_overridden")
+ render(Primer::Beta::IconButton.new(icon: item.icon,
+ tag: :a,
+ href: url_for(item.url),
+ classes: "op-app-header--primer-button hidden-for-mobile",
+ scheme: :invisible,
+ test_selector: "header-help-button",
+ aria: { label: I18n.t(:label_help) },
+ **item.html_options))
else
render_help_dropdown
end
@@ -47,111 +52,105 @@ module Redmine::MenuManager::TopMenu::HelpMenu
end
def render_help_dropdown
- link_to_help_pop_up = link_to "#",
- title: I18n.t(:label_help),
- class: "op-app-menu--item-action",
- aria: { haspopup: "true" } do
- render(Primer::Beta::Octicon.new(icon: "question", size: :medium))
- end
-
- render_menu_dropdown(
- link_to_help_pop_up,
- menu_item_class: "op-app-help hidden-for-mobile",
- drop_down_class: "op-menu"
- ) do
- result = "".html_safe
- render_onboarding result
- render_help_and_support result
- render_additional_resources result
+ render Primer::Alpha::ActionMenu.new(classes: "op-app-menu--item",
+ menu_id: "op-app-header--help-menu",
+ anchor_align: :end) do |menu|
+ menu.with_show_button(icon: :question,
+ scheme: :invisible,
+ classes: "op-app-header--primer-button hidden-for-mobile",
+ test_selector: "header-help-button",
+ "aria-label": I18n.t(:label_help))
- result
+ add_onboarding_item(menu)
+ menu.with_divider
+ add_help_and_support_items(menu)
+ menu.with_divider
+ add_additional_help_items(menu)
end
end
private
- def render_onboarding(result)
- result << content_tag(:li, class: "op-menu--item") do
- content_tag(:span, I18n.t("top_menu.getting_started"),
- class: "op-menu--headline",
- title: I18n.t("top_menu.getting_started"))
+ def add_onboarding_item(menu)
+ menu.with_group do |menu_group|
+ menu_group.with_heading(title: I18n.t("top_menu.getting_started"))
+
+ menu_group.with_item(
+ href: onboarding_video_dialog_path,
+ label: t(:label_introduction_video),
+ content_arguments: {
+ target: "_top",
+ data: { controller: "async-dialog" }
+ },
+ test_selector: "op-menu--item-action"
+ )
end
- result << render_onboarding_menu_item
- result << content_tag(:hr, "", class: "op-menu--separator")
end
- def render_onboarding_menu_item
- controller.render_to_string(partial: "onboarding/menu_item")
- end
+ def add_help_and_support_items(menu) # rubocop:disable Metrics/AbcSize
+ menu.with_group do |menu_group|
+ menu_group.with_heading(title: I18n.t("top_menu.help_and_support"))
- def render_help_and_support(result) # rubocop:disable Metrics/AbcSize
- result << content_tag(:li, class: "op-menu--item") do
- content_tag :span, I18n.t("top_menu.help_and_support"),
- class: "op-menu--headline",
- title: I18n.t("top_menu.help_and_support")
- end
- unless EnterpriseToken.hide_banners? && EnterpriseToken.active?
- result << static_link_item(:upsell,
- href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=ee-upsell-help-menu")
- end
- result << static_link_item(:user_guides)
- result << content_tag(:li, class: "op-menu--item") do
- link_to I18n.t("label_videos"),
- OpenProject::Configuration.youtube_channel,
- title: I18n.t("label_videos"),
- class: "op-menu--item-action",
- target: "_blank", rel: "noopener"
+ unless EnterpriseToken.hide_banners? && EnterpriseToken.active?
+ menu_group.with_item(
+ **link_options_for(:upsell,
+ href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=ee-upsell-help-menu")
+ )
+ end
+ menu_group.with_item(**link_options_for(:user_guides))
+ menu_group.with_item(href: OpenProject::Configuration.youtube_channel,
+ label: t(:label_videos),
+ content_arguments: {
+ target: "_blank",
+ rel: "noopener"
+ },
+ test_selector: "op-menu--item-action")
+ menu_group.with_item(**link_options_for(:shortcuts))
+ menu_group.with_item(**link_options_for(:forums))
+ menu_group.with_item(**link_options_for(
+ EnterpriseToken.active? ? :enterprise_support : :enterprise_support_as_community
+ ))
end
- result << static_link_item(:shortcuts)
- result << static_link_item(:forums)
- enterprise_support_link_key = if EnterpriseToken.active?
- :enterprise_support
- else
- :enterprise_support_as_community
- end
- result << static_link_item(enterprise_support_link_key)
- result << content_tag(:hr, "", class: "op-menu--separator")
end
- def render_additional_resources(result) # rubocop:disable Metrics/AbcSize
- result << content_tag(:li, class: "op-menu--item") do
- content_tag :span,
- I18n.t("top_menu.additional_resources"),
- class: "op-menu--headline",
- title: I18n.t("top_menu.additional_resources")
- end
+ def add_additional_help_items(menu) # rubocop:disable Metrics/AbcSize
+ menu.with_group do |menu_group|
+ menu_group.with_heading(title: I18n.t("top_menu.additional_resources"))
- if OpenProject::Static::Links.has? :impressum
- result << static_link_item(:impressum)
- end
+ if OpenProject::Static::Links.has? :impressum
+ menu_group.with_item(**link_options_for(:impressum))
+ end
- result << static_link_item(:data_privacy)
- result << static_link_item(:digital_accessibility)
- result << static_link_item(
- :website,
- href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=website-help-menu"
- )
- result << static_link_item(
- :newsletter,
- href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=newsletter-help-menu"
- )
- result << static_link_item(:blog)
- result << static_link_item(:release_notes)
- result << static_link_item(:report_bug)
- result << static_link_item(:roadmap)
- result << static_link_item(:crowdin)
- result << static_link_item(:api_docs)
+ menu_group.with_item(**link_options_for(:data_privacy))
+ menu_group.with_item(**link_options_for(:digital_accessibility))
+ menu_group.with_item(**link_options_for(
+ :website,
+ href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=website-help-menu"
+ ))
+ menu_group.with_item(**link_options_for(
+ :newsletter,
+ href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=newsletter-help-menu"
+ ))
+ menu_group.with_item(**link_options_for(:blog))
+ menu_group.with_item(**link_options_for(:release_notes))
+ menu_group.with_item(**link_options_for(:report_bug))
+ menu_group.with_item(**link_options_for(:roadmap))
+ menu_group.with_item(**link_options_for(:crowdin))
+ menu_group.with_item(**link_options_for(:api_docs))
+ end
end
- def static_link_item(key, options = {})
+ def link_options_for(key, options = {})
link = OpenProject::Static::Links.links[key]
label = I18n.t(link[:label])
- content_tag(:li, class: "op-menu--item") do
- link_to label,
- "#{link[:href]}#{options[:href_suffix]}",
- title: label,
- target: "_blank",
- class: "op-menu--item-action", rel: "noopener"
- end
+
+ {
+ href: "#{link[:href]}#{options[:href_suffix]}",
+ label: label,
+ content_arguments: {
+ target: "_blank",
+ rel: "noopener"
+ }
+ }
end
end
diff --git a/lib/redmine/menu_manager/top_menu/quick_add_menu.rb b/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
index 7c45d621aca..05a2e760720 100644
--- a/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
@@ -50,6 +50,7 @@ module Redmine::MenuManager::TopMenu::QuickAddMenu
"aria-label": I18n.t("menus.quick_add.label"))
add_first_level_items(menu)
+ menu.with_divider
add_second_level_items(menu)
end
end
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 8a909fbf858..871b9f20287 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -79,22 +79,12 @@ module Redmine::MenuManager::TopMenuHelper
capture do
concat render_quick_add_menu
concat render_top_menu_teaser
- concat top_menu_right_node
+ concat render_notification_top_menu_node
+ concat render_help_top_menu_node
+ concat render_user_top_menu_node
end
end
- def top_menu_right_node
- content_tag(:ul, class: "op-app-menu") do
- safe_join top_menu_right_menu_items
- end
- end
-
- def top_menu_right_menu_items
- [render_notification_top_menu_node,
- render_help_top_menu_node,
- render_user_top_menu_node]
- end
-
private
def render_notification_top_menu_node
@@ -244,10 +234,6 @@ module Redmine::MenuManager::TopMenuHelper
end
end
- def project_menu_items
- split_top_menu_into_main_or_more_menus[:projects]
- end
-
def help_menu_item
split_top_menu_into_main_or_more_menus[:help]
end
diff --git a/spec/features/menu_items/help_menu_spec.rb b/spec/features/menu_items/help_menu_spec.rb
index 7f593586521..32ad990072e 100644
--- a/spec/features/menu_items/help_menu_spec.rb
+++ b/spec/features/menu_items/help_menu_spec.rb
@@ -32,8 +32,8 @@ require "spec_helper"
RSpec.describe "Help menu items", :js do
let(:user) { create(:admin) }
- let(:help_item) { find(".op-app-help .op-app-menu--item-action") }
- let(:help_menu_dropdown_selector) { ".op-app-menu--dropdown.op-menu" }
+ let(:help_item) { page.find_test_selector("header-help-button") }
+ let(:help_menu_dropdown_selector) { "#op-app-header--help-menu-list" }
before do
login_as user
@@ -45,8 +45,9 @@ RSpec.describe "Help menu items", :js do
help_item.click
- expect(page).to have_css(".op-app-help .op-menu--item-action",
- text: I18n.t("homescreen.links.user_guides"))
+ within help_menu_dropdown_selector do
+ expect(page).to have_link(I18n.t("homescreen.links.user_guides"))
+ end
end
end
@@ -62,7 +63,7 @@ RSpec.describe "Help menu items", :js do
visit home_path
expect(help_item[:href]).to eq(custom_url)
- expect(page).to have_no_css(".op-app-help .op-app-menu--dropdown", visible: false)
+ expect(page).to have_no_css(help_menu_dropdown_selector, visible: :hidden)
end
end