leonardo 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/erb/leosca/leosca_generator.rb +22 -1
- data/lib/generators/erb/leosca/templates/_list.erb +3 -2
- data/lib/generators/erb/leosca/templates/_nested.erb +15 -0
- data/lib/generators/erb/leosca/templates/_show.erb +0 -1
- data/lib/generators/erb/leosca/templates/formtastic/_fields.html.erb +15 -10
- data/lib/generators/erb/leosca/templates/index.html.erb +21 -11
- data/lib/generators/erb/leosca/templates/with_nested.js.erb +9 -0
- data/lib/generators/leolay/leolay_generator.rb +8 -0
- data/lib/generators/leolay/templates/config/locales/devise.en.yml +5 -6
- data/lib/generators/leolay/templates/config/locales/devise.it.yml +8 -7
- data/lib/generators/leolay/templates/config/locales/en.yml +8 -0
- data/lib/generators/leolay/templates/config/locales/it.yml +8 -1
- data/lib/generators/leolay/templates/styles/cloudy/images/style/Thumbs.db +0 -0
- data/lib/generators/leolay/templates/styles/cloudy/images/style/logo.png +0 -0
- data/lib/generators/leolay/templates/styles/cloudy/stylesheets/app/states.sass +60 -0
- data/lib/generators/leolay/templates/styles/cloudy/stylesheets/app/stylesheet.sass +29 -18
- data/lib/generators/leolay/templates/styles/cloudy/views/layout/_layout.html.erb +1 -1
- data/lib/generators/leonardo.rb +14 -10
- data/lib/generators/rails/leosca/leosca_generator.rb +25 -8
- data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +13 -0
- data/lib/generators/rails/leosca_controller/templates/controller.rb +2 -2
- data/template.rb +16 -4
- metadata +28 -41
@@ -82,10 +82,27 @@ module Erb
|
|
82
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} %><%= link_to "", #{last_parent}_with_#{plural_table_name}_path(#{last_parent}), :id => "a_#{singular_table_name[0..5]}_\#{#{last_parent}.id}", :class =>"toggle_#{plural_table_name} desc", :remote => true %></td>
|
86
86
|
|
87
87
|
FILE
|
88
88
|
end if File.exists?(file)
|
89
|
+
available_nested_views.each do |view|
|
90
|
+
filenames = filenames_all_formats(view, source_paths)
|
91
|
+
filenames.each do |filename|
|
92
|
+
#Looking for custom filename into subfolder
|
93
|
+
filename_source = "#{"formtastic/" if formtastic?}#{filename}"
|
94
|
+
search_into_subfolder = nil
|
95
|
+
source_paths.each do |path|
|
96
|
+
if File.exists?(File.join(path,filename_source))
|
97
|
+
search_into_subfolder = true
|
98
|
+
break
|
99
|
+
end
|
100
|
+
end
|
101
|
+
filename_source = filename unless search_into_subfolder
|
102
|
+
|
103
|
+
template filename_source, File.join("app/views", base_namespaces, plural_last_parent, filename.sub('nested', plural_table_name))
|
104
|
+
end
|
105
|
+
end
|
89
106
|
end
|
90
107
|
|
91
108
|
protected
|
@@ -95,6 +112,10 @@ module Erb
|
|
95
112
|
%w(index edit edit_multiple copy show new _form _form_multiple _fields destroy _show _list _row_index select)
|
96
113
|
end
|
97
114
|
|
115
|
+
def available_nested_views
|
116
|
+
%w(_nested with_nested)
|
117
|
+
end
|
118
|
+
|
98
119
|
def filenames_all_formats(name, paths=[], formats=[:html, :js, nil])
|
99
120
|
filenames = []
|
100
121
|
paths.each do |path|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
</thead>
|
23
23
|
<tbody>
|
24
24
|
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| -%>
|
25
|
-
<tr id="
|
25
|
+
<tr id="tr_<%= singular_table_name[0..5] %>_<%%= <%= singular_table_name %>.id %>" class="<%%= cycle("odd", "even")%>">
|
26
26
|
<%%= render 'row_index', :<%= singular_table_name %> => <%= singular_table_name %>, :remote => remote, :message => "" %>
|
27
27
|
</tr>
|
28
28
|
<%% end -%>
|
@@ -30,7 +30,8 @@
|
|
30
30
|
</table>
|
31
31
|
|
32
32
|
<div class="separator"></div>
|
33
|
-
<div
|
33
|
+
<div class="clear"></div>
|
34
|
+
<div>
|
34
35
|
<%- if authorization? -%>
|
35
36
|
<%%- if can? :destroy, <%= class_name %> -%>
|
36
37
|
<%- end -%>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<tr id="th_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>" style="display: none;text-align: left;" class="header <%= plural_table_name %> tr_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>">
|
2
|
+
<th></th>
|
3
|
+
<%- attributes.first(5).each do |attribute| -%>
|
4
|
+
<th><%%= t('attributes.transaction.<%= attribute.name %>') -%></th>
|
5
|
+
<%- end -%>
|
6
|
+
</tr>
|
7
|
+
|
8
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| -%>
|
9
|
+
<tr id="tr_<%= singular_table_name[0..5] %>_<%%= <%= singular_table_name %>.id %>" style="display: none;" class="tr_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %> <%%= cycle("odd", "even")%>">
|
10
|
+
<td style="text-align: center;">└</td>
|
11
|
+
<%- attributes.first(5).each do |attribute| -%>
|
12
|
+
<td><%= attribute_to_erb(attribute, singular_table_name) -%></td>
|
13
|
+
<%- end -%>
|
14
|
+
</tr>
|
15
|
+
<%% end -%>
|
@@ -1,16 +1,21 @@
|
|
1
1
|
<%%= f.inputs do %>
|
2
2
|
<%- attributes.each do |attribute| -%>
|
3
|
-
<%- case attribute.
|
4
|
-
when
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
<%- case attribute.name
|
4
|
+
when 'state' -%>
|
5
|
+
<%%= f.input :<%= attribute.name %>, :as => :select, :collection => <%= class_name %>.state_machine.states.map{|s| [t("states.generic.#{s.name.to_s}"), s.value]} %>
|
6
|
+
<%- else -%>
|
7
|
+
<%- case attribute.type
|
8
|
+
when :references, :belongs_to -%>
|
9
|
+
<%% if <%= singular_table_name %>.new_record? -%>
|
10
|
+
<%%= f.input :<%= attribute.name %> if can?(:manage, <%=class_name %>) %>
|
11
|
+
<%% else -%>
|
12
|
+
<%%= f.input :<%= attribute.name %> %>
|
13
|
+
<%% end -%>
|
14
|
+
<%- when :date -%>
|
15
|
+
<%%= f.input :<%= attribute.name %>, :as => :string, :input_html => { :class => 'calendar', :maxlength => 10 } %>
|
16
|
+
<%- else -%>
|
8
17
|
<%%= f.input :<%= attribute.name %> %>
|
9
|
-
|
10
|
-
<%- when :date -%>
|
11
|
-
<%%= f.input :<%= attribute.name %>, :as => :string, :input_html => { :class => 'calendar', :maxlength => 10 } %>
|
12
|
-
<%- else -%>
|
13
|
-
<%%= f.input :<%= attribute.name %> %>
|
18
|
+
<%- end -%>
|
14
19
|
<%- end -%>
|
15
20
|
<%- end -%>
|
16
21
|
<%% end %>
|
@@ -5,8 +5,16 @@
|
|
5
5
|
<%% title t('attributes.<%= singular_table_name %>.op_index'<%= ", {:parent => \"#{last_parent}\", :name => @#{last_parent}.try(:name) || @#{last_parent}.try(:id)}" if nested? -%>) %>
|
6
6
|
|
7
7
|
<%% remote = @remote %>
|
8
|
+
|
9
|
+
<div id="index_wrapper">
|
10
|
+
|
11
|
+
<div id="list">
|
12
|
+
<%%= render 'list', :remote => remote %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div id="filter_container">
|
8
16
|
<%%= form_for <%= show_resource_path("@") %>, :remote => remote, :html => { :method => :get, :id => "form_search" } do |f| %>
|
9
|
-
<div class="filter-container">
|
17
|
+
<div class="filter-container">
|
10
18
|
<%- attributes.each do |attribute| -%>
|
11
19
|
<div class="filter-field">
|
12
20
|
<%- case attribute.type -%>
|
@@ -28,21 +36,23 @@
|
|
28
36
|
<%%= radio_button("<%= singular_table_name %>", "<%= attribute.name %>", "0", {:checked => (!@<%= singular_table_name %>.<%= attribute.name %>), :class => 'autosubmit'}) %><%%= label_tag "<%= singular_table_name %>_<%= attribute.name %>_0", t(:no) %><br />
|
29
37
|
<%%= radio_button("<%= singular_table_name %>", "<%= attribute.name %>", "", {:class => 'autosubmit'}) %><%%= label_tag "<%= singular_table_name %>_<%= attribute.name %>_", t(:all) %>
|
30
38
|
<%- when :text -%>
|
31
|
-
<%%= f.text_field :<%= attribute.name
|
39
|
+
<%%= f.text_field :<%= attribute.name %>, :size => 15 %>
|
32
40
|
<%- when :date -%>
|
33
|
-
<%%= f.text_field :<%= attribute.name %>, :class => "autosubmit<%=" calendar" if jquery_ui? %>" %>
|
41
|
+
<%%= f.text_field :<%= attribute.name %>, :class => "autosubmit<%=" calendar" if jquery_ui? %>", :size => 15 %>
|
34
42
|
<%- else -%>
|
35
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name
|
43
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, :size => 15 %>
|
36
44
|
<%- end -%>
|
37
45
|
</div>
|
46
|
+
<div class="clear"></div>
|
38
47
|
<%- end -%>
|
39
|
-
<div style="clear:both;">
|
40
|
-
<%%= f.submit t(:search), {:class=>'button medium'} %>
|
41
|
-
<%%= f.submit 'Csv', {:class=>'button medium csv'} %>
|
42
48
|
</div>
|
43
|
-
|
49
|
+
<div class="clear"></div>
|
50
|
+
<div>
|
51
|
+
<%%= f.submit t(:search), {:class=>'button small'} %>
|
52
|
+
<%%#= f.submit 'Csv', {:class=>'button small csv'} %>
|
53
|
+
</div>
|
44
54
|
<%% end %>
|
45
|
-
|
46
|
-
<div id="list">
|
47
|
-
<%%= render 'list', :remote => remote %>
|
48
55
|
</div>
|
56
|
+
<div class="clear"></div>
|
57
|
+
|
58
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
if ($("#a_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").hasClass('asc')) {
|
2
|
+
$("#a_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").removeClass('asc').addClass('desc');
|
3
|
+
$(".tr_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").slideUp();
|
4
|
+
} else {
|
5
|
+
$("#a_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").removeClass('desc').addClass('asc');
|
6
|
+
$(".tr_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").remove();
|
7
|
+
$("#tr_<%= last_parent[0..5] %>_<%%= @<%= last_parent %>.id %>").after("<%%= escape_javascript(render('<%= plural_table_name %>', :remote => true))%>");
|
8
|
+
$(".tr_<%= singular_table_name[0..5] %>_<%%= @<%= last_parent %>.id %>").show('fast');
|
9
|
+
}
|
@@ -15,6 +15,7 @@ class LeolayGenerator < Rails::Generators::Base
|
|
15
15
|
template "config.rb", "config/initializers/config.rb"
|
16
16
|
|
17
17
|
template "styles/#{style_name}/stylesheets/app/stylesheet.sass", "app/assets/stylesheets/#{style_name}.sass"
|
18
|
+
copy_file "styles/#{style_name}/stylesheets/app/states.sass", "app/assets/stylesheets/states.sass"
|
18
19
|
|
19
20
|
copy_file "app/helpers/layout_helper.rb", "app/helpers/layout_helper.rb"
|
20
21
|
|
@@ -99,6 +100,13 @@ class LeolayGenerator < Rails::Generators::Base
|
|
99
100
|
end
|
100
101
|
I18n.locale = session[:lang]
|
101
102
|
end
|
103
|
+
def get_operator(str, default='=')
|
104
|
+
m = str.match(/^(\<|\>|\=)(\>|\=|)/)
|
105
|
+
m ? m.to_s : default
|
106
|
+
end
|
107
|
+
def get_value(str)
|
108
|
+
str.sub(get_operator(str), '').strip
|
109
|
+
end
|
102
110
|
FILE
|
103
111
|
end
|
104
112
|
end
|
@@ -35,16 +35,15 @@ en:
|
|
35
35
|
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
36
36
|
registrations:
|
37
37
|
signed_up: 'Welcome! You have signed up successfully.'
|
38
|
-
|
38
|
+
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
|
39
|
+
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
|
40
|
+
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
|
39
41
|
updated: 'You updated your account successfully.'
|
42
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
|
40
43
|
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
41
|
-
reasons:
|
42
|
-
inactive: 'inactive'
|
43
|
-
unconfirmed: 'unconfirmed'
|
44
|
-
locked: 'locked'
|
45
44
|
unlocks:
|
46
45
|
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
47
|
-
unlocked: 'Your account
|
46
|
+
unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
|
48
47
|
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
|
49
48
|
omniauth_callbacks:
|
50
49
|
success: 'Successfully authorized from %{kind} account.'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
it:
|
2
4
|
errors:
|
3
5
|
messages:
|
@@ -33,24 +35,23 @@ it:
|
|
33
35
|
confirmed: "Il tuo account è stato correttamente confermato. Ora sei collegato."
|
34
36
|
registrations:
|
35
37
|
signed_up: "Iscrizione correttamente eseguita."
|
36
|
-
|
38
|
+
signed_up_but_unconfirmed: "Un messaggio con il link di conferma è stato inviato al tuo indirizzo email. Dovresti cliccare su quel link per attivare il tuo account."
|
39
|
+
signed_up_but_inactive: "Ti sei registrato con successo. Tuttavia, non è stato possibile effettuare il login perché il tuo account non è ancora stato attivato."
|
40
|
+
signed_up_but_locked: "Ti sei registrato con successo. Tuttavia, non è stato possibile effettuare il login perché il tuo account è bloccato."
|
37
41
|
updated: "Il tuo account è stato aggiornato."
|
42
|
+
update_needs_confirmation: "È stato aggiornato il tuo account con successo, ma abbiamo bisogno di verificare il tuo nuovo indirizzo email. Controlla la tua email e clicca sul link per confermare il nuovo indirizzo email."
|
38
43
|
destroyed: "Arrivederci! L'account è stato cancellato. Speriamo di rivederti presto."
|
39
|
-
reasons:
|
40
|
-
inactive: "Inattivo"
|
41
|
-
unconfirmed: "Non confermato"
|
42
|
-
locked: "Bloccato"
|
43
44
|
unlocks:
|
44
45
|
send_instructions: "Riceverai un messaggio email con le istruzioni per sbloccare il tuo account entro qualche minuto."
|
45
46
|
unlocked: "Il tuo account è stato correttamente sbloccato. Ora sei collegato."
|
46
47
|
send_paranoid_instructions: "Se il tuo indirizzo e-mail esiste nel nostro database, fra pochi minuti riceverai un link con le istruzioni per sbloccare il tuo account."
|
47
48
|
omniauth_callbacks:
|
48
49
|
success: "Sei stato autorizzato dall'account di %{kind}."
|
49
|
-
failure:
|
50
|
+
failure: "Non siamo riusciti ad autoruzzarti da %{kind} perchè '%{reason}'."
|
50
51
|
mailer:
|
51
52
|
confirmation_instructions:
|
52
53
|
subject: "Istruzioni per la conferma"
|
53
54
|
reset_password_instructions:
|
54
55
|
subject: "Istruzioni per reimpostare la password"
|
55
56
|
unlock_instructions:
|
56
|
-
subject: "Istruzioni per sbloccare l'account"
|
57
|
+
subject: "Istruzioni per sbloccare l'account"
|
@@ -215,6 +215,14 @@ en:
|
|
215
215
|
change_password: "Change password"
|
216
216
|
current_password: "Current password"
|
217
217
|
new_password: "New password"
|
218
|
+
states:
|
219
|
+
generic:
|
220
|
+
new: "New"
|
221
|
+
waiting: "Waiting"
|
222
|
+
working: "Working"
|
223
|
+
canceled: "Canceled"
|
224
|
+
completed: "Completed"
|
225
|
+
closed: "Closed"
|
218
226
|
|
219
227
|
unknown_request: "Sorry, this request is unknown and cannot be processed"
|
220
228
|
generic_error: "An error was occured and doesn't permit to execute this operation"
|
@@ -244,7 +244,14 @@ it:
|
|
244
244
|
change_password: "Cambia la password"
|
245
245
|
current_password: "Password attuale"
|
246
246
|
new_password: "Nuova password"
|
247
|
-
|
247
|
+
states:
|
248
|
+
generic:
|
249
|
+
new: "Nuovo"
|
250
|
+
waiting: "Attesa"
|
251
|
+
working: "Lavorazione"
|
252
|
+
canceled: "Eliminato"
|
253
|
+
completed: "Completato"
|
254
|
+
closed: "Chiuso"
|
248
255
|
|
249
256
|
unknown_request: "Spiacente, richiesta sconosciuta, non è possibile eseguirla"
|
250
257
|
generic_error: "Un errore impedisce di svolgere questa operazione"
|
Binary file
|
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
$color_new: rgb(140,140,140)
|
2
|
+
$bg_new: inherit
|
3
|
+
|
4
|
+
$bg_waiting: rgb(240,180,120)
|
5
|
+
$color_waiting: lighten($bg_waiting, 50%)
|
6
|
+
|
7
|
+
$bg_working: rgb(140,160,230)
|
8
|
+
$color_working: lighten($bg_working, 50%)
|
9
|
+
|
10
|
+
$bg_canceled: rgb(220,140,140)
|
11
|
+
$color_canceled: white
|
12
|
+
|
13
|
+
$bg_completed: rgb(110,160,110)
|
14
|
+
$color_completed: lighten($bg_completed, 50%)
|
15
|
+
|
16
|
+
$bg_closed: rgb(80,70,80)
|
17
|
+
$color_closed: lighten($bg_closed, 50%)
|
18
|
+
|
19
|
+
@mixin rounded-corners($radius: 4px)
|
20
|
+
border-radius: $radius
|
21
|
+
-moz-border-radius: $radius
|
22
|
+
-webkit-border-radius: $radius
|
23
|
+
|
24
|
+
.state
|
25
|
+
margin: 0px auto
|
26
|
+
padding: 4px
|
27
|
+
font-size: 0.7em
|
28
|
+
letter-spacing: 0.15em
|
29
|
+
text-transform: uppercase
|
30
|
+
&.generic
|
31
|
+
&.new
|
32
|
+
color: $color_new
|
33
|
+
border: 1px $color_new solid
|
34
|
+
background-color: $bg_new
|
35
|
+
@include rounded-corners
|
36
|
+
&.waiting, &.wait
|
37
|
+
color: $color_waiting
|
38
|
+
background-color: $bg_waiting
|
39
|
+
border: 1px $color_waiting solid
|
40
|
+
@include rounded-corners
|
41
|
+
&.working
|
42
|
+
color: $color_working
|
43
|
+
background-color: $bg_working
|
44
|
+
border: 1px $color_working solid
|
45
|
+
@include rounded-corners
|
46
|
+
&.canceled, &.deleted
|
47
|
+
color: $color_canceled
|
48
|
+
background-color: $bg_canceled
|
49
|
+
border: 1px darker($bg_canceled, 30%) dotted
|
50
|
+
@include rounded-corners
|
51
|
+
&.completed, &.complete
|
52
|
+
color: $color_completed
|
53
|
+
background-color: $bg_completed
|
54
|
+
border: 1px darker($bg_completed, 30%) solid
|
55
|
+
@include rounded-corners
|
56
|
+
&.closed
|
57
|
+
color: $color_closed
|
58
|
+
background-color: $bg_closed
|
59
|
+
border: 1px $color_closed dotted
|
60
|
+
@include rounded-corners
|
@@ -20,13 +20,14 @@ $textbox_bg: #f5f5f5 //related to the textbox image
|
|
20
20
|
$table_row_selection_color: rgb(255,255,210)
|
21
21
|
|
22
22
|
$style_path: styles/<%= style_name %>
|
23
|
+
@import "states"
|
23
24
|
|
24
25
|
*
|
25
26
|
margin: 0
|
26
27
|
|
27
28
|
body
|
28
29
|
font-family: Tahoma, Verdana, Arial
|
29
|
-
font-size:
|
30
|
+
font-size: 16px
|
30
31
|
background-color: $main_color
|
31
32
|
color: $text_color
|
32
33
|
|
@@ -84,7 +85,22 @@ div#container
|
|
84
85
|
border-radius: 0px 10px 10px 10px
|
85
86
|
//-webkit-border-radius: 0px 10px 10px 10px
|
86
87
|
|
88
|
+
div#list
|
89
|
+
margin-right: 260px
|
90
|
+
float: left
|
91
|
+
min-width: 60%
|
87
92
|
|
93
|
+
#filter_container
|
94
|
+
float: left
|
95
|
+
margin-left: -250px
|
96
|
+
margin-top: 80px
|
97
|
+
width: 250px
|
98
|
+
|
99
|
+
.filter-container
|
100
|
+
padding-bottom: 8px
|
101
|
+
.filter-field
|
102
|
+
float: left
|
103
|
+
padding: 4px
|
88
104
|
|
89
105
|
div#footer
|
90
106
|
p
|
@@ -92,7 +108,6 @@ div#footer
|
|
92
108
|
font-size: 0.8em
|
93
109
|
text-align: center
|
94
110
|
|
95
|
-
|
96
111
|
input, select, textarea
|
97
112
|
background: $textbox_bg url($style_path + '/input_background_bn.png') repeat-x scroll 0 0
|
98
113
|
color: $textbox_color
|
@@ -234,13 +249,6 @@ h3
|
|
234
249
|
border-color: #C00
|
235
250
|
color: #C00
|
236
251
|
|
237
|
-
|
238
|
-
.filter-container
|
239
|
-
padding-bottom: 8px
|
240
|
-
.filter-field
|
241
|
-
float: left
|
242
|
-
padding: 4px
|
243
|
-
|
244
252
|
form
|
245
253
|
div.field
|
246
254
|
padding: 5px 0
|
@@ -258,6 +266,18 @@ form
|
|
258
266
|
|
259
267
|
table.user
|
260
268
|
width: 100%
|
269
|
+
& .sorted
|
270
|
+
color: $text_color
|
271
|
+
& .asc
|
272
|
+
padding-right: 10px
|
273
|
+
background-repeat: no-repeat
|
274
|
+
background-position: right center
|
275
|
+
background-image: url($style_path + '/arrow_up.png')
|
276
|
+
& .desc
|
277
|
+
padding-right: 10px
|
278
|
+
background-repeat: no-repeat
|
279
|
+
background-position: right center
|
280
|
+
background-image: url($style_path + '/arrow_down.png')
|
261
281
|
thead
|
262
282
|
tr
|
263
283
|
& :hover
|
@@ -274,15 +294,6 @@ table.user
|
|
274
294
|
&.main
|
275
295
|
font-weight: bold
|
276
296
|
text-align: center
|
277
|
-
& .sorted
|
278
|
-
color: $text_color
|
279
|
-
padding-right: 10px
|
280
|
-
background-repeat: no-repeat
|
281
|
-
background-position: right center
|
282
|
-
& .asc
|
283
|
-
background-image: url($style_path + '/arrow_up.png')
|
284
|
-
& .desc
|
285
|
-
background-image: url($style_path + '/arrow_down.png')
|
286
297
|
tbody
|
287
298
|
tr
|
288
299
|
line-height: 1.2em
|
data/lib/generators/leonardo.rb
CHANGED
@@ -72,16 +72,20 @@ module Leonardo
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
def attribute_to_erb(attribute, object)
|
75
|
-
case attribute.
|
76
|
-
when
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
75
|
+
case attribute.name
|
76
|
+
when "state" then "<span class=\"state generic <%= #{object}.state_name.to_s %>\"><%= t(\"states.generic.\#{#{object}.state_name.to_s}\") %></span><span style=\"display:block;\"></span>"
|
77
|
+
else
|
78
|
+
case attribute.type
|
79
|
+
when :boolean then "<%= #{object}.#{attribute.name} ? style_image_tag(\"ico_v.png\", :class => \"ico_true\") : style_image_tag(\"ico_x.png\", :class => \"ico_false\") %>"
|
80
|
+
when :references, :belongs_to then "<%= link_to(#{object}.#{attribute.name}.try(:name) || \"#\#{#{object}.#{attribute.name}.try(:id)}\", #{object}.#{attribute.name}, :remote => @remote) %>"
|
81
|
+
when :integer then "<%= number_with_delimiter #{object}.#{attribute.name} %>"
|
82
|
+
when :decimal then "<%= number_to_currency #{object}.#{attribute.name} %>"
|
83
|
+
when :float then "<%= number_with_precision #{object}.#{attribute.name} %>"
|
84
|
+
when :date then "<%= #{object}.#{attribute.name}.strftime('%d-%m-%Y') if #{object}.#{attribute.name} %>"
|
85
|
+
when :datetime then "<%= #{object}.#{attribute.name}.strftime('%d-%m-%Y %H:%M:%S') if #{object}.#{attribute.name} %>"
|
86
|
+
when :time, :timestamp then "<%= #{object}.#{attribute.name}.strftime('%H:%M:%S') if #{object}.#{attribute.name} %>"
|
87
|
+
else "<%= #{object}.#{attribute.name} %>"
|
88
|
+
end
|
85
89
|
end
|
86
90
|
end
|
87
91
|
def get_attr_to_match(view=:list)
|
@@ -18,18 +18,35 @@ module Rails
|
|
18
18
|
return if options[:actions].present?
|
19
19
|
|
20
20
|
route_config = ""
|
21
|
-
|
21
|
+
iparent = 0
|
22
|
+
|
23
|
+
if nested?
|
24
|
+
plural_parent_resources.each do |m|
|
25
|
+
iparent += 2
|
26
|
+
indent = eval "/^\s{#{16 - iparent}}/"
|
27
|
+
route_config << <<-FILE.gsub(indent, '')
|
28
|
+
resources :#{m} do
|
29
|
+
get :with_#{file_name.pluralize}
|
30
|
+
post :select, :on => :collection
|
31
|
+
post :edit_multiple, :on => :collection
|
32
|
+
put :update_multiple, :on => :collection
|
33
|
+
put :create_multiple, :on => :collection
|
34
|
+
FILE
|
35
|
+
end
|
36
|
+
end
|
22
37
|
route_config << base_namespaces.map{|m| "namespace :#{m} do " }.join(" ") if leospaced?
|
23
38
|
route_config << regular_class_path.map{|m| "namespace :#{m} do " }.join(" ")
|
24
|
-
|
39
|
+
indent = eval "/^\s{#{8 - iparent}}/"
|
40
|
+
route_config << <<-FILE.gsub(indent, '')
|
41
|
+
|
25
42
|
resources :#{file_name.pluralize} do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
43
|
+
post :select, :on => :collection
|
44
|
+
post :edit_multiple, :on => :collection
|
45
|
+
put :update_multiple, :on => :collection
|
46
|
+
put :create_multiple, :on => :collection
|
47
|
+
end
|
31
48
|
FILE
|
32
|
-
route_config << "
|
49
|
+
route_config << " end" * (regular_class_path.size + plural_parent_resources.size + base_namespaces.size)
|
33
50
|
route route_config
|
34
51
|
end
|
35
52
|
|
@@ -155,7 +155,20 @@ module Rails
|
|
155
155
|
end
|
156
156
|
FILE
|
157
157
|
end if File.exists?(file)
|
158
|
+
end
|
159
|
+
|
160
|
+
def update_parent_controller
|
161
|
+
return unless nested?
|
162
|
+
file = "app/controllers/#{plural_last_parent}_controller.rb"
|
163
|
+
inject_into_file file, :before => " private" do
|
164
|
+
<<-FILE.gsub(/^ /, '')
|
165
|
+
def with_#{plural_table_name}
|
166
|
+
@#{last_parent} = #{last_parent.classify}.find params[:#{last_parent}_id]
|
167
|
+
@#{plural_table_name} = #{class_name}.where(:#{last_parent}_id => params[:#{last_parent}_id)
|
168
|
+
end
|
158
169
|
|
170
|
+
FILE
|
171
|
+
end if File.exists?(file)
|
159
172
|
end
|
160
173
|
|
161
174
|
end
|
@@ -35,7 +35,7 @@ end
|
|
35
35
|
end -%>
|
36
36
|
<%- conditions_operator_sign = case attribute.type
|
37
37
|
when :string, :text then "LIKE"
|
38
|
-
else "
|
38
|
+
else "\#{get_operator(params[:#{singular_table_name}][:#{attr_name}])}"
|
39
39
|
end -%>
|
40
40
|
<%- conditions_operator_value = case attribute.type
|
41
41
|
when :string, :text then "%"
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
if params[:<%= singular_table_name %>][:<%= attr_name %>] && params[:<%= singular_table_name %>][:<%= attr_name %>].length>0
|
47
47
|
conditions_fields << "#{<%= class_name %>.table_name}.<%= attr_name %> <%= conditions_operator_sign %> ?"
|
48
|
-
conditions_values << "<%= conditions_operator_value %>#{params[:<%= singular_table_name %>][:<%= attr_name %>]}<%= conditions_operator_value %>"
|
48
|
+
conditions_values << "<%= conditions_operator_value %>#{get_value(params[:<%= singular_table_name %>][:<%= attr_name %>])}<%= conditions_operator_value %>"
|
49
49
|
@<%= singular_table_name %>.<%= attr_name %> = params[:<%= singular_table_name %>][:<%= attr_name %>]
|
50
50
|
end
|
51
51
|
<%- end -%>
|
data/template.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#########################################################
|
2
2
|
# 2011 Marco Mastrodonato(c)
|
3
|
-
# This is a Rails 3.1 template to use with leonardo gem
|
3
|
+
# This is a Rails 3.1+ template to use with leonardo gem
|
4
4
|
# https://rubygems.org/gems/leonardo
|
5
5
|
#
|
6
6
|
# USAGE: rails new yourappname -m template.rb
|
7
7
|
#
|
8
8
|
# -------------------------------------------------------
|
9
|
-
#
|
9
|
+
# 21-02-2012: Removed validation_reflection, added activeadmin and bundle install folder
|
10
|
+
# 08-11-2011: Added roles_mask migration for cancan gem
|
10
11
|
# 27-10-2011: Replaced String.any? with String.size>0 for ruby 1.9.2 support
|
11
12
|
# 21-10-2011: Davide L. - Added folder creation 'vendor/assets/javascripts/include/' for linux compatibility
|
12
13
|
# 05-10-2011: Added ajax option
|
@@ -43,7 +44,7 @@ gem 'state_machine' if yes?("Do you have to handle states ?")
|
|
43
44
|
formtastic = yes?("Formtastic ?")
|
44
45
|
if formtastic
|
45
46
|
gem 'formtastic'
|
46
|
-
gem 'validation_reflection'
|
47
|
+
#gem 'validation_reflection'
|
47
48
|
end
|
48
49
|
|
49
50
|
rspec = yes?("Add rspec as testing framework ?")
|
@@ -69,6 +70,12 @@ gem 'cancan' if cancan
|
|
69
70
|
ajax = yes?("Would you enhance ajax ?")
|
70
71
|
gem "rails3-jquery-autocomplete" if ajax
|
71
72
|
|
73
|
+
activeadmin = yes?("Would install Active Admin ?")
|
74
|
+
if activeadmin
|
75
|
+
gem "activeadmin"
|
76
|
+
gem "meta_search"
|
77
|
+
end
|
78
|
+
|
72
79
|
#home = yes?("Generate controller home ? (raccomanded)")
|
73
80
|
home = true
|
74
81
|
|
@@ -82,7 +89,10 @@ if leolay
|
|
82
89
|
leolay_second_color = ask(" Choose secondary color [blank=default color]:")
|
83
90
|
end
|
84
91
|
|
85
|
-
|
92
|
+
if yes?("Bundle install ?")
|
93
|
+
dir = ask(" Insert folder name to install locally: [blank=default gems path]")
|
94
|
+
run "bundle install #{dir}"
|
95
|
+
end
|
86
96
|
|
87
97
|
generate "kaminari:config" if pagination
|
88
98
|
|
@@ -101,6 +111,8 @@ if cancan
|
|
101
111
|
generate "migration", "AddRolesMaskToUsers", "roles_mask:integer"
|
102
112
|
end
|
103
113
|
|
114
|
+
generate "active_admin:install" if activeadmin
|
115
|
+
|
104
116
|
generate "autocomplete:install" if ajax
|
105
117
|
|
106
118
|
####################################################################
|
metadata
CHANGED
@@ -1,32 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: leonardo
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.10.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 9
|
9
|
-
- 0
|
10
|
-
version: 1.9.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Marco Mastrodonato
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-12-13 00:00:00 Z
|
12
|
+
date: 2012-02-23 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
14
|
+
description: A generator for creating Rails applications ready to go. It generates
|
15
|
+
the layout, the style, the internationalization and manage external gems for authentication,
|
16
|
+
authorization and other. It also provides a customized scaffold to generates cool
|
17
|
+
sites ajax ready in few minutes. If you find a bug please report to m.mastrodonato@gmail.com
|
22
18
|
email: m.mastrodonato@gmail.com
|
23
19
|
executables: []
|
24
|
-
|
25
20
|
extensions: []
|
26
|
-
|
27
21
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
22
|
+
files:
|
30
23
|
- lib/generators/erb/leosca/leosca_generator.rb
|
31
24
|
- lib/generators/erb/leosca/templates/copy.html.erb
|
32
25
|
- lib/generators/erb/leosca/templates/destroy.js.erb
|
@@ -41,10 +34,12 @@ files:
|
|
41
34
|
- lib/generators/erb/leosca/templates/select.js.erb
|
42
35
|
- lib/generators/erb/leosca/templates/show.html.erb
|
43
36
|
- lib/generators/erb/leosca/templates/show.js.erb
|
37
|
+
- lib/generators/erb/leosca/templates/with_nested.js.erb
|
44
38
|
- lib/generators/erb/leosca/templates/_fields.html.erb
|
45
39
|
- lib/generators/erb/leosca/templates/_form.html.erb
|
46
40
|
- lib/generators/erb/leosca/templates/_form_multiple.html.erb
|
47
41
|
- lib/generators/erb/leosca/templates/_list.erb
|
42
|
+
- lib/generators/erb/leosca/templates/_nested.erb
|
48
43
|
- lib/generators/erb/leosca/templates/_row_index.html.erb
|
49
44
|
- lib/generators/erb/leosca/templates/_show.erb
|
50
45
|
- lib/generators/leolay/install_generator.rb
|
@@ -104,6 +99,7 @@ files:
|
|
104
99
|
- lib/generators/leolay/templates/styles/cloudy/images/style/msg_error.gif
|
105
100
|
- lib/generators/leolay/templates/styles/cloudy/images/style/msg_notice.gif
|
106
101
|
- lib/generators/leolay/templates/styles/cloudy/images/style/Thumbs.db
|
102
|
+
- lib/generators/leolay/templates/styles/cloudy/stylesheets/app/states.sass
|
107
103
|
- lib/generators/leolay/templates/styles/cloudy/stylesheets/app/stylesheet.sass
|
108
104
|
- lib/generators/leolay/templates/styles/cloudy/stylesheets/vendor/jquery-ui/jquery-ui-1.8.16.redcarpet.css
|
109
105
|
- lib/generators/leolay/templates/styles/cloudy/views/kaminari/_next_page.html.erb
|
@@ -146,36 +142,27 @@ files:
|
|
146
142
|
- template.rb
|
147
143
|
homepage: http://github.com/marcomd/Leonardo
|
148
144
|
licenses: []
|
149
|
-
|
150
145
|
post_install_message:
|
151
146
|
rdoc_options: []
|
152
|
-
|
153
|
-
require_paths:
|
147
|
+
require_paths:
|
154
148
|
- lib
|
155
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
150
|
none: false
|
157
|
-
requirements:
|
158
|
-
- -
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
|
161
|
-
|
162
|
-
- 0
|
163
|
-
version: "0"
|
164
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
156
|
none: false
|
166
|
-
requirements:
|
167
|
-
- -
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
version: "0"
|
173
|
-
requirements:
|
174
|
-
- Start a new app with the template.rb from github or inside root folder
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements:
|
162
|
+
- Start a new app with the template.rb inside root folder
|
175
163
|
rubyforge_project:
|
176
|
-
rubygems_version: 1.8.
|
164
|
+
rubygems_version: 1.8.15
|
177
165
|
signing_key:
|
178
166
|
specification_version: 3
|
179
|
-
summary: A layout and customized scaffold generator for Rails 3.1
|
167
|
+
summary: A layout and customized scaffold generator for Rails 3.1+
|
180
168
|
test_files: []
|
181
|
-
|