active_leonardo 0.5.3 → 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/active_template.rb +14 -4
- data/lib/generators/leolay/leolay_generator.rb +8 -0
- data/lib/generators/leolay/templates/config/locales/devise.it.yml +34 -33
- data/lib/generators/leolay/templates/config/locales/en.yml +1 -44
- data/lib/generators/leolay/templates/config/locales/it.yml +0 -41
- data/lib/generators/leolay/templates/styles/active/images/datepicker-input-icon.png +0 -0
- data/lib/generators/leolay/templates/styles/active/stylesheets/app/custom_active_admin.css.scss +5 -0
- data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +42 -13
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924be1159c792661c533104531258bcce052eccb
|
4
|
+
data.tar.gz: ad82164a253e59ee74fd4954c8471ff4ea8ef939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788c1e2692f15764bbfbc5184f298317ead94b198b7b3fd2b905e8cf454ad14daf067c6c44b354e6c47fa1720053d48dfabb2d1172762212fc4e5a9621e88c54
|
7
|
+
data.tar.gz: d8f411423017feef36ab87759f169899e32fc475614c3169cdab0648f82b187ce31009624a10d8cfab1fd27dfd5ee00110336719257c60b72214f83c340de23c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.6.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.5.3...v0.6.0) February 9th, 2016
|
2
|
+
------------------------------
|
3
|
+
* Rails 5 ready
|
4
|
+
* Now leosca generator prepares the activeadmin dsl for index, show, filters and form
|
5
|
+
* New user name method inside the model to show a name from email
|
6
|
+
* Updated italian devise message to align with version 3.5 of devise
|
7
|
+
|
1
8
|
0.5.3 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.5.2...v0.5.3) November 9th, 2015
|
2
9
|
------------------------------
|
3
10
|
* Removed a bug that occurs during the destroy
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ It generates the layout, the style, the internationalization and it helps you to
|
|
9
9
|
|
10
10
|
## Compatibility
|
11
11
|
|
12
|
-
This version has been tested on Rails `3.2` to `
|
12
|
+
This version has been tested on Rails `3.2` to `5.0.beta2` and Ruby `1.9.3` to `2.2.3` on Windows OS and Linux
|
13
13
|
|
14
14
|
|
15
15
|
Click on Travis badge for more details.
|
data/active_template.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#########################################################
|
2
|
-
#
|
3
|
-
# This is a Rails
|
2
|
+
# 2016 Marco Mastrodonato(c)
|
3
|
+
# This is a Rails 5.x template to use with activeleonardo gem
|
4
4
|
# https://rubygems.org/gems/active_leonardo
|
5
5
|
# https://github.com/marcomd/Active_Leonardo
|
6
6
|
#
|
@@ -49,7 +49,8 @@ if use_git
|
|
49
49
|
EOS
|
50
50
|
end
|
51
51
|
|
52
|
-
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin.git'
|
52
|
+
#gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin.git'
|
53
|
+
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin', branch: 'rails-5-rspec'
|
53
54
|
|
54
55
|
if test_mode
|
55
56
|
gem "active_leonardo", path: "../../."
|
@@ -93,7 +94,11 @@ if authentication
|
|
93
94
|
REMEM
|
94
95
|
p stdout
|
95
96
|
end
|
96
|
-
|
97
|
+
if /^5/ === rails_version
|
98
|
+
gem "devise", git: "https://github.com/plataformatec/devise.git"
|
99
|
+
else
|
100
|
+
gem "devise"
|
101
|
+
end
|
97
102
|
|
98
103
|
authorization = test_mode || yes?("Authorization ?")
|
99
104
|
if authorization
|
@@ -104,6 +109,11 @@ end
|
|
104
109
|
gem 'state_machines' if test_mode || yes?("Do you have to handle states ?")
|
105
110
|
|
106
111
|
gem 'inherited_resources'
|
112
|
+
if /^5/ === rails_version
|
113
|
+
gem 'formtastic', git: 'https://github.com/justinfrench/formtastic.git'
|
114
|
+
else
|
115
|
+
gem 'formtastic'
|
116
|
+
end
|
107
117
|
|
108
118
|
dashboard_root = test_mode || yes?("Would you use dashboard as root ? (recommended)")
|
109
119
|
home = test_mode || yes?("Ok. Would you create home controller as root ?") unless dashboard_root
|
@@ -124,6 +124,14 @@ class LeolayGenerator < Rails::Generators::Base
|
|
124
124
|
def admin?
|
125
125
|
self.role? 'admin'
|
126
126
|
end
|
127
|
+
def name
|
128
|
+
return unless self.email
|
129
|
+
# Get left email text
|
130
|
+
match_data = self.email.match(/^([a-z]+)(\.|\-|\_|)([a-z]+|)/i)
|
131
|
+
name = "\#{match_data[1].capitalize}"
|
132
|
+
name << " \#{match_data[3].capitalize}" unless match_data[3].blank?
|
133
|
+
name
|
134
|
+
end
|
127
135
|
FILE
|
128
136
|
end
|
129
137
|
|
@@ -1,38 +1,37 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
it:
|
4
|
-
errors:
|
5
|
-
messages:
|
6
|
-
expired: "è scaduto ed è necessario richiederne uno nuovo"
|
7
|
-
not_found: "non trovato"
|
8
|
-
already_confirmed: "è già stato confermato, riprova a collegarti"
|
9
|
-
not_locked: "non era bloccato"
|
10
|
-
not_saved:
|
11
|
-
one: "un errore ha impedito il salvataggio di %{resource}:"
|
12
|
-
other: "%{count} errori hanno impedito il salvataggio di %{resource}:"
|
13
|
-
|
14
4
|
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Il tuo account è stato correttamente confermato. Ora sei collegato."
|
7
|
+
send_instructions: "Riceverai un messaggio email con le istruzioni per confermare il tuo account entro qualche minuto."
|
8
|
+
send_paranoid_instructions: "Se il tuo indirizzo email esiste nel nostro database, fra pochi minuti riceverai un link con le istruzioni per confermare il tuo account."
|
15
9
|
failure:
|
16
10
|
already_authenticated: "Sei già autenticato"
|
17
|
-
|
18
|
-
|
11
|
+
inactive: "Il tuo account non è stato ancora attivato."
|
12
|
+
invalid: "%{authentication_keys} o password non validi."
|
19
13
|
locked: "Il tuo account è bloccato."
|
20
|
-
|
21
|
-
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
22
16
|
timeout: "Sessione scaduta, accedere nuovamente per continuare."
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
unauthenticated: "Devi accedere o registrarti per continuare."
|
18
|
+
unconfirmed: "Devi confermare il tuo account per continuare."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Istruzioni per la conferma"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Istruzioni per reimpostare la password"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Istruzioni per sbloccare l'account"
|
26
|
+
omniauth_callbacks:
|
27
|
+
failure: "Non siamo riusciti ad autoruzzarti da %{kind} perchè '%{reason}'."
|
28
|
+
success: "Sei stato autorizzato dall'account di %{kind}."
|
27
29
|
passwords:
|
30
|
+
no_token: "Non è possibile accedere a questa pagina se non hai effettuato una reimpostazione della password in tal caso assicurati di aver usato l'URL completo fornito."
|
28
31
|
send_instructions: "Riceverai un messaggio email con le istruzioni per reimpostare la tua password entro qualche minuto."
|
32
|
+
send_paranoid_instructions: "Se il tuo indirizzo e-mail esiste nel nostro database, riceverai un link per il recupero della password."
|
29
33
|
updated: "La tua password è stata cambiata. Ora sei collegato."
|
30
34
|
updated_not_active: "La tua password è stata cambiata."
|
31
|
-
send_paranoid_instructions: "Se il tuo indirizzo e-mail esiste nel nostro database, riceverai un link per il recupero della password."
|
32
|
-
confirmations:
|
33
|
-
send_instructions: "Riceverai un messaggio email con le istruzioni per confermare il tuo account entro qualche minuto."
|
34
|
-
send_paranoid_instructions: "Se il tuo indirizzo e-mail esiste nel nostro database, fra pochi minuti riceverai un link con le istruzioni per confermare il tuo account."
|
35
|
-
confirmed: "Il tuo account è stato correttamente confermato. Ora sei collegato."
|
36
35
|
registrations:
|
37
36
|
signed_up: "Iscrizione correttamente eseguita."
|
38
37
|
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."
|
@@ -41,17 +40,19 @@ it:
|
|
41
40
|
updated: "Il tuo account è stato aggiornato."
|
42
41
|
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."
|
43
42
|
destroyed: "Arrivederci! L'account è stato cancellato. Speriamo di rivederti presto."
|
43
|
+
sessions:
|
44
|
+
signed_in: "Accesso effettuato con successo."
|
45
|
+
signed_out: "Sei uscito correttamente."
|
44
46
|
unlocks:
|
45
47
|
send_instructions: "Riceverai un messaggio email con le istruzioni per sbloccare il tuo account entro qualche minuto."
|
46
48
|
unlocked: "Il tuo account è stato correttamente sbloccato. Ora sei collegato."
|
47
49
|
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."
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
subject: "Istruzioni per sbloccare l'account"
|
50
|
+
errors:
|
51
|
+
messages:
|
52
|
+
expired: "è scaduto ed è necessario richiederne uno nuovo"
|
53
|
+
not_found: "non trovato"
|
54
|
+
already_confirmed: "è già stato confermato, riprova a collegarti"
|
55
|
+
not_locked: "non era bloccato"
|
56
|
+
not_saved:
|
57
|
+
one: "un errore ha impedito il salvataggio di %{resource}:"
|
58
|
+
other: "%{count} errori hanno impedito il salvataggio di %{resource}:"
|
@@ -226,48 +226,5 @@ en:
|
|
226
226
|
completed: "Completed"
|
227
227
|
closed: "Closed"
|
228
228
|
|
229
|
-
unknown_request: "Sorry, this request is unknown and cannot be processed"
|
230
|
-
generic_error: "An error was occured and doesn't permit to execute this operation"
|
231
|
-
permission_denied: "You don't have authorization to perform this request."
|
232
|
-
created: "%{model} was successfully created."
|
233
|
-
created_ko: "An error prohibited %{model} to be created."
|
234
|
-
created_multiple: "%{model} were successfully created."
|
235
|
-
created_multiple_ko: "An error prohibited %{model} to be created."
|
236
|
-
updated: "%{model} was successfully updated."
|
237
|
-
updated_ko: "An error prohibited %{model} to be updated."
|
238
|
-
updated_multiple: "%{model} were successfully updated."
|
239
|
-
updated_multiple_ko: "An error prohibited %{model} to be updated."
|
240
|
-
deleted: "%{model} was successfully deleted."
|
241
|
-
deleted_ko: "An error prohibited %{model} to be deleted."
|
242
|
-
deleted_multiple: "%{model} were successfully deleted."
|
243
|
-
deleted_multiple_ko: "An error prohibited %{model} to be deleted."
|
244
|
-
search_found: "%{found} found"
|
245
|
-
search_not_found: "The search did not get any results"
|
246
|
-
select_rows_from_list: "Select the rows from the list before proceeding"
|
247
|
-
|
248
229
|
<<: *activerecord
|
249
|
-
<<: *actions
|
250
|
-
|
251
|
-
list: "List"
|
252
|
-
save: "Save"
|
253
|
-
create: "Create"
|
254
|
-
update: "Update"
|
255
|
-
edit: "Edit"
|
256
|
-
delete: "Delete"
|
257
|
-
destroy: "Destroy"
|
258
|
-
new: "New"
|
259
|
-
copy: "Copy"
|
260
|
-
back: "Back"
|
261
|
-
back_to_list: "Back to List"
|
262
|
-
show: "Show"
|
263
|
-
show_all: "Show all"
|
264
|
-
sure?: "Are you sure?"
|
265
|
-
add: "Add"
|
266
|
-
create: "Create"
|
267
|
-
update: "Update"
|
268
|
-
search: "Search"
|
269
|
-
radio-yes: "Yes"
|
270
|
-
radio-no: "No"
|
271
|
-
radio-all: "All"
|
272
|
-
loading: "Loading..."
|
273
|
-
choose_language: "Choose language"
|
230
|
+
<<: *actions
|
@@ -262,46 +262,5 @@ it:
|
|
262
262
|
last: "Ultimo"
|
263
263
|
truncate: "..."
|
264
264
|
|
265
|
-
unknown_request: "Spiacente, richiesta sconosciuta, non è possibile eseguirla"
|
266
|
-
generic_error: "Un errore impedisce di svolgere questa operazione"
|
267
|
-
permission_denied: "Non hai i privilegi per svolgere questa operazione."
|
268
|
-
created: "L'oggetto %{model} è stato creato correttamente."
|
269
|
-
created_ko: "Un errore ha impedito la creazione dell'oggetto %{model}."
|
270
|
-
created_multiple: "La creazione di %{model} è stata completata con successo."
|
271
|
-
created_multiple_ko: "Un errore ha impedito la creazione di %{model}."
|
272
|
-
updated: "L'oggetto %{model} è stato modificato correttamente."
|
273
|
-
updated_ko: "Un errore ha impedito la modifica dell'oggetto %{model}."
|
274
|
-
updated_multiple: "La modifica di %{model} è avvenuta con successo."
|
275
|
-
updated_multiple_ko: "Un errore ha impedito la modifica di %{model}."
|
276
|
-
deleted: "L'oggetto %{model} è stato eliminato."
|
277
|
-
updated_ko: "Un errore ha impedito l'eliminazione dell'oggetto %{model}."
|
278
|
-
deleted_multiple: "L'eliminazione di %{model} è avvenuta con successo."
|
279
|
-
deleted_multiple_ko: "Un errore ha impedito l'eliminazione di %{model}."
|
280
|
-
search_found: "La ricerca ha trovato %{found}"
|
281
|
-
search_not_found: "La ricerca non ha ottenuto risultati"
|
282
|
-
select_rows_from_list: "Seleziona le righe dalla lista prima di procedere"
|
283
|
-
|
284
265
|
<<: *activerecord
|
285
266
|
<<: *actions
|
286
|
-
|
287
|
-
list: "Lista"
|
288
|
-
save: "Salva"
|
289
|
-
edit: "Modifica"
|
290
|
-
delete: "Cancella"
|
291
|
-
destroy: "Elimina"
|
292
|
-
new: "Nuovo"
|
293
|
-
copy: "Copia"
|
294
|
-
back: "Indietro"
|
295
|
-
back_to_list: "Torna alla Lista"
|
296
|
-
show: "Visualizza"
|
297
|
-
show_all: "Mostra tutti"
|
298
|
-
sure?: "Sei sicuro?"
|
299
|
-
add: "Aggiungi"
|
300
|
-
create: "Crea"
|
301
|
-
update: "Aggiorna"
|
302
|
-
search: "Cerca"
|
303
|
-
radio-yes: "Si"
|
304
|
-
radio-no: "No"
|
305
|
-
radio-all: "Tutto"
|
306
|
-
loading: "Attendere..."
|
307
|
-
choose_language: "Scegli la lingua"
|
Binary file
|
data/lib/generators/leolay/templates/styles/active/stylesheets/app/custom_active_admin.css.scss
CHANGED
@@ -25,4 +25,9 @@ body.active_admin {
|
|
25
25
|
#footer {
|
26
26
|
text-align: center;
|
27
27
|
}
|
28
|
+
input[type=text].datepicker.calendar {
|
29
|
+
background: #fff image-url($style_path + "/datepicker-input-icon.png") no-repeat 100% 7px;
|
30
|
+
padding-right: $date-range-filter-input-right-padding;
|
31
|
+
width: $date-range-filter-input-width;
|
32
|
+
}
|
28
33
|
}
|
@@ -67,16 +67,9 @@ module Rails
|
|
67
67
|
<<-FILE.gsub(/^ /, '')
|
68
68
|
|
69
69
|
# ----- #{class_name.upcase} ----- #
|
70
|
-
can :read, #{class_name}
|
71
|
-
if #{options[:auth_class].downcase}.role? :user
|
72
|
-
|
73
|
-
can [:update], #{class_name}
|
74
|
-
#can [:destroy], #{class_name}
|
75
|
-
end
|
76
|
-
if #{options[:auth_class].downcase}.role? :manager
|
77
|
-
can [:read, :create, :update, :destroy], #{class_name}
|
78
|
-
end
|
79
|
-
|
70
|
+
can :read, #{class_name} if #{options[:auth_class].downcase}.role? :guest
|
71
|
+
can [:read, :create, :update], #{class_name} if #{options[:auth_class].downcase}.role? :user
|
72
|
+
can [:read, :create, :update, :destroy], #{class_name} if #{options[:auth_class].downcase}.role? :manager
|
80
73
|
FILE
|
81
74
|
end
|
82
75
|
end
|
@@ -110,12 +103,49 @@ module Rails
|
|
110
103
|
invoke "active_admin:resource", [singular_table_name]
|
111
104
|
file = "app/admin/#{singular_table_name}.rb"
|
112
105
|
|
113
|
-
|
106
|
+
inject_into_file file, :after => "ActiveAdmin.register #{class_name} do" do
|
107
|
+
<<-FILE.gsub(/^ /, '')
|
108
|
+
|
109
|
+
index do
|
110
|
+
selectable_column
|
111
|
+
id_column
|
112
|
+
#{attributes.first(5).map{|attr| " column(:#{attr.name}){|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")}
|
113
|
+
actions
|
114
|
+
end
|
115
|
+
|
116
|
+
show do |#{singular_table_name}|
|
117
|
+
attributes_table do
|
118
|
+
#{attributes.map{|attr| " row(:#{attr.name}){|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")}
|
119
|
+
row :created_at
|
120
|
+
row :updated_at
|
121
|
+
end
|
122
|
+
# Insert here child tables
|
123
|
+
#panel I18n.t('models.xxxxx') do
|
124
|
+
# table_for #{singular_table_name}.xxxxx do
|
125
|
+
# column(:id) {|xxxxx| link_to xxxxx.id, [:admin, xxxxx]}
|
126
|
+
#end
|
127
|
+
active_admin_comments
|
128
|
+
end
|
129
|
+
|
130
|
+
#{attributes.map{|attr| " filter :#{attr.name}"}.join("\n")}
|
131
|
+
|
132
|
+
form do |f|
|
133
|
+
f.inputs do
|
134
|
+
#{attributes.map{|attr| " f.input :#{attr.name}"}.join("\n")}
|
135
|
+
end
|
136
|
+
#For date use as: :datepicker, input_html: { class: 'calendar' }
|
137
|
+
#For state machine data field as: :select, collection: (f.object.class.state_machine.states.collect { |state| [state.human_name.underscore.capitalize, state.value] }.sort_by { |name| name }), :for => :states, :include_blank => false
|
138
|
+
f.actions
|
139
|
+
end
|
140
|
+
FILE
|
141
|
+
end if File.exists?(file)
|
142
|
+
|
143
|
+
if /^[4-5]/ === Rails.version
|
114
144
|
inject_into_file file, :after => "ActiveAdmin.register #{class_name} do" do
|
115
145
|
<<-FILE.gsub(/^ /, '')
|
116
146
|
|
117
147
|
permit_params do
|
118
|
-
permitted = [#{attributes.map{|attr| ":#{attr.name}"}.join(', ')}]
|
148
|
+
permitted = [:id, #{attributes.map{|attr| ":#{attr.name}"}.join(', ')}, :created_at, :updated_at]
|
119
149
|
permitted
|
120
150
|
end
|
121
151
|
|
@@ -132,7 +162,6 @@ module Rails
|
|
132
162
|
load_resource :except => :index
|
133
163
|
end
|
134
164
|
|
135
|
-
|
136
165
|
FILE
|
137
166
|
end if authorization? && File.exists?(file)
|
138
167
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_leonardo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Mastrodonato
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/generators/leolay/templates/spec/helpers/application_helpers.rb
|
60
60
|
- lib/generators/leolay/templates/spec/support/devise.rb
|
61
61
|
- lib/generators/leolay/templates/styles/active/favicon.ico
|
62
|
+
- lib/generators/leolay/templates/styles/active/images/datepicker-input-icon.png
|
62
63
|
- lib/generators/leolay/templates/styles/active/images/ico_v.png
|
63
64
|
- lib/generators/leolay/templates/styles/active/images/ico_x.png
|
64
65
|
- lib/generators/leolay/templates/styles/active/images/logo.png
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
requirements:
|
114
115
|
- The active_template.rb, check the homepage project
|
115
116
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.4.5.1
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: This gem provides a new customized scaffold generator to combine with active
|