ultra_light_wizard 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +0 -0
- data/.ruby-version +0 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +13 -9
- data/Rakefile +0 -0
- data/VERSION +1 -1
- data/lib/generators/templates/app/controllers/wizard_steps_controller.rb.erb +2 -5
- data/lib/generators/templates/app/helpers/wizard_steps_helper.rb.erb +24 -0
- data/lib/generators/templates/app/models/wizard_step_model.rb.erb +3 -0
- data/lib/generators/templates/app/views/wizard_step_navigation_view.html.erb +10 -0
- data/lib/generators/templates/app/views/wizard_step_view.html.erb +1 -0
- data/lib/generators/ultra_light_wizard/wizard_generator.rb +2 -0
- data/lib/ultra_light_wizard.rb +0 -0
- data/ruby187.Gemfile +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/ultra_light_wizard/ultra_light_wizard_spec.rb +0 -0
- data/ultra_light_wizard.gemspec +9 -6
- data/ultra_light_wizard.jpg +0 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba76fbcd0ade6374d02dc6ec9a1cb27993bcc88e
|
4
|
+
data.tar.gz: 956dda788823323818f4480af2fd884b3162ebaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808ba91e959078bda15d1871e90b9fcc0892d89ae4b98ec0d794b561812fafd0e50ec7225dc179a142981452fb4cd2f9ba6770a280136694ef7c9dcdd4ef9cf8
|
7
|
+
data.tar.gz: d98b21362e21e01232004de2154037e85a992c33977e9ffd1ea4f1844403c748c83af10c21a78306dd0c97266511708e5386c63414fc2e7c0daefd875c2f6d45
|
data/.ruby-gemset
CHANGED
File without changes
|
data/.ruby-version
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/Gemfile.lock
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -3,7 +3,9 @@ Ultra Light Wizard
|
|
3
3
|
|
4
4
|
No time to manage a wizard state machine, session variables, or complicated controllers? Use Ultra Light Wizard!! A RESTful session-less validation-friendly simple wizard approach in Rails.
|
5
5
|
|
6
|
-
|
6
|
+
![Ultra Light Wizard Image](https://cdn.rawgit.com/AndyObtiva/ultra_light_wizard/master/ultra_light_wizard.jpg)
|
7
|
+
|
8
|
+
This RailsConf 2014 talk video explains it all:
|
7
9
|
https://www.youtube.com/watch?v=muyfoiKHMMA
|
8
10
|
|
9
11
|
Instructions
|
@@ -61,18 +63,20 @@ Once the files are generated, you can proceed to place your own code customizati
|
|
61
63
|
|
62
64
|
To learn more about the Ultra Light Wizard philosophy and function, please read this [Code Painter](http://www.codepainter.ca) blog post: [Ultra Light & Maintainable Wizard in Rails] (http://www.codepainter.ca/2013/10/ultra-light-maintainable-wizards-in.html)
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
+
Features
|
67
|
+
========
|
66
68
|
|
67
69
|
- Wizard step generator (model part builder MVC components)
|
68
|
-
+ Routes
|
69
|
-
+ Controller steps
|
70
|
-
+ Model parts
|
71
|
-
+ View parts
|
72
|
-
|
70
|
+
+ [DONE] Routes
|
71
|
+
+ [DONE] Controller steps
|
72
|
+
+ [DONE] Model parts
|
73
|
+
+ [DONE] View parts
|
74
|
+
+ [DONE] View navigation
|
75
|
+
+ [DONE] Helper (or Controller SuperModule trait) for ultra light wizard support
|
76
|
+
- Forms
|
73
77
|
- Support for nested resources
|
74
78
|
- Modularize (perhaps extracting sub-generators)
|
75
|
-
|
79
|
+
- [DONE] Customize name conventions
|
76
80
|
|
77
81
|
License
|
78
82
|
=======
|
data/Rakefile
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class <%= class_name %><%= step_alias.pluralize.camelize %>Controller < ApplicationController
|
2
|
-
before_action :
|
2
|
+
before_action :load_<%= file_path %>
|
3
3
|
|
4
4
|
<%= step_alias.pluralize.upcase %> = %w(<%= steps.to_a.join(' ') %>)
|
5
5
|
|
@@ -29,11 +29,8 @@ class <%= class_name %><%= step_alias.pluralize.camelize %>Controller < Applicat
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
-
def
|
32
|
+
def load_<%= file_path %>
|
33
33
|
@<%= file_path %> = <%= file_path %>_<%= step_alias %>_model
|
34
|
-
if @<%= file_path %>.user_id != current_user.id && !current_user.is_admin?
|
35
|
-
render(:file => "#{Rails.root.to_s}/public/403.html", :layout => false, :status => 403)
|
36
|
-
end
|
37
34
|
end
|
38
35
|
|
39
36
|
def <%= file_path %>_<%= step_alias %>_model
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module <%= class_name %><%= step_alias.pluralize.camelize %>Helper
|
2
|
+
<%= step_alias.pluralize.upcase %> = %w(<%= steps.to_a.join(' ') %>)
|
3
|
+
|
4
|
+
def <%= file_path %>_<%= step_alias %>_model
|
5
|
+
<%= file_path %>_class = "<%= class_name %>::#{<%= step_alias %>.camelcase}".constantize rescue <%= class_name %>
|
6
|
+
<%= file_path %>_class.find(params[:<%= file_path %>_id])
|
7
|
+
end
|
8
|
+
|
9
|
+
def <%= step_alias %>
|
10
|
+
<%= step_alias.pluralize.upcase %>.find {|a_<%= step_alias %>| a_<%= step_alias %> == params[:id].to_s.downcase}
|
11
|
+
end
|
12
|
+
|
13
|
+
def next_<%= step_alias %>
|
14
|
+
current_<%= step_alias %>_index = <%= step_alias.pluralize.upcase %>.index(<%= step_alias %>)
|
15
|
+
<%= step_alias.pluralize.upcase %>[current_<%= step_alias %>_index+1]
|
16
|
+
end
|
17
|
+
|
18
|
+
def previous_<%= step_alias %>
|
19
|
+
current_<%= step_alias %>_index = <%= step_alias.pluralize.upcase %>.index(<%= step_alias %>)
|
20
|
+
previous_<%= step_alias %>_index = current_<%= step_alias %>_index-1
|
21
|
+
previous_<%= step_alias %>_index < 0 ? nil : <%= step_alias.pluralize.upcase %>[previous_<%= step_alias %>_index]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<ul>
|
2
|
+
<%% if <%= "previous_#{step_alias}" %>.present? %>
|
3
|
+
<li><%%= link_to "Previous <%= step_alias %>", edit_<%= file_path %>_<%= file_path %>_<%= step_alias %>_path(<%= file_path %>_<%= step_alias %>_model, previous_step) %></li>
|
4
|
+
<%% end %>
|
5
|
+
<%% if <%= "next_#{step_alias}" %>.present? %>
|
6
|
+
<li><%%= link_to "Next <%= step_alias %>", edit_<%= file_path %>_<%= file_path %>_<%= step_alias %>_path(<%= file_path %>_<%= step_alias %>_model, next_step) %></li>
|
7
|
+
<%% else %>
|
8
|
+
<li><%%= link_to "Finish <%= step_alias %>", <%= file_path %>_path(<%= file_path %>_<%= step_alias %>_model) %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
@@ -20,6 +20,8 @@ module UltraLightWizard
|
|
20
20
|
desc "Creates a configuration file for a specific application context (e.g. admin). Takes context path as argument (e.g. admin or internal/wiki) to create config/features/[context_path].yml"
|
21
21
|
def copy_config
|
22
22
|
template "app/controllers/wizard_steps_controller.rb.erb", "app/controllers/#{file_path}_#{step_alias.pluralize}_controller.rb"
|
23
|
+
template "app/helpers/wizard_steps_helper.rb.erb", "app/helpers/#{file_path}_#{step_alias.pluralize}_helper.rb"
|
24
|
+
template "app/views/wizard_step_navigation_view.html.erb", "app/views/#{file_path}_#{step_alias.pluralize}/_#{step_alias}_navigation.html.erb"
|
23
25
|
steps.each do |step|
|
24
26
|
@wizard_step = step
|
25
27
|
template "app/models/wizard_step_model.rb.erb", "app/models/#{file_path}/#{step}.rb"
|
data/lib/ultra_light_wizard.rb
CHANGED
File without changes
|
data/ruby187.Gemfile
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
File without changes
|
data/ultra_light_wizard.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ultra_light_wizard 0.0.
|
5
|
+
# stub: ultra_light_wizard 0.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ultra_light_wizard"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Andy Maleh"]
|
14
|
-
s.date = "2016-01-
|
14
|
+
s.date = "2016-01-27"
|
15
15
|
s.description = "Ultra light & maintainble wizards in Rails that honor REST, MVC, and OO with minimal writing of code involved and maximum flexibility"
|
16
16
|
s.email = "andy.am@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -28,18 +28,21 @@ Gem::Specification.new do |s|
|
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"lib/generators/templates/app/controllers/wizard_steps_controller.rb.erb",
|
31
|
+
"lib/generators/templates/app/helpers/wizard_steps_helper.rb.erb",
|
31
32
|
"lib/generators/templates/app/models/wizard_step_model.rb.erb",
|
33
|
+
"lib/generators/templates/app/views/wizard_step_navigation_view.html.erb",
|
32
34
|
"lib/generators/templates/app/views/wizard_step_view.html.erb",
|
33
35
|
"lib/generators/ultra_light_wizard/wizard_generator.rb",
|
34
36
|
"lib/ultra_light_wizard.rb",
|
35
37
|
"ruby187.Gemfile",
|
36
38
|
"spec/spec_helper.rb",
|
37
39
|
"spec/ultra_light_wizard/ultra_light_wizard_spec.rb",
|
38
|
-
"ultra_light_wizard.gemspec"
|
40
|
+
"ultra_light_wizard.gemspec",
|
41
|
+
"ultra_light_wizard.jpg"
|
39
42
|
]
|
40
43
|
s.homepage = "http://github.com/AndyObtiva/ultra_light_wizard"
|
41
44
|
s.licenses = ["MIT"]
|
42
|
-
s.rubygems_version = "2.4.
|
45
|
+
s.rubygems_version = "2.4.8"
|
43
46
|
s.summary = "Ultra Light & Maintainable Wizards In Rails"
|
44
47
|
|
45
48
|
if s.respond_to? :specification_version then
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_light_wizard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|
@@ -42,7 +42,9 @@ files:
|
|
42
42
|
- Rakefile
|
43
43
|
- VERSION
|
44
44
|
- lib/generators/templates/app/controllers/wizard_steps_controller.rb.erb
|
45
|
+
- lib/generators/templates/app/helpers/wizard_steps_helper.rb.erb
|
45
46
|
- lib/generators/templates/app/models/wizard_step_model.rb.erb
|
47
|
+
- lib/generators/templates/app/views/wizard_step_navigation_view.html.erb
|
46
48
|
- lib/generators/templates/app/views/wizard_step_view.html.erb
|
47
49
|
- lib/generators/ultra_light_wizard/wizard_generator.rb
|
48
50
|
- lib/ultra_light_wizard.rb
|
@@ -50,6 +52,7 @@ files:
|
|
50
52
|
- spec/spec_helper.rb
|
51
53
|
- spec/ultra_light_wizard/ultra_light_wizard_spec.rb
|
52
54
|
- ultra_light_wizard.gemspec
|
55
|
+
- ultra_light_wizard.jpg
|
53
56
|
homepage: http://github.com/AndyObtiva/ultra_light_wizard
|
54
57
|
licenses:
|
55
58
|
- MIT
|
@@ -70,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
73
|
version: '0'
|
71
74
|
requirements: []
|
72
75
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.4.
|
76
|
+
rubygems_version: 2.4.8
|
74
77
|
signing_key:
|
75
78
|
specification_version: 4
|
76
79
|
summary: Ultra Light & Maintainable Wizards In Rails
|