leonardo 1.8.3 → 1.8.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,7 @@
1
- 1.8.3 (November 8th, 2011) Marco Mastrodonato
2
- * Controller/sort_column => Fixed an issue with multiple tables
3
- * Dev users are now added by rake db:seed, no more by migration
1
+ 1.8.4 (November 9th, 2011) Marco Mastrodonato
2
+ * Fixed a bug in the list view when was used option --under
3
+ * Now is possible to sort also by ID
4
+ * Specs updated, all green
4
5
 
5
6
  TODO:
6
7
  * Lists: Multiple selection and multiple operation
@@ -10,6 +11,12 @@ TODO:
10
11
 
11
12
 
12
13
 
14
+ 1.8.3 (November 8th, 2011) Marco Mastrodonato
15
+ * Controller/sort_column => Fixed an issue with multiple tables
16
+ * Dev users are now added by rake db:seed, no more by migration
17
+
18
+
19
+
13
20
  1.8.2 (October 10th, 2011) Marco Mastrodonato
14
21
  * List: Added id as first column
15
22
  * Replaced String.any? with String.size>0 for ruby 1.9.2 support
@@ -6,10 +6,10 @@
6
6
  <table class='user' cellspacing='0'>
7
7
  <thead>
8
8
  <tr>
9
- <th>#</th>
9
+ <th><%%= sortable :id, '#', remote<%= ", '#{underscore_resource_path(:parent_singular_resource_plural)}_path', '#{formatted_parent_resources("@")}'" if nested? %> %></th>
10
10
  <%- attributes.each do |attribute| -%>
11
11
  <%- attr_name = case attribute.type when :references, :belongs_to then "#{attribute.name}_id" else attribute.name end -%>
12
- <th><%%= sortable :<%= attr_name %>, t('attributes.<%= singular_table_name %>.<%= attribute.name %>'), remote %></th>
12
+ <th><%%= sortable :<%= attr_name %>, t('attributes.<%= singular_table_name %>.<%= attribute.name %>'), remote<%= ", '#{underscore_resource_path(:parent_singular_resource_plural)}_path', '#{formatted_parent_resources("@")}'" if nested? %> %></th>
13
13
  <%- end -%>
14
14
  <th></th>
15
15
  <th></th>
@@ -2,6 +2,6 @@ var $dialog = $('<div></div>')
2
2
  .html("<%%= escape_javascript(render('show'))%>")
3
3
  .dialog({
4
4
  autoOpen: false,
5
- title: '<%%= "#{t('models.<%= singular_table_name %>')} #{@<%= singular_table_name %>.try(:name) || @<%= singular_table_name %>.try(:id)}"%>'
5
+ title: '<%%= "#{t('models.<%= singular_table_name %>')} #{@<%= singular_table_name %>.id}"%>'
6
6
  });
7
7
  $dialog.dialog('open');
@@ -108,12 +108,14 @@ class LeolayGenerator < Rails::Generators::Base
108
108
  inject_into_file file, :after => "module ApplicationHelper" do
109
109
  <<-FILE.gsub(/^ /, '')
110
110
 
111
- def sortable(column, title = nil, remote = nil)
111
+ def sortable(column, title = nil, remote = nil, path = nil, *params)
112
112
  column = column.to_s
113
113
  title ||= column.titleize
114
- css_class = (column == sort_column) ? "sorted \#{sort_direction}" : nil
114
+ css_class = (column == sort_column) ? "sorted #{sort_direction}" : nil
115
115
  direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc"
116
- link_to(title, {:sort => column, :direction => direction}, :remote => true, :disable_with => t(:loading), :class => css_class)
116
+ params << "{:sort => column, :direction => direction}"
117
+ path = path ? eval("#{path}(#{params.join(',')})") : {:sort => column, :direction => direction}
118
+ link_to(title, path, :remote => true, :disable_with => t(:loading), :class => css_class)
117
119
  end
118
120
  FILE
119
121
  end
@@ -162,36 +164,6 @@ class LeolayGenerator < Rails::Generators::Base
162
164
  end
163
165
  end
164
166
 
165
-
166
- #def create_admin_migration
167
- # file = "db/migrate/*_create_admin.rb"
168
- # return unless options.authentication? and Dir[file].empty?
169
- # file = file.sub('*', Time.now.strftime("%Y%m%d%H%M99"))
170
- # create_file file do
171
- # <<-FILE.gsub(/^ /, '')
172
- # class CreateAdmin < ActiveRecord::Migration
173
- # def self.up
174
- # add_column :users, :roles_mask, :integer
175
- # user=User.new :email => 'admin@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
176
- # user.roles=['admin']
177
- # user.save
178
- # user=User.new :email => 'manager@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
179
- # user.roles=['manager']
180
- # user.save
181
- # user=User.new :email => 'user@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
182
- # user.roles=['user']
183
- # user.save
184
- # end
185
- # def self.down
186
- # User.delete User.find_all_by_email(['admin@#{app_name.downcase}.com',
187
- # 'manager@#{app_name.downcase}.com',
188
- # 'user@#{app_name.downcase}.com']).map(&:id)
189
- # remove_column :users, :roles_mask
190
- # end
191
- # end
192
- # FILE
193
- # end
194
- #end
195
167
  def create_users_for_development
196
168
  return unless options.authentication?
197
169
  file = "db/seeds.rb"
@@ -72,7 +72,7 @@ module Leonardo
72
72
  def attribute_to_erb(attribute, object)
73
73
  case attribute.type
74
74
  when :boolean then "<%= #{object}.#{attribute.name} ? style_image_tag(\"ico_v.png\", :class => \"ico_true\") : style_image_tag(\"ico_x.png\", :class => \"ico_false\") %>"
75
- when :references, :belongs_to then "<%= link_to(#{object}.#{attribute.name}.try(:name) || \"#\#{#{object}.#{attribute.name}.try(:id)}\"), #{object}.#{attribute.name}, :remote => @remote) %>"
75
+ when :references, :belongs_to then "<%= link_to(#{object}.#{attribute.name}.try(:name) || \"#\#{#{object}.#{attribute.name}.try(:id)}\", #{object}.#{attribute.name}, :remote => @remote) %>"
76
76
  when :integer then "<%= number_with_delimiter #{object}.#{attribute.name} %>"
77
77
  when :decimal then "<%= number_to_currency #{object}.#{attribute.name} %>"
78
78
  when :float then "<%= number_with_precision #{object}.#{attribute.name} %>"
@@ -84,10 +84,13 @@ module Leonardo
84
84
  end
85
85
  def get_attr_to_match(view=:list)
86
86
  attributes.each do |attribute|
87
- return "have_content(#{singular_table_name}.#{attribute.name})",
88
- "have_no_content(#{singular_table_name}.#{attribute.name})" if attribute.type==:string
87
+ case attribute.type
88
+ when :string, :text then
89
+ return "have_content(#{singular_table_name}.#{attribute.name})",
90
+ "have_no_content(#{singular_table_name}.#{attribute.name})"
91
+ end
89
92
  end
90
- #If there are not string attributes
93
+ #If there are not string or text attributes
91
94
  case view
92
95
  when :list
93
96
  return "have_xpath('//table/tbody/tr')", "have_no_xpath('//table/tbody/tr')"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leonardo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 3
10
- version: 1.8.3
9
+ - 4
10
+ version: 1.8.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marco Mastrodonato
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-08 00:00:00 Z
18
+ date: 2011-11-09 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
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