From e4648a2109301dc2722b14df3130295bf0669632 Mon Sep 17 00:00:00 2001 From: Henriette Dinger Date: Wed, 13 Feb 2019 10:16:10 +0100 Subject: [PATCH 1/4] Allow overflowing menus within the ckeditor --- app/assets/stylesheets/content/_forms.sass | 3 +++ app/views/wiki/_page_form.html.erb | 2 +- .../views/my_projects_overviews/_block_textilizable.html.erb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/content/_forms.sass b/app/assets/stylesheets/content/_forms.sass index dc1698030f..8bddb3c5d5 100644 --- a/app/assets/stylesheets/content/_forms.sass +++ b/app/assets/stylesheets/content/_forms.sass @@ -399,6 +399,9 @@ fieldset.form--fieldset &.-vertical display: block + + .form--field.-visible-overflow & + overflow: visible &:nth-of-type(n+2), .form--field.-no-label & diff --git a/app/views/wiki/_page_form.html.erb b/app/views/wiki/_page_form.html.erb index 1ed845a052..ed97759c0d 100644 --- a/app/views/wiki/_page_form.html.erb +++ b/app/views/wiki/_page_form.html.erb @@ -10,7 +10,7 @@ <% end %> <% end %> -
+
<%= f.text_area :text, cols: 100, rows: 25, diff --git a/modules/my_project_page/app/views/my_projects_overviews/_block_textilizable.html.erb b/modules/my_project_page/app/views/my_projects_overviews/_block_textilizable.html.erb index f65a057d28..be5082c27e 100644 --- a/modules/my_project_page/app/views/my_projects_overviews/_block_textilizable.html.erb +++ b/modules/my_project_page/app/views/my_projects_overviews/_block_textilizable.html.erb @@ -51,7 +51,7 @@ See doc/COPYRIGHT.md for more details.
-
+
<%= styled_label_tag "textile_#{block_name}", t('info_custom_text') %>
From d547748b1621f98d9934b3ac83eff0e450282187 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Wed, 13 Feb 2019 10:32:13 +0100 Subject: [PATCH 2/4] move api patch registration to constants to be reload stable --- {lib/api => config/constants}/api_patch_registry.rb | 2 +- lib/open_project/plugins/acts_as_op_engine.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename {lib/api => config/constants}/api_patch_registry.rb (99%) diff --git a/lib/api/api_patch_registry.rb b/config/constants/api_patch_registry.rb similarity index 99% rename from lib/api/api_patch_registry.rb rename to config/constants/api_patch_registry.rb index 511fc0f749..ded96d3970 100644 --- a/lib/api/api_patch_registry.rb +++ b/config/constants/api_patch_registry.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -module API +module Constants class APIPatchRegistry class << self def add_patch(class_name, path, &block) diff --git a/lib/open_project/plugins/acts_as_op_engine.rb b/lib/open_project/plugins/acts_as_op_engine.rb index 86aa2e172f..8c1610722d 100644 --- a/lib/open_project/plugins/acts_as_op_engine.rb +++ b/lib/open_project/plugins/acts_as_op_engine.rb @@ -27,6 +27,7 @@ #++ require_dependency 'open_project/ui/extensible_tabs' +require_dependency 'config/constants/api_patch_registry' module OpenProject::Plugins module ActsAsOpEngine @@ -225,7 +226,7 @@ module OpenProject::Plugins # 1. it does not seem possible to pass it as constant (auto loader not ready yet) # 2. we can't constantize it here, because that would evaluate # the API before it can be patched - ::API::APIPatchRegistry.add_patch base_endpoint, path, &block + ::Constants::APIPatchRegistry.add_patch base_endpoint, path, &block end end From 8587c6c777bc5609b79b37c2f74b0a7ddbe8f385 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Wed, 13 Feb 2019 10:32:47 +0100 Subject: [PATCH 3/4] bump grape --- Gemfile | 2 +- Gemfile.lock | 4 ++-- lib/api/open_project_api.rb | 33 ++++++++++++++++++++++++++++++++- lib/api/patchable_api.rb | 10 ++++++---- lib/api/v3/root.rb | 2 +- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 7dffdec299..2816dbd7b5 100644 --- a/Gemfile +++ b/Gemfile @@ -273,7 +273,7 @@ end gem 'bootsnap', '~> 1.3.2', require: true # API gems -gem 'grape', '~> 1.1' +gem 'grape', '~> 1.2.3' gem 'reform', '~> 2.2.0' gem 'reform-rails', '~> 0.1.7' diff --git a/Gemfile.lock b/Gemfile.lock index 7844aeb18d..389920eadb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -456,7 +456,7 @@ GEM actionpack (>= 3.0) multi_json request_store (>= 1.0) - grape (1.1.0) + grape (1.2.3) activesupport builder mustermann-grape (~> 1.0.0) @@ -918,7 +918,7 @@ DEPENDENCIES friendly_id (~> 5.2.1) fuubar (~> 2.3.2) gon (~> 6.2.1) - grape (~> 1.1) + grape (~> 1.2.3) grids! health_check html-pipeline (~> 2.8.0) diff --git a/lib/api/open_project_api.rb b/lib/api/open_project_api.rb index f8541e5a7e..6ad48a6093 100644 --- a/lib/api/open_project_api.rb +++ b/lib/api/open_project_api.rb @@ -28,6 +28,37 @@ module API class OpenProjectAPI < ::Grape::API - include ::API::PatchableAPI + class << self + def inherited(api, *) + super + + # run unscoped patches (i.e. patches that are on the class root, not in a namespace) + api.apply_patches(nil) + end + end + end +end + +Grape::DSL::Routing::ClassMethods.module_eval do + # Be reload safe. otherwise, an infinite loop occurs on reload. + unless instance_methods.include?(:orig_namespace) + alias :orig_namespace :namespace + end + + def namespace(space = nil, options = {}, &block) + orig_namespace(space, options) do + instance_eval(&block) + apply_patches(space) + end + end + + def apply_patches(path) + (patches[path] || []).each do |patch| + instance_eval(&patch) + end + end + + def patches + ::Constants::APIPatchRegistry.patches_for(base) end end diff --git a/lib/api/patchable_api.rb b/lib/api/patchable_api.rb index 688c4058fe..fe944ea083 100644 --- a/lib/api/patchable_api.rb +++ b/lib/api/patchable_api.rb @@ -29,15 +29,17 @@ module API module PatchableAPI def self.included(base) - base.extend ClassMethods + base.class_eval do + prepend ClassMethods + end end module ClassMethods - def inherited(subclass) + def inherited(api, base_instance_parent = Grape::API::Instance) super # run unscoped patches (i.e. patches that are on the class root, not in a namespace) - subclass.send(:execute_patches_for, nil) + api.send(:execute_patches_for, nil) end def namespace(name, *args, &block) @@ -64,7 +66,7 @@ module API end def patches - ::API::APIPatchRegistry.patches_for(self) + ::Constants::APIPatchRegistry.patches_for(self) end end end diff --git a/lib/api/v3/root.rb b/lib/api/v3/root.rb index ee812b0a16..09b1cf8348 100644 --- a/lib/api/v3/root.rb +++ b/lib/api/v3/root.rb @@ -30,7 +30,7 @@ # Root class of the API v3 # This is the place for all API v3 wide configuration, helper methods, exceptions -# rescuing, mounting of differnet API versions etc. +# rescuing, mounting of different API versions etc. module API module V3 From fb7df01450839734d479e39a84b962942bab05d3 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Wed, 13 Feb 2019 14:59:32 +0100 Subject: [PATCH 4/4] Add information of minimal MariaDB (10.2) version necessary for utf8mb4 support. --- docs/installation/manual/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/installation/manual/README.md b/docs/installation/manual/README.md index 8e2b01bb38..20bd9c4702 100644 --- a/docs/installation/manual/README.md +++ b/docs/installation/manual/README.md @@ -92,7 +92,8 @@ Lastly, exit the system user ### Using MySQL instead -We recommend against using MySQL. If you have to use MySQL instead, please ensure a version of >= 5.7 as it supports special characters such as emojis (emoticons) out of the box. +We recommend against using MySQL. If you have to use MySQL instead, please ensure a version of >= 5.7 +(MariaDB version >= 10.2) as it supports special characters such as emojis (emoticons) out of the box. If your Linux distribution only provides older versions of MySQL it is worth considering [adding MySQL as an `apt` source](https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/). @@ -116,7 +117,7 @@ the OpenProject database. You may replace the string `openproject` with the desired username and database name. The password `my_password` should definitely be changed. -**On MySQL version 5.7 or greater (recommended)** +**On MySQL version 5.7 (MariaDB 10.2) or greater (recommended)** ```sql mysql> CREATE DATABASE openproject CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; @@ -236,7 +237,7 @@ production: password: openproject ``` -** MySQL installation: version 5.7 or greater (recommended)** +** MySQL installation: version 5.7 (MariaDB 10.2) or greater (recommended)** The encoding should be set to `utf8mb4` as we created the DB with that encoding a few steps ago.