noodall-ui 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/generators/noodall/component/USAGE +8 -0
- data/lib/generators/noodall/component/component_generator.rb +19 -0
- data/lib/generators/noodall/component/templates/admin_template.html.erb +12 -0
- data/lib/generators/noodall/component/templates/factory.rb +5 -0
- data/lib/generators/noodall/component/templates/model.rb +7 -0
- data/lib/generators/noodall/component/templates/template.html.erb +11 -0
- data/lib/noodall/ui/version.rb +1 -1
- metadata +9 -3
data/Gemfile.lock
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Noodall
|
2
|
+
class ComponentGenerator < Rails::Generators::NamedBase
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
5
|
+
|
6
|
+
#check_class_collision
|
7
|
+
|
8
|
+
class_option :root, :type => :boolean, :default => false, :desc => "Can be a root node"
|
9
|
+
class_option :factory, :type => :boolean, :default => true, :desc => "Include Factory Girl factory"
|
10
|
+
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
|
11
|
+
|
12
|
+
def create_node_files
|
13
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
14
|
+
template "template.html.erb", "app/views/components/_#{file_name}.html.erb"
|
15
|
+
template "admin_template.html.erb", "app/views/admin/components/_#{file_name}.html.erb"
|
16
|
+
template "factory.rb", "spec/factories/#{file_name}.rb" if options.factory?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%%= fields_for :node do |n| %>
|
2
|
+
<%%= n.fields_for slot_name, component do |f| %>
|
3
|
+
|
4
|
+
<%%= f.hidden_field :_type %>
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
<p>
|
7
|
+
<%%= f.label :<%= attribute.name %> %><br/>
|
8
|
+
<span class="input-wrap"><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %></span>
|
9
|
+
</p>
|
10
|
+
<% end -%>
|
11
|
+
<%% end
|
12
|
+
end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div id="<%%= slot_code %>" class="component promo <%%= 'double' if expand %> <%%= additional_classes %>">
|
2
|
+
<% unless attributes.empty? %>
|
3
|
+
<dl>
|
4
|
+
<% for attribute in attributes -%>
|
5
|
+
<dt><%= attribute.name.titleize %></dt>
|
6
|
+
<dd><%%= component.<%= attribute.name %>%></dd>
|
7
|
+
<% end -%>
|
8
|
+
</dl>
|
9
|
+
<% end -%>
|
10
|
+
</div>
|
11
|
+
|
data/lib/noodall/ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steve England
|
@@ -230,6 +230,12 @@ files:
|
|
230
230
|
- generators/node/templates/template.html.erb
|
231
231
|
- generators/node_features/USAGE
|
232
232
|
- generators/node_features/node_features_generator.rb
|
233
|
+
- lib/generators/noodall/component/USAGE
|
234
|
+
- lib/generators/noodall/component/component_generator.rb
|
235
|
+
- lib/generators/noodall/component/templates/admin_template.html.erb
|
236
|
+
- lib/generators/noodall/component/templates/factory.rb
|
237
|
+
- lib/generators/noodall/component/templates/model.rb
|
238
|
+
- lib/generators/noodall/component/templates/template.html.erb
|
233
239
|
- lib/generators/noodall/node/USAGE
|
234
240
|
- lib/generators/noodall/node/node_generator.rb
|
235
241
|
- lib/generators/noodall/node/templates/admin_template.html.erb
|