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 +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +14 -1
- data/app/controllers/configurable_engine/application_controller.rb +6 -0
- data/app/controllers/configurable_engine/configurables_controller.rb +1 -6
- data/app/views/configurable_engine/configurables/show.html.erb +1 -2
- data/app/views/layouts/configurable_engine/application.html.erb +13 -0
- data/config/routes.rb +1 -1
- data/lib/configurable_engine/configurables_controller_methods.rb +3 -2
- data/lib/configurable_engine/version.rb +1 -1
- data/lib/generators/configurable_engine/install_generator.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35d8e042be21d9ecc3832fcf236bec6145e58ee6a545185121cda190f26a935e
|
4
|
+
data.tar.gz: 5d3619555b52de54a69da528aec0e92a9b5911425ea06f244a01082e6cfd588d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebc8c63d1ea3ac3722dd7632ab38ecba3cd60dd0b2a23b6595f9905e7aaa947aa8b069f0f8de5e0f275ca69cd09b786ee9f866aba82c6c7672f02f937116bdaf
|
7
|
+
data.tar.gz: b09227577c08b4e35523d134dbf7dbeff3ff2c1c45f6f01c536985c446239ec2ee8ee39b8c649e334c4bd9ee5a3a165a85b3c3fbdabbc2332fba4cbb2aec7f5e
|
data/CHANGELOG.md
CHANGED
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
|
-
|
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
|
@@ -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(
|
7
|
+
<%= form_tag({}, method: :put) do -%>
|
9
8
|
<%- @keys.each do |key| -%>
|
10
9
|
<%- options = Configurable.defaults[key] -%>
|
11
10
|
<div class="configurable">
|
data/config/routes.rb
CHANGED
@@ -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
|
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
|
22
|
+
redirect_to(action: :show)
|
22
23
|
end
|
23
24
|
end
|
24
25
|
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.
|
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
|