configurable_engine 2.0.1 → 2.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 052c84d5fd01f589b20d96f859db8e9472ccc006e65e1169cfa856821d99c505
4
- data.tar.gz: 0cad323593bc477cc75fdf4e5688b32bdc40f37f378bc87812944e2a3dac76f1
3
+ metadata.gz: 35d8e042be21d9ecc3832fcf236bec6145e58ee6a545185121cda190f26a935e
4
+ data.tar.gz: 5d3619555b52de54a69da528aec0e92a9b5911425ea06f244a01082e6cfd588d
5
5
  SHA512:
6
- metadata.gz: e49206f97f2db7ac059b4e9999d7de7e7d45aaebba6f16c3d41befdbf97ab6fba031149d5513cbc2c09d45db661f2703d39835d14713ccfac34fb668cb2950c6
7
- data.tar.gz: 61f85de5aa43479682c21777d3b6929fb38f1a667dc94359de380c9622ada73676c9067ac594cc3ec2d4026bee5e210abc19bb4745687d0101c6137ed2d85963
6
+ metadata.gz: ebc8c63d1ea3ac3722dd7632ab38ecba3cd60dd0b2a23b6595f9905e7aaa947aa8b069f0f8de5e0f275ca69cd09b786ee9f866aba82c6c7672f02f937116bdaf
7
+ data.tar.gz: b09227577c08b4e35523d134dbf7dbeff3ff2c1c45f6f01c536985c446239ec2ee8ee39b8c649e334c4bd9ee5a3a165a85b3c3fbdabbc2332fba4cbb2aec7f5e
@@ -1,4 +1,8 @@
1
- ### v2.0.0 - August 20, 2020
1
+ ### v2.0.2 - August 20, 2020
2
+ **bug fixes**
3
+ fix rendering with included module
4
+
5
+ ### v2.0.1 - August 20, 2020
2
6
  **bug fixes**
3
7
  Can render layout of parent application
4
8
 
data/README.md CHANGED
@@ -59,7 +59,7 @@ If you want to add a layout, or protect the configurable controller, create `app
59
59
  $ bundle exec rails generate controller admin/configurables
60
60
  ```
61
61
 
62
- and include `ConfigurableEngine::ConfigurablesController`, eg.
62
+ include `ConfigurableEngine::ConfigurablesController`, eg.
63
63
 
64
64
  ```ruby
65
65
  class Admin::ConfigurablesController < ApplicationController
@@ -72,6 +72,19 @@ class Admin::ConfigurablesController < ApplicationController
72
72
  end
73
73
  ```
74
74
 
75
+ and replace
76
+ ```ruby
77
+ route 'mount ConfigurableEngine::Engine, at: "/admin/configurable", as: "configurable"'
78
+ ```
79
+
80
+ with
81
+
82
+ ```ruby
83
+ namespace :admin do
84
+ resource :configurable, only: [:show, :update]
85
+ end
86
+ ```
87
+
75
88
  To ensure text areas are rendered correctly, ensure that your layout preserves whitespace. In haml, use the `~` operator
76
89
 
77
90
  ```haml
@@ -0,0 +1,6 @@
1
+ module ConfigurableEngine
2
+ class ApplicationController < ActionController::Base
3
+ layout "configurable_engine/application"
4
+ protect_from_forgery with: :exception
5
+ end
6
+ end
@@ -1,10 +1,5 @@
1
1
  module ConfigurableEngine
2
- class ConfigurablesController < ApplicationController
3
- # this allows us to render url_helpers from parent app's layout
4
- helper Rails.application.routes.url_helpers
5
- # this ensures our local routes override any parent routes
6
- helper ConfigurableEngine::Engine.routes.url_helpers
7
-
2
+ class ConfigurablesController < ::ConfigurableEngine::ApplicationController
8
3
  include ConfigurableEngine::ConfigurablesControllerMethods
9
4
  end
10
5
  end
@@ -1,11 +1,10 @@
1
1
  <div class='configurable-container'>
2
-
3
2
  <div class="header">
4
3
  <h2>Config</h2>
5
4
  </div>
6
5
 
7
6
  <div class="configurable-options">
8
- <%= form_tag(configurable_path, :method => :put) do -%>
7
+ <%= form_tag({}, method: :put) do -%>
9
8
  <%- @keys.each do |key| -%>
10
9
  <%- options = Configurable.defaults[key] -%>
11
10
  <div class="configurable">
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Configurable engine</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
@@ -1,3 +1,3 @@
1
1
  ConfigurableEngine::Engine.routes.draw do
2
- resource :configurable, path: '/'
2
+ resource :configurable, path: '/', only: [:show, :update]
3
3
  end
@@ -2,6 +2,7 @@ module ConfigurableEngine
2
2
  module ConfigurablesControllerMethods
3
3
  def show
4
4
  @keys = Configurable.keys
5
+ render 'configurable_engine/configurables/show'
5
6
  end
6
7
 
7
8
  def update
@@ -15,10 +16,10 @@ module ConfigurableEngine
15
16
  end
16
17
 
17
18
  if failures.empty?
18
- redirect_to configurable_path, :notice => "Changes successfully updated"
19
+ redirect_to(action: :show, :notice => "Changes successfully updated")
19
20
  else
20
21
  flash[:error] = failures.flat_map(&:errors).flat_map(&:full_messages).join(',')
21
- redirect_to configurable_path
22
+ redirect_to(action: :show)
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module ConfigurableEngine
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
@@ -22,7 +22,7 @@ class InstallGenerator < Rails::Generators::Base
22
22
  end
23
23
 
24
24
  def mount_interface
25
- route 'mount ConfigurableEngine::Engine, at: "/admin/configurable"'
25
+ route 'mount ConfigurableEngine::Engine, at: "/admin/configurable", as: "configurable"'
26
26
  end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configurable_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Campbell
@@ -38,9 +38,11 @@ files:
38
38
  - CHANGELOG.md
39
39
  - LICENSE.txt
40
40
  - README.md
41
+ - app/controllers/configurable_engine/application_controller.rb
41
42
  - app/controllers/configurable_engine/configurables_controller.rb
42
43
  - app/models/configurable.rb
43
44
  - app/views/configurable_engine/configurables/show.html.erb
45
+ - app/views/layouts/configurable_engine/application.html.erb
44
46
  - config/routes.rb
45
47
  - lib/configurable_engine.rb
46
48
  - lib/configurable_engine/configurables_controller_methods.rb