refinerycms-core 4.0.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/refinery_core_manifest.js +9 -1
  3. data/app/assets/images/refinery/logo-large.png +0 -0
  4. data/app/assets/images/refinery/logo-medium.png +0 -0
  5. data/app/assets/images/refinery/logo-site-bar.png +0 -0
  6. data/app/assets/images/refinery/logo-small-medium.png +0 -0
  7. data/app/assets/images/refinery/logo-small.png +0 -0
  8. data/app/assets/images/refinery/logo-tiny.png +0 -0
  9. data/app/assets/images/refinery/logo.png +0 -0
  10. data/app/assets/images/refinery/refinery-cms-logo.svg +1 -558
  11. data/app/assets/javascripts/refinery/admin.js.erb +37 -21
  12. data/app/assets/javascripts/refinery/ajaxy_pagination.js +16 -0
  13. data/app/assets/javascripts/refinery/image_crop.js +101 -0
  14. data/app/assets/javascripts/refinery/interface.js.erb +42 -0
  15. data/app/assets/javascripts/refinery/refinery.js.erb +3 -3
  16. data/app/assets/javascripts/refinery/submit_continue.js.erb +23 -0
  17. data/app/assets/stylesheets/refinery/components/_file_type_icons.scss +36 -0
  18. data/app/assets/stylesheets/refinery/components/_icons.scss +89 -47
  19. data/app/assets/stylesheets/refinery/global/_colours.scss +12 -5
  20. data/app/assets/stylesheets/refinery/mixins/_images.scss +99 -0
  21. data/app/assets/stylesheets/refinery/mixins/_locales.scss +22 -0
  22. data/app/assets/stylesheets/refinery/mixins/_rounded.scss +9 -23
  23. data/app/assets/stylesheets/refinery/plugins/_ui.scss +7 -4
  24. data/app/assets/stylesheets/refinery/refinery.scss +4 -1
  25. data/app/assets/stylesheets/refinery/sections/_layout.scss +490 -265
  26. data/app/controllers/refinery/admin/dialogs_controller.rb +6 -6
  27. data/app/helpers/refinery/action_helper.rb +75 -0
  28. data/app/helpers/refinery/icon_helper.rb +51 -0
  29. data/app/helpers/refinery/image_helper.rb +1 -1
  30. data/app/helpers/refinery/pagination_helper.rb +1 -0
  31. data/app/helpers/refinery/site_bar_helper.rb +10 -7
  32. data/app/helpers/refinery/tag_helper.rb +5 -36
  33. data/app/helpers/refinery/translation_helper.rb +12 -1
  34. data/app/views/refinery/_head.html.erb +1 -0
  35. data/app/views/refinery/_matomo_analytics.html.erb +18 -0
  36. data/app/views/refinery/_site_bar.html.erb +9 -9
  37. data/app/views/refinery/admin/_error_messages.html.erb +4 -4
  38. data/app/views/refinery/admin/_locale_picker.html.erb +8 -14
  39. data/config/initializers/assets.rb +5 -1
  40. data/config/initializers/zeitwerk.rb +12 -0
  41. data/config/locales/en.yml +3 -1
  42. data/config/locales/sk.yml +7 -0
  43. data/lib/generators/refinery/cms/cms_generator.rb +24 -20
  44. data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +5 -0
  45. data/lib/generators/refinery/dummy/dummy_generator.rb +32 -10
  46. data/lib/generators/refinery/dummy/templates/rails/application.rb.erb +27 -7
  47. data/lib/generators/refinery/dummy/templates/rails/boot.rb.erb +1 -2
  48. data/lib/generators/refinery/dummy/templates/rails/database.yml +55 -14
  49. data/lib/generators/refinery/dummy/templates/rails/manifest.js +3 -0
  50. data/lib/generators/refinery/dummy/templates/rails/storage.yml +7 -0
  51. data/lib/generators/refinery/engine/engine_generator.rb +1 -0
  52. data/lib/generators/refinery/engine/templates/Gemfile +1 -2
  53. data/lib/generators/refinery/engine/templates/Rakefile +2 -2
  54. data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +1 -1
  55. data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +1 -1
  56. data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +1 -0
  57. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +1 -1
  58. data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +15 -4
  59. data/lib/generators/refinery/engine/templates/lib/generators/refinery/extension_plural_name_generator.rb.erb +1 -1
  60. data/lib/generators/refinery/engine/templates/lib/refinery/plural_name.rb.erb +1 -1
  61. data/lib/refinery/admin/base_controller.rb +2 -2
  62. data/lib/refinery/application_controller.rb +1 -2
  63. data/lib/refinery/cli.rb +1 -1
  64. data/lib/refinery/core/configuration.rb +4 -1
  65. data/lib/refinery/core/engine.rb +20 -0
  66. data/lib/refinery/core.rb +0 -1
  67. data/lib/refinery/crud.rb +33 -32
  68. data/lib/refinery/extension_generation.rb +55 -8
  69. data/lib/refinery/generators/generated_attribute.rb +13 -0
  70. data/lib/refinery/plugins.rb +1 -1
  71. data/lib/refinery/version.rb +4 -4
  72. data/lib/refinery.rb +9 -2
  73. data/lib/refinerycms/core.rb +1 -0
  74. data/lib/tasks/refinery.rake +3 -3
  75. data/refinerycms-core.gemspec +21 -27
  76. data/spec/controllers/refinery/sitemap_controller_spec.rb +1 -1
  77. data/spec/helpers/refinery/tag_helper_spec.rb +1 -1
  78. data/spec/helpers/refinery/translation_helper_spec.rb +46 -10
  79. data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +6 -6
  80. data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +23 -2
  81. data/spec/lib/refinery/cli_spec.rb +2 -2
  82. data/spec/lib/refinery/{users_manager_spec.rb → core/users_manager_spec.rb} +1 -1
  83. data/spec/lib/refinery/crud_spec.rb +2 -1
  84. data/spec/presenters/refinery/translated_field_presenter_spec.rb +5 -7
  85. data/spec/support/refinery.rb +2 -2
  86. data/spec/{features → system}/refinery/admin/custom_assets_spec.rb +1 -1
  87. data/spec/system/refinery/admin/dialogs_spec.rb +29 -0
  88. data/spec/{features → system}/refinery/admin/xhr_paging_spec.rb +10 -7
  89. data/spec/{features → system}/refinery/application_layout_spec.rb +3 -4
  90. data/spec/{features → system}/refinery/core_spec.rb +1 -1
  91. data/spec/{features → system}/refinery/site_bar_spec.rb +5 -3
  92. data/vendor/assets/javascripts/canvas-to-blob.js +126 -0
  93. data/vendor/assets/javascripts/cropper.js +3715 -0
  94. data/vendor/assets/stylesheets/cropper.css +305 -0
  95. metadata +108 -171
  96. checksums.yaml.gz.sig +0 -0
  97. data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +0 -10
  98. data/app/assets/javascripts/refinery/interface.js.coffee.erb +0 -33
  99. data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +0 -12
  100. data/spec/features/refinery/admin/dialogs_spec.rb +0 -29
  101. data/spec/support/database_cleaner.rb +0 -21
  102. data.tar.gz.sig +0 -0
  103. metadata.gz.sig +0 -5
  104. /data/lib/generators/refinery/cms/templates/config/{database.yml.mysql → database.mysql.yml} +0 -0
  105. /data/lib/generators/refinery/cms/templates/config/{database.yml.postgresql → database.postgresql.yml} +0 -0
  106. /data/lib/generators/refinery/cms/templates/config/{database.yml.sqlite3 → database.sqlite3.yml} +0 -0
  107. /data/lib/refinery/{users_manager.rb → core/users_manager.rb} +0 -0
@@ -1,16 +1,16 @@
1
- module ::Refinery
1
+ module Refinery
2
2
  module Admin
3
3
  class DialogsController < ::Refinery::AdminController
4
- TYPES = %w[image link]
4
+ TYPES = %w[image link].freeze
5
5
 
6
- before_action :find_dialog_type, :find_iframe_src, :only => [:show]
6
+ before_action :find_dialog_type, :find_iframe_src, only: [:show]
7
7
 
8
8
  def index
9
9
  redirect_to Refinery::Core.backend_path
10
10
  end
11
11
 
12
12
  def show
13
- render :layout => false
13
+ render layout: false
14
14
  end
15
15
 
16
16
  def from_dialog?
@@ -28,7 +28,7 @@ module ::Refinery
28
28
  def find_iframe_src
29
29
  if @dialog_type == 'image'
30
30
  @iframe_src = refinery.insert_admin_images_path(
31
- url_params.merge(:modal => true)
31
+ url_params.merge(modal: true)
32
32
  )
33
33
  elsif @dialog_type == 'link'
34
34
  @iframe_src = refinery.link_to_admin_pages_dialogs_path url_params
@@ -37,7 +37,7 @@ module ::Refinery
37
37
 
38
38
  def url_params
39
39
  params.to_unsafe_h.reject { |key, value| /(action)|(controller)/ === key}.
40
- merge :id => nil
40
+ merge id: nil
41
41
  end
42
42
 
43
43
  end
@@ -0,0 +1,75 @@
1
+ module Refinery
2
+ module ActionHelper
3
+ def i18n_scope
4
+ 'refinery.index.locale_picker'
5
+ end
6
+
7
+ # returns a link to the requested url, with the requested icon as content
8
+ def action_icon(action, url, title, options={})
9
+ action_icon_label(action, url, title, options, false)
10
+ end
11
+
12
+ # returns a link to the requested url, with icon and label as content
13
+ def action_label(action, url, title, options={})
14
+ action_icon_label(action, url, title, options, true)
15
+ end
16
+
17
+ # See icons.scss for defined icons/classes
18
+ def action_icon_label(action, url, title, options={}, label = true)
19
+ options[:title] = title
20
+ action_classes = ["#{action}_icon", action]
21
+
22
+ case action
23
+ when :preview
24
+ options[:target] = '_blank'
25
+ when :delete
26
+ options[:method] = 'delete'
27
+ when :reorder_done
28
+ action_classes.push 'hidden'
29
+ end
30
+
31
+ options[:class] = [options[:class], *action_classes].compact.join(' ')
32
+ link_to(label && title || '', url, **options)
33
+ end
34
+
35
+
36
+ def edit_in_current_locale(url:, title:, **options)
37
+ action_icon(:edit, url, title, class: :edit, **options)
38
+ end
39
+
40
+ def locale_language(locale)
41
+ Refinery::I18n.locales[locale]
42
+ end
43
+
44
+ def edit_in_locale(locale, url:, title: nil, **options)
45
+ if options.delete(:label)
46
+ action_label(
47
+ :locale, "#{url}?switch_locale=#{locale}",
48
+ title || locale.to_s.upcase,
49
+ **options,
50
+ id: locale,
51
+ class: :edit, **options
52
+ )
53
+ else
54
+ action_icon(
55
+ :locale, "#{url}?switch_locale=#{locale}",
56
+ title || ::I18n.t('.edit_in_language', language: locale_language(locale), scope: 'refinery.admin.locale_picker'),
57
+ **options,
58
+ id: locale,
59
+ class: :edit
60
+ )
61
+ end
62
+ end
63
+
64
+ def edit_in_locales(edit_url, locales = [], i18n_scope: %i[refinery admin locale_picker])
65
+ return if locales.empty?
66
+
67
+ edit_links = locales.map do |locale|
68
+ language = ::Refinery::I18n.config.locales.fetch(locale, locale)
69
+ edit_in_locale(locale, url: edit_url, title: t('edit_in_language', language: language, scope: i18n_scope))
70
+ end
71
+
72
+ tag.span edit_links.compact.join(' ').html_safe, class: :locales
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,51 @@
1
+ module Refinery
2
+ module IconHelper
3
+ require 'set'
4
+
5
+ # finds icons for documents such as resources and images
6
+ # split mime_type,
7
+ # handle special case of 'application',
8
+ # match type or subtype to icons we support
9
+ def mime_type_icon(mime_type)
10
+ default_icon = 'file-o'
11
+
12
+ type, sub_type = mime_type.split('/')
13
+ sub_type = application_type(sub_type) if type == 'application'
14
+
15
+ icons = available_icons & Set[type, sub_type] # intersection
16
+ icon = icons.empty? ? default_icon : icons.first
17
+
18
+ tag.span class: icon_class(icon)
19
+ end
20
+
21
+ # handle mime-types like 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' and
22
+ # 'application/vnd.ms-excel'
23
+ def application_type(type)
24
+ last_word = type.split('.').last # remove intermediate paths
25
+ .gsub('-', '_') # convert dashes to underscore
26
+ .to_sym
27
+ application_icons[last_word]
28
+ end
29
+
30
+ def icon_class(icon) = "#{icon}_icon"
31
+
32
+ def application_icons = {
33
+ document: "word",
34
+ ms_excel: "excel",
35
+ ms_powerpoint: "powerpoint",
36
+ msword: "word",
37
+ pdf: "pdf",
38
+ presentation: "powerpoint",
39
+ x_rar: "archive",
40
+ sheet: "excel",
41
+ zip: "zip",
42
+ }
43
+
44
+ # these are the fontawesome-4 icons matching a document type
45
+ def available_icons = Set[
46
+ 'archive', 'audio', 'code', 'excel', 'image',
47
+ 'movie', 'pdf', 'photo', 'picture', 'plain',
48
+ 'powerpoint', 'sound', 'text', 'video', 'word', 'zip',
49
+ ]
50
+ end
51
+ end
@@ -29,7 +29,7 @@ module Refinery
29
29
  image_tag_args = (image.thumbnail_dimensions(geometry) rescue {})
30
30
  image_tag_args[:alt] = image.respond_to?(:title) ? image.title : image.image_name
31
31
 
32
- image_tag(image.thumbnail(thumbnail_args).url, image_tag_args.merge(options))
32
+ image_tag image.thumbnail(thumbnail_args).url, **image_tag_args, **options
33
33
  end
34
34
  end
35
35
  end
@@ -9,6 +9,7 @@ module Refinery
9
9
  "frame_center"
10
10
  end
11
11
  end
12
+ alias pagination_selector pagination_css_class
12
13
 
13
14
  end
14
15
  end
@@ -1,26 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Refinery
2
4
  module SiteBarHelper
3
5
 
4
6
  # Generates the link to determine where the site bar switch button returns to.
5
7
  def site_bar_switch_link
6
- link_to_if(admin?, t('.switch_to_your_website', site_bar_translate_locale_args),
8
+ link_to_if(admin?, t('.switch_to_your_website', **site_bar_translate_locale_args),
7
9
  refinery.root_path(site_bar_translate_locale_args),
8
- 'data-turbolinks' => false) do
9
- link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args),
10
+ data: {turbolinks: false}) do
11
+ link_to t('.switch_to_your_website_editor', **site_bar_translate_locale_args),
10
12
  Refinery::Core.backend_path, 'data-turbolinks' => false
11
13
  end
12
14
  end
13
15
 
14
16
  def site_bar_edit_link
15
17
  return nil if admin? || @page.nil?
16
- link_to t('refinery.admin.pages.edit', site_bar_translate_locale_args),
18
+
19
+ link_to t('refinery.admin.pages.page.edit', **site_bar_translate_locale_args),
17
20
  refinery.admin_edit_page_path(@page.nested_url,
18
- :switch_locale => (@page.translations.first.locale unless @page.translated_to_default_locale?)),
19
- 'data-turbolinks' => false
21
+ switch_locale: (@page.translations.first.locale unless @page.translated_to_default_locale?)),
22
+ data: {turbolinks: false}
20
23
  end
21
24
 
22
25
  def site_bar_translate_locale_args
23
- { :locale => Refinery::I18n.current_locale }
26
+ { locale: Refinery::I18n.current_locale }
24
27
  end
25
28
 
26
29
  def display_site_bar?
@@ -1,5 +1,6 @@
1
1
  module Refinery
2
2
  module TagHelper
3
+ include ActionHelper
3
4
 
4
5
  # Returns <img class='help' tooltip='Your Input' src='refinery/icons/information.png' />
5
6
 
@@ -12,44 +13,12 @@ module Refinery
12
13
  # This is just a quick wrapper to render an image tag that lives inside refinery/icons.
13
14
  # They are all 16x16 so this is the default but is able to be overriden with supplied options.
14
15
  def refinery_icon_tag(filename, options = {})
16
+ Refinery.deprecate('Refinery::TagHelper.refinery_icon_tag', when: '5.1', replacement: 'Refinery::ActionHelper.action_icon')
17
+
15
18
  filename = "#{filename}.png" unless filename.split('.').many?
16
19
  path = image_path "refinery/icons/#{filename}", skip_pipeline: true
17
- image_tag path, {:width => 16, :height => 16}.merge(options)
18
- end
19
-
20
- def action_icon(action, url, title, options={})
21
- action_icon_label(action, url, title, options, false)
22
- end
23
-
24
- def action_label(action, url, title, options={})
25
- action_icon_label(action, url, title, options, true)
26
- end
27
-
28
- def action_icon_label(action, url, title, options={}, label = true)
29
- # See icons.scss for defined icons/classes
30
-
31
- options[:title] = title
32
- options[:class].presence ? options[:class] << " #{action}_icon " : options[:class] = "#{action}_icon"
33
- options[:class] << ' icon_label' if label
34
-
35
- case action
36
- when :preview
37
- options[:target] = '_blank'
38
- when :delete
39
- options[:method] = :delete
40
- when :reorder_done
41
- options[:class] << ' hidden'
42
- end
43
-
44
- link_to(label && title || '', url, options)
45
- end
46
-
47
- # this stacks the text onto the locale icon (actually a comment balloon)
48
- def locale_text_icon(text)
49
- content_tag(:span, class: 'fa-stack') do
50
- content_tag(:i, '', class: 'fa fa-comment') << content_tag(:strong, text)
51
- end
20
+ image_tag path, {width: 16, height: 16}.merge(options)
52
21
  end
53
22
 
54
23
  end
55
- end
24
+ end
@@ -3,7 +3,7 @@ module Refinery
3
3
 
4
4
  # Overrides Rails' core I18n.t() function to produce a more helpful error message.
5
5
  # The default one wreaks havoc with CSS and makes it hard to understand the problem.
6
- def t(key, options = {})
6
+ def t(key, **options)
7
7
  if (val = super) =~ /class.+?translation_missing/
8
8
  val = val.to_s.gsub(/<span[^>]*>/, 'i18n: ').gsub('</span>', '').gsub(', ', '.')
9
9
  end
@@ -14,5 +14,16 @@ module Refinery
14
14
  def translated_field(record, field)
15
15
  Refinery::TranslatedFieldPresenter.new(record).call(field)
16
16
  end
17
+
18
+ def locales_with_translated_field(record, field_name, include_current: true)
19
+ field_name = field_name.to_sym
20
+ translations = record.translations.where.not(field_name => [nil, ""])
21
+ translations = translations.where.not(locale: Refinery::I18n.default_frontend_locale.to_s) unless include_current
22
+
23
+ translations.pluck(:locale).map(&:to_sym).sort_by do |locale|
24
+ index = Refinery::I18n.frontend_locales.index(locale)
25
+ index ? [0, index] : [1, locale]
26
+ end
27
+ end
17
28
  end
18
29
  end
@@ -10,5 +10,6 @@
10
10
  <%= yield :stylesheets %>
11
11
 
12
12
  <%= render '/refinery/google_analytics' %>
13
+ <%= render '/refinery/matomo_analytics' %>
13
14
 
14
15
  <%= javascript_include_tag 'modernizr-min' %>
@@ -0,0 +1,18 @@
1
+ <% server = Refinery::Core.matomo_analytics_server.to_s.strip %>
2
+ <% site_id = Refinery::Core.matomo_analytics_site_id.to_s.strip %>
3
+ <% unless local_request? or admin? or server =~ /^(analytics.example.org)?$/ or site_id =~ /^$/ -%>
4
+ <!-- Matomo -->
5
+ <script type="text/javascript">
6
+ var _paq = _paq || [];
7
+ _paq.push(['trackPageView']);
8
+ _paq.push(['enableLinkTracking']);
9
+ (function() {
10
+ var u="//<%= server %>/";
11
+ _paq.push(['setTrackerUrl', u+'piwik.php']);
12
+ _paq.push(['setSiteId', '<%= site_id %>']);
13
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
14
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
15
+ })();
16
+ </script>
17
+ <!-- End Matomo Code -->
18
+ <% end -%>
@@ -3,26 +3,26 @@
3
3
  <% content_for :stylesheets, stylesheet_link_tag('refinery/site_bar') unless !!local_assigns[:exclude_css] %>
4
4
  <%= yield(:stylesheets) unless local_assigns[:head] || local_assigns[:exclude_css] %>
5
5
  <% end -%>
6
- <div id='site_bar'>
7
- <div id='site_bar_content' class='clearfix'>
6
+ <div id="site_bar">
7
+ <div id="site_bar_content" class="clearfix">
8
8
 
9
- <%= link_to 'https://www.refinerycms.com', :id => 'site_bar_refinery_cms_logo', :target => '_blank' do %>
10
- <%= image_tag 'refinery/refinery-cms-logo.svg', alt: 'Refinery CMS' %>
9
+ <%= link_to 'https://github.com/refinery/refinerycms', :id => 'site_bar_refinery_cms_logo', :target => '_blank' do %>
10
+ <%= image_tag 'refinery/refinery-cms-logo.svg', alt: 'Refinery CMS' %>
11
11
  <% end %>
12
12
 
13
- <div id='editor_switch'>
13
+ <div id="editor_switch">
14
14
  <%= site_bar_switch_link -%>
15
15
  <%= site_bar_edit_link -%>
16
16
  </div>
17
17
 
18
- <div id='site_bar_branding'>
19
- <span id='site_bar_company_name'>
18
+ <div id="site_bar_branding">
19
+ <span id="site_bar_company_name">
20
20
  <%= Refinery::Core.site_name %>
21
21
  </span>
22
22
 
23
- <%= link_to t('.log_out', site_bar_translate_locale_args),
23
+ <%= link_to t('.log_out', **site_bar_translate_locale_args),
24
24
  ::Refinery::Core.refinery_logout_path,
25
- :id => 'logout' if ::Refinery::Core.refinery_logout_path.present? %>
25
+ id: 'logout' if ::Refinery::Core.refinery_logout_path.present? %>
26
26
  </div>
27
27
  </div>
28
28
  </div>
@@ -3,12 +3,12 @@
3
3
  <p><%= t('.problems_in_following_fields') %>:</p>
4
4
  <ul>
5
5
  <% if defined?(include_object_name) and include_object_name %>
6
- <% object.errors.full_messages.each do |value| %>
7
- <li><%= value %></li>
6
+ <% object.errors.each do |error| %>
7
+ <li><%= error.message %></li>
8
8
  <% end %>
9
9
  <% else %>
10
- <% object.errors.each do |key, value| %>
11
- <li><%= value %></li>
10
+ <% object.errors.each do |error| %>
11
+ <li><%= error.message %></li>
12
12
  <% end %>
13
13
  <% end %>
14
14
  </ul>
@@ -1,18 +1,12 @@
1
- <input type="hidden" name="switch_locale" id="switch_locale" value="<%= local_assigns[:current_locale] %>" />
1
+ <input type="hidden" name="switch_locale" id="switch_locale" value="<%= local_assigns[:current_locale] %>">
2
2
  <% if Refinery::I18n.frontend_locales.many? %>
3
3
  <label><%= t('.language') %></label>
4
- <ul id="switch_locale_picker" class="clearfix">
5
- <% locales = Refinery::I18n.locales.clone %>
6
- <% Refinery::I18n.frontend_locales.each do |locale| %>
7
- <% locale_name = locales.delete(locale) %>
8
- <li<%= %Q{ class=selected} if locale.to_s == local_assigns[:current_locale].to_s %>>
9
- <%= link_to refinery.url_for(:switch_locale => locale, :parent_id => params[:parent_id]), id: locale do %>
10
- <div class="<%=locale %> locale_marker">
11
- <%= locale_text_icon(locale.upcase) %>
12
- </div>
13
- <%= locale_name %>
14
- <% end %>
15
- </li>
4
+ <div id="switch_locale_picker" class="locales">
5
+ <% Refinery::I18n.frontend_locales.each do |locale, language| %>
6
+ <% classes = locale.to_s == local_assigns[:current_locale].to_s ? 'selected' : '' %>
7
+ <%= edit_in_locale(locale,
8
+ url: refinery.url_for(parent_id: params[:parent_id]),
9
+ title: language, class: classes, label: true ) %>
16
10
  <% end %>
17
- </ul>
11
+ </div>
18
12
  <% end %>
@@ -1 +1,5 @@
1
- Rails.application.config.assets.precompile << 'refinery_core_manifest.js'
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.application.config.respond_to?(:assets)
4
+ Rails.application.config.assets.precompile << 'refinery_core_manifest.js'
5
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RefineryInflector < Zeitwerk::Inflector
4
+ def camelize(basename, abspath)
5
+ return 'Refinery' if basename.start_with?('refinerycms-')
6
+ super
7
+ end
8
+ end
9
+
10
+ Rails.autoloaders.each do |autoloader|
11
+ autoloader.inflector = RefineryInflector.new
12
+ end
@@ -43,7 +43,9 @@ en:
43
43
  change: Click here to pick an image
44
44
  show: Show
45
45
  locale_picker:
46
- language: Language
46
+ language: Language,
47
+ edit_in_locale: Edit in '%{locale_code}'
48
+ edit_in_language: Edit in %{language}
47
49
  resource_picker:
48
50
  download_current: Download current file
49
51
  opens_in_new_window: Opens in a new window
@@ -52,6 +52,11 @@ sk:
52
52
  button_text: Hľadať
53
53
  results_for_html: "Výsledky hľadania pre &#8216;<em>%{query}</em>&#8217;"
54
54
  no_results: Žiadne záznamy sa nenašli
55
+ cancel_search: 'Zrušiť vyhľadávanie'
56
+ search_input_notice: ''
57
+ input:
58
+ placeholder: "Hľadať &#8230;"
59
+ help: 'Napíšte slovo alebo frázu, ktorú chcete vyhľadať'
55
60
  delete:
56
61
  message: Naozaj chcete zmazať '%{title}'?
57
62
  error_messages:
@@ -66,6 +71,8 @@ sk:
66
71
  close_this_message: Zavrieť správu
67
72
  draft_page_message:
68
73
  not_live: Táto stránka NIE JE viditeľná pre bežných návštevníkov webu.
74
+ skip_to_first_child_page_message:
75
+ skip_to_first_child: "Táto stránka má nastavenie \"Presmeruj na prvú substránku\" a nikdy nebude zobrazená návštevníkom"
69
76
  footer:
70
77
  copyright: Copyright © %{year} %{site_name}
71
78
  no_script:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'mkmf'
3
5
 
@@ -5,18 +7,18 @@ module Refinery
5
7
  class CmsGenerator < Rails::Generators::Base
6
8
  source_root Pathname.new(File.expand_path('../templates', __FILE__))
7
9
 
8
- class_option :update, :type => :boolean, :aliases => nil, :group => :runtime,
9
- :desc => "Update an existing Refinery CMS based application"
10
- class_option :fresh_installation, :type => :boolean, :aliases => nil, :group => :runtime, :default => false,
11
- :desc => "Allow Refinery to remove default Rails files in a fresh installation"
12
- class_option :heroku, :type => :string, :default => nil, :group => :runtime, :banner => 'APP_NAME',
13
- :desc => "Deploy to Heroku after the generator has run."
14
- class_option :stack, :type => :string, :default => 'cedar-14', :group => :runtime,
15
- :desc => "Specify which Heroku stack you want to use. Requires --heroku option to function."
16
- class_option :skip_db, :type => :boolean, :default => false, :aliases => nil, :group => :runtime,
17
- :desc => "Skip over any database creation, migration or seeding."
18
- class_option :skip_migrations, :type => :boolean, :default => false, :aliases => nil, :group => :runtime,
19
- :desc => "Skip over installing or running migrations."
10
+ class_option :update, type: :boolean, aliases: nil, group: :runtime,
11
+ desc: "Update an existing Refinery CMS based application"
12
+ class_option :fresh_installation, type: :boolean, aliases: nil, group: :runtime, default: false,
13
+ desc: "Allow Refinery to remove default Rails files in a fresh installation"
14
+ class_option :heroku, type: :string, default: nil, group: :runtime, banner: 'APP_NAME',
15
+ desc: "Deploy to Heroku after the generator has run."
16
+ class_option :stack, type: :string, default: 'cedar-14', group: :runtime,
17
+ desc: "Specify which Heroku stack you want to use. Requires --heroku option to function."
18
+ class_option :skip_db, type: :boolean, default: false, aliases: nil, group: :runtime,
19
+ desc: "Skip over any database creation, migration or seeding."
20
+ class_option :skip_migrations, type: :boolean, default: false, aliases: nil, group: :runtime,
21
+ desc: "Skip over installing or running migrations."
20
22
 
21
23
  def generate
22
24
  start_pretending?
@@ -55,15 +57,15 @@ module Refinery
55
57
  if destination_path.join(application_css).file?
56
58
  insert_into_file application_css, %q{*= require refinery/formatting
57
59
  *= require refinery/theme
58
- }, :before => "*= require_self"
60
+ }, before: "*= require_self"
59
61
  end
60
62
  end
61
63
 
62
64
  def append_gemfile!
63
65
  if destination_path.join('Gemfile').file? &&
64
66
  destination_path.join('Gemfile').read !~ %r{group :development, :test do\n.+?gem 'sqlite3'\nend}m
65
- gsub_file 'Gemfile', %q{gem 'sqlite3'}, %q{group :development, :test do
66
- gem 'sqlite3'
67
+ gsub_file 'Gemfile', /(gem\ ['|"]sqlite3['|"].*)$/, %q{group :development, :test do
68
+ \1
67
69
  end} end
68
70
  end
69
71
 
@@ -215,10 +217,10 @@ end
215
217
  " end"
216
218
  ].join("\n")
217
219
 
218
- gsub_file env, current_mailer_config, new_mailer_config, :verbose => false
220
+ gsub_file env, current_mailer_config, new_mailer_config, verbose: false
219
221
  end
220
222
 
221
- gsub_file env, "config.assets.compile = false", "config.assets.compile = true", :verbose => false
223
+ gsub_file env, "config.assets.compile = false", "config.assets.compile = true", verbose: false
222
224
  end
223
225
  end
224
226
 
@@ -253,7 +255,7 @@ end
253
255
  %w(public/index.html app/views/layouts/application.html.erb).each do |roadblock|
254
256
  if (roadblock_path = destination_path.join(roadblock)).file?
255
257
  if self.options[:fresh_installation]
256
- remove_file roadblock_path, :verbose => true
258
+ remove_file roadblock_path, verbose: true
257
259
  else
258
260
  say_status :"-- You may need to remove '#{roadblock}' for Refinery to function properly --", nil, :yellow
259
261
  end
@@ -329,7 +331,7 @@ end
329
331
  # Only pretend to do the next actions if this is Refinery to stay DRY
330
332
  if destination_path == Refinery.root
331
333
  say_status :'-- pretending to make changes that happen in an actual installation --', nil, :yellow
332
- old_pretend = self.options[:pretend]
334
+ self.old_pretend = self.options[:pretend]
333
335
  new_options = self.options.dup
334
336
  new_options[:pretend] = true
335
337
  self.options = new_options
@@ -340,10 +342,12 @@ end
340
342
  # Stop pretending
341
343
  if destination_path == Refinery.root
342
344
  say_status :'-- finished pretending --', nil, :yellow
343
- new_options = self.options.dup
345
+ new_options = options.dup.merge(pretend: old_pretend)
344
346
  new_options[:pretend] = old_pretend
345
347
  self.options = new_options
346
348
  end
347
349
  end
350
+
351
+ private attr_accessor :old_pretend
348
352
  end
349
353
  end
@@ -20,6 +20,11 @@ Refinery::Core.configure do |config|
20
20
  # Google Analytics are made.
21
21
  # config.google_analytics_page_code = <%= Refinery::Core.google_analytics_page_code.inspect %>
22
22
 
23
+ # This activates Matomo open web analytics tracking within your website. If the server config is
24
+ # left blank or set to analytics.example.org then the javascript tracking code will not be loaded.
25
+ # config.matomo_analytics_server = <%= Refinery::Core.matomo_analytics_server.inspect %>
26
+ # config.matomo_analytics_site_id = <%= Refinery::Core.matomo_analytics_site_id.inspect %>
27
+
23
28
  # Enable/disable authenticity token on frontend
24
29
  # config.authenticity_token_on_frontend = <%= Refinery::Core.authenticity_token_on_frontend.inspect %>
25
30