mondo-generators 0.2.0 → 0.5.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.
Files changed (35) hide show
  1. data/VERSION +1 -1
  2. data/mondo-generators.gemspec +29 -3
  3. data/rails_generators/mondo_authentication/mondo_authentication_generator.rb +7 -4
  4. data/rails_generators/mondo_authentication/templates/authentication.rb +2 -2
  5. data/rails_generators/mondo_authentication/templates/authorization_rules.rb +3 -3
  6. data/rails_generators/mondo_authentication/templates/locales/en.yml +78 -0
  7. data/rails_generators/mondo_authentication/templates/locales/it.yml +208 -0
  8. data/rails_generators/mondo_authentication/templates/migration.rb +2 -2
  9. data/rails_generators/mondo_authentication/templates/sessions_controller.rb +2 -2
  10. data/rails_generators/mondo_authentication/templates/users_helper.rb +2 -2
  11. data/rails_generators/mondo_layout/mondo_layout_generator.rb +64 -0
  12. data/rails_generators/mondo_layout/templates/_flash_message.html.haml +3 -0
  13. data/rails_generators/mondo_layout/templates/application.js +17 -0
  14. data/rails_generators/mondo_layout/templates/helper.rb +60 -0
  15. data/rails_generators/mondo_layout/templates/images/error.png +0 -0
  16. data/rails_generators/mondo_layout/templates/images/navbar_bkg.gif +0 -0
  17. data/rails_generators/mondo_layout/templates/images/notice.png +0 -0
  18. data/rails_generators/mondo_layout/templates/images/success.png +0 -0
  19. data/rails_generators/mondo_layout/templates/layout.html.haml +43 -0
  20. data/rails_generators/mondo_layout/templates/stylesheets/_colors.sass +9 -0
  21. data/rails_generators/mondo_layout/templates/stylesheets/_constants.sass +14 -0
  22. data/rails_generators/mondo_layout/templates/stylesheets/_mixins.sass +15 -0
  23. data/rails_generators/mondo_layout/templates/stylesheets/partials/_base.sass +46 -0
  24. data/rails_generators/mondo_layout/templates/stylesheets/partials/_content.sass +6 -0
  25. data/rails_generators/mondo_layout/templates/stylesheets/partials/_errors.sass +23 -0
  26. data/rails_generators/mondo_layout/templates/stylesheets/partials/_footer.sass +13 -0
  27. data/rails_generators/mondo_layout/templates/stylesheets/partials/_forms.sass +49 -0
  28. data/rails_generators/mondo_layout/templates/stylesheets/partials/_header.sass +60 -0
  29. data/rails_generators/mondo_layout/templates/stylesheets/partials/_links.sass +17 -0
  30. data/rails_generators/mondo_layout/templates/stylesheets/partials/_pagination.sass +14 -0
  31. data/rails_generators/mondo_layout/templates/stylesheets/partials/_tables.sass +13 -0
  32. data/rails_generators/mondo_layout/templates/stylesheets/partials/_typography.sass +21 -0
  33. data/rails_generators/mondo_layout/templates/stylesheets/partials/_users.sass +31 -0
  34. data/rails_generators/mondo_layout/templates/stylesheets/screen.sass +11 -0
  35. metadata +28 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.5.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mondo-generators}
8
- s.version = "0.2.0"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Luca Tironi"]
12
- s.date = %q{2009-11-25}
12
+ s.date = %q{2009-11-27}
13
13
  s.description = %q{A collection of useful generator scripts for Rails.}
14
14
  s.email = %q{luca.tironi@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,6 +26,8 @@ Gem::Specification.new do |s|
26
26
  "rails_generators/mondo_authentication/mondo_authentication_generator.rb",
27
27
  "rails_generators/mondo_authentication/templates/authentication.rb",
28
28
  "rails_generators/mondo_authentication/templates/authorization_rules.rb",
29
+ "rails_generators/mondo_authentication/templates/locales/en.yml",
30
+ "rails_generators/mondo_authentication/templates/locales/it.yml",
29
31
  "rails_generators/mondo_authentication/templates/migration.rb",
30
32
  "rails_generators/mondo_authentication/templates/session.rb",
31
33
  "rails_generators/mondo_authentication/templates/sessions_controller.rb",
@@ -38,7 +40,31 @@ Gem::Specification.new do |s|
38
40
  "rails_generators/mondo_authentication/templates/views/login.html.haml",
39
41
  "rails_generators/mondo_authentication/templates/views/mass_new.html.haml",
40
42
  "rails_generators/mondo_authentication/templates/views/new.html.haml",
41
- "rails_generators/mondo_authentication/templates/views/show.html.haml"
43
+ "rails_generators/mondo_authentication/templates/views/show.html.haml",
44
+ "rails_generators/mondo_layout/mondo_layout_generator.rb",
45
+ "rails_generators/mondo_layout/templates/_flash_message.html.haml",
46
+ "rails_generators/mondo_layout/templates/application.js",
47
+ "rails_generators/mondo_layout/templates/helper.rb",
48
+ "rails_generators/mondo_layout/templates/images/error.png",
49
+ "rails_generators/mondo_layout/templates/images/navbar_bkg.gif",
50
+ "rails_generators/mondo_layout/templates/images/notice.png",
51
+ "rails_generators/mondo_layout/templates/images/success.png",
52
+ "rails_generators/mondo_layout/templates/layout.html.haml",
53
+ "rails_generators/mondo_layout/templates/stylesheets/_colors.sass",
54
+ "rails_generators/mondo_layout/templates/stylesheets/_constants.sass",
55
+ "rails_generators/mondo_layout/templates/stylesheets/_mixins.sass",
56
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_base.sass",
57
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_content.sass",
58
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_errors.sass",
59
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_footer.sass",
60
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_forms.sass",
61
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_header.sass",
62
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_links.sass",
63
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_pagination.sass",
64
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_tables.sass",
65
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_typography.sass",
66
+ "rails_generators/mondo_layout/templates/stylesheets/partials/_users.sass",
67
+ "rails_generators/mondo_layout/templates/stylesheets/screen.sass"
42
68
  ]
43
69
  s.homepage = %q{http://gemcutter.org/gems/mondo-generators}
44
70
  s.rdoc_options = ["--charset=UTF-8"]
@@ -37,13 +37,16 @@ class MondoAuthenticationGenerator < Rails::Generator::Base
37
37
  m.template "authorization_rules.rb", "config/authorization_rules.rb"
38
38
  m.migration_template "migration.rb", "db/migrate", :migration_file_name => "create_#{user_plural_name}"
39
39
 
40
- m.insert_into "config/routes.rb", "map.resources :#{user_plural_name}, :collection => { :mass_new => :get, :mass_create => :post }"
41
- m.route_resources session_plural_name
42
- m.route_name :login, 'login', :controller => session_plural_name, :action => 'new'
43
- m.route_name :logout, 'logout', :controller => session_plural_name, :action => 'destroy'
44
40
  m.route_name :signup, 'signup', :controller => user_plural_name, :action => 'new'
41
+ m.route_name :logout, 'logout', :controller => session_plural_name, :action => 'destroy'
42
+ m.route_name :login, 'login', :controller => session_plural_name, :action => 'new'
43
+ m.insert_into "config/routes.rb", 'map.resources :users, :collection => { :mass_new => :get, :mass_create => :post }'
44
+ m.route_resources session_plural_name
45
45
 
46
46
  m.insert_into "app/controllers/#{application_controller_name}.rb", 'include Authentication'
47
+
48
+ m.template "locales/en.yml", "config/locales/en.yml"
49
+ m.template "locales/it.yml", "config/locales/it.yml"
47
50
  end
48
51
  end
49
52
 
@@ -18,7 +18,7 @@ module Authentication
18
18
  current_<%= user_singular_name %>
19
19
  end
20
20
 
21
- def require_user
21
+ def require_login
22
22
  unless logged_in?
23
23
  store_target_location
24
24
  redirect_to login_url
@@ -26,7 +26,7 @@ module Authentication
26
26
  end
27
27
  end
28
28
 
29
- def require_no_user
29
+ def require_logout
30
30
  if logged_in?
31
31
  store_target_location
32
32
  flash[:notice] = t("application.require_user")
@@ -4,9 +4,9 @@ authorization do
4
4
 
5
5
  role :<%= user_singular_name %> do
6
6
  includes :guest
7
- has_permission_on :%= user_plural_name %>, :to => :show
8
- has_permission_on :%= user_plural_name %>, :to => :update do
9
- if_attribute :id => is { <%= user_singular_name %> .id }
7
+ has_permission_on :<%= user_plural_name %>, :to => :show
8
+ has_permission_on :<%= user_plural_name %>, :to => :update do
9
+ if_attribute :id => is { <%= user_singular_name %>.id }
10
10
  end
11
11
  end
12
12
 
@@ -0,0 +1,78 @@
1
+ en:
2
+ label:
3
+ create: Create
4
+ update: Update
5
+ email: Email
6
+ password: Password
7
+ login: Login
8
+ signup: Signup
9
+ logout: Logout
10
+ show: Show
11
+ edit: Edit
12
+ destroy: Delete
13
+ back: Back
14
+ welcome: "Welcome, "
15
+
16
+ confirm:
17
+ logout: "Are you sure you want to logout?"
18
+ destroy: "Are you sure?"
19
+
20
+ application:
21
+ require_user: "You must be logged out to access this page"
22
+ permission_denied: "You don't have permission to complete that action."
23
+
24
+ accounts:
25
+ create:
26
+ notice: "Account successfully created."
27
+ update:
28
+ notice: "Account successfully updated."
29
+
30
+ roles:
31
+ index:
32
+ title: "Roles"
33
+ new_role_link: "Add new role"
34
+ new:
35
+ title: "New role"
36
+ create:
37
+ notice: "Role successfully created."
38
+ edit:
39
+ title: "Edit role"
40
+ update:
41
+ notice: "Role successfully updated."
42
+ destroy:
43
+ notice: "Role successfully deleted."
44
+
45
+ users:
46
+ index:
47
+ title: "Users"
48
+ search: "Search"
49
+ new_user_link: "Add new user"
50
+ mass_new_users_link: "Mass add new Users"
51
+ new:
52
+ title: "New user"
53
+ create:
54
+ notice: "User successfully created."
55
+ mass_new:
56
+ title: "Mass add new Users"
57
+ label: "Insert new users"
58
+ help: "Please insert users comma separated as <strong>First Name,Last Name,Email,Password</strong>"
59
+ mass_create:
60
+ notice: "Users successfully created."
61
+ error: "You didn't insert any user!"
62
+ edit:
63
+ title: "Edit user"
64
+ update:
65
+ notice: "User successfully updated."
66
+ destroy:
67
+ notice: "User successfully deleted."
68
+
69
+ user_sessions:
70
+ new:
71
+ title: "Login"
72
+ login: "Your login"
73
+ email: "Your email"
74
+ password: "Your password"
75
+ create:
76
+ notice: "Successfully logged in."
77
+ destroy:
78
+ notice: "Successfully logged out."
@@ -0,0 +1,208 @@
1
+ it:
2
+ label:
3
+ create: Aggiungi
4
+ update: Aggiona
5
+ email: Email
6
+ password: Password
7
+ login: Login
8
+ signup: Registrati
9
+ logout: Logout
10
+ show: Vedi
11
+ edit: Modifica
12
+ destroy: Cancella
13
+ back: Indietro
14
+ welcome: "Ciao, "
15
+
16
+ confirm:
17
+ logout: "Sei sicuro di voler fare logout?"
18
+ destroy: "Sei sicuro?"
19
+
20
+ application:
21
+ require_user: "Bisogna aver eseguito il logout per accedere a questa pagina."
22
+ permission_denied: "Non hai il permesso di eseguire questa azione."
23
+
24
+ accounts:
25
+ create:
26
+ notice: "Account creato con successo."
27
+ update:
28
+ notice: "Account modificato con successo."
29
+
30
+ users:
31
+ index:
32
+ title: "Utenti"
33
+ search: "Cerca"
34
+ new_user_link: "Aggiungi nuovo utente"
35
+ mass_new_users_link: "Aggiungi utenti in massa"
36
+ new:
37
+ title: "Nuovo utente"
38
+ create:
39
+ notice: "Utente creato con successo."
40
+ mass_new:
41
+ title: "Aggiungi utenti in massa"
42
+ label: "Inserisci nuovi utenti"
43
+ help: "Ti preghiamo di inserire gli utenti separati da virgole nell'ordine <strong>Nome,Cognome,Email,Password</strong>"
44
+ mass_create:
45
+ notice: "Utenti creati con successo."
46
+ error: "Non hai inserito nessun utente!"
47
+ edit:
48
+ title: "Modifica utente"
49
+ update:
50
+ notice: "Utente modificato con successo."
51
+ destroy:
52
+ notice: "Utente cancellato con successo."
53
+
54
+ user_sessions:
55
+ new:
56
+ title: "Login"
57
+ login: "Il tuo login"
58
+ email: "La tua email"
59
+ password: "La tua password"
60
+ create:
61
+ notice: "Login eseguito con successo."
62
+ destroy:
63
+ notice: "Logout eseguito con successo."
64
+
65
+ # Italian translations for Ruby on Rails
66
+ # by Claudio Poli (masterkain@gmail.com)
67
+ # maintained by Simone Carletti (weppos@weppos.net)
68
+ #
69
+ # This localization file targets Rails 2.3.2.
70
+ # If you need a previous version go to http://github.com/weppos/rails-i18n/
71
+ # and choose between available tags.
72
+ number:
73
+ format:
74
+ separator: ","
75
+ delimiter: "."
76
+ precision: 3
77
+
78
+ currency:
79
+ format:
80
+ format: "%n %u"
81
+ unit: "€"
82
+ separator: "."
83
+ delimiter: ","
84
+ precision: 2
85
+
86
+ percentage:
87
+ format:
88
+ delimiter: ""
89
+ # precision:
90
+
91
+ precision:
92
+ format:
93
+ # separator:
94
+ delimiter: ""
95
+ # precision:
96
+
97
+ human:
98
+ format:
99
+ # separator:
100
+ delimiter: ""
101
+ precision: 1
102
+ storage_units:
103
+ format: "%n %u"
104
+ units:
105
+ byte:
106
+ one: "Byte"
107
+ other: "Byte"
108
+ kb: "Kb"
109
+ mb: "Mb"
110
+ gb: "Gb"
111
+ tb: "Tb"
112
+
113
+ date:
114
+ formats:
115
+ default: "%d-%m-%Y"
116
+ short: "%d %b"
117
+ long: "%d %B %Y"
118
+
119
+ day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
120
+ abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]
121
+
122
+ month_names: [~, Gennaio, Febbraio, Marzo, Aprile, Maggio, Giugno, Luglio, Agosto, Settembre, Ottobre, Novembre, Dicembre]
123
+ abbr_month_names: [~, Gen, Feb, Mar, Apr, Mag, Giu, Lug, Ago, Set, Ott, Nov, Dic]
124
+ order: [ :day, :month, :year ]
125
+
126
+ time:
127
+ formats:
128
+ default: "%a %d %b %Y, %H:%M:%S %z"
129
+ short: "%d %b %H:%M"
130
+ long: "%d %B %Y %H:%M"
131
+
132
+ am: 'am'
133
+ pm: 'pm'
134
+
135
+ datetime:
136
+ distance_in_words:
137
+ half_a_minute: "mezzo minuto"
138
+ less_than_x_seconds:
139
+ one: "meno di un secondo"
140
+ other: "meno di {{count}} secondi"
141
+ x_seconds:
142
+ one: "1 secondo"
143
+ other: "{{count}} secondi"
144
+ less_than_x_minutes:
145
+ one: "meno di un minuto"
146
+ other: "meno di {{count}} minuti"
147
+ x_minutes:
148
+ one: "1 minuto"
149
+ other: "{{count}} minuti"
150
+ about_x_hours:
151
+ one: "circa un'ora"
152
+ other: "circa {{count}} ore"
153
+ x_days:
154
+ one: "1 giorno"
155
+ other: "{{count}} giorni"
156
+ about_x_months:
157
+ one: "circa un mese"
158
+ other: "circa {{count}} mesi"
159
+ x_months:
160
+ one: "1 mese"
161
+ other: "{{count}} mesi"
162
+ about_x_years:
163
+ one: "circa un anno"
164
+ other: "circa {{count}} anni"
165
+ over_x_years:
166
+ one: "oltre un anno"
167
+ other: "oltre {{count}} anni"
168
+ prompts:
169
+ year: "Anno"
170
+ month: "Mese"
171
+ day: "Giorno"
172
+ hour: "Ora"
173
+ minute: "Minuto"
174
+ second: "Secondi"
175
+
176
+ support:
177
+ array:
178
+ words_connector: ", "
179
+ two_words_connector: " e "
180
+ last_word_connector: ", e "
181
+
182
+ activerecord:
183
+ errors:
184
+ template:
185
+ header:
186
+ one: "Non posso salvare questo {{model}}: 1 errore"
187
+ other: "Non posso salvare questo {{model}}: {{count}} errori."
188
+ body: "Per favore ricontrolla i seguenti campi:"
189
+ messages:
190
+ inclusion: "non è incluso nella lista"
191
+ exclusion: "è riservato"
192
+ invalid: "non è valido"
193
+ confirmation: "non coincide con la conferma"
194
+ accepted: "deve essere accettata"
195
+ empty: "non può essere vuoto"
196
+ blank: "non può essere lasciato in bianco"
197
+ too_long: "è troppo lungo (il massimo è {{count}} lettere)"
198
+ too_short: "è troppo corto (il minimo è {{count}} lettere)"
199
+ wrong_length: "è della lunghezza sbagliata (deve essere di {{count}} lettere)"
200
+ taken: "è già in uso"
201
+ not_a_number: "non è un numero"
202
+ greater_than: "deve essere superiore a {{count}}"
203
+ greater_than_or_equal_to: "deve essere superiore o uguale a {{count}}"
204
+ equal_to: "deve essere uguale a {{count}}"
205
+ less_than: "deve essere meno di {{count}}"
206
+ less_than_or_equal_to: "deve essere meno o uguale a {{count}}"
207
+ odd: "deve essere dispari"
208
+ even: "deve essere pari"
@@ -1,6 +1,6 @@
1
1
  class Create<%= user_plural_class_name %> < ActiveRecord::Migration
2
2
  def self.up
3
- create_table :<%= user_plural_class_name %> do |t|
3
+ create_table :<%= user_plural_name %> do |t|
4
4
  t.string :email
5
5
  t.string :first_name
6
6
  t.string :last_name
@@ -26,6 +26,6 @@ class Create<%= user_plural_class_name %> < ActiveRecord::Migration
26
26
  end
27
27
 
28
28
  def self.down
29
- drop_table :<%= user_plural_class_name %>
29
+ drop_table :<%= user_plural_name %>
30
30
  end
31
31
  end
@@ -1,6 +1,6 @@
1
1
  class <%= session_plural_class_name %>Controller < ApplicationController
2
- before_filter :require_user, :only => :destroy
3
- before_filter :require_no_user, :only => [:new, :create]
2
+ before_filter :require_login, :only => :destroy
3
+ before_filter :require_logout, :only => [:new, :create]
4
4
 
5
5
  def new
6
6
  @<%= session_singular_name %> = <%= session_class_name %>.new
@@ -1,6 +1,6 @@
1
1
  module <%= user_plural_class_name %>Helper
2
- def current_user
3
- @current_user
2
+ def current_<%= user_singular_name %>
3
+ @current_<%= user_singular_name %>
4
4
  end
5
5
 
6
6
  def profile_pic(user, size = "normal")
@@ -0,0 +1,64 @@
1
+ class MondoLayoutGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @app_name = @args.first || 'AppName'
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory 'app/views/layouts'
10
+ m.directory 'app/views/shared'
11
+ m.directory 'app/helpers'
12
+ m.directory 'app/stylesheets/partials'
13
+ m.directory 'public/stylesheets/compiled'
14
+ m.directory 'public/images/icons'
15
+
16
+ m.template "layout.html.haml", "app/views/layouts/application.html.haml"
17
+ m.template "_flash_message.html.haml", "app/views/layouts/_flash_message.html.haml"
18
+ m.file "stylesheets/screen.sass", "app/stylesheets/screen.sass"
19
+ m.file "stylesheets/_colors.sass", "app/stylesheets/_colors.sass"
20
+ m.file "stylesheets/_mixins.sass", "app/stylesheets/_mixins.sass"
21
+ m.file "stylesheets/_constants.sass", "app/stylesheets/_constants.sass"
22
+
23
+ m.file "stylesheets/partials/_base.sass", "app/stylesheets/partials/_base.sass"
24
+ m.file "stylesheets/partials/_typography.sass", "app/stylesheets/partials/_typography.sass"
25
+ m.file "stylesheets/partials/_header.sass", "app/stylesheets/partials/_header.sass"
26
+ m.file "stylesheets/partials/_content.sass", "app/stylesheets/partials/_content.sass"
27
+ m.file "stylesheets/partials/_footer.sass", "app/stylesheets/partials/_footer.sass"
28
+
29
+ m.file "stylesheets/partials/_tables.sass", "app/stylesheets/partials/_tables.sass"
30
+ m.file "stylesheets/partials/_forms.sass", "app/stylesheets/partials/_forms.sass"
31
+ m.file "stylesheets/partials/_links.sass", "app/stylesheets/partials/_links.sass"
32
+ m.file "stylesheets/partials/_pagination.sass", "app/stylesheets/partials/_pagination.sass"
33
+ m.file "stylesheets/partials/_errors.sass", "app/stylesheets/partials/_errors.sass"
34
+
35
+ m.file "stylesheets/partials/_users.sass", "app/stylesheets/partials/_users.sass"
36
+
37
+ m.file "helper.rb", "app/helpers/layout_helper.rb"
38
+ m.file "application.js", "public/javascripts/application.js"
39
+ m.file "images/navbar_bkg.gif", "public/images/navbar_bkg.gif"
40
+ m.file "images/error.png", "public/images/icons/error.png"
41
+ m.file "images/notice.png", "public/images/icons/notice.png"
42
+ m.file "images/success.png", "public/images/icons/success.png"
43
+ end
44
+ end
45
+
46
+ def app_name
47
+ @app_name
48
+ end
49
+
50
+ protected
51
+
52
+ def add_options!(opt)
53
+ opt.separator ''
54
+ opt.separator 'Options:'
55
+ end
56
+
57
+ def banner
58
+ <<-EOS
59
+ Creates generic layout, stylesheet, and helper files.
60
+
61
+ USAGE: #{$0} #{spec.name} [app_name]
62
+ EOS
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ #flash{:class => message_type}
2
+ = image_tag "icons/#{message_type}.png", :class => "icon"
3
+ = message
@@ -0,0 +1,17 @@
1
+ // Place your application-specific JavaScript functions and classes here
2
+ // This file is automatically included by javascript_include_tag :defaults
3
+ function insert_fields(link, method, content) {
4
+ var new_id = new Date().getTime();
5
+ var regexp = new RegExp("new_" + method, "g")
6
+ $(link).up().insert({
7
+ before: content.replace(regexp, new_id)
8
+ });
9
+ }
10
+
11
+ function remove_fields(link) {
12
+ var hidden_field = $(link).previous("input[type=hidden]");
13
+ if (hidden_field) {
14
+ hidden_field.value = '1';
15
+ }
16
+ $(link).up(".fields").hide();
17
+ }
@@ -0,0 +1,60 @@
1
+ # These helper methods can be called in your template to set variables to be used in the layout
2
+ # This module should be included in all views globally,
3
+ # to do so you may need to add this line to your ApplicationController
4
+ # helper :layout
5
+ module LayoutHelper
6
+
7
+ # allows the inclusion of javascript files in the <head> section for specific views
8
+ def javascript(*files)
9
+ content_for(:head, javascript_include_tag(*files))
10
+ end
11
+
12
+ # allows the inclusion of css files in the <head> section for specific views
13
+ def stylesheet(*files)
14
+ content_for(:head, stylesheet_link_tag(*files))
15
+ end
16
+
17
+ # change the <title> for specific views
18
+ def title(page_title)
19
+ content_for(:title, page_title)
20
+ end
21
+
22
+ # change the class => page for specific layouts
23
+ def page(page_name)
24
+ content_for(:page, page_name)
25
+ end
26
+
27
+ # a link to the previous visited page
28
+ def link_to_back
29
+ link_to(t("label.back"), :back)
30
+ end
31
+
32
+ def flash_message
33
+ flash.each do |message_type, message|
34
+ haml_concat render(:partial => "shared/flash_message", :locals => {:message_type => message_type, :message => message}) +
35
+ javascript_tag(
36
+ visual_effect(:appear, "flash_box", :duration => 0.5, :to => 0.7, :queue => {:position => :end, :scope => :folder}) +
37
+ visual_effect(:fade, "flash_box", :duration => 0.5, :delay => 8, :from => 0.7, :queue => {:position => :end, :scope => :folder}))
38
+ flash.discard
39
+ end unless flash.blank?
40
+ end
41
+
42
+ # helpers for nested forms
43
+ def add_child_link(name, f, method)
44
+ fields = new_child_fields(f, method)
45
+ link_to_function(name, h("insert_fields(this, '#{method}', '#{escape_javascript(fields)}')"))
46
+ end
47
+
48
+ def remove_child_link(name, f)
49
+ f.hidden_field(:_delete) + link_to_function(name, "remove_fields(this)")
50
+ end
51
+
52
+ def new_child_fields(form_builder, method, options = {})
53
+ options[:object] ||= form_builder.object.class.reflect_on_association(method).klass.new
54
+ options[:partial] ||= method.to_s.singularize
55
+ options[:form_builder_local] ||= :f
56
+ form_builder.fields_for(method, options[:object], :child_index => "new_#{method}") do |f|
57
+ render(:partial => options[:partial], :locals => { options[:form_builder_local] => f })
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,43 @@
1
+ !!! Strict
2
+ %html{html_attrs}
3
+ %head
4
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html;charset=UTF-8'}
5
+ %title
6
+ == <%= app_name %> | #{yield(:title)}
7
+ = stylesheet_link_tag 'compiled/screen.css', :media => 'screen, projection'
8
+ = stylesheet_link_tag 'compiled/print.css', :media => 'print'
9
+ /[if lt IE 8]
10
+ = stylesheet_link_tag 'compiled/ie.css', :media => 'screen, projection'
11
+ = javascript_include_tag :defaults
12
+ %body{:id => yield(:page)}
13
+ #wrap
14
+ #header
15
+ %h1
16
+ AppName
17
+ #navbar
18
+ %ul
19
+ - if logged_in?
20
+ %li
21
+ = t("label.welcome")
22
+ = link_to current_user.full_name, user_path(@current_user)
23
+ %li
24
+ = link_to "Home", root_path
25
+ %li
26
+ = link_to "Logout", logout_path
27
+ - else
28
+ %li
29
+ = link_to "Home", root_path
30
+ %li
31
+ = link_to "Login", login_path
32
+ #flash_box{:onclick => "new Effect.Fade(this, {duration: 0.1, from: 0.7});", :style => "display: none;"}
33
+ - flash_message
34
+ #content
35
+ %h2= yield(:title)
36
+ = yield
37
+ .push
38
+
39
+ #footer
40
+ %p.right
41
+ SDA Bocconi Learning Lab
42
+ %p.left
43
+
@@ -0,0 +1,9 @@
1
+ !body_background_color = #fff
2
+ !header_background_color = #111
3
+ !navbar_background_color = #fff
4
+ !content_background_color = #fff
5
+ !footer_background_color = #fff
6
+
7
+ !font_color = #464646
8
+ !link_color = #4183c4
9
+ !link_hover_color = #08f
@@ -0,0 +1,14 @@
1
+ !blueprint_grid_columns = 24
2
+ !blueprint_container_size = 950px
3
+ !blueprint_grid_margin = 10px
4
+
5
+ !blueprint_grid_width = (!blueprint_container_size + !blueprint_grid_margin) / !blueprint_grid_columns - !blueprint_grid_margin
6
+
7
+ !container_width = !blueprint_container_size
8
+ !left_column_width = 350px
9
+ !right_column_width = !container_width - !left_column_width - 10px
10
+ !footer_height = 2.5em
11
+
12
+ !font_size = 12px
13
+ !headline_fonts = "Helvetica Neue", "HelveticaNeue", "Helvetica", "Arial"
14
+ !normal_fonts = "Georgia", "Palatino", "Garamond", "serif"
@@ -0,0 +1,15 @@
1
+ =container
2
+ :width = !container_width
3
+ =centered
4
+ +container
5
+ :margin 0 auto
6
+ =bordered
7
+ :padding 0.2em 0.2em 0.2em 0.5em
8
+ :border-left 2px solid #ccc
9
+ =colborder
10
+ :border-right 1px solid #EEEEEE
11
+ :margin-right 25px
12
+ :padding-right 24px
13
+ =weak
14
+ :font-size 90%
15
+ :color #888
@@ -0,0 +1,46 @@
1
+ html, body
2
+ :margin 0
3
+ :height 100%
4
+
5
+ body
6
+ +blueprint-typography-body(!font_size)
7
+ :background = !body_background_color
8
+ :font-family = !normal_fonts
9
+ :color = !font_color
10
+ :text-align left
11
+
12
+ #wrap
13
+ :min-height 100%
14
+ :height auto !important
15
+ :height 100%
16
+ :margin-bottom = -!footer_height
17
+
18
+ .push
19
+ :height = !footer_height
20
+
21
+ a
22
+ img
23
+ :border 0
24
+
25
+ img.icon
26
+ :vertical-align text-bottom
27
+
28
+ br.clear
29
+ :clear both
30
+
31
+ li span.handle
32
+ :font-size 90%
33
+ :cursor move
34
+ :color #777
35
+
36
+ @import header.sass
37
+ @import content.sass
38
+ @import footer.sass
39
+
40
+ @import typography.sass
41
+ @import tables.sass
42
+ @import forms.sass
43
+ @import pagination.sass
44
+ @import errors.sass
45
+
46
+ @import users.sass
@@ -0,0 +1,6 @@
1
+ #content
2
+ +clearfix
3
+ +container
4
+ :margin-bottom 2em
5
+ :padding 0 2em
6
+
@@ -0,0 +1,23 @@
1
+ .fieldWithErrors
2
+ :display inline
3
+ label
4
+ :color #cf0000
5
+ #errorExplanation
6
+ :margin-bottom 1.5em
7
+ :background-color #fff
8
+ h2
9
+ :margin 0
10
+ :padding 3px
11
+ :text-align left
12
+ :font-weight bold
13
+ :color #fff
14
+ :font-size 1.2em
15
+ :background-color #c00
16
+ p
17
+ :margin 0
18
+ :padding 1em 1em 0
19
+ ul
20
+ :margin 0
21
+ :padding 0.5em 0 1em 3em
22
+ :border-bottom 2px solid #cf0000
23
+ :list-style-type square
@@ -0,0 +1,13 @@
1
+ #footer
2
+ +clearfix
3
+ :height = !footer_height
4
+ :margin 0
5
+ :padding 0.4em 2em 0
6
+ :border-top 1px solid #ccc
7
+ :background = !footer_background_color
8
+ p
9
+ :margin 0
10
+ p.left
11
+ +float
12
+ p.right
13
+ +float("right")
@@ -0,0 +1,49 @@
1
+ label
2
+ :font-family = !headline_fonts
3
+ :font-weight bold
4
+ textarea
5
+ :padding 0.2em
6
+ :font-family courier
7
+ :font-size 14px
8
+ :line-height 18px
9
+ .bigfield
10
+ :padding 0.1em 0.2em
11
+ :font-size 110%
12
+
13
+ .required
14
+ +weak
15
+
16
+ p.buttons
17
+ +clearfix
18
+ :margin-bottom 0
19
+
20
+ a.button
21
+ // you can pass "left" or "right" to +anchor-button to float it in that direction
22
+ // or you can pass no argument to leave it inline-block (cross browser safe!) within
23
+ // the flow of your page.
24
+ +anchor-button("left")
25
+ // All the button color mixins take 4 optional arguments:
26
+ // font color, background color, border color, border highlight color
27
+ // the first three default to constants set in blueprint/modules/buttons.sass
28
+ // the last one defaults to a shade lighter than the border color.
29
+ +button-colors
30
+ +button-hover-colors
31
+ +button-active-colors
32
+
33
+ button
34
+ // The +button-button mixin is just like the +anchor-button mixin, but for <button> elements.
35
+ +button-button("left")
36
+ +button-colors
37
+ +button-hover-colors
38
+ +button-active-colors
39
+
40
+ // We can change the colors for buttons of certain classes, etc.
41
+ a.positive, button.positive
42
+ :color #529214
43
+ +button-hover-colors(#529214, #E6EFC2, #C6D880)
44
+ +button-active-colors(#FFF, #529214, #529214)
45
+
46
+ a.negative, button.negative
47
+ :color #D12F19
48
+ +button-hover-colors(#D12F19, #FBE3E4, #FBC2C4)
49
+ +button-active-colors(#FFF, #D12F19, #D12F19)
@@ -0,0 +1,60 @@
1
+ #header
2
+ +clearfix
3
+ :padding 0 2em
4
+ :background = !header_background_color
5
+ h1
6
+ :margin-top 0.3em
7
+ :font-size 2em
8
+ :color #fff
9
+ :font-family = !headline_fonts
10
+ .alt
11
+ :margin-left 0.5em
12
+ :font-size 70%
13
+ :color #aaa
14
+
15
+ #navbar
16
+ +clearfix
17
+ :padding 5px 2em
18
+ :background
19
+ :color = !navbar_background_color
20
+ :image url('../../images/navbar_bkg.gif')
21
+ :position center center
22
+ :repeat repeat-x
23
+ :border
24
+ :top 1px solid #ccc
25
+ :bottom 1px solid #ccc
26
+ ul
27
+ +float("right")
28
+ :margin 0
29
+ +no-bullets
30
+ +horizontal-list(1em)
31
+ :font-family = !headline_fonts
32
+ :border-left 1px solid #ccc
33
+ li
34
+ :border
35
+ :left 1px solid #fff
36
+ :right 1px solid #ccc
37
+ a
38
+ +link-colors(#464646,#000)
39
+ :text-decoration none
40
+ :font-weight bold
41
+
42
+ #flash_box
43
+ :left 0
44
+ :padding 1em 0
45
+ :position absolute
46
+ :width 100%
47
+ :z-index 100
48
+ :opacity 0.8
49
+ :background-color #FCFCFF
50
+ :border-bottom 1px solid #CCCCCC
51
+ :cursor pointer
52
+ #flash
53
+ :font-weight bold
54
+ :text-align center
55
+ #flash.success
56
+ :color #264409
57
+ #flash.notice
58
+ :color #514721
59
+ #flash.error
60
+ :color #8A1F11
@@ -0,0 +1,17 @@
1
+ span.attachment
2
+ a
3
+ :display inline-block
4
+ :padding-left 20px
5
+ :background transparent url("../../images/icons/attachment.png") top left no-repeat
6
+ a[href$=".pdf"]
7
+ :background transparent url("../../images/icons/page_white_acrobat.png") top left no-repeat
8
+ a[href$=".zip"], a[href$=".gzip"], a[href$=".rar"], a[href$=".gz"]
9
+ :background transparent url("../../images/icons/compress.png") top left no-repeat
10
+ a[href$=".xls"], a[href$=".csv"], a[href$=".xlt"], a[href$=".xlw"], a[href$=".xml"], a[href$=".xlsx"]
11
+ :background transparent url("../../images/icons/page_white_excel.png") top left no-repeat
12
+ a[href$=".txt"], a[href$=".rtf"], a[href$=".doc"], a[href$=".docx"]
13
+ :background transparent url("../../images/icons/page_white_word.png") top left no-repeat
14
+ a[href$=".pps"], a[href$=".ppt"], a[href$=".pptx"]
15
+ :background transparent url("../../images/icons/page_white_powerpoint.png") top left no-repeat
16
+ a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"]
17
+ :background transparent url("../../images/icons/picture.png") top left no-repeat
@@ -0,0 +1,14 @@
1
+ .pagination
2
+ :margin 0.5em 0
3
+ a, a:hover, a:active, .current, .disabled
4
+ :margin 0.2em
5
+ :padding 0.4em 0.8em
6
+ :border 1px solid #d1d1cf
7
+ :text-decoration none
8
+ .current
9
+ :font-weight bold
10
+ :background-color #d1d1cf
11
+ :color #fff
12
+ .disabled
13
+ :border 1px solid #aaa
14
+ :color #aaa
@@ -0,0 +1,13 @@
1
+ table
2
+ :border-collapse collapse
3
+ tbody
4
+ :border-bottom 1px solid #bbb
5
+ th
6
+ :text-align left
7
+ :border 1px solid #ccc
8
+ :border-bottom 1px solid #bbb
9
+ :color #000
10
+ tr.odd td
11
+ :background #fafafa
12
+ tr.even td
13
+ :background #eee
@@ -0,0 +1,21 @@
1
+ +blueprint-typography-defaults
2
+
3
+ body
4
+ :color = !font_color
5
+ :font-family = !normal_fonts
6
+
7
+ h2,h3,h4,h5,h6
8
+ :font-family = !headline_fonts
9
+ :font-weight bold
10
+ :padding-left 0.1em
11
+ p, ul
12
+ :padding-left 0.1em
13
+
14
+ a, a:focus, a:visited
15
+ :color = !link_color
16
+ :font-weight bold
17
+ :text-decoration none
18
+ :outline 0
19
+ a:hover
20
+ :text-decoration none
21
+ :color = !link_hover_color
@@ -0,0 +1,31 @@
1
+ .user_profile_pic
2
+ +float
3
+ :width 50px
4
+ :height 50px
5
+ :margin-right 10px
6
+ :background-color #C4CDE0
7
+ img.fb_profile_pic_rendered
8
+ :width 50px
9
+ :height 50px
10
+ .user_profile_pic_big
11
+ +float
12
+ :width 140px
13
+ :margin-right 10px
14
+ :margin-bottom 10px
15
+ img.fb_profile_pic_rendered
16
+ :width 140px
17
+ :height auto
18
+ .user_profile_pic_small
19
+ +float
20
+ :width 24px
21
+ :height 24px
22
+ :margin-top 5px
23
+ :margin-right 5px
24
+ :margin-bottom 5px
25
+ :background-color #C4CDE0
26
+ img.fb_profile_pic_rendered
27
+ :width 24px
28
+ :height 24px
29
+
30
+ #search
31
+ :text-align right
@@ -0,0 +1,11 @@
1
+ @import blueprint.sass
2
+ @import blueprint/modules/reset.sass
3
+ @import blueprint/modules/buttons.sass
4
+ @import compass/utilities.sass
5
+
6
+ +blueprint-grid
7
+
8
+ @import constants.sass
9
+ @import mixins.sass
10
+ @import colors.sass
11
+ @import partials/base.sass
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mondo-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Tironi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-25 00:00:00 +01:00
12
+ date: 2009-11-27 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -32,6 +32,8 @@ files:
32
32
  - rails_generators/mondo_authentication/mondo_authentication_generator.rb
33
33
  - rails_generators/mondo_authentication/templates/authentication.rb
34
34
  - rails_generators/mondo_authentication/templates/authorization_rules.rb
35
+ - rails_generators/mondo_authentication/templates/locales/en.yml
36
+ - rails_generators/mondo_authentication/templates/locales/it.yml
35
37
  - rails_generators/mondo_authentication/templates/migration.rb
36
38
  - rails_generators/mondo_authentication/templates/session.rb
37
39
  - rails_generators/mondo_authentication/templates/sessions_controller.rb
@@ -45,6 +47,30 @@ files:
45
47
  - rails_generators/mondo_authentication/templates/views/mass_new.html.haml
46
48
  - rails_generators/mondo_authentication/templates/views/new.html.haml
47
49
  - rails_generators/mondo_authentication/templates/views/show.html.haml
50
+ - rails_generators/mondo_layout/mondo_layout_generator.rb
51
+ - rails_generators/mondo_layout/templates/_flash_message.html.haml
52
+ - rails_generators/mondo_layout/templates/application.js
53
+ - rails_generators/mondo_layout/templates/helper.rb
54
+ - rails_generators/mondo_layout/templates/images/error.png
55
+ - rails_generators/mondo_layout/templates/images/navbar_bkg.gif
56
+ - rails_generators/mondo_layout/templates/images/notice.png
57
+ - rails_generators/mondo_layout/templates/images/success.png
58
+ - rails_generators/mondo_layout/templates/layout.html.haml
59
+ - rails_generators/mondo_layout/templates/stylesheets/_colors.sass
60
+ - rails_generators/mondo_layout/templates/stylesheets/_constants.sass
61
+ - rails_generators/mondo_layout/templates/stylesheets/_mixins.sass
62
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_base.sass
63
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_content.sass
64
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_errors.sass
65
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_footer.sass
66
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_forms.sass
67
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_header.sass
68
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_links.sass
69
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_pagination.sass
70
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_tables.sass
71
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_typography.sass
72
+ - rails_generators/mondo_layout/templates/stylesheets/partials/_users.sass
73
+ - rails_generators/mondo_layout/templates/stylesheets/screen.sass
48
74
  has_rdoc: true
49
75
  homepage: http://gemcutter.org/gems/mondo-generators
50
76
  licenses: []