aasm_actionable 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/generators/aasm_actionable/views_generator.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 701615f921afb99389e5881c7392d97a411b3009
|
4
|
+
data.tar.gz: d4ef7a8f8a32eebc3b83d3189f02d101ed28f27e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8acfb67b5f0e4989564bc6dc3edecd994b7d48bd29c7d9ade7a91b1c4e9f9184d7ce0e14b0e8643fbd8eba196978e67360490ff125b507ffcf8c8646513b7c0e
|
7
|
+
data.tar.gz: 842cf6db75f23d02ce638dd5b319c57cf9739ad5268037ccba44fcaa4cb0c4f6ddda293c3c71499a9c1a4e8288ff86d1693b247e1fd93c1375a34d4013c6b0ae
|
data/README.md
CHANGED
@@ -21,11 +21,11 @@ Each action that aasm_actionable may display requires the developer to provide t
|
|
21
21
|
|
22
22
|
Additionally, you may wish to create a controller method and route to handle the action being performed. By convention, the controller method should have the same name as the action, ie. `do_action` for the example above.
|
23
23
|
|
24
|
-
Once you have provided one or more actions for a model, you can render a model instance's available actions by including `AasmActionable::ControllerMixin` in your controller, and adding `<%= render_state_actions my_instance %>` in your view.
|
24
|
+
Once you have provided one or more actions for a model, you can render a model instance's available actions by including `AasmActionable::ControllerMixin` in your controller, and adding `<%= render_state_actions my_instance %>` in your view. The default template uses styles and code from [Bootstrap 3](http://getbootstrap.com/), so you should either ensure that it is included in your application, or change the default template (see Custom Rendering below.)
|
25
25
|
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
Example
|
28
|
+
-------
|
29
29
|
|
30
30
|
Consider the following contrived Order model (in `app/models/order.rb`) for a (trivial) online store:
|
31
31
|
|
@@ -143,7 +143,7 @@ Next, we create a partial for each action. For example, for the dispatch action
|
|
143
143
|
Finally, we render the actions in the order view by adding `<%= render_state_actions @order %>` to `app/views/order/show.html.erb`.
|
144
144
|
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
Custom Rendering
|
147
|
+
----------------
|
148
148
|
|
149
|
-
|
149
|
+
The default template for `aasm_actionable` can be customized as necessary. Run `rails g aasm_actionable:views` to copy the template to app/views/aasm_actionable/_list.html.erb, and edit it as required.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
|
4
|
+
module AasmActionable
|
5
|
+
module Generators
|
6
|
+
class ViewsGenerator < Rails::Generators::Base
|
7
|
+
desc 'Install a copy of the default aasm_actionable views'
|
8
|
+
source_root File.expand_path('../../../../app/views', __FILE__)
|
9
|
+
|
10
|
+
def copy_views
|
11
|
+
directory 'aasm_actionable', 'app/views/aasm_actionable'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aasm_actionable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan MacDonell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/aasm_actionable.rb
|
64
64
|
- lib/aasm_actionable/controller_mixin.rb
|
65
65
|
- lib/aasm_actionable/engine.rb
|
66
|
+
- lib/generators/aasm_actionable/views_generator.rb
|
66
67
|
homepage: http://rubygems.org/gems/aasm_actionable
|
67
68
|
licenses:
|
68
69
|
- MIT
|