formgen 0.3.4 → 0.4.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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/formgen.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{formgen}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Pullmonkey"]
|
12
|
-
s.date = %q{2011-12-
|
12
|
+
s.date = %q{2011-12-22}
|
13
13
|
s.description = %q{Ruby on Rails form generator based on has_many and belongs_to associations. Includes the helpers and javascript for adding and removing fields_for form attributes.}
|
14
14
|
s.email = %q{info@skizmo.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/generators/skizmo/form/templates/edit.html.erb",
|
36
36
|
"lib/generators/skizmo/form/templates/edit.html.haml",
|
37
37
|
"lib/generators/skizmo/form/templates/helper.rb",
|
38
|
+
"lib/generators/skizmo/form/templates/index.html.haml",
|
38
39
|
"lib/generators/skizmo/form/templates/javascript.js",
|
39
40
|
"lib/generators/skizmo/form/templates/new.html.erb",
|
40
41
|
"lib/generators/skizmo/form/templates/new.html.haml",
|
@@ -9,6 +9,8 @@ module Skizmo
|
|
9
9
|
:description => "Update helpers to add link_to_add and link_to_remove methods if there are has_many associations, as well as a setup method for building objects required for nested attribute associations and for building selectable lists for select boxes"
|
10
10
|
class_option :select_boxes, :type => :boolean, :default => true,
|
11
11
|
:description => "Generates select box selections for belongs_to and has_many associations that are not accepted as nested_attributes"
|
12
|
+
class_option :index_view, :type => :boolean, :default => false,
|
13
|
+
:description => "Generate index view for the model"
|
12
14
|
|
13
15
|
def generate_form
|
14
16
|
unless nested_has_many_classes.empty?
|
@@ -18,6 +20,7 @@ module Skizmo
|
|
18
20
|
unless nested_classes_with_attributes.empty? and non_nested_has_many_classes.empty? and non_nested_belongs_to_classes.empty?
|
19
21
|
template "setup_helper.rb", "app/helpers/#{file_name}_setup_helper.rb" if options.helpers?
|
20
22
|
end
|
23
|
+
template "index.html.#{engine}", "app/views/#{file_name.pluralize}/index.html.#{engine}" if options.index_view?
|
21
24
|
template "new.html.#{engine}", "app/views/#{file_name.pluralize}/new.html.#{engine}"
|
22
25
|
template "edit.html.#{engine}", "app/views/#{file_name.pluralize}/edit.html.#{engine}"
|
23
26
|
@have_attachment_string = have_attachments? ? ", :html => { :multipart => true }" : ""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
%h1 <%= name.pluralize.underscore.gsub("_", " ").camelize %>
|
2
|
+
|
3
|
+
%table
|
4
|
+
%tr
|
5
|
+
<% attributes_worth_using_in_the_form.each do |att| -%>
|
6
|
+
%th <%= att.humanize %>
|
7
|
+
<% end -%>
|
8
|
+
%th{:colspan => "2"}
|
9
|
+
|
10
|
+
- @<%= cls.to_s.pluralize.underscore %>.each do |<%= cls.to_s.underscore %>|
|
11
|
+
%tr
|
12
|
+
<% attributes_worth_using_in_the_form.each do |att| -%>
|
13
|
+
%td= <%= cls.to_s.underscore %>.<%= att %>
|
14
|
+
<% end -%>
|
15
|
+
%td= link_to "Edit", edit_<%= cls.to_s.underscore %>_path(<%= cls.to_s.underscore %>), {:title => 'Edit <%= name.underscore.gsub("_"," ") %>'}
|
16
|
+
%td= link_to "Delete", <%= cls.to_s.underscore %>, {:title => 'Remove <%= name.underscore.gsub("_"," ") %>'}, {:confirm => 'Are you sure?', :method => :delete}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 3
|
9
8
|
- 4
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pullmonkey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/generators/skizmo/form/templates/edit.html.erb
|
107
107
|
- lib/generators/skizmo/form/templates/edit.html.haml
|
108
108
|
- lib/generators/skizmo/form/templates/helper.rb
|
109
|
+
- lib/generators/skizmo/form/templates/index.html.haml
|
109
110
|
- lib/generators/skizmo/form/templates/javascript.js
|
110
111
|
- lib/generators/skizmo/form/templates/new.html.erb
|
111
112
|
- lib/generators/skizmo/form/templates/new.html.haml
|