solidus_static_content 1.0.0 → 2.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 (105) hide show
  1. checksums.yaml +5 -5
  2. data/.gem_release.yml +5 -0
  3. data/.github/dependabot.yml +11 -0
  4. data/.github/workflows/lint.yml +29 -0
  5. data/.github/workflows/test.yml +25 -0
  6. data/.gitignore +18 -6
  7. data/.rspec +2 -3
  8. data/.standard.yml +6 -0
  9. data/CHANGELOG.md +110 -0
  10. data/Gemfile +48 -7
  11. data/Guardfile +9 -7
  12. data/README.md +94 -69
  13. data/Rakefile +4 -13
  14. data/app/assets/stylesheets/spree/frontend/solidus_static_content.css +7 -0
  15. data/app/assets/stylesheets/spree/frontend/spree_static_content.css +2 -7
  16. data/app/helpers/spree/pages_helper.rb +9 -5
  17. data/app/models/solidus_static_content/permission_sets/page_display.rb +21 -0
  18. data/app/models/solidus_static_content/permission_sets/page_management.rb +21 -0
  19. data/app/models/spree/page.rb +36 -37
  20. data/app/overrides/solidus_static_content/pages_in_footer.rb +11 -0
  21. data/app/overrides/solidus_static_content/pages_in_header.rb +11 -0
  22. data/app/overrides/solidus_static_content/pages_in_sidebar.rb +11 -0
  23. data/bin/console +17 -0
  24. data/bin/r +9 -0
  25. data/bin/rails +7 -6
  26. data/bin/rails-engine +15 -0
  27. data/bin/rails-sandbox +17 -0
  28. data/bin/rake +7 -0
  29. data/bin/sandbox +77 -0
  30. data/bin/sandbox_rails +9 -0
  31. data/bin/setup +8 -0
  32. data/config/locales/de.yml +7 -5
  33. data/config/locales/en.yml +7 -6
  34. data/config/locales/es-MX.yml +38 -0
  35. data/config/locales/es.yml +6 -5
  36. data/config/locales/et.yml +6 -5
  37. data/config/locales/fr.yml +7 -5
  38. data/config/locales/it.yml +6 -5
  39. data/config/locales/nl.yml +7 -5
  40. data/config/locales/pl.yml +6 -5
  41. data/config/locales/pt-BR.yml +6 -5
  42. data/config/locales/pt.yml +7 -5
  43. data/config/locales/ro.yml +11 -9
  44. data/config/locales/ru.yml +7 -5
  45. data/config/locales/sv.yml +7 -5
  46. data/config/routes.rb +13 -3
  47. data/db/migrate/20081216193152_create_pages.rb +3 -1
  48. data/db/migrate/20090625125735_extend_pages.rb +10 -9
  49. data/db/migrate/20090814113100_add_visible_to_pages.rb +6 -4
  50. data/db/migrate/20090814142845_add_default_true_to_visible_for_page.rb +5 -3
  51. data/db/migrate/20090829000527_add_index_for_page.rb +3 -2
  52. data/db/migrate/20091219021134_add_meta_fields_to_pages.rb +3 -1
  53. data/db/migrate/20100204105222_add_layout_to_pages.rb +4 -2
  54. data/db/migrate/20100323085528_add_show_in_sidebar_option_to_pages.rb +5 -3
  55. data/db/migrate/20110717103112_add_meta_title_to_page.rb +3 -1
  56. data/db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb +9 -7
  57. data/db/migrate/20140926121757_add_pages_stores.rb +3 -3
  58. data/db/migrate/20180305193240_update_spree_page_position.rb +15 -0
  59. data/lib/controllers/backend/spree/admin/pages_controller.rb +22 -0
  60. data/lib/controllers/frontend/spree/static_content_controller.rb +32 -0
  61. data/lib/generators/solidus_static_content/install/install_generator.rb +35 -5
  62. data/lib/generators/solidus_static_content/install/templates/app/controllers/static_content_controller.rb +28 -0
  63. data/lib/generators/solidus_static_content/install/templates/app/views/static_content/show.html.erb +28 -0
  64. data/lib/solidus_static_content/engine.rb +43 -0
  65. data/lib/solidus_static_content/route_matcher.rb +15 -0
  66. data/lib/solidus_static_content/testing_support/factories.rb +18 -0
  67. data/lib/solidus_static_content/version.rb +5 -0
  68. data/lib/solidus_static_content.rb +5 -20
  69. data/lib/views/backend/spree/admin/pages/_form.html.erb +119 -0
  70. data/lib/views/backend/spree/admin/pages/edit.html.erb +32 -0
  71. data/lib/views/backend/spree/admin/pages/index.html.erb +68 -0
  72. data/lib/views/backend/spree/admin/pages/new.html.erb +31 -0
  73. data/lib/views/backend/spree/admin/shared/_pages_tabs.html.erb +9 -0
  74. data/{app/views → lib/views/frontend}/spree/static_content/_static_content_sidebar.html.erb +1 -1
  75. data/lib/views/frontend/spree/static_content/show.html.erb +18 -0
  76. data/solidus_static_content.gemspec +35 -31
  77. metadata +75 -184
  78. data/.travis.yml +0 -21
  79. data/app/assets/javascripts/spree/backend/spree_static_content.js +0 -1
  80. data/app/assets/javascripts/spree/frontend/spree_static_content.js +0 -1
  81. data/app/assets/stylesheets/spree/backend/spree_static_content.css +0 -3
  82. data/app/controllers/spree/admin/pages_controller.rb +0 -3
  83. data/app/controllers/spree/static_content_controller.rb +0 -20
  84. data/app/overrides/pages_in_footer.rb +0 -5
  85. data/app/overrides/pages_in_header.rb +0 -5
  86. data/app/overrides/pages_in_menu.rb +0 -5
  87. data/app/overrides/pages_in_sidebar.rb +0 -5
  88. data/app/views/spree/admin/pages/_form.html.erb +0 -98
  89. data/app/views/spree/admin/pages/edit.html.erb +0 -18
  90. data/app/views/spree/admin/pages/index.html.erb +0 -51
  91. data/app/views/spree/admin/pages/new.html.erb +0 -18
  92. data/app/views/spree/static_content/show.html.erb +0 -26
  93. data/lib/spree_static_content/engine.rb +0 -17
  94. data/spec/controllers/static_content_controller_spec.rb +0 -37
  95. data/spec/factories/page_factory.rb +0 -18
  96. data/spec/features/admin/pages_spec.rb +0 -67
  97. data/spec/features/static_content_spec.rb +0 -53
  98. data/spec/helpers/page_helper_spec.rb +0 -14
  99. data/spec/lib/spree_static.content_spec.rb +0 -34
  100. data/spec/models/page_spec.rb +0 -46
  101. data/spec/spec_helper.rb +0 -50
  102. /data/{LICENSE.md → LICENSE} +0 -0
  103. /data/{app/views → lib/views/frontend}/spree/static_content/_static_content_footer.html.erb +0 -0
  104. /data/{app/views → lib/views/frontend}/spree/static_content/_static_content_header.html.erb +0 -0
  105. /data/{app/views → lib/views/frontend}/spree/static_content/_static_content_list.html.erb +0 -0
@@ -1,54 +1,53 @@
1
- class Spree::Page < ActiveRecord::Base
2
- default_scope -> { order("position ASC") }
1
+ # frozen_string_literal: true
3
2
 
4
- has_and_belongs_to_many :stores, :join_table => 'spree_pages_stores'
3
+ module Spree
4
+ class Page < ApplicationRecord
5
+ acts_as_list
6
+ default_scope -> { order("position ASC") }
5
7
 
6
- validates_presence_of :title
7
- validates_presence_of [:slug, :body], :if => :not_using_foreign_link?
8
- validates_presence_of :layout, :if => :render_layout_as_partial?
8
+ has_and_belongs_to_many :stores, join_table: "spree_pages_stores"
9
9
 
10
- validates :slug, :uniqueness => true, :if => :not_using_foreign_link?
11
- validates :foreign_link, :uniqueness => true, :allow_blank => true
10
+ validates :title, presence: true
11
+ validates :slug, :body, presence: true, if: :not_using_foreign_link?
12
+ validates :layout, presence: {if: :render_layout_as_partial?}
13
+ validates :stores, presence: true
12
14
 
13
- scope :visible, -> { where(:visible => true) }
14
- scope :header_links, -> { where(:show_in_header => true).visible }
15
- scope :footer_links, -> { where(:show_in_footer => true).visible }
16
- scope :sidebar_links, -> { where(:show_in_sidebar => true).visible }
15
+ validates :slug, uniqueness: true, if: :not_using_foreign_link?
16
+ validates :foreign_link, uniqueness: true, allow_blank: true
17
17
 
18
- scope :by_store, lambda { |store| joins(:stores).where("spree_pages_stores.store_id = ?", store) }
18
+ before_validation :generate_slug, if: :title?
19
19
 
20
- before_save :update_positions_and_slug
20
+ scope :visible, -> { where(visible: true) }
21
+ scope :header_links, -> { where(show_in_header: true).visible }
22
+ scope :footer_links, -> { where(show_in_footer: true).visible }
23
+ scope :sidebar_links, -> { where(show_in_sidebar: true).visible }
24
+ scope :ordered_by_position, -> { order(:position) }
21
25
 
22
- def initialize(*args)
23
- super(*args)
26
+ scope :by_store, lambda { |store| joins(:stores).where("spree_pages_stores.store_id = ?", store) }
24
27
 
25
- last_page = Spree::Page.last
26
- self.position = last_page ? last_page.position + 1 : 0
27
- end
28
+ before_save :normalize_slug
28
29
 
29
- def link
30
- foreign_link.blank? ? slug : foreign_link
31
- end
30
+ def link
31
+ foreign_link.presence || slug
32
+ end
32
33
 
33
- private
34
+ def meta_title
35
+ super.presence || title
36
+ end
34
37
 
35
- def update_positions_and_slug
36
- # ensure that all slugs start with a slash
37
- slug.prepend('/') if not_using_foreign_link? and not slug.start_with? '/'
38
+ private
38
39
 
39
- unless new_record?
40
- return unless prev_position = Spree::Page.find(self.id).position
41
- if prev_position > self.position
42
- Spree::Page.where("? <= position AND position < ?", self.position, prev_position).update_all("position = position + 1")
43
- elsif prev_position < self.position
44
- Spree::Page.where("? < position AND position <= ?", prev_position, self.position).update_all("position = position - 1")
45
- end
40
+ def normalize_slug
41
+ # ensure that all slugs start with a slash
42
+ slug.prepend("/") if not_using_foreign_link? && (!slug.start_with? "/")
46
43
  end
47
44
 
48
- true
49
- end
45
+ def not_using_foreign_link?
46
+ foreign_link.blank?
47
+ end
50
48
 
51
- def not_using_foreign_link?
52
- foreign_link.blank?
49
+ def generate_slug
50
+ self.slug ||= title.parameterize
51
+ end
53
52
  end
54
53
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusStaticContent
4
+ module PagesInFooter
5
+ Deface::Override.new(virtual_path: "spree/shared/_footer",
6
+ name: "pages_in_footer",
7
+ insert_bottom: "#footer-right",
8
+ partial: "spree/static_content/static_content_footer",
9
+ disabled: false)
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusStaticContent
4
+ module PagesInHeader
5
+ Deface::Override.new(virtual_path: "spree/shared/_main_nav_bar",
6
+ name: "pages_in_header",
7
+ insert_bottom: "#main-nav-bar",
8
+ partial: "spree/static_content/static_content_header",
9
+ disabled: false)
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusStaticContent
4
+ module PagesInSidebar
5
+ Deface::Override.new(virtual_path: "spree/shared/_sidebar",
6
+ name: "pages_in_sidebar",
7
+ insert_bottom: "#sidebar",
8
+ partial: "spree/static_content/static_content_sidebar",
9
+ disabled: false)
10
+ end
11
+ end
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "bundler/setup"
6
+ require "solidus_static_content"
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+ $LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+
16
+ require "irb"
17
+ IRB.start(__FILE__)
data/bin/r ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ warn %{
5
+ DEPRECATION: bin/r has been replaced by bin/rails-engine, please use that
6
+ command instead.
7
+ }.strip
8
+
9
+ exec "#{__dir__}/rails-engine"
data/bin/rails CHANGED
@@ -1,7 +1,8 @@
1
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
4
- ENGINE_PATH = File.expand_path('../../lib/spree_static_content/engine', __FILE__)
5
-
6
- require 'rails/all'
7
- require 'rails/engine/commands'
4
+ if %w[g generate].include? ARGV.first
5
+ exec "#{__dir__}/rails-engine", *ARGV
6
+ else
7
+ exec "#{__dir__}/rails-sandbox", *ARGV
8
+ end
data/bin/rails-engine ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # This command will automatically be run when you run "rails" with Rails gems
5
+ # installed from the root of your application.
6
+
7
+ ENGINE_ROOT = File.expand_path('..', __dir__)
8
+ ENGINE_PATH = File.expand_path('../lib/solidus_static_content/engine', __dir__)
9
+
10
+ # Set up gems listed in the Gemfile.
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
12
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
13
+
14
+ require 'rails/all'
15
+ require 'rails/engine/commands'
data/bin/rails-sandbox ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ app_root = 'sandbox'
5
+
6
+ unless File.exist? "#{app_root}/bin/rails"
7
+ warn 'Creating the sandbox app...'
8
+ Dir.chdir "#{__dir__}/.." do
9
+ system "#{__dir__}/sandbox" or begin
10
+ warn 'Automatic creation of the sandbox app failed'
11
+ exit 1
12
+ end
13
+ end
14
+ end
15
+
16
+ Dir.chdir app_root
17
+ exec 'bin/rails', *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ case "$DB" in
6
+ postgres|postgresql)
7
+ RAILSDB="postgresql"
8
+ ;;
9
+ mysql)
10
+ RAILSDB="mysql"
11
+ ;;
12
+ sqlite|'')
13
+ RAILSDB="sqlite3"
14
+ ;;
15
+ *)
16
+ echo "Invalid DB specified: $DB"
17
+ exit 1
18
+ ;;
19
+ esac
20
+
21
+ if [ ! -z $SOLIDUS_BRANCH ]
22
+ then
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="main"
26
+ fi
27
+
28
+ extension_name="solidus_static_content"
29
+
30
+ # Stay away from the bundler env of the containing extension.
31
+ function unbundled {
32
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- "$@"
33
+ }
34
+
35
+ rm -rf ./sandbox
36
+ rails new sandbox \
37
+ --database="$RAILSDB" \
38
+ --skip-git \
39
+ --skip-keeps \
40
+ --skip-rc \
41
+ --skip-spring \
42
+ --skip-test \
43
+ --skip-javascript
44
+
45
+ if [ ! -d "sandbox" ]; then
46
+ echo 'sandbox rails application failed'
47
+ exit 1
48
+ fi
49
+
50
+ # 🔥 Fix for Sprockets error: Ensure the manifest.js file exists
51
+ mkdir -p sandbox/app/assets/config
52
+ cat <<EOF > sandbox/app/assets/config/manifest.js
53
+ //= link_tree ../images
54
+ //= link_directory ../javascripts .js
55
+ //= link_directory ../stylesheets .css
56
+ EOF
57
+
58
+ cd ./sandbox
59
+ cat <<RUBY >> Gemfile
60
+ group :test, :development do
61
+ platforms :mri do
62
+ gem 'pry'
63
+ end
64
+ end
65
+ RUBY
66
+ unbundled bundle add solidus --github solidusio/solidus --branch "${BRANCH:-main}" --version '> 0.a'
67
+ unbundled bundle exec rake db:drop db:create
68
+ unbundled bundle exec rails generate solidus:install --payment-method=none --auto-accept "$@"
69
+ unbundled bundle add ${extension_name} --path '../'
70
+ unbundled bundle exec rails generate $extension_name:install --frontend=starter --auto-run-migrations
71
+
72
+ echo
73
+ echo "🚀 Sandbox app successfully created for ${extension_name}!"
74
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
75
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
76
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
77
+ echo "🚀 This app is intended for test purposes."
data/bin/sandbox_rails ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ warn %{
5
+ DEPRECATION: bin/sandbox_rails has been replaced by bin/rails-sandbox, please
6
+ use that command instead.
7
+ }.strip
8
+
9
+ exec "#{__dir__}/rails-sandbox"
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ gem install bundler --conservative
7
+ bundle update
8
+ bin/rake clobber
@@ -30,8 +30,10 @@ de:
30
30
  back_to_static_pages_list: "Zurück zu den statischen Seiten Liste"
31
31
  page: Seite
32
32
  pages: Seiten
33
- static_content:
34
- static_pages: Statische Seiten
35
- new_page: Neue Seite
36
- editing_page: Seite bearbeiten
37
- link: Link
33
+ stores: Shops
34
+ static_pages: Statische Seiten
35
+ new_page: Neue Seite
36
+ editing_page: Seite bearbeiten
37
+ link: Link
38
+ add_one: Erstelle einen
39
+
@@ -26,12 +26,13 @@ en:
26
26
  spree:
27
27
  admin:
28
28
  tab:
29
- Pages: Pages
29
+ pages: Pages
30
30
  back_to_static_pages_list: "Back to static pages list"
31
31
  page: Page
32
32
  pages: Pages
33
- static_content:
34
- static_pages: Static pages
35
- new_page: New page
36
- editing_page: Editing page
37
- link: Link
33
+ stores: Stores
34
+ static_pages: Static pages
35
+ new_page: New page
36
+ editing_page: Editing page
37
+ link: Link
38
+ add_one: Create One
@@ -0,0 +1,38 @@
1
+ ---
2
+ es-MX:
3
+ activerecord:
4
+ attributes:
5
+ spree/page:
6
+ body: Cuerpo
7
+ foreign_link: Enlace externo (URL)
8
+ show_in_header: Mostrar en la cabecera
9
+ show_in_footer: Mostrar en el pie de página
10
+ layout: Disposición
11
+ meta_description: "Meta Descripción"
12
+ meta_keywords: "Meta Palabras"
13
+ meta_title: "Meta Título"
14
+ position: Posición
15
+ render_layout_as_partial: "Renderizar disposición como parciales"
16
+ show_in_sidebar: "Mostrar en el barra lateral"
17
+ slug: Slug
18
+ title: Título
19
+ visible: Visible
20
+ models:
21
+ spree/page:
22
+ few: Páginas
23
+ many: Páginas
24
+ one: Página
25
+ other: Páginas
26
+ spree:
27
+ admin:
28
+ tab:
29
+ pages: Páginas
30
+ back_to_static_pages_list: "Volver a la lista de páginas estáticas"
31
+ page: Página
32
+ pages: Páginas
33
+ stores: Tiendas
34
+ static_pages: "Páginas estáticas"
35
+ new_page: "Nueva página"
36
+ editing_page: "Edición de página"
37
+ link: Enlace
38
+ add_one: Crea uno
@@ -30,8 +30,9 @@ es:
30
30
  back_to_static_pages_list: "Volver a la lista de páginas estáticas"
31
31
  page: Página
32
32
  pages: Páginas
33
- static_content:
34
- static_pages: "Páginas estáticas"
35
- new_page: "Nueva página"
36
- editing_page: "Edición de página"
37
- link: Enlace
33
+ stores: Tiendas
34
+ static_pages: "Páginas estáticas"
35
+ new_page: "Nueva página"
36
+ editing_page: "Edición de página"
37
+ link: Enlace
38
+ add_one: Crea uno
@@ -30,8 +30,9 @@ et:
30
30
  back_to_static_pages_list: "Tagasi staatiliste lehtede nimekiri"
31
31
  page: Lehekülg
32
32
  pages: Leheküljed
33
- static_content:
34
- static_pages: Leheküljed
35
- new_page: Uus lehekülg
36
- editing_page: Muudan lehekülge
37
- link: Link
33
+ stores: Kauplustes
34
+ static_pages: Leheküljed
35
+ new_page: Uus lehekülg
36
+ editing_page: Muudan lehekülge
37
+ link: Link
38
+ add_one: Loo see
@@ -30,8 +30,10 @@ fr:
30
30
  back_to_static_pages_list: "Retour à la liste des pages statiques"
31
31
  page: Page
32
32
  pages: Pages
33
- static_content:
34
- editing_page: "Edition de la page"
35
- link: Lien
36
- new_page: "Nouvelle page"
37
- static_pages: "Pages statiques"
33
+ stores: Magasins
34
+ editing_page: "Edition de la page"
35
+ link: Lien
36
+ new_page: "Nouvelle page"
37
+ static_pages: "Pages statiques"
38
+ add_one: "Créer une"
39
+
@@ -30,8 +30,9 @@ it:
30
30
  back_to_static_pages_list: Torna alla lista delle pagine statiche
31
31
  page: Pagina
32
32
  pages: Pagine
33
- static_content:
34
- static_pages: Pagine statiche
35
- new_page: Nuova pagina
36
- editing_page: Modifica pagina
37
- link: Link
33
+ stores: I negozi
34
+ static_pages: Pagine statiche
35
+ new_page: Nuova pagina
36
+ editing_page: Modifica pagina
37
+ link: Link
38
+ add_one: Crearne uno
@@ -30,8 +30,10 @@ nl:
30
30
  back_to_static_pages_list: "Terug naar statische pagina's"
31
31
  page: Page
32
32
  pages: "Statische pagina's"
33
- static_content:
34
- editing_page: "Pagina bewerken"
35
- link: Link
36
- new_page: "Nieuwe pagina"
37
- static_pages: "Statische pagina's"
33
+ stores: Winkel
34
+ editing_page: "Pagina bewerken"
35
+ link: Link
36
+ new_page: "Nieuwe pagina"
37
+ static_pages: "Statische pagina's"
38
+ add_one: "Creëer er een"
39
+
@@ -32,8 +32,9 @@ pl:
32
32
  back_to_static_pages_list: "Powrót do listy stron statycznych"
33
33
  page: Strona
34
34
  pages: "Strony statyczne"
35
- static_content:
36
- editing_page: "Edycja strony"
37
- link: Odnośnik
38
- new_page: "Nowa strona"
39
- static_pages: "Strony statyczne"
35
+ stores: Sklepy
36
+ editing_page: "Edycja strony"
37
+ link: Odnośnik
38
+ new_page: "Nowa strona"
39
+ static_pages: "Strony statyczne"
40
+ add_one: "Stworzyć jeden"
@@ -30,8 +30,9 @@ pt-BR:
30
30
  back_to_static_pages_list: "Voltar à lista de páginas estáticas"
31
31
  page: Página
32
32
  pages: Páginas
33
- static_content:
34
- editing_page: "Editando página"
35
- link: Link
36
- new_page: "Nova página"
37
- static_pages: "Páginas estáticas"
33
+ stores: Lojas
34
+ editing_page: "Editando página"
35
+ link: Link
36
+ new_page: "Nova página"
37
+ static_pages: "Páginas estáticas"
38
+ add_one: Crie um
@@ -30,8 +30,10 @@ pt:
30
30
  back_to_static_pages_list: "Voltar à lista de páginas estáticas"
31
31
  page: Página
32
32
  pages: Páginas
33
- static_content:
34
- editing_page: "Editar página"
35
- link: Link
36
- new_page: "Nova página"
37
- static_pages: "Páginas estáticas"
33
+ stores: Lojas
34
+ new_page: "Nova página"
35
+ editing_page: "Editar página"
36
+ link: Link
37
+ new_page: "Nova página"
38
+ static_pages: "Páginas estáticas"
39
+ add_one: Crie um
@@ -24,15 +24,17 @@ ro:
24
24
  spree:
25
25
  page: Pagină
26
26
  pages: Pagine
27
- static_content:
28
- static_pages: Pagini statice
29
- static_pages_desc: Descrierea paginilor statice
30
- new_page: Pagină nouă
31
- editing_page: Editarea paginii
32
- confirm_delete: Sunteți siguri că doriți să ștergeți această pagină?
33
- link: Link
34
- meta_title: Titlu meta
35
- page_navigation_title: Pagini
27
+ stores: Magazine
28
+ new_page: Pagină nouă
29
+ static_pages: Pagini statice
30
+ static_pages_desc: Descrierea paginilor statice
31
+ new_page: Pagină nouă
32
+ editing_page: Editarea paginii
33
+ confirm_delete: Sunteți siguri că doriți să ștergeți această pagină?
34
+ link: Link
35
+ meta_title: Titlu meta
36
+ page_navigation_title: Pagini
37
+ add_one: Creeaza una
36
38
  back_to_static_pages_list: Înapoi la lista de pagini
37
39
  admin:
38
40
  tab:
@@ -27,11 +27,13 @@ ru:
27
27
  spree:
28
28
  page: "Страница"
29
29
  pages: "Страницы"
30
- static_content:
31
- static_pages: "Статические страницы"
32
- new_page: "Новая страница"
33
- editing_page: "Редактирование страницы"
34
- link: "Ссылка"
30
+ stores: "магазины"
31
+ new_page: "Новая страница"
32
+ static_pages: "Статические страницы"
33
+ new_page: "Новая страница"
34
+ editing_page: "Редактирование страницы"
35
+ link: "Ссылка"
36
+ add_one: "Создай"
35
37
  back_to_static_pages_list: "Назад к списку страниц"
36
38
  admin:
37
39
  tab:
@@ -30,8 +30,10 @@ sv:
30
30
  back_to_static_pages_list: "Tillbaka till listan med sidor"
31
31
  page: Sida
32
32
  pages: Sidor
33
- static_content:
34
- editing_page: "Editera sidan"
35
- link: Länk
36
- new_page: "Ny sida"
37
- static_pages: "Statiska sidor"
33
+ stores: Butiker
34
+ new_page: "Ny sida"
35
+ editing_page: "Editera sidan"
36
+ link: Länk
37
+ new_page: "Ny sida"
38
+ static_pages: "Statiska sidor"
39
+ add_one: "Skapa en"
data/config/routes.rb CHANGED
@@ -1,8 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Spree::Core::Engine.routes.draw do
2
4
  namespace :admin do
3
- resources :pages
5
+ resources :pages do
6
+ collection do
7
+ post :update_positions
8
+ end
9
+ end
4
10
  end
5
- constraints(Spree::StaticPage) do
6
- get '/(*path)', :to => 'static_content#show', :as => 'static'
11
+
12
+ # Check if the layout is not the default layout to avoid conflicts with the starter_frontend routes
13
+ if Spree::Config.layout != "layouts/storefront"
14
+ constraints(SolidusStaticContent::RouteMatcher) do
15
+ get "/(*path)", to: "static_content#show", as: "static"
16
+ end
7
17
  end
8
18
  end
@@ -1,4 +1,6 @@
1
- class CreatePages < ActiveRecord::Migration
1
+ # frozen_string_literal: true
2
+
3
+ class CreatePages < SolidusSupport::Migration[4.2]
2
4
  def self.up
3
5
  create_table :spree_pages do |t|
4
6
  t.string :title
@@ -1,19 +1,20 @@
1
- class ExtendPages < ActiveRecord::Migration
2
- class Page < ActiveRecord::Base
1
+ # frozen_string_literal: true
2
+
3
+ class ExtendPages < SolidusSupport::Migration[4.2]
4
+ class Page < ApplicationRecord
3
5
  end
4
6
 
5
7
  def self.up
6
8
  change_table :spree_pages do |t|
7
- t.boolean :show_in_header, :default => false, :null => false
8
- t.boolean :show_in_footer, :default => false, :null => false
9
- t.string :foreign_link
10
- t.integer :position, :default => 1, :null => false
9
+ t.boolean :show_in_header, default: false, null: false
10
+ t.boolean :show_in_footer, default: false, null: false
11
+ t.string :foreign_link
12
+ t.integer :position, default: 1, null: false
11
13
  if Page.table_exists?
12
- Page.order(:updated_at).each_with_index{|page,x| page.update_attribute(:position, x+1)}
14
+ Page.order(:updated_at).each_with_index { |page, x| page.update_attribute(:position, x + 1) }
13
15
  else
14
- Spree::Page.order(:updated_at).each_with_index{|page,x| page.update_attribute(:position, x+1)}
16
+ Spree::Page.order(:updated_at).each_with_index { |page, x| page.update_attribute(:position, x + 1) }
15
17
  end
16
-
17
18
  end
18
19
  end
19
20