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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- noodall-ui (0.0.3)
4
+ noodall-ui (0.0.4)
5
5
  dynamic_form
6
6
  noodall-core
7
7
  thoughtbot-sortable_table (= 0.0.6)
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ ./script/generate node Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -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,5 @@
1
+ Factory.define :<%= file_name %> do |<%= file_name %>|
2
+ <% for attribute in attributes -%>
3
+ <%= file_name %>.<%= attribute.name %> {Faker::Lorem.words(5).join(' ').titleize}
4
+ <% end -%>
5
+ end
@@ -0,0 +1,7 @@
1
+ class <%= class_name %> < Noodall::Component
2
+ <% for attribute in attributes -%>
3
+ key :<%= attribute.name %>, <%= attribute.type.to_s.classify %>
4
+ <% end -%>
5
+
6
+ allowed_positions :main, :small, :wide
7
+ 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
+
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
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