leonardo 1.9.0.beta2 → 1.9.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/CHANGELOG CHANGED
@@ -1,18 +1,26 @@
1
- 1.9.0.beta2 (December 12th, 2011) Marco Mastrodonato
1
+ 1.9.0 (December 13th, 2011) Marco Mastrodonato
2
+ * Specs updated, all green.
3
+
4
+
5
+ TODO:
6
+ * Model: Create name attribute for every one that does not have
7
+ * Handle eager loading including child resources
8
+ * Add user management
9
+
10
+
11
+
12
+ 1.9.0.beta2 (December 9th, 2011) Marco Mastrodonato
2
13
  * Specs updated
3
14
  * Little improvements
4
15
 
16
+
17
+
5
18
  1.9.0.beta1 (November 30th, 2011) Marco Mastrodonato
6
19
  * Lists: Added multiple selection to combine with massive operation
7
20
  * Lists: Added copy operation to create new items from existing. It works for multiple rows as well.
8
21
  * Data forms: fields moved into new partial to share with multiple operation
9
22
  * Little improvements
10
23
 
11
- TODO:
12
- * Model: Create name attribute for every one that does not have
13
- * Handle eager loading including child resources
14
- * Add user management
15
-
16
24
 
17
25
 
18
26
  1.8.4 (November 9th, 2011) Marco Mastrodonato
@@ -79,10 +79,10 @@ module Erb
79
79
 
80
80
  def update_parent_views
81
81
  return unless nested?
82
- file = "app/views/#{plural_last_parent}/_list.erb"
82
+ file = "app/views/#{plural_last_parent}/_row_index.html.erb"
83
83
  inject_into_file file, :before => "<!-- Manage section, do not remove this tag -->" do
84
84
  <<-FILE.gsub(/^ /, '')
85
- <td><%= link_to t('models.#{plural_table_name}'), #{list_resources_path_back} %></td>
85
+ <td><%= link_to t('models.#{plural_table_name}'), #{list_resources_path_back} %></td>
86
86
 
87
87
  FILE
88
88
  end if File.exists?(file)
@@ -3,7 +3,7 @@
3
3
  <%end%>
4
4
  <%%= page_entries_info @<%= plural_table_name %>, t('models.<%= singular_table_name %>'), t('models.<%= plural_table_name %>') %>
5
5
  <%% if @<%= plural_table_name %>.any? -%>
6
- <%%= form_for :select, :url => select_<%= plural_table_name %>_path, :remote => false, :html => { :method => :post, :id => "form_select" } do |f| %>
6
+ <%%= form_for :select, :url => select_<%= list_resources_path %>, :remote => false, :html => { :method => :post, :id => "form_select" } do |f| %>
7
7
  <table class='user' cellspacing='0'>
8
8
  <thead>
9
9
  <tr>
@@ -61,10 +61,10 @@ module Leonardo
61
61
  end
62
62
  def attribute_to_requests(attribute, object_id=nil)
63
63
  object_id ||= "#{singular_table_name}_#{attribute.name}"
64
- object_id = object_id.gsub('#', "\#{#{singular_table_name}.id}")
64
+ object_id = object_id.gsub('#', "\#{#{singular_table_name}.id}").gsub('name', attribute.name)
65
65
  case attribute.type
66
66
  when :boolean then "check \"#{object_id}\" if #{singular_table_name}.#{attribute.name}"
67
- when :references, :belongs_to then "select #{singular_table_name}.#{attribute.name}.name, :from => \"#{object_id}\""
67
+ when :references, :belongs_to then "select #{singular_table_name}.#{attribute.name}.name, :from => \"#{object_id}_id\""
68
68
  when :datetime, :time, :timestamp
69
69
  then ""
70
70
  when :date then "fill_in \"#{object_id}\", :with => #{singular_table_name}.#{attribute.name}.strftime('%d-%m-%Y')"
@@ -105,22 +105,12 @@ module Leonardo
105
105
  end
106
106
  end
107
107
  def get_attr_to_check(view=:list)
108
- attribute = nil
109
108
  case view
110
109
  when :something
111
110
  else
112
- attributes.each{|a| attribute = case a.type when :string, :text then a.name end}
113
- attributes.each{|a| attribute = case a.type when :references, :belongs_to, :datetime then nil else a.name end} unless attribute
114
- #attributes.each do |attribute|
115
- # case attribute.type
116
- # when :references, :belongs_to, :datetime
117
- # else
118
- # selected_attr = attribute.name
119
- # break
120
- # end
121
- #end
111
+ attributes.each{|a| case a.type when :string, :text then return a.name end}
112
+ attributes.each{|a| case a.type when :references, :belongs_to, :datetime then nil else return a.name end}
122
113
  end
123
- attribute
124
114
  end
125
115
  def fill_form_with_values(object_id=nil)
126
116
  items = []
@@ -304,7 +294,7 @@ module Leonardo
304
294
  #product under brand/category => brand_category_products_path(product.brand, product.category)
305
295
  def list_resources_path_test(resource=nil, prefix_parent=nil)
306
296
  unless prefix_parent
307
- resource = resource || singular_table_name
297
+ resource ||= singular_table_name
308
298
  prefix_parent = "#{resource}."
309
299
  end
310
300
  "#{underscore_resource_path(:parent_singular_resource_plural)}_path(#{formatted_parent_resources(prefix_parent, "", resource)})"
@@ -314,7 +304,7 @@ module Leonardo
314
304
  #product under category => "[category, product]" or "[product.category, product]"
315
305
  #product under brand/category => "[brand, category, product]" or "[product.brand, product.category, product]"
316
306
  def show_resource_path_test(resource=nil, prefix_parent=nil, prefix_resource="")
317
- resource = resource || singular_table_name
307
+ resource ||= singular_table_name
318
308
  prefix_parent = prefix_parent || "#{resource}."
319
309
  formatted_resource_path(prefix_parent, prefix_resource, "[]", resource)
320
310
  end
@@ -323,7 +313,7 @@ module Leonardo
323
313
  #product under category => new_category_product_path(product.category)
324
314
  #product under brand/category => new_brand_category_product_path(product.brand, product.category)
325
315
  def new_resource_path_test(resource=nil, prefix_parent=nil)
326
- resource = resource || singular_table_name
316
+ resource ||= singular_table_name
327
317
  prefix_parent = prefix_parent || "#{resource}."
328
318
  "new_#{underscore_resource_path}_path(#{formatted_parent_resources(prefix_parent, "",resource)})"
329
319
  end
@@ -40,8 +40,14 @@ describe "<%= class_name.pluralize %>" do
40
40
  end
41
41
 
42
42
  it "copy several <%= plural_table_name %>" do
43
- <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2)
44
- visit <%= list_resources_path_test %>
43
+ <%- parents = []; str_parents_create = str_parents_where = "" -%>
44
+ <%- base_parent_resources.each do |parent| -%>
45
+ <%= parent %> = Factory(:<%= parent %>)
46
+ <%- parents << ":#{parent}_id => #{parent}.id" -%>
47
+ <%- end -%>
48
+ <%- str_parents_create = ", #{parents.join(', ')}" if parents.any? -%>
49
+ <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2<%= str_parents_create %>)
50
+ visit <%= list_resources_path_test("#{plural_table_name}[0]") %>
45
51
  <%= "login_view_as(:user_manager)" if authentication? -%>
46
52
  #save_and_open_page #uncomment to debug
47
53
  <%= plural_table_name %>.each do |<%= singular_table_name %>|
@@ -52,7 +58,7 @@ describe "<%= class_name.pluralize %>" do
52
58
  click_button I18n.t(:copy).upcase
53
59
  page.should have_content(I18n.t('attributes.<%= singular_table_name %>.op_copy'))
54
60
  <%= plural_table_name %>.each do |<%= singular_table_name %>|
55
- <%= fill_form_with_values("#{plural_table_name}_#_name").join(CRLF) %>
61
+ <%= fill_form_with_values("#{plural_table_name}_#_name").join(CRLF) %>
56
62
  end
57
63
  click_button I18n.t(:submit)
58
64
  page.should have_content(I18n.t(:created_multiple, :model => "#{<%= plural_table_name %>.size} #{I18n.t('models.<%= plural_table_name %>')}"))
@@ -74,8 +80,14 @@ describe "<%= class_name.pluralize %>" do
74
80
  end
75
81
 
76
82
  it "edit several <%= plural_table_name %>" do
77
- <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2)
78
- visit <%= list_resources_path_test %>
83
+ <%- parents = []; str_parents_create = str_parents_where = "" -%>
84
+ <%- base_parent_resources.each do |parent| -%>
85
+ <%= parent %> = Factory(:<%= parent %>)
86
+ <%- parents << ":#{parent}_id => #{parent}.id" -%>
87
+ <%- end -%>
88
+ <%- str_parents_create = ", #{parents.join(', ')}" if parents.any? -%>
89
+ <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2<%= str_parents_create %>)
90
+ visit <%= list_resources_path_test("#{plural_table_name}[0]") %>
79
91
  <%= "login_view_as(:user_manager)" if authentication? -%>
80
92
  #save_and_open_page #uncomment to debug
81
93
  <%= plural_table_name %>.each do |<%= singular_table_name %>|
@@ -105,8 +117,14 @@ describe "<%= class_name.pluralize %>" do
105
117
  end
106
118
 
107
119
  it "destroy several <%= plural_table_name %>" do
108
- <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2)
109
- visit <%= list_resources_path_test %>
120
+ <%- parents = []; str_parents_create = str_parents_where = "" -%>
121
+ <%- base_parent_resources.each do |parent| -%>
122
+ <%= parent %> = Factory(:<%= parent %>)
123
+ <%- parents << ":#{parent}_id => #{parent}.id" -%>
124
+ <%- end -%>
125
+ <%- str_parents_create = ", #{parents.join(', ')}" if parents.any? -%>
126
+ <%= plural_table_name %> = FactoryGirl.create_list(:<%= singular_table_name %>, 2<%= str_parents_create %>)
127
+ visit <%= list_resources_path_test("#{plural_table_name}[0]") %>
110
128
  <%= "login_view_as(:user_manager)" if authentication? -%>
111
129
  #save_and_open_page #uncomment to debug
112
130
  <%= plural_table_name %>.each do |<%= singular_table_name %>|
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leonardo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196247
5
- prerelease: 6
4
+ hash: 51
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 9
9
9
  - 0
10
- - beta
11
- - 2
12
- version: 1.9.0.beta2
10
+ version: 1.9.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Marco Mastrodonato
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2011-12-09 00:00:00 Z
18
+ date: 2011-12-13 00:00:00 Z
21
19
  dependencies: []
22
20
 
23
21
  description: A generator for creating Rails 3.1 applications ready to go. It generates the layout, the style, the internationalization and manage external gems for authentication, authorization and other. It also provides a customized scaffold to generates cool sites ajax ready in few minutes. If you find a bug please report to m.mastrodonato@gmail.com
@@ -166,14 +164,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
164
  required_rubygems_version: !ruby/object:Gem::Requirement
167
165
  none: false
168
166
  requirements:
169
- - - ">"
167
+ - - ">="
170
168
  - !ruby/object:Gem::Version
171
- hash: 25
169
+ hash: 3
172
170
  segments:
173
- - 1
174
- - 3
175
- - 1
176
- version: 1.3.1
171
+ - 0
172
+ version: "0"
177
173
  requirements:
178
174
  - Start a new app with the template.rb from github or inside root folder
179
175
  rubyforge_project: