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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4fb012c97e50d28d83c4efce564265f2fdb538f7
4
- data.tar.gz: d159565b4f4ea4a7a883ce4378fa1a4b35f6d21f
2
+ SHA256:
3
+ metadata.gz: 36a00320fd2554bbb2414bc64b45691610c1fdd6446e026e57d162553a39d47b
4
+ data.tar.gz: d2480b136fc1ecc8f64cf8eebd20e3e5b597966df697e102bda3c4aecbab6e0a
5
5
  SHA512:
6
- metadata.gz: a814032d5eab0fab3c699c1169864a59c8d48a8438d21eaa1115d6064444adc59ca8c103990f81002cb638ddeb8b7f37b37652a7ba814e9b68cbd2b8f5f70af8
7
- data.tar.gz: 3624ace3e06d964c27007cce8e50527c29e50e1ae7069fef94b10151538adb6e76614a3881a0c05d5b44a1e46b730637b402466797a4f27374787b42a244c2ba
6
+ metadata.gz: 33d3223b1fe7f2aebd01751af23414834c0dc02edf4d22a29a80fffc7b0043a9138abd3dca03149160abec35e3aaeebfd2e35732d1ea77dd0d348cbcfb8e6f15
7
+ data.tar.gz: f4fdf74889347f53dd93ac6d441bd813c36b97eb145f312c18afa460a1ab013a232766b895ed655e59fe1dfe8e7a015f0a512e09f8b97ee1f40e60d0389d7d28
data/.gem_release.yml ADDED
@@ -0,0 +1,5 @@
1
+ bump:
2
+ recurse: false
3
+ file: 'lib/solidus_static_content/version.rb'
4
+ message: Bump SolidusStaticContent to %{version}
5
+ tag: true
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ ignore:
9
+ - dependency-name: solidus_core
10
+ versions:
11
+ - 3.0.0.rc2
@@ -0,0 +1,29 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ concurrency:
10
+ group: lint-${{ github.ref_name }}
11
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ standardrb:
18
+ name: StandardRB
19
+ runs-on: ubuntu-24.04
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: "3.4"
26
+ bundler-cache: true
27
+ rubygems: latest
28
+ - name: Run StandardRB
29
+ run: bundle exec standardrb
@@ -0,0 +1,25 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ schedule:
9
+ - cron: "0 0 * * 4" # every Thursday
10
+
11
+ concurrency:
12
+ group: test-${{ github.ref_name }}
13
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ rspec:
20
+ uses: solidusio/test-solidus-extension/.github/workflows/test.yml@main
21
+ with:
22
+ ruby_versions: '["3.4"]'
23
+ rails_versions: '["8.0", "7.2"]'
24
+ solidus_branches: '["v4.7"]'
25
+ databases: '["postgresql", "sqlite"]'
data/.gitignore CHANGED
@@ -1,9 +1,21 @@
1
+ *.gem
2
+ \#*
3
+ *~
4
+ .#*
1
5
  .DS_Store
2
- nbproject
3
- **.gem
6
+ .idea
7
+ .project
8
+ .sass-cache
9
+ coverage
4
10
  Gemfile.lock
5
- spec/dummy/
6
- .rvmrc
7
11
  tmp
8
- coverage
9
- .bundle
12
+ nbproject
13
+ pkg
14
+ *.swp
15
+ spec/dummy
16
+ spec/examples.txt
17
+ /sandbox
18
+ .rvmrc
19
+ .ruby-version
20
+ .ruby-gemset
21
+ vendor
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
- --colour
2
- --format
3
- progress
1
+ --color
2
+ --require spec_helper
data/.standard.yml ADDED
@@ -0,0 +1,6 @@
1
+ parallel: true
2
+ format: progress
3
+ ruby_version: 3.1
4
+ ignore:
5
+ - 'spec/dummy/**/*'
6
+ - 'sandbox/**/*'
data/CHANGELOG.md ADDED
@@ -0,0 +1,110 @@
1
+ # Changelog
2
+
3
+ ## [v2.1.0](https://github.com/solidusio-contrib/solidus_static_content/tree/v2.1.0) (2026-08-25)
4
+
5
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_static_content/compare/v2.0.0...v2.1.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Not compatible with Solidus 4 [\#87](https://github.com/solidusio-contrib/solidus_static_content/issues/87)
10
+ - Not compatible with Ruby 3.1.2 [\#85](https://github.com/solidusio-contrib/solidus_static_content/issues/85)
11
+ - Support for Ruby 3.0 [\#83](https://github.com/solidusio-contrib/solidus_static_content/issues/83)
12
+ - Dependabot can't resolve your Ruby dependency files [\#78](https://github.com/solidusio-contrib/solidus_static_content/issues/78)
13
+ - Prepare Solidus Static Content for Solidus 3.0 [\#75](https://github.com/solidusio-contrib/solidus_static_content/issues/75)
14
+ - Dependabot can't resolve your Ruby dependency files [\#74](https://github.com/solidusio-contrib/solidus_static_content/issues/74)
15
+ - Dependabot can't resolve your Ruby dependency files [\#73](https://github.com/solidusio-contrib/solidus_static_content/issues/73)
16
+ - wrong translation key [\#72](https://github.com/solidusio-contrib/solidus_static_content/issues/72)
17
+ - Version conflict on newest version \(deface compatibility\) [\#65](https://github.com/solidusio-contrib/solidus_static_content/issues/65)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Add privilege and category method to permission sets [\#93](https://github.com/solidusio-contrib/solidus_static_content/pull/93) ([sascha-karnatz](https://github.com/sascha-karnatz))
22
+ - Move to Standardrb [\#92](https://github.com/solidusio-contrib/solidus_static_content/pull/92) ([sascha-karnatz](https://github.com/sascha-karnatz))
23
+ - Run tests on GitHub [\#91](https://github.com/solidusio-contrib/solidus_static_content/pull/91) ([sascha-karnatz](https://github.com/sascha-karnatz))
24
+ - Add updated Menu Item for Solidus 4.2 [\#89](https://github.com/solidusio-contrib/solidus_static_content/pull/89) ([sascha-karnatz](https://github.com/sascha-karnatz))
25
+ - Restore solidus\_static\_content on Solidus 4.0 [\#88](https://github.com/solidusio-contrib/solidus_static_content/pull/88) ([JustShah](https://github.com/JustShah))
26
+ - Update to use forked solidus\_frontend when needed [\#84](https://github.com/solidusio-contrib/solidus_static_content/pull/84) ([waiting-for-dev](https://github.com/waiting-for-dev))
27
+ - English Translation Key Fix [\#82](https://github.com/solidusio-contrib/solidus_static_content/pull/82) ([QuintinAdam](https://github.com/QuintinAdam))
28
+ - Updates Gemspec to allow Ruby 3 [\#81](https://github.com/solidusio-contrib/solidus_static_content/pull/81) ([QuintinAdam](https://github.com/QuintinAdam))
29
+ - Upgrade to GitHub-native Dependabot [\#80](https://github.com/solidusio-contrib/solidus_static_content/pull/80) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
30
+ - Solidus version update to v3.0.0 [\#79](https://github.com/solidusio-contrib/solidus_static_content/pull/79) ([webhive](https://github.com/webhive))
31
+ - Scroll Update button into view before clicking [\#76](https://github.com/solidusio-contrib/solidus_static_content/pull/76) ([jarednorman](https://github.com/jarednorman))
32
+
33
+ ## [v2.0.0](https://github.com/solidusio-contrib/solidus_static_content/tree/v2.0.0) (2020-06-05)
34
+
35
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_static_content/compare/v1.0.0...v2.0.0)
36
+
37
+ **Breaking changes:**
38
+
39
+ - Rename SpreeStaticContent to SolidusStaticContent [\#67](https://github.com/solidusio-contrib/solidus_static_content/pull/67) ([aldesantis](https://github.com/aldesantis))
40
+ - Remove deprecated constants [\#66](https://github.com/solidusio-contrib/solidus_static_content/pull/66) ([aldesantis](https://github.com/aldesantis))
41
+
42
+ **Implemented enhancements:**
43
+
44
+ - Remove the `I18n` namespace from views [\#54](https://github.com/solidusio-contrib/solidus_static_content/issues/54)
45
+ - Drag & drop ordering + general views updates [\#53](https://github.com/solidusio-contrib/solidus_static_content/pull/53) ([elia](https://github.com/elia))
46
+ - Use the same sidebar logic that Solidus uses [\#52](https://github.com/solidusio-contrib/solidus_static_content/pull/52) ([elia](https://github.com/elia))
47
+ - Auto-generate slug when missing, require presence of a store, attach to the default store by default [\#48](https://github.com/solidusio-contrib/solidus_static_content/pull/48) ([elia](https://github.com/elia))
48
+ - Some more streamlining of the setup process and readme [\#46](https://github.com/solidusio-contrib/solidus_static_content/pull/46) ([elia](https://github.com/elia))
49
+ - Remove Deface hook for Pages in favor of MenuItem [\#45](https://github.com/solidusio-contrib/solidus_static_content/pull/45) ([elia](https://github.com/elia))
50
+ - CircleCI test results [\#43](https://github.com/solidusio-contrib/solidus_static_content/pull/43) ([elia](https://github.com/elia))
51
+ - General cleanup and updates [\#42](https://github.com/solidusio-contrib/solidus_static_content/pull/42) ([elia](https://github.com/elia))
52
+ - Gem structure refresh [\#39](https://github.com/solidusio-contrib/solidus_static_content/pull/39) ([elia](https://github.com/elia))
53
+
54
+ **Fixed bugs:**
55
+
56
+ - Could not find table 'spree\_pages' [\#30](https://github.com/solidusio-contrib/solidus_static_content/issues/30)
57
+ - Meta tag added to pages are added as well as the store ones [\#13](https://github.com/solidusio-contrib/solidus_static_content/issues/13)
58
+ - Page not found if store isn't mounted at the root [\#12](https://github.com/solidusio-contrib/solidus_static_content/issues/12)
59
+ - Add html code in static\_content [\#7](https://github.com/solidusio-contrib/solidus_static_content/issues/7)
60
+ - Add support for Solidus mounted on subpaths [\#55](https://github.com/solidusio-contrib/solidus_static_content/pull/55) ([elia](https://github.com/elia))
61
+ - Fix meta tags [\#50](https://github.com/solidusio-contrib/solidus_static_content/pull/50) ([elia](https://github.com/elia))
62
+ - Update the engine name to match migrations [\#49](https://github.com/solidusio-contrib/solidus_static_content/pull/49) ([elia](https://github.com/elia))
63
+ - Avoid adding the menu item multiple times [\#47](https://github.com/solidusio-contrib/solidus_static_content/pull/47) ([elia](https://github.com/elia))
64
+ - Limit sprockets to v3 until it's fixed on Solidus [\#44](https://github.com/solidusio-contrib/solidus_static_content/pull/44) ([elia](https://github.com/elia))
65
+
66
+ **Closed issues:**
67
+
68
+ - Couldn't find Spree::Page [\#33](https://github.com/solidusio-contrib/solidus_static_content/issues/33)
69
+ - Spree::PagesHelper doesn't have `render_snippet` method [\#25](https://github.com/solidusio-contrib/solidus_static_content/issues/25)
70
+ - admin menu item 'Pages' still appears after logout [\#9](https://github.com/solidusio-contrib/solidus_static_content/issues/9)
71
+ - Problem with solidus 2.1.0.beta1 and solidus\_static\_content [\#5](https://github.com/solidusio-contrib/solidus_static_content/issues/5)
72
+ - DB Migration not working [\#4](https://github.com/solidusio-contrib/solidus_static_content/issues/4)
73
+ - Migrations not running [\#3](https://github.com/solidusio-contrib/solidus_static_content/issues/3)
74
+
75
+ **Merged pull requests:**
76
+
77
+ - Update the readme with the solidus\_dev\_support template [\#71](https://github.com/solidusio-contrib/solidus_static_content/pull/71) ([aldesantis](https://github.com/aldesantis))
78
+ - Update extension template with solidus\_dev\_support [\#70](https://github.com/solidusio-contrib/solidus_static_content/pull/70) ([aldesantis](https://github.com/aldesantis))
79
+ - Adds Spree::PermissionSets for Pages [\#64](https://github.com/solidusio-contrib/solidus_static_content/pull/64) ([memotoro](https://github.com/memotoro))
80
+ - Relax solidus\_support dependency [\#63](https://github.com/solidusio-contrib/solidus_static_content/pull/63) ([kennyadsl](https://github.com/kennyadsl))
81
+ - Regenerate ext with solidus\_dev\_support [\#60](https://github.com/solidusio-contrib/solidus_static_content/pull/60) ([elia](https://github.com/elia))
82
+ - Fixes wrong labels, tabs and breadcrumbs [\#59](https://github.com/solidusio-contrib/solidus_static_content/pull/59) ([memotoro](https://github.com/memotoro))
83
+ - Replace Spree.t and I18n.t with the "t" helper [\#56](https://github.com/solidusio-contrib/solidus_static_content/pull/56) ([elia](https://github.com/elia))
84
+ - Update pg requirement from ~\> 0.21 to ~\> 1.1 [\#41](https://github.com/solidusio-contrib/solidus_static_content/pull/41) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
85
+ - Update factory\_bot requirement from ~\> 4.7 to ~\> 5.1 [\#37](https://github.com/solidusio-contrib/solidus_static_content/pull/37) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
86
+ - Update mysql2 requirement from ~\> 0.4.10 to ~\> 0.5.2 [\#36](https://github.com/solidusio-contrib/solidus_static_content/pull/36) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
87
+ - Relax sqlite gem dependency for Rails 6 compatibility [\#35](https://github.com/solidusio-contrib/solidus_static_content/pull/35) ([aldesantis](https://github.com/aldesantis))
88
+ - Patch store relationship saving [\#34](https://github.com/solidusio-contrib/solidus_static_content/pull/34) ([octoxan](https://github.com/octoxan))
89
+ - Switch from Travis to CircleCI [\#32](https://github.com/solidusio-contrib/solidus_static_content/pull/32) ([BravoSimone](https://github.com/BravoSimone))
90
+ - Update test files [\#28](https://github.com/solidusio-contrib/solidus_static_content/pull/28) ([jtapia](https://github.com/jtapia))
91
+ - Use dynamic attributes on factories [\#24](https://github.com/solidusio-contrib/solidus_static_content/pull/24) ([aitbw](https://github.com/aitbw))
92
+ - Extension maintenance [\#23](https://github.com/solidusio-contrib/solidus_static_content/pull/23) ([aitbw](https://github.com/aitbw))
93
+ - Fix specs [\#22](https://github.com/solidusio-contrib/solidus_static_content/pull/22) ([kennyadsl](https://github.com/kennyadsl))
94
+ - Remove versions past EOL from .travis.yml [\#19](https://github.com/solidusio-contrib/solidus_static_content/pull/19) ([jacobherrington](https://github.com/jacobherrington))
95
+ - Add Solidus 2.7 to .travis.yml [\#18](https://github.com/solidusio-contrib/solidus_static_content/pull/18) ([jacobherrington](https://github.com/jacobherrington))
96
+ - Relax Deface dependency [\#14](https://github.com/solidusio-contrib/solidus_static_content/pull/14) ([aldesantis](https://github.com/aldesantis))
97
+ - Fixes visibility hidden of Page menu before login [\#11](https://github.com/solidusio-contrib/solidus_static_content/pull/11) ([memotoro](https://github.com/memotoro))
98
+
99
+ ## [v1.0.0](https://github.com/solidusio-contrib/solidus_static_content/tree/v1.0.0) (2016-09-22)
100
+
101
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_static_content/compare/3ad3f010dcb5cb66d195abe0c6c9abdd05ccc76f...v1.0.0)
102
+
103
+ **Merged pull requests:**
104
+
105
+ - Support Solidus 2.0, test all versions [\#2](https://github.com/solidusio-contrib/solidus_static_content/pull/2) ([jhawthorn](https://github.com/jhawthorn))
106
+ - Solidus support [\#1](https://github.com/solidusio-contrib/solidus_static_content/pull/1) ([alexblackie](https://github.com/alexblackie))
107
+
108
+
109
+
110
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -1,13 +1,54 @@
1
- source 'https://rubygems.org/'
1
+ # frozen_string_literal: true
2
2
 
3
- branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
4
- gem 'solidus', github: 'solidusio/solidus', branch: branch
3
+ source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
- if branch == 'master' || branch >= "v2.0"
7
- gem "rails-controller-testing", group: :test
6
+ branch = ENV.fetch("SOLIDUS_BRANCH", "main")
7
+ gem "solidus", github: "solidusio/solidus", branch: branch
8
+
9
+ # The solidus_frontend gem has been pulled out since v3.2
10
+ if branch >= "v3.2"
11
+ gem "solidus_frontend"
12
+ elsif branch == "main"
13
+ gem "solidus_frontend", github: "solidusio/solidus_frontend"
14
+ else
15
+ gem "solidus_frontend", github: "solidusio/solidus", branch: branch
8
16
  end
9
17
 
10
- gem 'pg'
11
- gem 'mysql2'
18
+ rails_version = ENV.fetch("RAILS_VERSION", "~> 7.0")
19
+ # CI passes bare versions such as "8.0", which Bundler reads as an exact
20
+ # requirement that no released gem satisfies. Treat them as pessimistic instead.
21
+ rails_version = "~> #{rails_version}.0" if rails_version.match?(/\A\d+\.\d+\z/)
22
+ gem "rails", rails_version
23
+
24
+ # Extract the minimum Rails version from the version requirement.
25
+ # For example, both "~> 7.0" and ">= 7.0" translate to a minimum of "7.0".
26
+ rails_req = Gem::Requirement.new(rails_version)
27
+ min_rails_version = rails_req.requirements.map(&:last).min || Gem::Version.new("0")
28
+
29
+ # Determine the sqlite3 version based on the minimum Rails version.
30
+ # If the minimum Rails version is less than 7.2, use "~> 1.4"; otherwise, use "~> 2.0".
31
+ sqlite_version =
32
+ if min_rails_version < Gem::Version.new("7.2")
33
+ "~> 1.4"
34
+ else
35
+ "~> 2.0"
36
+ end
37
+
38
+ case ENV.fetch("DB", nil)
39
+ when "mysql"
40
+ gem "mysql2"
41
+ when "postgresql"
42
+ gem "pg"
43
+ else
44
+ gem "sqlite3", sqlite_version
45
+ end
12
46
 
13
47
  gemspec
48
+
49
+ # Use a local Gemfile to include development dependencies that might not be
50
+ # relevant for the project or for other contributors, e.g. pry-byebug.
51
+ #
52
+ # We use `send` instead of calling `eval_gemfile` to work around an issue with
53
+ # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
54
+ send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
data/Guardfile CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard "rspec", cmd: "bundle exec rspec" do
2
- watch("spec/spec_helper.rb") { "spec" }
3
- watch("config/routes.rb") { "spec/controllers" }
4
- watch("app/controllers/application_controller.rb") { "spec/controllers" }
5
- watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb"}
6
- watch(%r{^app/(.+)_decorator\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch(%r{^(app|lib)/(.+)(\.rb|\.erb)$}) { |m| "spec/#{m[2]}_spec.rb" }
8
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" }
4
+ watch("spec/spec_helper.rb") { "spec" }
5
+ watch("config/routes.rb") { "spec/controllers" }
6
+ watch("app/controllers/application_controller.rb") { "spec/controllers" }
7
+ watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
8
+ watch(%r{^app/(.+)_decorator\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
9
+ watch(%r{^(app|lib)/(.+)(\.rb|\.erb)$}) { |m| "spec/#{m[2]}_spec.rb" }
10
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" }
9
11
  end
data/README.md CHANGED
@@ -1,105 +1,130 @@
1
1
  # Solidus Static Content
2
2
 
3
- [![Build Status](https://travis-ci.org/solidusio-contrib/solidus_static_content.svg)](https://travis-ci.org/solidusio-contrib/solidus_static_content)
3
+ [![Test](https://github.com/solidusio-contrib/solidus_static_content/actions/workflows/test.yml/badge.svg)](https://github.com/solidusio-contrib/solidus_static_content/actions/workflows/test.yml)
4
4
 
5
- A fork of the [Spree extension][1] for compatibility with [Solidus][7].
5
+ A fork of the [Spree extension](https://github.com/spree-contrib/spree_static_content) for
6
+ compatibility with [Solidus](https://solidus.io).
6
7
 
7
- Good, clean content management of pages for Spree. You can use this to:
8
+ Good, clean content management of pages for Solidus. You can use it to:
8
9
 
9
- - Add and manage static pages such as an 'About' page.
10
- - Show a static page instead of existing dynamic pages such as the home page,
11
- products pages, and taxon pages.
10
+ - Add and manage static pages such as an About page.
11
+ - Show a static page instead of existing dynamic pages such as the home page, products pages, and
12
+ taxon pages.
12
13
 
13
- ## Basic Installation
14
+ ## Installation
14
15
 
15
- Add to your `Gemfile`:
16
+ Add solidus_static_content to your Gemfile:
16
17
 
17
- ```ruby
18
- gem 'solidus_static_content', github: 'solidusio-contrib/solidus_static_content'
19
- ```
18
+ ### Starter Frontend
20
19
 
21
- Run:
20
+ Bundle your dependencies and run the installation generator:
22
21
 
23
- ```
24
- $ bundle install
25
- $ bundle exec rails g solidus_static_content:install
22
+ ```shell
23
+ bundle
24
+ bin/rails generate solidus_static_content:install --frontend=starter
26
25
  ```
27
26
 
28
- That's all!
27
+ Please, be aware that the installation only works with the default
28
+ implementation of the starter frontend. Any customization to the files that
29
+ will be modified by the installer might break the installation procedure.
30
+ If that happens, try to adapt the installed code on top of the customizations
31
+ of the store.
29
32
 
33
+ ### Legacy Frontend
30
34
 
31
- ## HowTo
35
+ If you are using the legacy `solidus_frontend` gem, please run this command instead:
32
36
 
33
- Using the 'Pages' option in the admin tab, you can add static pages to your
34
- Spree install. The page content can be pulled directly from the database, be a
35
- separate layout file or rendered as a partial.
37
+ ```shell
38
+ bin/rails generate solidus_static_content:install
39
+ ```
36
40
 
37
- In the admin tab, use the 'New page' option to create a new static page.
41
+ ## Usage
38
42
 
39
- The title, slug, body, and meta fields will replace their respective page
40
- elements on load. The title, slug and body element are all required fields.
43
+ Using the 'Pages' option in the admin tab, you can add static pages to your Solidus store. The page
44
+ content can be pulled directly from the database, be a separate layout file or be rendered as a
45
+ partial.
41
46
 
42
- Body text provided without a layout / partial being specified will be loaded in
43
- the spree_application layout after it is pulled from the database.
47
+ In the admin tab, use the 'New page' option to create a new static page.
44
48
 
49
+ The title, slug, body, and meta fields will replace their respective page elements on load. The
50
+ title, slug and body element are all required fields.
45
51
 
46
- ### Layout and Partial Rendering
52
+ Body text provided without a layout/partial being specified will be loaded in the
53
+ `spree_application` layout after it is pulled from the database.
47
54
 
48
- To render an entire page without the spree_application layout, specify a
49
- relative path to the layout file (eg. `spree/layouts/layout_file_name`). This
50
- file will not be prefixed with an underscore as it is a layout, not a partial.
55
+ ### Layout and partial rendering
51
56
 
52
- To render a partial, specify the path in the layout file name and check the
53
- 'Render layout as partial' option. The path specified in the layout area will
54
- not have an underscore, but it will be required in the filename.
57
+ To render an entire page without the `spree_application` layout, specify a relative path to the
58
+ layout file (e.g. `spree/layouts/layout_file_name`). Note that the name of this file will not be
59
+ prefixed with an underscore as it is a layout, not a partial.
55
60
 
56
- Also note the availability of the render_snippet helper which finds a page by
57
- its slug and renders the raw page body anywhere in your view.
61
+ To render a partial, specify the path in the layout file name and check the 'Render layout as
62
+ partial' option. The path specified in the layout area will not have an underscore, but it will be
63
+ required in the filename.
64
+
65
+ Also note the availability of the `render_snippet` helper which finds a page by its slug and renders
66
+ the raw page body anywhere in your view.
58
67
 
59
68
  ### Options
60
69
 
61
- Use the 'Show in' checkboxes to specify whether to display the page links in the
62
- header, footer or sidebar. The position setting alters the order in which they
63
- appear.
70
+ Use the 'Show in' checkboxes to specify whether to display the page links in the header, footer or
71
+ sidebar. The position setting alters the order in which they appear.
64
72
 
65
- Finally, toggle the visibility using the 'Visible' checkbox. If it is unchecked,
66
- the page will not be available.
73
+ Finally, toggle the visibility using the 'Visible' checkbox. If it is unchecked, the page will not
74
+ be available.
67
75
 
76
+ ## Development
68
77
 
69
- ## Contributing
78
+ ### Testing the extension
70
79
 
71
- In the spirit of [free software][2], **everyone** is encouraged to help improve
72
- this project.
80
+ First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
81
+ app if it does not exist, then it will run specs. The dummy app can be regenerated by using
82
+ `bin/rake extension:test_app`.
73
83
 
74
- Here are some ways *you* can contribute:
84
+ ```shell
85
+ bundle
86
+ bin/rake
87
+ ```
75
88
 
76
- * by using prerelease versions
77
- * by reporting [bugs][3]
78
- * by suggesting new features
79
- * by writing translations
80
- * by writing or editing documentation
81
- * by writing specifications
82
- * by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
83
- * by refactoring code
84
- * by resolving [issues][3]
85
- * by reviewing patches
89
+ To run [Standard](https://github.com/standardrb/standard) static code analysis run
86
90
 
87
- Starting point:
91
+ ```shell
92
+ bundle exec standardrb
93
+ ```
88
94
 
89
- * Fork the repo
90
- * Clone your repo
91
- * Run `bundle install`
92
- * Run `bundle exec rake test_app` to create the test application in `spec/test_app`
93
- * Make your changes
94
- * Ensure specs pass by running `bundle exec rspec spec`
95
- * Submit your pull request
95
+ When testing your application's integration with this extension you may use its factories.
96
+ Simply add this require statement to your spec_helper:
97
+
98
+ ```ruby
99
+ require 'solidus_static_content/testing_support/factories'
100
+ ```
101
+
102
+ ### Running the sandbox
103
+
104
+ To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
105
+ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
106
+ `sandbox/bin/rails`.
107
+
108
+ Here's an example:
109
+
110
+ ```shell
111
+ $ bin/rails server
112
+ => Booting Puma
113
+ => Rails 6.0.2.1 application starting in development
114
+ * Listening on tcp://127.0.0.1:3000
115
+ Use Ctrl-C to stop
116
+ ```
117
+
118
+ ### Releasing new versions
119
+
120
+ Your new extension version can be released using `gem-release` like this:
121
+
122
+ ```shell
123
+ bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
124
+ ```
96
125
 
97
- Copyright (c) 2014 [Peter Berkenbosch][4] and [contributors][5], released under the [New BSD License][6]
126
+ ## License
98
127
 
99
- [1]: https://github.com/spree-contrib/spree_static_content/
100
- [2]: http://www.fsf.org/licensing/essays/free-sw.html
101
- [3]: https://github.com/solidusio-contrib/solidus_static_content/issues
102
- [4]: https://github.com/peterberkenbosch
103
- [5]: https://github.com/solidusio-contrib/solidus_static_content/graphs/contributors
104
- [6]: ./LICENSE.md
105
- [7]: https://solidus.io/
128
+ Copyright (c) 2014 [Peter Berkenbosch](https://github.com/peterberkenbosch) and
129
+ [contributors](https://github.com/solidusio-contrib/solidus_static_content/graphs/contributors),
130
+ released under the New BSD License.
data/Rakefile CHANGED
@@ -1,15 +1,6 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ # frozen_string_literal: true
3
2
 
4
- require 'rspec/core/rake_task'
5
- require 'spree/testing_support/common_rake'
3
+ require "solidus_dev_support/rake_tasks"
4
+ SolidusDevSupport::RakeTasks.install
6
5
 
7
- RSpec::Core::RakeTask.new
8
-
9
- task :default => [:spec]
10
-
11
- desc "Generates a dummy app for testing"
12
- task :test_app do
13
- ENV['LIB_NAME'] = 'solidus_static_content'
14
- Rake::Task['common:test_app'].invoke
15
- end
6
+ task default: "extension:specs"
@@ -0,0 +1,7 @@
1
+ /* Sidebar */
2
+ nav#pages .pages-root {
3
+ text-transform: uppercase;
4
+ border-bottom: 1px solid rgb(217, 217, 219);
5
+ margin-bottom: 5px;
6
+ font-size: 14px;
7
+ }
@@ -1,7 +1,2 @@
1
- /* Sidebar */
2
- nav#pages .pages-root {
3
- text-transform: uppercase;
4
- border-bottom: 1px solid rgb(217, 217, 219);
5
- margin-bottom: 5px;
6
- font-size: 14px;
7
- }
1
+ /* DEPRECATED: Delegate to the solidus namespaced file */
2
+ /* = require spree/frontend/solidus_static_content */
@@ -1,6 +1,10 @@
1
- module Spree::PagesHelper
2
- def render_snippet(slug)
3
- page = Spree::Page.find_by_slug(slug)
4
- raw page.body if page
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ module PagesHelper
5
+ def render_snippet(slug)
6
+ page = Spree::Page.find_by(slug: slug)
7
+ raw page.body if page
8
+ end
5
9
  end
6
- end
10
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusStaticContent
4
+ module PermissionSets
5
+ class PageDisplay < Spree::PermissionSets::Base
6
+ class << self
7
+ def privilege
8
+ :display
9
+ end
10
+
11
+ def category
12
+ :page
13
+ end
14
+ end
15
+
16
+ def activate!
17
+ can [:display, :admin], Spree::Page
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusStaticContent
4
+ module PermissionSets
5
+ class PageManagement < Spree::PermissionSets::Base
6
+ class << self
7
+ def privilege
8
+ :management
9
+ end
10
+
11
+ def category
12
+ :page
13
+ end
14
+ end
15
+
16
+ def activate!
17
+ can :manage, Spree::Page
18
+ end
19
+ end
20
+ end
21
+ end