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
Add include_gon to base template
Oliver Günther8984b989c646
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rbindex af916cd2a23..6f4b8b3273a 100644--- a/app/controllers/admin/settings_controller.rb+++ b/app/controllers/admin/settings_controller.rb@@ -34,8 +34,6 @@ module Adminbefore_action :require_adminbefore_action :find_plugin, only: %i[show_plugin update_plugin]- helper_method :gon-current_menu_item [:show] do:settingsenddiff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rbindex efcfbc1aeca..3de4ba826da 100644--- a/app/controllers/application_controller.rb+++ b/app/controllers/application_controller.rb@@ -39,6 +39,7 @@ class ApplicationController < ActionController::Baseclass_attribute :accept_key_auth_actionshelper_method :render_to_string+ helper_method :gonprotecteddiff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rbindex b9bcfbfed5c..7d3e463d066 100644--- a/app/controllers/attribute_help_texts_controller.rb+++ b/app/controllers/attribute_help_texts_controller.rb@@ -37,8 +37,6 @@ class AttributeHelpTextsController < ApplicationControllerbefore_action :find_type_scopebefore_action :require_enterprise_token_grant- helper_method :gon-def new@attribute_help_text = AttributeHelpText.new type: @attribute_scopeenddiff --git a/app/controllers/custom_actions_controller.rb b/app/controllers/custom_actions_controller.rbindex 87d740b3546..fb18c69874c 100644--- a/app/controllers/custom_actions_controller.rb+++ b/app/controllers/custom_actions_controller.rb@@ -38,8 +38,6 @@ class CustomActionsController < ApplicationControllerlayout 'admin'- helper_method :gon-def index@custom_actions = CustomAction.order_by_positionenddiff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rbindex d46e2d28147..9c0bf8e6e3d 100644--- a/app/controllers/custom_fields_controller.rb+++ b/app/controllers/custom_fields_controller.rb@@ -31,8 +31,6 @@class CustomFieldsController < ApplicationControllerlayout 'admin'- helper_method :gon-before_action :require_adminbefore_action :find_custom_field, only: %i(edit update destroy delete_option reorder_alphabetical)before_action :prepare_custom_option_position, only: %i(update create)diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rbindex da399ccc51a..da5e5f02d7c 100644--- a/app/controllers/enterprises_controller.rb+++ b/app/controllers/enterprises_controller.rb@@ -31,8 +31,6 @@ class EnterprisesController < ApplicationControllerlayout 'admin'menu_item :enterprise- helper_method :gon-before_action :augur_content_security_policybefore_action :chargebee_content_security_policybefore_action :youtube_content_security_policy@@ -44,7 +42,7 @@ class EnterprisesController < ApplicationController@current_token = EnterpriseToken.current@token = @current_token || EnterpriseToken.new- write_augur_to_gon+ helpers.write_augur_to_gonif !@current_token.present?write_trial_key_to_gon@@ -108,11 +106,6 @@ class EnterprisesController < ApplicationControllerendend- def write_augur_to_gon- gon.augur_url = OpenProject::Configuration.enterprise_trial_creation_host- gon.token_version = OpenProject::Token::VERSION- end-def default_breadcrumbt(:label_enterprise_edition)enddiff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex e45351943f4..b10a69d1673 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -32,8 +32,6 @@ class GroupsController < ApplicationControllerinclude GroupsHelperlayout 'admin'- helper_method :gon-before_action :require_admin, except: %i[show]before_action :find_group, only: %i[destroy update show create_memberships destroy_membershipedit_membership add_users]diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rbindex 2518cfee591..eef49a10eb1 100644--- a/app/controllers/my_controller.rb+++ b/app/controllers/my_controller.rb@@ -35,8 +35,6 @@ class MyController < ApplicationControllerlayout 'my'- helper_method :gon-before_action :require_loginbefore_action :set_current_userbefore_action :check_password_confirmation, only: %i[update_account]diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rbindex 8b7c3230960..14dbc204981 100644--- a/app/controllers/placeholder_users_controller.rb+++ b/app/controllers/placeholder_users_controller.rb@@ -31,8 +31,6 @@class PlaceholderUsersController < ApplicationControllerlayout 'admin'- helper_method :gon-before_action :authorize_global, except: %i[show]before_action :find_placeholder_user, only: %i[showdiff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rbindex 6426a406274..a78ce9aa375 100644--- a/app/controllers/types_controller.rb+++ b/app/controllers/types_controller.rb@@ -34,7 +34,6 @@ class TypesController < ApplicationControllerlayout 'admin'before_action :require_admin- helper_method :gondef index@types = ::Type.page(page_param).per_page(per_page_param)diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 00d7e84c366..3e6f4cc994c 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -31,8 +31,6 @@class UsersController < ApplicationControllerlayout 'admin'- helper_method :gon-before_action :authorize_global, except: %i[show deletion_info destroy]before_action :find_user, only: %i[showdiff --git a/app/helpers/enterprise_helper.rb b/app/helpers/enterprise_helper.rbnew file mode 100644index 00000000000..d6a7478ae6c--- /dev/null+++ b/app/helpers/enterprise_helper.rb@@ -0,0 +1,6 @@+module EnterpriseHelper+ def write_augur_to_gon+ gon.augur_url = OpenProject::Configuration.enterprise_trial_creation_host+ gon.token_version = OpenProject::Token::VERSION+ end+enddiff --git a/app/helpers/hide_sections_helper.rb b/app/helpers/hide_sections_helper.rbindex 22937f5bf4e..2ec81f3ebc1 100644--- a/app/helpers/hide_sections_helper.rb+++ b/app/helpers/hide_sections_helper.rb@@ -31,14 +31,10 @@module HideSectionsHelperdef initialize_hide_sections_with(all, active)gon.push(- hide_sections: {+ hideSections: {all: all,active: active})-- nonced_javascript_tag do- include_gon(need_tag: false, nonce: content_security_policy_script_nonce, camel_case: true, camel_depth: 15)- endendenddiff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erbindex 15f77fb2f74..f0945ba41d4 100644--- a/app/views/common/_tabs.html.erb+++ b/app/views/common/_tabs.html.erb@@ -27,9 +27,6 @@ See COPYRIGHT and LICENSE files for more details.++#%><% gon.contentTabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %>-<%= nonced_javascript_tag do %>- <%= include_gon(need_tag: false) -%>-<% end %><content-tabs></content-tabs>diff --git a/app/views/common/upsale.html.erb b/app/views/common/upsale.html.erbindex 9f577a35007..c937d4c2d17 100644--- a/app/views/common/upsale.html.erb+++ b/app/views/common/upsale.html.erb@@ -1,5 +1,6 @@-<div class="upsale-notification">+<% write_augur_to_gon %>+<div class="upsale-notification"><h2><%= feature_title %></h2><% if feature_description.empty? %><p class="upsale--feature-reference">diff --git a/app/views/custom_actions/_form.html.erb b/app/views/custom_actions/_form.html.erbindex 2adda82c4dc..f1fef43df02 100644--- a/app/views/custom_actions/_form.html.erb+++ b/app/views/custom_actions/_form.html.erb@@ -1,4 +1,4 @@-<%= initialize_hide_sections_with @custom_action.all_actions.map { |a| { key: a.key, label: a.human_name } },+<% initialize_hide_sections_with @custom_action.all_actions.map { |a| { key: a.key, label: a.human_name } },@custom_action.actions.map { |a| { key: a.key, label: a.human_name } } %><div class="form--field -required">diff --git a/app/views/enterprises/show.html.erb b/app/views/enterprises/show.html.erbindex 68171d32b89..ca07e2f73d9 100644--- a/app/views/enterprises/show.html.erb+++ b/app/views/enterprises/show.html.erb@@ -2,10 +2,6 @@<%= toolbar title: t("admin.enterprise.upgrade_to_ee") %>-<%= nonced_javascript_tag do %>- <%= include_gon(need_tag: false) -%>-<% end %>-<%= error_messages_for 'token' %><% if @current_token.present? %>diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erbindex 66c9f97834f..1cb58073b30 100644--- a/app/views/layouts/_common_head.html.erb+++ b/app/views/layouts/_common_head.html.erb@@ -29,6 +29,9 @@<%= render 'common/favicons' %>+<%# Allow gon output when necessary %>+<%= include_gon(nonce: content_security_policy_script_nonce) %>+<%# Include CLI assets (development) or prod build assets %><%= include_frontend_assets %>diff --git a/app/views/layouts/angular/angular.html.erb b/app/views/layouts/angular/angular.html.erbindex 62bc28efd2f..2b672c38c0a 100644--- a/app/views/layouts/angular/angular.html.erb+++ b/app/views/layouts/angular/angular.html.erb@@ -29,9 +29,6 @@ See COPYRIGHT and LICENSE files for more details.<%= content_for :header_tags do %><% html_title(*local_assigns[:page_title]) if local_assigns[:page_title].present? %>- <%= nonced_javascript_tag do %>- <%= include_gon(need_tag: false) -%>- <% end %><!-- plug-in specific tags --><%= call_hook :view_work_package_overview_attributes %><% end -%>diff --git a/app/views/layouts/angular/notifications.html.erb b/app/views/layouts/angular/notifications.html.erbindex f6f6a4f2689..ffa7c987dcc 100644--- a/app/views/layouts/angular/notifications.html.erb+++ b/app/views/layouts/angular/notifications.html.erb@@ -27,12 +27,6 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= content_for :header_tags do %>- <%= nonced_javascript_tag do %>- <%= include_gon(need_tag: false) -%>- <% end %>-<% end -%>-<%= content_for :content_body do %><openproject-base></openproject-base><% end -%>diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erbindex 44e4a2bebeb..11354133539 100644--- a/app/views/search/index.html.erb+++ b/app/views/search/index.html.erb@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.<% content_for :header_tags do %><%= call_hook :search_index_head %>- <%= include_gon(nonce: content_security_policy_script_nonce) %>+<% end %><global-search-title></global-search-title>diff --git a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.tsindex 1407581078a..8f7fc77a3f1 100644--- a/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts+++ b/frontend/src/app/features/enterprise/free-trial-button/free-trial-button.component.ts@@ -26,7 +26,12 @@// See COPYRIGHT and LICENSE files for more details.//++-import { Component, Injector } from '@angular/core';+import {+ ChangeDetectionStrategy,+ Component,+ Injector,+ OnInit,+} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { EnterpriseTrialModalComponent } from 'core-app/features/enterprise/enterprise-modal/enterprise-trial.modal';import { OpModalService } from 'core-app/shared/components/modal/modal.service';@@ -38,8 +43,9 @@ export const freeTrialButtonSelector = 'free-trial-button';selector: freeTrialButtonSelector,templateUrl: './free-trial-button.component.html',styleUrls: ['./free-trial-button.component.sass'],+ changeDetection: ChangeDetectionStrategy.OnPush,})-export class FreeTrialButtonComponent {+export class FreeTrialButtonComponent implements OnInit {public text = {button_trial: this.I18n.t('js.admin.enterprise.upsale.button_start_trial'),};@@ -50,6 +56,10 @@ export class FreeTrialButtonComponent {public eeTrialService:EnterpriseTrialService) {}+ ngOnInit() {+ console.warn('HELLO');+ }+public openTrialModal() {// cancel request and open first modal windowthis.eeTrialService.cancelled = true;diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rbindex c3099c92328..1f1c49a9d67 100644--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb@@ -31,8 +31,6 @@module Bimmodule IfcModelsclass IfcModelsController < BaseController- helper_method :gon-before_action :find_project_by_project_id,only: %i[index new create show defaults edit update destroy direct_upload_finished]before_action :find_ifc_model_object, only: %i[edit update destroy]diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_viewer_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_viewer_controller.rbindex 39970efe6c1..c242565b75e 100644--- a/modules/bim/app/controllers/bim/ifc_models/ifc_viewer_controller.rb+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_viewer_controller.rb@@ -31,8 +31,6 @@module Bimmodule IfcModelsclass IfcViewerController < BaseController- helper_method :gon-before_action :find_project_by_project_idbefore_action :authorizebefore_action :find_all_ifc_modelsdiff --git a/modules/bim/app/views/bim/ifc_models/ifc_viewer/show.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_viewer/show.html.erbindex 9c38baa0495..7cd5e1601ff 100644--- a/modules/bim/app/views/bim/ifc_models/ifc_viewer/show.html.erb+++ b/modules/bim/app/views/bim/ifc_models/ifc_viewer/show.html.erb@@ -29,7 +29,6 @@ See COPYRIGHT and LICENSE files for more details.<% content_for :header_tags do %><% provision_gon_for_ifc_model(@ifc_models, @shown_model_ids) %>- <%= include_gon(nonce: content_security_policy_script_nonce) %><% end %><% unconverted = @shown_ifc_models.reject(&:converted?) %>diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rbindex de9156d6a62..7b321187fa5 100644--- a/modules/meeting/app/controllers/meeting_contents_controller.rb+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb@@ -39,8 +39,6 @@ class MeetingContentsController < ApplicationControllerhelper :watchershelper :meetings- helper_method :gon-before_action :find_meeting, :find_contentbefore_action :authorizediff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 17b26b6f2ba..261e3ef3763 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -35,7 +35,6 @@ class MeetingsController < ApplicationControllerhelper :watchershelper :meeting_contents- helper_method :goninclude WatchersHelperinclude PaginationHelper