pageflow 16.1.0 → 16.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +70 -194
  3. data/README.md +6 -5
  4. data/app/assets/images/pageflow/admin/icons/published_with_noindex.svg +4 -0
  5. data/app/assets/javascripts/pageflow/dist/ui.js +1 -0
  6. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +1 -1
  7. data/app/assets/stylesheets/pageflow/admin/entries.scss +4 -0
  8. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +4 -0
  9. data/app/assets/stylesheets/pageflow/editor/base.scss +0 -1
  10. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +55 -6
  11. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +12 -1
  12. data/app/assets/stylesheets/pageflow/ui/forms.scss +3 -3
  13. data/app/assets/stylesheets/pageflow/{editor/wysihtml5.scss → ui/input/text_area_input.scss} +13 -1
  14. data/app/assets/stylesheets/pageflow/ui.scss +1 -0
  15. data/app/controllers/pageflow/editor/entry_publications_controller.rb +5 -1
  16. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  17. data/app/controllers/pageflow/entries_controller.rb +2 -2
  18. data/app/helpers/pageflow/entries_helper.rb +2 -0
  19. data/app/helpers/pageflow/meta_tags_helper.rb +2 -1
  20. data/app/helpers/pageflow/page_types_helper.rb +4 -4
  21. data/app/helpers/pageflow/revision_file_helper.rb +3 -3
  22. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  23. data/app/models/concerns/pageflow/entry_publication_states.rb +9 -0
  24. data/app/models/concerns/pageflow/uploadable_file.rb +5 -0
  25. data/app/models/pageflow/account.rb +2 -2
  26. data/app/models/pageflow/entry.rb +7 -5
  27. data/app/models/pageflow/entry_at_revision.rb +2 -0
  28. data/app/models/pageflow/image_file.rb +20 -5
  29. data/app/models/pageflow/image_file_url_templates.rb +7 -1
  30. data/app/models/pageflow/revision.rb +6 -4
  31. data/app/models/pageflow/site.rb +2 -2
  32. data/app/models/pageflow/sitemaps.rb +1 -0
  33. data/app/models/pageflow/used_file.rb +8 -0
  34. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +1 -7
  35. data/app/views/components/pageflow/admin/revisions_tab.rb +8 -0
  36. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -0
  37. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
  38. data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
  39. data/app/views/pageflow/image_files/_image_file.json.jbuilder +1 -0
  40. data/app/views/pageflow/meta_tags/_entry.html.erb +1 -0
  41. data/config/initializers/features.rb +2 -0
  42. data/config/initializers/paperclip.rb +4 -0
  43. data/config/locales/de.yml +50 -0
  44. data/config/locales/en.yml +49 -0
  45. data/db/migrate/20231024062501_add_output_presences_to_image_files.rb +5 -0
  46. data/db/migrate/20231128124523_add_noindex_to_revisions.rb +5 -0
  47. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +266 -151
  48. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +8 -2
  49. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  50. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  51. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -1
  52. data/entry_types/paged/lib/pageflow_paged/engine.rb +7 -11
  53. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +9 -3
  54. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +6 -6
  55. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +21 -37
  56. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +1 -3
  57. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -6
  58. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +17 -17
  59. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +4 -0
  60. data/entry_types/scrolled/config/locales/de.yml +47 -11
  61. data/entry_types/scrolled/config/locales/en.yml +42 -10
  62. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +22 -89
  63. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +2 -1
  64. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +8 -12
  65. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +6 -0
  66. data/entry_types/scrolled/lib/pageflow_scrolled/web_app_manifest.rb +1 -1
  67. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +1 -1
  68. data/entry_types/scrolled/package/config/webpack.js +26 -0
  69. data/entry_types/scrolled/package/contentElements-editor.js +36 -23
  70. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  71. data/entry_types/scrolled/package/contentElements-frontend.js +250 -94
  72. data/entry_types/scrolled/package/editor.js +331 -147
  73. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-fa9e3aff.js → EditableInlineText.module-6ee0e024.js} +463 -275
  74. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-10a1d600.js → PhonePlatformContext-b28d991a.js} +1 -1
  75. data/entry_types/scrolled/package/frontend/{ToggleFullscreenCornerButton-727cce0d.js → ToggleFullscreenCornerButton-8242f213.js} +1 -1
  76. data/entry_types/scrolled/package/frontend/{Viewer-169e14ca.js → Viewer-32cd1ac1.js} +4 -4
  77. data/entry_types/scrolled/package/frontend/{Viewer-ee1aa590.js → Viewer-6e4d14ed.js} +4 -4
  78. data/entry_types/scrolled/package/frontend/{arrowRight-92a34ccc.js → arrowRight-e42e6011.js} +2 -2
  79. data/entry_types/scrolled/package/frontend/{components-4a09bfa3.js → components-24363f97.js} +7 -6
  80. data/entry_types/scrolled/package/frontend/{i18n-ddd92820.js → i18n-71c39823.js} +84 -46
  81. data/entry_types/scrolled/package/frontend/{index-02378634.js → index-fc4b13e6.js} +3 -3
  82. data/entry_types/scrolled/package/frontend/index.css +1 -1
  83. data/entry_types/scrolled/package/frontend/index.js +90 -66
  84. data/entry_types/scrolled/package/frontend/{useContentElementEditorState-63045393.js → useContentElementEditorState-245f1986.js} +1 -1
  85. data/entry_types/scrolled/package/package.json +4 -3
  86. data/entry_types/scrolled/package/testHelpers.js +4 -2
  87. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  88. data/entry_types/scrolled/package/widgets/defaultNavigation.js +39 -4
  89. data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -0
  90. data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +49 -0
  91. data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -0
  92. data/entry_types/scrolled/package/widgets/textInlineFileRights.js +37 -0
  93. data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
  94. data/lib/generators/pageflow/resque/templates/resque.rb +1 -1
  95. data/lib/generators/pageflow/routes/routes_generator.rb +1 -1
  96. data/lib/pageflow/configuration.rb +8 -1
  97. data/lib/pageflow/engine.rb +15 -58
  98. data/lib/pageflow/page_type.rb +1 -1
  99. data/lib/pageflow/paperclip_processors/webp.rb +63 -0
  100. data/lib/pageflow/rails_version.rb +2 -2
  101. data/lib/pageflow/user_mixin.rb +1 -1
  102. data/lib/pageflow/version.rb +1 -1
  103. data/package/config/jest/index.js +3 -1
  104. data/package/editor.js +272 -154
  105. data/package/frontend.js +8 -2
  106. data/package/ui.js +1 -0
  107. data/spec/factories/entries.rb +17 -0
  108. metadata +78 -56
@@ -0,0 +1,49 @@
1
+ import { ThemeIcon, frontend } from 'pageflow-scrolled/frontend';
2
+ import React from 'react';
3
+ import classNames from 'classnames';
4
+
5
+ function _defineProperty(obj, key, value) {
6
+ if (key in obj) {
7
+ Object.defineProperty(obj, key, {
8
+ value: value,
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true
12
+ });
13
+ } else {
14
+ obj[key] = value;
15
+ }
16
+
17
+ return obj;
18
+ }
19
+
20
+ var styles = {"standAlone":"IconInlineFileRights-module_standAlone__15788","button":"IconInlineFileRights-module_button__o5ZmR","tooltip":"IconInlineFileRights-module_tooltip__2e1u8","transparent":"IconInlineFileRights-module_transparent__2dVaA","wrapper":"IconInlineFileRights-module_wrapper__2kQK_","scroller":"IconInlineFileRights-module_scroller__1hT8t"};
21
+
22
+ function IconInlineFileRights(_ref) {
23
+ var _classNames;
24
+
25
+ var context = _ref.context,
26
+ playerControlsStandAlone = _ref.playerControlsStandAlone,
27
+ playerControlsTransparent = _ref.playerControlsTransparent,
28
+ children = _ref.children;
29
+
30
+ if (context === 'afterElement') {
31
+ return null;
32
+ }
33
+
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ className: classNames(styles.wrapper, (_classNames = {}, _defineProperty(_classNames, styles.transparent, context !== 'playerControls' || playerControlsTransparent), _defineProperty(_classNames, styles.standAlone, context !== 'playerControls'), _classNames))
36
+ }, /*#__PURE__*/React.createElement("button", {
37
+ className: styles.button
38
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
39
+ name: "copyright"
40
+ })), /*#__PURE__*/React.createElement("div", {
41
+ className: styles.tooltip
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: styles.scroller
44
+ }, children)));
45
+ }
46
+
47
+ frontend.widgetTypes.register('iconInlineFileRights', {
48
+ component: IconInlineFileRights
49
+ });
@@ -0,0 +1 @@
1
+ .TextInlineFileRights-module_text__1tT0W{font-size:14px;position:relative;z-index:1;color:var(--content-text-color)}.TextInlineFileRights-module_text__1tT0W li{text-align:right;padding-top:.2em}.TextInlineFileRights-module_forSection__22xHD{position:absolute;bottom:0;right:0}.TextInlineFileRights-module_forSection__22xHD li{padding:0 .4em .2em 0}.TextInlineFileRights-module_text__1tT0W a{color:inherit;-webkit-text-decoration-color:color-mix(in srgb,currentColor,transparent);text-decoration-color:color-mix(in srgb,currentColor,transparent)}.TextInlineFileRights-module_text__1tT0W span{opacity:.7}
@@ -0,0 +1,37 @@
1
+ import { frontend } from 'pageflow-scrolled/frontend';
2
+ import React from 'react';
3
+ import classNames from 'classnames';
4
+
5
+ function _defineProperty(obj, key, value) {
6
+ if (key in obj) {
7
+ Object.defineProperty(obj, key, {
8
+ value: value,
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true
12
+ });
13
+ } else {
14
+ obj[key] = value;
15
+ }
16
+
17
+ return obj;
18
+ }
19
+
20
+ var styles = {"text":"TextInlineFileRights-module_text__1tT0W","forSection":"TextInlineFileRights-module_forSection__22xHD"};
21
+
22
+ function TextInlineFileRights(_ref) {
23
+ var context = _ref.context,
24
+ children = _ref.children;
25
+
26
+ if (context === 'insideElement' || context === 'playerControls') {
27
+ return null;
28
+ }
29
+
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: classNames(styles.text, _defineProperty({}, styles.forSection, context === 'section'))
32
+ }, /*#__PURE__*/React.createElement("div", null, children));
33
+ }
34
+
35
+ frontend.widgetTypes.register('textInlineFileRights', {
36
+ component: TextInlineFileRights
37
+ });
@@ -1,5 +1,5 @@
1
1
  require 'resque/tasks'
2
- require 'resque_scheduler/tasks'
2
+ require 'resque/scheduler/tasks'
3
3
 
4
4
  namespace :resque do
5
5
  # Tell resque to initialize the rails app in worker processes
@@ -1,5 +1,5 @@
1
1
  require 'resque'
2
- require 'resque_scheduler'
2
+ require 'resque-scheduler'
3
3
 
4
4
  # Change to use your favorite method of configuration. Consider the
5
5
  # dotenv gem to setup your environment with a .env file.
@@ -18,7 +18,7 @@ module Pageflow
18
18
  end
19
19
 
20
20
  def require_resque_server
21
- prepend_to_file 'config/routes.rb', "require 'resque/server'\nrequire 'resque_scheduler/server'\n\n"
21
+ prepend_to_file 'config/routes.rb', "require 'resque/server'\nrequire 'resque/scheduler/server'\n\n"
22
22
  end
23
23
  end
24
24
  end
@@ -349,9 +349,12 @@ module Pageflow
349
349
  # @since 0.11
350
350
  attr_accessor :authorize_user_deletion
351
351
 
352
+ # Array of values that the `license` attribute on files can take.
353
+ attr_accessor :available_file_licenses
354
+
352
355
  # Array of values that the `kind` attribute on text tracks can
353
356
  # take. Defaults to `[:captions, :subtitles, :descriptions]`.
354
- attr_reader :available_text_track_kinds
357
+ attr_accessor :available_text_track_kinds
355
358
 
356
359
  # Allow one user to be member of multiple accounts. Defaults to
357
360
  # true.
@@ -451,6 +454,10 @@ module Pageflow
451
454
 
452
455
  @authorize_user_deletion = lambda { |_user| true }
453
456
 
457
+ @available_file_licenses = [
458
+ :cc_by_4, :cc_by_sa_4, :cc_by_nc_4, :cc_by_nc_sa_4, :cc_by_nd_4, :cc_by_nc_nd_4
459
+ ]
460
+
454
461
  @available_text_track_kinds = [:captions, :subtitles, :descriptions]
455
462
 
456
463
  @allow_multiaccount_users = true
@@ -43,64 +43,21 @@ module Pageflow
43
43
  class Engine < ::Rails::Engine
44
44
  isolate_namespace Pageflow
45
45
 
46
- if Pageflow::RailsVersion.experimental?
47
- config.autoload_paths << root.join('app/views/components')
48
- config.eager_load_paths << root.join('app/views/components')
49
-
50
- lib = root.join('lib')
51
-
52
- config.autoload_paths << lib
53
- config.eager_load_paths << lib
54
-
55
- initializer 'pageflow.autoloading' do
56
- Rails.autoloaders.main.ignore(
57
- lib.join('generators'),
58
- lib.join('tasks'),
59
- lib.join('pageflow/paperclip_processors'),
60
- lib.join('pageflow/version.rb')
61
- )
62
- end
63
- else
64
- config.paths.add('app/views/components', autoload: true)
65
- config.paths.add('lib', autoload: true)
66
-
67
- def eager_load!
68
- # Manually eager load `lib/pageflow` as the least bad option:
69
- #
70
- # - Autoload paths are not eager loaded in production.
71
- #
72
- # - `lib` cannot be an eager load path since otherwise templates
73
- # in `lib/generators` are also executed.
74
- #
75
- # - `lib/pageflow` cannot be an eager load path since eager load
76
- # paths are automatically used as autoload paths. That way
77
- # `lib/pageflow/admin/something.rb` could be autoloaded via
78
- # `Admin::Something`.
79
- #
80
- # - Using `require` in `lib/pageflow.rb` disables code
81
- # reloading.
82
- #
83
- # - Using `require_dependency` in `lib/pageflow.rb` does not
84
- # activate code reloading either since it requires the
85
- # autoload path to be set up correctly, which only happens
86
- # during initialization.
87
- super
88
-
89
- lib_path = config.root.join('lib')
90
- matcher = %r{\A#{Regexp.escape(lib_path.to_s)}/(.*)\.rb\Z}
91
-
92
- already_required_files = [
93
- 'pageflow/engine',
94
- 'pageflow/global_config_api',
95
- 'pageflow/news_item_api',
96
- 'pageflow/version'
97
- ]
98
-
99
- Dir.glob("#{lib_path}/pageflow/**/*.rb").sort.each do |file|
100
- logical_path = file.sub(matcher, '\1')
101
- require_dependency(logical_path) unless already_required_files.include?(logical_path)
102
- end
103
- end
46
+ config.autoload_paths << root.join('app/views/components')
47
+ config.eager_load_paths << root.join('app/views/components')
48
+
49
+ lib = root.join('lib')
50
+
51
+ config.autoload_paths << lib
52
+ config.eager_load_paths << lib
53
+
54
+ initializer 'pageflow.autoloading' do
55
+ Rails.autoloaders.main.ignore(
56
+ lib.join('generators'),
57
+ lib.join('tasks'),
58
+ lib.join('pageflow/paperclip_processors'),
59
+ lib.join('pageflow/version.rb')
60
+ )
104
61
  end
105
62
 
106
63
  config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
@@ -202,7 +202,7 @@ module Pageflow
202
202
  # name 'rainbow'
203
203
  #
204
204
  # def json_seed_template
205
- # 'pageflow/rainbow/page_type.json.jbuilder'
205
+ # 'pageflow/rainbow/page_type'
206
206
  # end
207
207
  # end
208
208
  #
@@ -0,0 +1,63 @@
1
+ require 'vips'
2
+
3
+ module Pageflow
4
+ module PaperclipProcessors
5
+ # @api private
6
+ class Webp < Paperclip::Processor
7
+ ANIMATED_FORMATS = %w[.gif].freeze
8
+
9
+ def initialize(file, options = {}, attachment = nil)
10
+ super
11
+
12
+ geometry = options[:geometry].to_s
13
+ @should_crop = geometry[-1, 1] == '#'
14
+
15
+ @target_geometry = Paperclip::Geometry.parse(geometry)
16
+ @whiny = options.fetch(:whiny, true)
17
+
18
+ @current_format = File.extname(file.path)
19
+ @basename = File.basename(@file.path, @current_format)
20
+ end
21
+
22
+ def make
23
+ source = @file
24
+ filename = [@basename, '.webp'].join
25
+ destination = Paperclip::TempfileFactory.new.generate(filename)
26
+
27
+ begin
28
+ thumbnail = Vips::Image.thumbnail(
29
+ ANIMATED_FORMATS.include?(@current_format) ? "#{source.path}[n=-1]" : source.path,
30
+ width,
31
+ size: @should_crop ? :both : :down,
32
+ height: height,
33
+ crop: crop
34
+ )
35
+ thumbnail.webpsave(destination.path)
36
+ rescue Vips::Error => e
37
+ if @whiny
38
+ message = "There was an error processing the thumbnail for #{@basename}:\n" + e.message
39
+ raise Paperclip::Error, message
40
+ end
41
+ end
42
+
43
+ destination
44
+ end
45
+
46
+ private
47
+
48
+ def crop
49
+ return unless @should_crop
50
+
51
+ @options[:crop] || :centre
52
+ end
53
+
54
+ def width
55
+ @target_geometry.width
56
+ end
57
+
58
+ def height
59
+ @target_geometry.height
60
+ end
61
+ end
62
+ end
63
+ end
@@ -3,11 +3,11 @@ module Pageflow
3
3
  extend self
4
4
 
5
5
  def detect
6
- from_env || '5.2.0'
6
+ from_env || '~> 6.1.0'
7
7
  end
8
8
 
9
9
  def experimental?
10
- detect != '5.2.0'
10
+ detect != '~> 6.1.0'
11
11
  end
12
12
 
13
13
  private
@@ -71,7 +71,7 @@ module Pageflow
71
71
  end
72
72
 
73
73
  module ClassMethods
74
- def ransackable_attributes(_auth_object)
74
+ def ransackable_attributes(_auth_object = nil)
75
75
  %w[first_name last_name email]
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module Pageflow
2
- VERSION = '16.1.0'.freeze
2
+ VERSION = '16.2.0'.freeze
3
3
  end
@@ -4,7 +4,9 @@ module.exports = {
4
4
  globals: {
5
5
  __webpack_public_path__: '',
6
6
  pageflow: {
7
- config: {}
7
+ config: {
8
+ availableFileLicenses: []
9
+ }
8
10
  }
9
11
  },
10
12