jfs-generators 0.1.1 → 0.2.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 (43) hide show
  1. data/README.md +131 -10
  2. data/rails_generators/jfs_960/USAGE +10 -0
  3. data/rails_generators/jfs_960/jfs_960_generator.rb +23 -0
  4. data/rails_generators/jfs_960/templates/960.css +1 -0
  5. data/rails_generators/jfs_960/templates/reset.css +1 -0
  6. data/rails_generators/jfs_960/templates/text.css +1 -0
  7. data/rails_generators/jfs_config/USAGE +23 -0
  8. data/rails_generators/jfs_config/jfs_config_generator.rb +35 -0
  9. data/rails_generators/jfs_config/templates/config.yml +8 -0
  10. data/rails_generators/jfs_config/templates/load_config.rb +2 -0
  11. data/rails_generators/jfs_jquery/USAGE +10 -0
  12. data/rails_generators/jfs_jquery/jfs_jquery_generator.rb +30 -0
  13. data/rails_generators/jfs_jquery/templates/jquery-ui.min.js +9 -0
  14. data/rails_generators/jfs_jquery/templates/jquery.min.js +19 -0
  15. data/rails_generators/jfs_layout/USAGE +30 -0
  16. data/rails_generators/jfs_layout/jfs_layout_generator.rb +36 -0
  17. data/rails_generators/jfs_layout/templates/en.yml +3 -0
  18. data/rails_generators/jfs_layout/templates/helper.rb +10 -0
  19. data/rails_generators/jfs_layout/templates/layout.html.erb +31 -0
  20. data/rails_generators/jfs_layout/templates/stylesheet.css +73 -0
  21. data/rails_generators/jfs_model/USAGE +6 -5
  22. data/rails_generators/jfs_model/jfs_model_generator.rb +3 -3
  23. data/rails_generators/jfs_model/templates/model.rb +5 -3
  24. data/rails_generators/jfs_scaffold/USAGE +33 -0
  25. data/rails_generators/jfs_scaffold/jfs_scaffold_generator.rb +104 -0
  26. data/rails_generators/jfs_scaffold/templates/actions/create.rb +25 -0
  27. data/rails_generators/jfs_scaffold/templates/actions/destroy.rb +16 -0
  28. data/rails_generators/jfs_scaffold/templates/actions/edit.rb +14 -0
  29. data/rails_generators/jfs_scaffold/templates/actions/index.rb +14 -0
  30. data/rails_generators/jfs_scaffold/templates/actions/new.rb +14 -0
  31. data/rails_generators/jfs_scaffold/templates/actions/show.rb +14 -0
  32. data/rails_generators/jfs_scaffold/templates/actions/update.rb +25 -0
  33. data/rails_generators/jfs_scaffold/templates/controller.rb +3 -0
  34. data/rails_generators/jfs_scaffold/templates/en.yml +31 -0
  35. data/rails_generators/jfs_scaffold/templates/helper.rb +2 -0
  36. data/rails_generators/jfs_scaffold/templates/migration.rb +14 -0
  37. data/rails_generators/jfs_scaffold/templates/model.rb +12 -0
  38. data/rails_generators/jfs_scaffold/templates/views/_fields.html.erb +7 -0
  39. data/rails_generators/jfs_scaffold/templates/views/edit.html.erb +15 -0
  40. data/rails_generators/jfs_scaffold/templates/views/index.html.erb +36 -0
  41. data/rails_generators/jfs_scaffold/templates/views/new.html.erb +8 -0
  42. data/rails_generators/jfs_scaffold/templates/views/show.html.erb +29 -0
  43. metadata +40 -2
@@ -0,0 +1,31 @@
1
+ en:
2
+ <%= plural_name %>:
3
+ fields:
4
+ id: Id
5
+ <%- attributes.each do |attribute| -%>
6
+ <%= attribute.name %>: <%= attribute.name.humanize.titleize %>
7
+ <%- end -%>
8
+ created_at: Created At
9
+ updated_at: Updated At
10
+ index:
11
+ title: List <%= plural_class_name.humanize.titleize %>
12
+ short_title: List
13
+ new:
14
+ title: New <%= class_name.humanize.titleize %>
15
+ short_title: New
16
+ submit: Create <%= class_name.humanize.titleize %>
17
+ create:
18
+ flash: The <%= singular_name.humanize.downcase %> was created successfully.
19
+ show:
20
+ title: Show <%= class_name.humanize.titleize %>
21
+ short_title: Show
22
+ edit:
23
+ title: Edit <%= class_name.humanize.titleize %>
24
+ short_title: Edit
25
+ submit: Update <%= class_name.humanize.titleize %>
26
+ update:
27
+ flash: The <%= singular_name.humanize.downcase %> was updated successfully.
28
+ destroy:
29
+ title: Destroy <%= class_name.humanize.titleize %>
30
+ short_title: Destroy
31
+ flash: The <%= singular_name.humanize.downcase %> was destroyed successfully.
@@ -0,0 +1,2 @@
1
+ module <%= plural_class_name %>Helper
2
+ end
@@ -0,0 +1,14 @@
1
+ class Create<%= plural_class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= plural_name %> do |t|
4
+ <%- attributes.each do |attribute| -%>
5
+ t.<%= attribute.type %> :<%= attribute.name %>
6
+ <%- end -%>
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :<%= plural_name %>
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+
3
+ <%- attributes.each do |attribute| -%>
4
+ <%- if attribute.type.to_sym.eql? :belongs_to -%>
5
+ <%= "belongs_to :#{attribute.name}" %>
6
+ <%- end -%>
7
+ <%- end -%>
8
+ <%- attributes.each do |attribute| -%>
9
+ <%= gen_attr_accessible attribute %>
10
+ <%- end -%>
11
+
12
+ end
@@ -0,0 +1,7 @@
1
+ <%%= f.error_messages %>
2
+ <%- attributes.each do |attribute| -%>
3
+ <p>
4
+ <%%= f.label :<%= attribute.name %>, t('.<%= attribute.name %>') %><br />
5
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
6
+ </p>
7
+ <%- end -%>
@@ -0,0 +1,15 @@
1
+ <h1><%%=title t('.title') %></h1>
2
+ <%% form_for(@<%= singular_name %>) do |f| %>
3
+ <%%= render :partial => 'fields', :locals => { :f => f } %>
4
+ <p><%%= f.submit t('.submit') %></p>
5
+ <%% end %>
6
+ <p>
7
+ <%- if is_action_included? :show -%>
8
+ <%%= link_to t('<%= plural_name %>.show.title'), @<%= singular_name %> %> |
9
+ <%- end -%>
10
+ <%- if is_action_included? :destroy -%>
11
+ <%%= link_to t('<%= plural_name %>.destroy.title'), @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %><%- end -%> |
12
+ <%- if is_action_included? :index -%>
13
+ <%%= link_to t('<%= plural_name %>.index.title'), <%= plural_name %>_path %>
14
+ <%- end -%>
15
+ </p>
@@ -0,0 +1,36 @@
1
+ <h1><%%=title t('.title') %></h1>
2
+ <table>
3
+ <tr>
4
+ <%- attributes.each do |attribute| -%>
5
+ <th><%%=t '<%= plural_name %>.fields.<%= attribute.name %>' %></th>
6
+ <%- end -%>
7
+ <%- if is_action_included? :show -%>
8
+ <th>&nbsp;</th>
9
+ <%- end -%>
10
+ <%- if is_action_included? :edit -%>
11
+ <th>&nbsp;</th>
12
+ <%- end -%>
13
+ <%- if is_action_included? :destroy -%>
14
+ <th>&nbsp;</th>
15
+ <%- end -%>
16
+ </tr>
17
+ <%% @<%= plural_name %>.each do |<%= singular_name %>| %>
18
+ <tr>
19
+ <%- attributes.each do |attribute| -%>
20
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
21
+ <%- end -%>
22
+ <%- if is_action_included? :show -%>
23
+ <td><%%= link_to t('<%= plural_name %>.show.short_title'), <%= singular_name %> %></td>
24
+ <%- end -%>
25
+ <%- if is_action_included? :edit -%>
26
+ <td><%%= link_to t('<%= plural_name %>.edit.short_title'), edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
27
+ <%- end -%>
28
+ <%- if is_action_included? :destroy -%>
29
+ <td><%%= link_to t('<%= plural_name %>.destroy.short_title'), <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
30
+ <%- end -%>
31
+ </tr>
32
+ <%% end %>
33
+ </table>
34
+ <%- if is_action_included? :new -%>
35
+ <p><%%= link_to t('<%= plural_name %>.new.title'), new_<%= singular_name %>_path %></p>
36
+ <%- end -%>
@@ -0,0 +1,8 @@
1
+ <h1><%%=title t('.title') %></h1>
2
+ <%% form_for(@<%= singular_name %>) do |f| %>
3
+ <%%= render :partial => 'fields', :locals => { :f => f } %>
4
+ <p><%%= f.submit t('.submit') %></p>
5
+ <%% end %>
6
+ <%- if is_action_included? :index -%>
7
+ <p><%%= link_to t('<%= plural_name %>.index.title'), <%= plural_name %>_path %></p>
8
+ <%- end -%>
@@ -0,0 +1,29 @@
1
+ <h1><%%=title t('.title') %></h1>
2
+ <p>
3
+ <strong><%%=t '<%= plural_name %>.fields.id' %>:</strong>
4
+ <%%=h @<%= singular_name %>.id %>
5
+ </p>
6
+ <%- attributes.each do |attribute| -%>
7
+ <p>
8
+ <strong><%%=t '<%= plural_name %>.fields.<%= attribute.name %>' %>:</strong>
9
+ <%%=h @<%= singular_name %>.<%= attribute.name %> %>
10
+ </p>
11
+ <%- end -%>
12
+ <p>
13
+ <strong><%%=t '<%= plural_name %>.fields.created_at' %>:</strong>
14
+ <%%=l @<%= singular_name %>.created_at, :format => :long %>
15
+ </p>
16
+ <p>
17
+ <strong><%%=t '<%= plural_name %>.fields.updated_at' %>:</strong>
18
+ <%%=l @<%= singular_name %>.updated_at, :format => :long %>
19
+ </p>
20
+ <p>
21
+ <%- if is_action_included? :edit -%>
22
+ <%%= link_to t('<%= plural_name %>.edit.title'), edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
23
+ <%- end -%>
24
+ <%- if is_action_included? :destroy -%>
25
+ <%%= link_to t('<%= plural_name %>.destroy.title'), @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %><%- end -%> |
26
+ <%- if is_action_included? :index -%>
27
+ <%%= link_to t('<%= plural_name %>.index.title'), <%= plural_name %>_path %>
28
+ <%- end -%>
29
+ </p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jfs-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Stahl
@@ -24,13 +24,51 @@ extra_rdoc_files:
24
24
  - README.md
25
25
  files:
26
26
  - lib/generators.rb
27
+ - rails_generators/jfs_960/USAGE
28
+ - rails_generators/jfs_960/jfs_960_generator.rb
29
+ - rails_generators/jfs_960/templates/960.css
30
+ - rails_generators/jfs_960/templates/reset.css
31
+ - rails_generators/jfs_960/templates/text.css
32
+ - rails_generators/jfs_config/USAGE
33
+ - rails_generators/jfs_config/jfs_config_generator.rb
34
+ - rails_generators/jfs_config/templates/config.yml
35
+ - rails_generators/jfs_config/templates/load_config.rb
36
+ - rails_generators/jfs_jquery/USAGE
37
+ - rails_generators/jfs_jquery/jfs_jquery_generator.rb
38
+ - rails_generators/jfs_jquery/templates/jquery-ui.min.js
39
+ - rails_generators/jfs_jquery/templates/jquery.min.js
40
+ - rails_generators/jfs_layout/USAGE
41
+ - rails_generators/jfs_layout/jfs_layout_generator.rb
42
+ - rails_generators/jfs_layout/templates/en.yml
43
+ - rails_generators/jfs_layout/templates/helper.rb
44
+ - rails_generators/jfs_layout/templates/layout.html.erb
45
+ - rails_generators/jfs_layout/templates/stylesheet.css
27
46
  - rails_generators/jfs_model/USAGE
28
47
  - rails_generators/jfs_model/jfs_model_generator.rb
29
48
  - rails_generators/jfs_model/templates/migration.rb
30
49
  - rails_generators/jfs_model/templates/model.rb
50
+ - rails_generators/jfs_scaffold/USAGE
51
+ - rails_generators/jfs_scaffold/jfs_scaffold_generator.rb
52
+ - rails_generators/jfs_scaffold/templates/actions/create.rb
53
+ - rails_generators/jfs_scaffold/templates/actions/destroy.rb
54
+ - rails_generators/jfs_scaffold/templates/actions/edit.rb
55
+ - rails_generators/jfs_scaffold/templates/actions/index.rb
56
+ - rails_generators/jfs_scaffold/templates/actions/new.rb
57
+ - rails_generators/jfs_scaffold/templates/actions/show.rb
58
+ - rails_generators/jfs_scaffold/templates/actions/update.rb
59
+ - rails_generators/jfs_scaffold/templates/controller.rb
60
+ - rails_generators/jfs_scaffold/templates/en.yml
61
+ - rails_generators/jfs_scaffold/templates/helper.rb
62
+ - rails_generators/jfs_scaffold/templates/migration.rb
63
+ - rails_generators/jfs_scaffold/templates/model.rb
64
+ - rails_generators/jfs_scaffold/templates/views/_fields.html.erb
65
+ - rails_generators/jfs_scaffold/templates/views/edit.html.erb
66
+ - rails_generators/jfs_scaffold/templates/views/index.html.erb
67
+ - rails_generators/jfs_scaffold/templates/views/new.html.erb
68
+ - rails_generators/jfs_scaffold/templates/views/show.html.erb
31
69
  - LICENSE
32
70
  - README.md
33
- has_rdoc: false
71
+ has_rdoc: true
34
72
  homepage: http://github.com/jfs/generators
35
73
  post_install_message:
36
74
  rdoc_options: