leonardo 1.8.4 → 1.9.0.beta1
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 +11 -5
- data/lib/generators/erb/leosca/leosca_generator.rb +1 -1
- data/lib/generators/erb/leosca/templates/_fields.html.erb +17 -0
- data/lib/generators/erb/leosca/templates/_form.html.erb +1 -17
- data/lib/generators/erb/leosca/templates/_form_multiple.html.erb +10 -0
- data/lib/generators/erb/leosca/templates/_list.erb +35 -24
- data/lib/generators/erb/leosca/templates/_row_index.html.erb +23 -0
- data/lib/generators/erb/leosca/templates/copy.html.erb +7 -0
- data/lib/generators/erb/leosca/templates/edit_multiple.html.erb +7 -0
- data/lib/generators/erb/leosca/templates/formtastic/_fields.html.erb +16 -0
- data/lib/generators/erb/leosca/templates/formtastic/_form.html.erb +1 -16
- data/lib/generators/erb/leosca/templates/formtastic/_form_multiple.html.erb +10 -0
- data/lib/generators/erb/leosca/templates/index.html.erb +1 -1
- data/lib/generators/erb/leosca/templates/select.js.erb +28 -0
- data/lib/generators/erb/leosca/templates/show.js.erb +2 -0
- data/lib/generators/leolay/leolay_generator.rb +15 -9
- data/lib/generators/leolay/templates/app/assets/javascripts/custom.js +23 -5
- data/lib/generators/leolay/templates/{layout_helper.rb → app/helpers/layout_helper.rb} +15 -0
- data/lib/generators/leolay/templates/config/locales/devise.en.yml +1 -1
- data/lib/generators/leolay/templates/config/locales/en.yml +12 -5
- data/lib/generators/leolay/templates/config/locales/it.yml +11 -1
- data/lib/generators/leolay/templates/styles/cloudy/images/style/Thumbs.db +0 -0
- data/lib/generators/leolay/templates/styles/cloudy/images/style/button_120_98.png +0 -0
- data/lib/generators/leolay/templates/styles/cloudy/stylesheets/app/stylesheet.sass +17 -12
- data/lib/generators/rails/leosca/leosca_generator.rb +9 -1
- data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +2 -0
- data/lib/generators/rails/leosca_controller/templates/controller.rb +68 -0
- metadata +27 -14
- data/lib/generators/leolay/templates/styles/cloudy/images/style/bg_but_gray.png +0 -0
data/CHANGELOG
CHANGED
@@ -1,16 +1,22 @@
|
|
1
|
-
1.
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
1
|
+
1.9.0.beta1 (November 30th, 2011) Marco Mastrodonato
|
2
|
+
* Lists: Added multiple selection to combine with massive operation
|
3
|
+
* Lists: Added copy operation to create new items from existing. It works for multiple rows as well.
|
4
|
+
* Data forms: fields moved into new partial to share with multiple operation
|
5
5
|
|
6
6
|
TODO:
|
7
|
-
* Lists: Multiple selection and multiple operation
|
8
7
|
* Model: Create name attribute for every one that does not have
|
9
8
|
* Handle eager loading including child resources
|
10
9
|
* Add user management
|
11
10
|
|
12
11
|
|
13
12
|
|
13
|
+
1.8.4 (November 9th, 2011) Marco Mastrodonato
|
14
|
+
* Fixed a bug in the list view when was used option --under
|
15
|
+
* Now is possible to sort also by ID
|
16
|
+
* Specs updated, all green
|
17
|
+
|
18
|
+
|
19
|
+
|
14
20
|
1.8.3 (November 8th, 2011) Marco Mastrodonato
|
15
21
|
* Controller/sort_column => Fixed an issue with multiple tables
|
16
22
|
* Dev users are now added by rake db:seed, no more by migration
|
@@ -92,7 +92,7 @@ module Erb
|
|
92
92
|
|
93
93
|
#Override
|
94
94
|
def available_views
|
95
|
-
%w(index edit show new _form
|
95
|
+
%w(index edit edit_multiple copy show new _form _form_multiple _fields destroy _show _list _row_index select)
|
96
96
|
end
|
97
97
|
|
98
98
|
def filenames_all_formats(name, paths=[], formats=[:html, :js, nil])
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%- attributes.each do |attribute| -%>
|
2
|
+
<div class="field">
|
3
|
+
<%%= f.label :<%= attribute.name %>, t('attributes.<%= singular_table_name %>.<%= attribute.name %>') %><br />
|
4
|
+
<%- case attribute.type
|
5
|
+
when :references, :belongs_to -%>
|
6
|
+
<%% if @<%= singular_table_name %>.new_record? -%>
|
7
|
+
<%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.classify %>.all, :id, :name, :prompt => true if can?(:manage, <%=class_name %>) %>
|
8
|
+
<%% else -%>
|
9
|
+
<%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.classify %>.all, :id, :name, :prompt => true %>
|
10
|
+
<%% end -%>
|
11
|
+
<%- when :date -%>
|
12
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> <%=", :class => \"calendar\"" if jquery_ui?%> %>
|
13
|
+
<%- else -%>
|
14
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
15
|
+
<%- end -%>
|
16
|
+
</div>
|
17
|
+
<%- end -%>
|
@@ -11,23 +11,7 @@
|
|
11
11
|
</div>
|
12
12
|
<%% end %>
|
13
13
|
|
14
|
-
|
15
|
-
<div class="field">
|
16
|
-
<%%= f.label :<%= attribute.name %>, t('attributes.<%= singular_table_name %>.<%= attribute.name %>') %><br />
|
17
|
-
<%- case attribute.type
|
18
|
-
when :references, :belongs_to -%>
|
19
|
-
<%% if @<%= singular_table_name %>.new_record? -%>
|
20
|
-
<%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.classify %>.all, :id, :name, :prompt => true if can?(:manage, <%=class_name %>) %>
|
21
|
-
<%% else -%>
|
22
|
-
<%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.classify %>.all, :id, :name, :prompt => true %>
|
23
|
-
<%% end -%>
|
24
|
-
<%- when :date -%>
|
25
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> <%=", :class => \"calendar\"" if jquery_ui?%> %>
|
26
|
-
<%- else -%>
|
27
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
28
|
-
<%- end -%>
|
29
|
-
</div>
|
30
|
-
<%- end -%>
|
14
|
+
<%%= render 'fields', :f => f %>
|
31
15
|
<div class="actions">
|
32
16
|
<%%= f.submit :class => 'button large' %>
|
33
17
|
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%%= form_for(:<%= plural_table_name %>, :url => path, :method => :put) do |f| %>
|
2
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
3
|
+
<%%= f.fields_for "#{<%= singular_table_name %>.id}", <%= singular_table_name %> do |f_<%= singular_table_name %>| %>
|
4
|
+
<%%= render 'fields', :f => f_<%= singular_table_name %> %>
|
5
|
+
<%% end %>
|
6
|
+
<%% end %>
|
7
|
+
<div class="actions">
|
8
|
+
<%%= f.submit :class => 'button large' %>
|
9
|
+
</div>
|
10
|
+
<%% end %>
|
@@ -1,12 +1,16 @@
|
|
1
|
-
|
1
|
+
<%if pagination?%>
|
2
2
|
<%%= paginate @<%= plural_table_name %>, :remote => remote %>
|
3
|
-
|
4
|
-
|
3
|
+
<%end%>
|
4
|
+
<%%= page_entries_info @<%= plural_table_name %>, t('models.<%= singular_table_name %>'), t('models.<%= plural_table_name %>') %>
|
5
5
|
|
6
|
+
<%%= form_for :select, :url => select_<%= plural_table_name %>_path, :remote => false, :html => { :method => :post, :id => "form_select" } do |f| %>
|
6
7
|
<table class='user' cellspacing='0'>
|
7
8
|
<thead>
|
8
9
|
<tr>
|
9
|
-
<th
|
10
|
+
<th>
|
11
|
+
<%%= check_box_tag nil, nil, false, :class => "selector" %>
|
12
|
+
<%%= sortable :id, '#', remote<%= ", '#{underscore_resource_path(:parent_singular_resource_plural)}_path', '#{formatted_parent_resources("@")}'" if nested? %> %>
|
13
|
+
</th>
|
10
14
|
<%- attributes.each do |attribute| -%>
|
11
15
|
<%- attr_name = case attribute.type when :references, :belongs_to then "#{attribute.name}_id" else attribute.name end -%>
|
12
16
|
<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>
|
@@ -19,32 +23,39 @@
|
|
19
23
|
<tbody>
|
20
24
|
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| -%>
|
21
25
|
<tr id="tr<%%= <%= singular_table_name %>.id %>" class="<%%= cycle("odd", "even")%>">
|
22
|
-
|
23
|
-
<%- attributes.each do |attribute| -%>
|
24
|
-
<td><%= attribute_to_erb(attribute, singular_table_name) -%></td>
|
25
|
-
<%- end -%>
|
26
|
-
<!-- Manage section, do not remove this tag -->
|
27
|
-
<td><%%= link_to t(:show), <%= show_resource_path %><%= ", :remote => remote" if jquery_ui? %> %></td>
|
28
|
-
<%- if authorization? -%>
|
29
|
-
<%%- if can? :update, <%= singular_table_name %> -%>
|
30
|
-
<%- end -%>
|
31
|
-
<td><%%= link_to t(:edit), <%= edit_resource_path %> %></td>
|
32
|
-
<%- if authorization? -%>
|
33
|
-
<%%- end -%>
|
34
|
-
<%- end -%>
|
35
|
-
<%- if authorization? -%>
|
36
|
-
<%%- if can? :destroy, <%= singular_table_name %> -%>
|
37
|
-
<%- end -%>
|
38
|
-
<td><%%= link_to t(:destroy), <%= destroy_resource_path %>, <%= key_value :confirm, "t(:sure?)" %>, <%= key_value :method, ":delete" %>, :remote => remote %></td>
|
39
|
-
<%- if authorization? -%>
|
40
|
-
<%%- end -%>
|
41
|
-
<%- end -%>
|
26
|
+
<%%= render 'row_index', :<%= singular_table_name %> => <%= singular_table_name %>, :remote => remote, :message => "" %>
|
42
27
|
</tr>
|
43
28
|
<%% end -%>
|
44
29
|
</tbody>
|
45
30
|
</table>
|
46
31
|
|
47
32
|
<div class="separator"></div>
|
33
|
+
<div style="clear:both;">
|
34
|
+
<%- if authorization? -%>
|
35
|
+
<%%- if can? :destroy, <%= class_name %> -%>
|
36
|
+
<%- end -%>
|
37
|
+
<%%= f.submit t(:destroy).upcase, <%= key_value :confirm, "t(:sure?)" %>, :class=>'button small' %>
|
38
|
+
<%- if authorization? -%>
|
39
|
+
<%%- end -%>
|
40
|
+
<%- end -%>
|
41
|
+
<%- if authorization? -%>
|
42
|
+
<%%- if can? :update, <%= class_name %> -%>
|
43
|
+
<%- end -%>
|
44
|
+
<%%= f.submit t(:edit).upcase, {:class=>'button small'} %>
|
45
|
+
<%- if authorization? -%>
|
46
|
+
<%%- end -%>
|
47
|
+
<%- end -%>
|
48
|
+
<%- if authorization? -%>
|
49
|
+
<%%- if can? :create, <%= class_name %> -%>
|
50
|
+
<%- end -%>
|
51
|
+
<%%= f.submit t(:copy).upcase, {:class=>'button small'} %>
|
52
|
+
<%- if authorization? -%>
|
53
|
+
<%%- end -%>
|
54
|
+
<%- end -%>
|
55
|
+
</div>
|
56
|
+
<%% end -%>
|
57
|
+
<div class="separator"></div>
|
58
|
+
|
48
59
|
<%- if pagination? -%>
|
49
60
|
<%%= paginate @<%= plural_table_name %>, :remote => remote %>
|
50
61
|
<%- end -%>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<td>
|
2
|
+
<%%= check_box_tag "ids[]", <%= singular_table_name %>.id, false, {:id =>"check#{<%= singular_table_name %>.id}", :class => "selectable"} %>
|
3
|
+
<%%= number_with_delimiter <%= singular_table_name %>.id %>
|
4
|
+
</td>
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<td><%= attribute_to_erb(attribute, singular_table_name) -%></td>
|
7
|
+
<%- end -%>
|
8
|
+
<!-- Manage section, do not remove this tag -->
|
9
|
+
<td><%%= link_to t(:show), <%= show_resource_path %><%= ", :remote => remote" if jquery_ui? %> %></td>
|
10
|
+
<%- if authorization? -%>
|
11
|
+
<%%- if can? :update, <%= singular_table_name %> -%>
|
12
|
+
<%- end -%>
|
13
|
+
<td><%%= link_to t(:edit), <%= edit_resource_path %> %></td>
|
14
|
+
<%- if authorization? -%>
|
15
|
+
<%%- end -%>
|
16
|
+
<%- end -%>
|
17
|
+
<%- if authorization? -%>
|
18
|
+
<%%- if can? :destroy, <%= singular_table_name %> -%>
|
19
|
+
<%- end -%>
|
20
|
+
<td><%%= link_to t(:destroy), <%= destroy_resource_path %>, <%= key_value :confirm, "t(:sure?)" %>, <%= key_value :method, ":delete" %>, :remote => remote %></td>
|
21
|
+
<%- if authorization? -%>
|
22
|
+
<%%- end -%>
|
23
|
+
<%- end -%>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%% secondary_navigation({:value => link_to(t(:list), <%= list_resources_path %>)},
|
2
|
+
({:value => link_to(t(:add), <%= new_resource_path %>)}<%= " if can?(:create, #{class_name})" if authorization? %>)
|
3
|
+
) %>
|
4
|
+
|
5
|
+
<%% title t('attributes.<%= singular_table_name %>.op_copy') %>
|
6
|
+
|
7
|
+
<%%= render 'form_multiple', :path => create_multiple_<%= list_resources_path %> %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%% secondary_navigation({:value => link_to(t(:list), <%= list_resources_path %>)},
|
2
|
+
({:value => link_to(t(:add), <%= new_resource_path %>)}<%= " if can?(:create, #{class_name})" if authorization? %>)
|
3
|
+
) %>
|
4
|
+
|
5
|
+
<%% title t('attributes.<%= singular_table_name %>.op_edit_multiple') %>
|
6
|
+
|
7
|
+
<%%= render 'form_multiple', :path => update_multiple_<%= list_resources_path %> %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%%= f.inputs do %>
|
2
|
+
<%- attributes.each do |attribute| -%>
|
3
|
+
<%- case attribute.type
|
4
|
+
when :references, :belongs_to -%>
|
5
|
+
<%% if @<%= singular_table_name %>.new_record? -%>
|
6
|
+
<%%= f.input :<%= attribute.name %> if can?(:manage, <%=class_name %>) %>
|
7
|
+
<%% else -%>
|
8
|
+
<%%= f.input :<%= attribute.name %> %>
|
9
|
+
<%% end -%>
|
10
|
+
<%- when :date -%>
|
11
|
+
<%%= f.input :<%= attribute.name %>, :as => :string, :input_html => { :class => 'calendar', :maxlength => 10 } %>
|
12
|
+
<%- else -%>
|
13
|
+
<%%= f.input :<%= attribute.name %> %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- end -%>
|
16
|
+
<%% end %>
|
@@ -1,20 +1,5 @@
|
|
1
1
|
<%%= semantic_form_for(<%= form_resource_path %>) do |f| %>
|
2
|
-
<%%= f
|
3
|
-
<%- attributes.each do |attribute| -%>
|
4
|
-
<%- case attribute.type
|
5
|
-
when :references, :belongs_to -%>
|
6
|
-
<%% if @<%= singular_table_name %>.new_record? -%>
|
7
|
-
<%%= f.input :<%= attribute.name %> if can?(:manage, <%=class_name %>) %>
|
8
|
-
<%% else -%>
|
9
|
-
<%%= f.input :<%= attribute.name %> %>
|
10
|
-
<%% end -%>
|
11
|
-
<%- when :date -%>
|
12
|
-
<%%= f.input :<%= attribute.name %>, :as => :string, :input_html => { :class => 'calendar', :maxlength => 10 } %>
|
13
|
-
<%- else -%>
|
14
|
-
<%%= f.input :<%= attribute.name %> %>
|
15
|
-
<%- end -%>
|
16
|
-
<%- end -%>
|
17
|
-
<%% end %>
|
2
|
+
<%%= render 'fields', :f => f %>
|
18
3
|
<%%= f.buttons do %>
|
19
4
|
<%%= f.commit_button :button_html => { :class => "button large" } %>
|
20
5
|
<%% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%%= semantic_form_for(:<%= plural_table_name %>, :url => path, :method => :put) do |f| %>
|
2
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
3
|
+
<%%= f.semantic_fields_for "#{<%= singular_table_name %>.id}", <%= singular_table_name %> do |f_<%= singular_table_name %>| %>
|
4
|
+
<%%= render 'fields', :f => f_<%= singular_table_name %> %>
|
5
|
+
<%% end %>
|
6
|
+
<%% end %>
|
7
|
+
<%%= f.buttons do %>
|
8
|
+
<%%= f.commit_button :button_html => { :class => "button large" } %>
|
9
|
+
<%% end %>
|
10
|
+
<%% end %>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<%- when :text -%>
|
31
31
|
<%%= f.text_field :<%= attribute.name %> %>
|
32
32
|
<%- when :date -%>
|
33
|
-
<%%= f.text_field :<%= attribute.name
|
33
|
+
<%%= f.text_field :<%= attribute.name %>, :class => "autosubmit<%=" calendar" if jquery_ui? %>"
|
34
34
|
<%- else -%>
|
35
35
|
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
36
36
|
<%- end -%>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%% @results.each do |key, value| -%>
|
2
|
+
<%% result, msg = value %>
|
3
|
+
var id = "#tr<%%= key %>";
|
4
|
+
<%% case @operation %>
|
5
|
+
<%% when :destroy %>
|
6
|
+
$(id).hide('fast').text('');
|
7
|
+
<%% when :edit %>
|
8
|
+
//$(id).effect("highlight", {}, 3000);
|
9
|
+
<%% @<%= singular_table_name %> = @<%= plural_table_name %>.find(key) %>
|
10
|
+
var $dialog = $('<div></div>')
|
11
|
+
.html("<%%= escape_javascript(render('form'))%>")
|
12
|
+
.dialog({
|
13
|
+
autoOpen: false,
|
14
|
+
minHeight: 400,
|
15
|
+
minWidth: 700,
|
16
|
+
title: '<%%= "#{t('models.<%= singular_table_name %>')} #{key}"%>'
|
17
|
+
});
|
18
|
+
$dialog.dialog('open');
|
19
|
+
<%% else %>
|
20
|
+
//Other operations which updates the row
|
21
|
+
$(id).html("<%%= escape_javascript(render('row_index', :<%= singular_table_name %> => @<%= plural_table_name %>.find(key), :remote => true, :message => msg ))%>");
|
22
|
+
<%% if result -%>
|
23
|
+
$(id).removeClass('error').addClass('operation done');
|
24
|
+
<%% else -%>
|
25
|
+
$(id).removeClass('done').addClass('operation error');
|
26
|
+
<%% end -%>
|
27
|
+
<%% end %>
|
28
|
+
<%% end -%>
|
@@ -2,6 +2,8 @@ var $dialog = $('<div></div>')
|
|
2
2
|
.html("<%%= escape_javascript(render('show'))%>")
|
3
3
|
.dialog({
|
4
4
|
autoOpen: false,
|
5
|
+
minHeight: 200,
|
6
|
+
minWidth: 400,
|
5
7
|
title: '<%%= "#{t('models.<%= singular_table_name %>')} #{@<%= singular_table_name %>.id}"%>'
|
6
8
|
});
|
7
9
|
$dialog.dialog('open');
|
@@ -16,7 +16,7 @@ class LeolayGenerator < Rails::Generators::Base
|
|
16
16
|
|
17
17
|
template "styles/#{style_name}/stylesheets/app/stylesheet.sass", "app/assets/stylesheets/#{style_name}.sass"
|
18
18
|
|
19
|
-
copy_file "layout_helper.rb", "app/helpers/layout_helper.rb"
|
19
|
+
copy_file "app/helpers/layout_helper.rb", "app/helpers/layout_helper.rb"
|
20
20
|
|
21
21
|
copy_file "styles/#{style_name}/views/layout/application.html.erb", "app/views/layouts/application.html.erb", :force => true
|
22
22
|
template "styles/#{style_name}/views/layout/_layout.html.erb", "app/views/layouts/_#{style_name}.html.erb"
|
@@ -111,10 +111,10 @@ class LeolayGenerator < Rails::Generators::Base
|
|
111
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
|
114
|
+
css_class = (column == sort_column) ? "sorted \#{sort_direction}" : nil
|
115
115
|
direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc"
|
116
116
|
params << "{:sort => column, :direction => direction}"
|
117
|
-
path = path ? eval("
|
117
|
+
path = path ? eval("#\{path}(\#{params.join(',')})") : {:sort => column, :direction => direction}
|
118
118
|
link_to(title, path, :remote => true, :disable_with => t(:loading), :class => css_class)
|
119
119
|
end
|
120
120
|
FILE
|
@@ -227,12 +227,18 @@ class LeolayGenerator < Rails::Generators::Base
|
|
227
227
|
|
228
228
|
if options.jquery_ui?
|
229
229
|
file = "#{app_path}/custom.js"
|
230
|
-
append_file file do
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
230
|
+
#append_file file do
|
231
|
+
# <<-FILE.gsub(/^ /, '')
|
232
|
+
#
|
233
|
+
# $(function (){
|
234
|
+
# $('.calendar').datepicker();
|
235
|
+
# });
|
236
|
+
# FILE
|
237
|
+
#end
|
238
|
+
inject_into_file file, :after => "$(document).ready(function() {" do
|
239
|
+
<<-FILE.gsub(/^ /, '')
|
240
|
+
|
241
|
+
$('.calendar').datepicker();
|
236
242
|
FILE
|
237
243
|
end
|
238
244
|
|
@@ -1,8 +1,26 @@
|
|
1
1
|
// Leonardo
|
2
|
-
//
|
2
|
+
// Use this file to add your javascript
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
$(document).ready(function() {
|
5
|
+
//Add this class to an input form to auto submit on change
|
6
|
+
$('.autosubmit').live('change', function() {
|
7
|
+
setTimeout("$('#"+this.id+"').parents('form:first').submit();", 300);
|
8
|
+
return false;
|
9
|
+
});
|
10
|
+
$('.selectable').live('change', function() {
|
11
|
+
if ($(this).is(':checked')) {
|
12
|
+
$(this).parents('tr').addClass('selected');
|
13
|
+
} else {
|
14
|
+
$(this).parents('tr').removeClass('selected');
|
15
|
+
}
|
16
|
+
});
|
17
|
+
$('.selector').live('change', function() {
|
18
|
+
$(".selectable").attr('checked', $(this).is(':checked')).each(function(){
|
19
|
+
if ($(this).is(':checked')) {
|
20
|
+
$(this).parents('tr').addClass('selected');
|
21
|
+
} else {
|
22
|
+
$(this).parents('tr').removeClass('selected');
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
8
26
|
});
|
@@ -36,4 +36,19 @@ module LayoutHelper
|
|
36
36
|
def style_image_tag(name,args={})
|
37
37
|
image_tag("styles/#{CONFIG[:default_style]}/#{name}",args)
|
38
38
|
end
|
39
|
+
|
40
|
+
#Show search informations
|
41
|
+
def page_entries_info(collection, singular_model_name, plural_model_name=nil)
|
42
|
+
html = ""
|
43
|
+
html << content_tag(:div, nil, :class => "separator")
|
44
|
+
html << content_tag(:span, :class => "page_info") do
|
45
|
+
if collection.any?
|
46
|
+
t(:search_found, :found => pluralize(collection.total_count, singular_model_name, (plural_model_name || singular.pluralize)))
|
47
|
+
else
|
48
|
+
t(:search_not_found)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
html << content_tag(:div, nil, :class => "separator")
|
52
|
+
html.html_safe
|
53
|
+
end
|
39
54
|
end
|
@@ -181,7 +181,7 @@ en:
|
|
181
181
|
submit:
|
182
182
|
create: "Create %{model}"
|
183
183
|
update: "Update %{model}"
|
184
|
-
submit: "
|
184
|
+
submit: "Proceed"
|
185
185
|
|
186
186
|
activerecord: &activerecord
|
187
187
|
models: &models
|
@@ -190,10 +190,7 @@ en:
|
|
190
190
|
created_at: "Created at"
|
191
191
|
updated_at: "Updated at"
|
192
192
|
#Attributes zone - do not remove
|
193
|
-
|
194
|
-
submit:
|
195
|
-
create: "Create %{model}"
|
196
|
-
update: "Update %{model}"
|
193
|
+
|
197
194
|
formtastic:
|
198
195
|
titles:
|
199
196
|
labels:
|
@@ -202,6 +199,7 @@ en:
|
|
202
199
|
actions: &actions
|
203
200
|
create: "Create %{model}"
|
204
201
|
update: "Save changes"
|
202
|
+
submit: "Proceed"
|
205
203
|
authentication:
|
206
204
|
sign_in: "Sign in"
|
207
205
|
sign_in_with: "Sign in with"
|
@@ -225,9 +223,18 @@ en:
|
|
225
223
|
permission_denied: "You don't have authorization to perform this request."
|
226
224
|
created: "%{model} was successfully created."
|
227
225
|
created_ko: "An error prohibited %{model} to be created."
|
226
|
+
created_multiple: "%{model} were successfully created."
|
227
|
+
created_multiple_ko: "An error prohibited %{model} to be created."
|
228
228
|
updated: "%{model} was successfully updated."
|
229
229
|
updated_ko: "An error prohibited %{model} to be updated."
|
230
|
+
updated_multiple: "%{model} were successfully updated."
|
231
|
+
updated_multiple_ko: "An error prohibited %{model} to be updated."
|
230
232
|
deleted: "%{model} was successfully deleted."
|
233
|
+
deleted_multiple: "%{model} were successfully deleted."
|
234
|
+
deleted_multiple_ko: "An error prohibited %{model} to be deleted."
|
235
|
+
search_found: "%{found} found"
|
236
|
+
search_not_found: "The search did not get any results"
|
237
|
+
select_rows_from_list: "Select the rows from the list before proceeding"
|
231
238
|
|
232
239
|
<<: *activerecord
|
233
240
|
<<: *actions
|
@@ -179,7 +179,7 @@ it:
|
|
179
179
|
submit:
|
180
180
|
create: "Crea %{model}"
|
181
181
|
update: "Aggiorna %{model}"
|
182
|
-
submit: "
|
182
|
+
submit: "Procedi"
|
183
183
|
|
184
184
|
activerecord: &activerecord
|
185
185
|
models: &models
|
@@ -228,6 +228,7 @@ it:
|
|
228
228
|
actions: &actions
|
229
229
|
create: "Crea %{model}"
|
230
230
|
update: "Aggiorna"
|
231
|
+
submit: "Procedi"
|
231
232
|
authentication:
|
232
233
|
sign_in: "Accedi"
|
233
234
|
sign_in_with: "Accedi con"
|
@@ -252,9 +253,18 @@ it:
|
|
252
253
|
permission_denied: "Non hai i privilegi per svolgere questa operazione."
|
253
254
|
created: "L'oggetto %{model} è stato creato correttamente."
|
254
255
|
created_ko: "Un errore ha impedito la creazione dell'oggetto %{model}."
|
256
|
+
created_multiple: "La creazione di %{model} è stata completata con successo."
|
257
|
+
created_multiple_ko: "Un errore ha impedito la creazione di %{model}."
|
255
258
|
updated: "L'oggetto %{model} è stato modificato correttamente."
|
256
259
|
updated_ko: "Un errore ha impedito la modifica dell'oggetto %{model}."
|
260
|
+
updated_multiple: "La modifica di %{model} è avvenuta con successo."
|
261
|
+
updated_multiple_ko: "Un errore ha impedito la modifica di %{model}."
|
257
262
|
deleted: "L'oggetto %{model} è stato eliminato."
|
263
|
+
deleted_multiple: "L'eliminazione di %{model} è avvenuta con successo."
|
264
|
+
deleted_multiple_ko: "Un errore ha impedito l'eliminazione di %{model}."
|
265
|
+
search_found: "La ricerca ha trovato %{found}"
|
266
|
+
search_not_found: "La ricerca non ha ottenuto risultati"
|
267
|
+
select_rows_from_list: "Seleziona le righe dalla lista prima di procedere"
|
258
268
|
|
259
269
|
<<: *activerecord
|
260
270
|
<<: *actions
|
@@ -173,12 +173,14 @@ div.navigation
|
|
173
173
|
&.small
|
174
174
|
font-size: 0.85em
|
175
175
|
font-weight: bold
|
176
|
-
color:
|
177
|
-
height:
|
178
|
-
width:
|
179
|
-
|
176
|
+
color: white
|
177
|
+
height: 49px
|
178
|
+
width: 120px
|
179
|
+
padding-top: 0
|
180
|
+
background: transparent url($style_path + '/button_120_98.png') no-repeat
|
180
181
|
&:hover
|
181
|
-
|
182
|
+
color: #aaa
|
183
|
+
background-position: 0px -49px
|
182
184
|
|
183
185
|
&.medium
|
184
186
|
font-size: 1.05em
|
@@ -267,7 +269,7 @@ table.user
|
|
267
269
|
color: $text_color
|
268
270
|
//background-color: $main_bg
|
269
271
|
color: $title_color
|
270
|
-
padding:
|
272
|
+
padding: 2px
|
271
273
|
text-align: left
|
272
274
|
&.main
|
273
275
|
font-weight: bold
|
@@ -286,13 +288,16 @@ table.user
|
|
286
288
|
line-height: 1.2em
|
287
289
|
height: 2.5em
|
288
290
|
&.odd
|
289
|
-
|
291
|
+
&.selected
|
292
|
+
background-color: darken($table_row_selection_color, 5%)
|
293
|
+
&:hover
|
294
|
+
background-color: $table_row_selection_color
|
290
295
|
&.even
|
291
296
|
background-color: darken($main_bg, 2%)
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
297
|
+
&.selected
|
298
|
+
background-color: darken($table_row_selection_color, 7%)
|
299
|
+
&:hover
|
300
|
+
background-color: darken($table_row_selection_color, 2%)
|
296
301
|
|
297
302
|
td
|
298
303
|
padding: 2px
|
@@ -303,7 +308,7 @@ table.user
|
|
303
308
|
text-align:center
|
304
309
|
|
305
310
|
.separator
|
306
|
-
margin:
|
311
|
+
margin: 0.7em 0
|
307
312
|
border-bottom: 1px dashed lighten($second_color, 30%)
|
308
313
|
|
309
314
|
//Navigation section
|
@@ -21,7 +21,15 @@ module Rails
|
|
21
21
|
route_config << plural_parent_resources.map{|m| "resources :#{m} do " }.join(" ") if nested?
|
22
22
|
route_config << base_namespaces.map{|m| "namespace :#{m} do " }.join(" ") if leospaced?
|
23
23
|
route_config << regular_class_path.map{|m| "namespace :#{m} do " }.join(" ")
|
24
|
-
route_config <<
|
24
|
+
route_config << <<-FILE.gsub(/^ /, '')
|
25
|
+
resources :#{file_name.pluralize} do
|
26
|
+
post :select, :on => :collection
|
27
|
+
post :edit_multiple, :on => :collection
|
28
|
+
put :update_multiple, :on => :collection
|
29
|
+
post :copy, :on => :collection
|
30
|
+
put :create_multiple, :on => :collection
|
31
|
+
end
|
32
|
+
FILE
|
25
33
|
route_config << " end" * (regular_class_path.size + plural_parent_resources.size + base_namespaces.size)
|
26
34
|
route route_config
|
27
35
|
end
|
@@ -45,6 +45,8 @@ module Rails
|
|
45
45
|
end
|
46
46
|
content << " op_new: \"New #{singular_table_name}\"#{CRLF}"
|
47
47
|
content << " op_edit: \"Editing #{singular_table_name}\"#{CRLF}"
|
48
|
+
content << " op_edit_multiple: \"Editing #{plural_table_name}\"#{CRLF}"
|
49
|
+
content << " op_copy: \"Creating new #{plural_table_name}\"#{CRLF}"
|
48
50
|
if nested?
|
49
51
|
content << " op_index: \"Listing #{plural_table_name} belongings to %{parent} %{name}\"#{CRLF}"
|
50
52
|
else
|
@@ -129,6 +129,16 @@ end
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
def create_multiple
|
133
|
+
respond_to do |format|
|
134
|
+
if <%= class_name %>.create(params[:<%= plural_table_name %>].values)
|
135
|
+
format.html { redirect_to <%= list_resources_path %>, :notice => I18n.t(:created_multiple, :model => I18n.t('models.<%= plural_table_name %>')) }
|
136
|
+
else
|
137
|
+
format.html { render :action => "copy" }
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
132
142
|
# PUT <%= route_url %>/1
|
133
143
|
# PUT <%= route_url %>/1.json
|
134
144
|
def update
|
@@ -145,6 +155,16 @@ end
|
|
145
155
|
end
|
146
156
|
end
|
147
157
|
|
158
|
+
def update_multiple
|
159
|
+
respond_to do |format|
|
160
|
+
if <%= class_name %>.update(params[:<%= plural_table_name %>].keys, params[:<%= plural_table_name %>].values)
|
161
|
+
format.html { redirect_to <%= list_resources_path %>, :notice => I18n.t(:updated_multiple, :model => I18n.t('models.<%= plural_table_name %>')) }
|
162
|
+
else
|
163
|
+
format.html { render :action => "edit_multiple" }
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
148
168
|
# DELETE <%= route_url %>/1
|
149
169
|
# DELETE <%= route_url %>/1.json
|
150
170
|
def destroy
|
@@ -158,6 +178,54 @@ end
|
|
158
178
|
end
|
159
179
|
end
|
160
180
|
|
181
|
+
def select
|
182
|
+
if params[:ids]
|
183
|
+
@<%= plural_table_name %> = <%= class_name %>.where("#{<%= class_name %>.table_name}.id" => params[:ids]).order("#{<%= class_name %>.table_name}.id")
|
184
|
+
@operation = case params[:commit].downcase
|
185
|
+
when I18n.t(:destroy).downcase then :destroy
|
186
|
+
when I18n.t(:edit).downcase then :edit
|
187
|
+
when I18n.t(:copy).downcase then :copy
|
188
|
+
else :unknown_request
|
189
|
+
end
|
190
|
+
@results = {}
|
191
|
+
@<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
192
|
+
begin
|
193
|
+
case @operation
|
194
|
+
when :destroy
|
195
|
+
<%= orm_instance.destroy %>
|
196
|
+
@results[<%= singular_table_name %>.id] = [true, I18n.t(:deleted, :model => I18n.t('models.<%= singular_table_name %>'))]
|
197
|
+
when :edit
|
198
|
+
@results[<%= singular_table_name %>.id] = [true, ""]
|
199
|
+
when :copy
|
200
|
+
@results[<%= singular_table_name %>.id] = [true, ""]
|
201
|
+
else
|
202
|
+
raise I18n.t(@operation)
|
203
|
+
end
|
204
|
+
rescue
|
205
|
+
@results[<%= singular_table_name %>.id] = [false, $!.message]
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
respond_to do |format|
|
210
|
+
format.js
|
211
|
+
format.html do
|
212
|
+
case @operation
|
213
|
+
when :destroy
|
214
|
+
redirect_to <%= list_resources_path %> and return
|
215
|
+
when :edit
|
216
|
+
render :edit_multiple and return
|
217
|
+
when :copy
|
218
|
+
render :copy and return
|
219
|
+
else
|
220
|
+
redirect_to root_path, :alert => I18n.t(:unknown_request) and return
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
else
|
225
|
+
redirect_to <%= list_resources_path %>, :alert => I18n.t(:select_rows_from_list) and return
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
161
229
|
private
|
162
230
|
def sort_direction
|
163
231
|
%w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leonardo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 62196241
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
- 1
|
12
|
+
version: 1.9.0.beta1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Marco Mastrodonato
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-11-
|
20
|
+
date: 2011-11-30 00:00:00 Z
|
19
21
|
dependencies: []
|
20
22
|
|
21
23
|
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
|
@@ -28,20 +30,29 @@ extra_rdoc_files: []
|
|
28
30
|
|
29
31
|
files:
|
30
32
|
- lib/generators/erb/leosca/leosca_generator.rb
|
33
|
+
- lib/generators/erb/leosca/templates/copy.html.erb
|
31
34
|
- lib/generators/erb/leosca/templates/destroy.js.erb
|
32
35
|
- lib/generators/erb/leosca/templates/edit.html.erb
|
36
|
+
- lib/generators/erb/leosca/templates/edit_multiple.html.erb
|
37
|
+
- lib/generators/erb/leosca/templates/formtastic/_fields.html.erb
|
33
38
|
- lib/generators/erb/leosca/templates/formtastic/_form.html.erb
|
39
|
+
- lib/generators/erb/leosca/templates/formtastic/_form_multiple.html.erb
|
34
40
|
- lib/generators/erb/leosca/templates/index.html.erb
|
35
41
|
- lib/generators/erb/leosca/templates/index.js.erb
|
36
42
|
- lib/generators/erb/leosca/templates/new.html.erb
|
43
|
+
- lib/generators/erb/leosca/templates/select.js.erb
|
37
44
|
- lib/generators/erb/leosca/templates/show.html.erb
|
38
45
|
- lib/generators/erb/leosca/templates/show.js.erb
|
46
|
+
- lib/generators/erb/leosca/templates/_fields.html.erb
|
39
47
|
- lib/generators/erb/leosca/templates/_form.html.erb
|
48
|
+
- lib/generators/erb/leosca/templates/_form_multiple.html.erb
|
40
49
|
- lib/generators/erb/leosca/templates/_list.erb
|
50
|
+
- lib/generators/erb/leosca/templates/_row_index.html.erb
|
41
51
|
- lib/generators/erb/leosca/templates/_show.erb
|
42
52
|
- lib/generators/leolay/install_generator.rb
|
43
53
|
- lib/generators/leolay/leolay_generator.rb
|
44
54
|
- lib/generators/leolay/templates/app/assets/javascripts/custom.js
|
55
|
+
- lib/generators/leolay/templates/app/helpers/layout_helper.rb
|
45
56
|
- lib/generators/leolay/templates/app/views/devise/confirmations/new.html.erb
|
46
57
|
- lib/generators/leolay/templates/app/views/devise/mailer/confirmation_instructions.html.erb
|
47
58
|
- lib/generators/leolay/templates/app/views/devise/mailer/reset_password_instructions.html.erb
|
@@ -60,7 +71,6 @@ files:
|
|
60
71
|
- lib/generators/leolay/templates/config/locales/kaminari.en.yml
|
61
72
|
- lib/generators/leolay/templates/config/locales/kaminari.it.yml
|
62
73
|
- lib/generators/leolay/templates/config.rb
|
63
|
-
- lib/generators/leolay/templates/layout_helper.rb
|
64
74
|
- lib/generators/leolay/templates/lib/utility.rb
|
65
75
|
- lib/generators/leolay/templates/spec/factories.rb
|
66
76
|
- lib/generators/leolay/templates/spec/helpers/application_helpers_spec.rb
|
@@ -83,8 +93,8 @@ files:
|
|
83
93
|
- lib/generators/leolay/templates/styles/cloudy/images/kaminari/nav.png
|
84
94
|
- lib/generators/leolay/templates/styles/cloudy/images/style/arrow_down.png
|
85
95
|
- lib/generators/leolay/templates/styles/cloudy/images/style/arrow_up.png
|
86
|
-
- lib/generators/leolay/templates/styles/cloudy/images/style/bg_but_gray.png
|
87
96
|
- lib/generators/leolay/templates/styles/cloudy/images/style/bg_top.png
|
97
|
+
- lib/generators/leolay/templates/styles/cloudy/images/style/button_120_98.png
|
88
98
|
- lib/generators/leolay/templates/styles/cloudy/images/style/button_170_126.png
|
89
99
|
- lib/generators/leolay/templates/styles/cloudy/images/style/button_229_170.png
|
90
100
|
- lib/generators/leolay/templates/styles/cloudy/images/style/ico_back.png
|
@@ -95,6 +105,7 @@ files:
|
|
95
105
|
- lib/generators/leolay/templates/styles/cloudy/images/style/logo.png
|
96
106
|
- lib/generators/leolay/templates/styles/cloudy/images/style/msg_error.gif
|
97
107
|
- lib/generators/leolay/templates/styles/cloudy/images/style/msg_notice.gif
|
108
|
+
- lib/generators/leolay/templates/styles/cloudy/images/style/Thumbs.db
|
98
109
|
- lib/generators/leolay/templates/styles/cloudy/stylesheets/app/stylesheet.sass
|
99
110
|
- lib/generators/leolay/templates/styles/cloudy/stylesheets/vendor/jquery-ui/jquery-ui-1.8.16.redcarpet.css
|
100
111
|
- lib/generators/leolay/templates/styles/cloudy/views/kaminari/_next_page.html.erb
|
@@ -155,14 +166,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
167
|
none: false
|
157
168
|
requirements:
|
158
|
-
- - "
|
169
|
+
- - ">"
|
159
170
|
- !ruby/object:Gem::Version
|
160
|
-
hash:
|
171
|
+
hash: 25
|
161
172
|
segments:
|
162
|
-
-
|
163
|
-
|
164
|
-
|
165
|
-
|
173
|
+
- 1
|
174
|
+
- 3
|
175
|
+
- 1
|
176
|
+
version: 1.3.1
|
177
|
+
requirements:
|
178
|
+
- Start a new app with the template.rb from github or inside root folder
|
166
179
|
rubyforge_project:
|
167
180
|
rubygems_version: 1.8.9
|
168
181
|
signing_key:
|
Binary file
|