toronto 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a84c6e2526c44dcde56e8de5dd852fe1785ec824
4
- data.tar.gz: e4f86445fcf2b0b43e7839a037110cb953b9b0e1
3
+ metadata.gz: 1f543ee308526522fb360af9f2964ad1b76baede
4
+ data.tar.gz: e55ba83c0b1de7275c79c41251d61ac459e2593e
5
5
  SHA512:
6
- metadata.gz: d41370266cd3dcd58db7ea25c35f35f1b40264b6385587575ef086f7be0bb6a69145f6bb6bca7ccac020d65fc40f16939d7f7661f02d186f08df6dfbec047e17
7
- data.tar.gz: b5967ea9c2b72d5da166ee8b07e0e14c6ba948580a6f5035e4b75dc27af6c0f0d9d737767e1bed4146d4d30e21b0c4601d7c9586354d5bbaf1547bd95587b512
6
+ metadata.gz: 459e93d8873397c5b20482a5321b4cde84fb245bd9a1ccff081037c71a21beb4f05a003c9bccab85b2ccf84409c4f03e8400a749df821c54eb418a7a3d034a49
7
+ data.tar.gz: 6f3f0faee3fc9f0151a92eb83dc4887a6f698cd99ec9d65085db1e5eda2a8ddd271b063d564498dbfc21d905e5d14b384ed23a2d0e67c9dd061cee1dd086c4f0
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
- # Bootstrap Generators
1
+ # Toronto
2
2
 
3
3
  This is a fork from https://github.com/decioferreira/bootstrap-generators
4
4
 
5
- * All fields are translated
5
+ * Patch your scaffold generator
6
+ * Use bootstrap
7
+ * Translate fields (english and french for the moment)
8
+ * References produce selects
9
+ * Automatic menu
6
10
 
7
- *Caution* : it only work for haml
11
+ *Caution* : supported template engine : haml only
8
12
 
9
13
  ## Current Twitter Bootstrap version
10
14
 
@@ -15,10 +19,7 @@ The current supported version of Twitter Bootstrap is 3.3.4.
15
19
  In your Gemfile, add this line:
16
20
 
17
21
  gem 'toronto'
18
-
19
- Or you can install from latest build:
20
-
21
- gem 'bootstrap-generators', git: 'git://github.com/decioferreira/bootstrap-generators.git'
22
+ gem 'haml-rails'
22
23
 
23
24
  Run bundle install:
24
25
 
@@ -28,7 +29,7 @@ Run bundle install:
28
29
 
29
30
  Get started:
30
31
 
31
- rails generate bootstrap:install
32
+ rails generate toronto:install
32
33
 
33
34
  To overwrite files that already exist, pass the `--force` (`-f`) option.
34
35
 
@@ -44,14 +45,12 @@ You can easily customize colors, grid system, fonts, and much more by editing `b
44
45
 
45
46
  ## Usage
46
47
 
47
- To print the options and usage run the command `rails generate bootstrap:install --help`
48
+ To print the options and usage run the command `rails toronto:install --help`
48
49
 
49
50
  Usage:
50
- rails generate bootstrap:install [options]
51
+ rails generate toronto:install [options]
51
52
 
52
53
  Options:
53
- -e, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
54
- # Default: erb
55
54
  -se, [--stylesheet-engine=STYLESHEET_ENGINE] # Indicates when to generate stylesheet engine
56
55
  # Default: scss
57
56
  [--skip-turbolinks], [--no-skip-turbolinks] # Indicates when to generate skip turbolinks
@@ -70,30 +69,7 @@ To print the options and usage run the command `rails generate bootstrap:install
70
69
 
71
70
  Supported template engines:
72
71
 
73
- * ERB
74
72
  * Haml
75
- * Slim
76
-
77
- ##### Haml
78
-
79
- Add the dependency on your Gemfile:
80
-
81
- gem 'haml-rails'
82
-
83
- And then run:
84
-
85
- rails generate bootstrap:install --template-engine=haml
86
-
87
- ##### Slim
88
-
89
- Add the dependency on your Gemfile:
90
-
91
- gem 'slim-rails'
92
-
93
- And then run:
94
-
95
- rails generate bootstrap:install --template-engine=slim
96
-
97
73
 
98
74
  #### Stylesheet engines
99
75
 
data/README.md.old ADDED
@@ -0,0 +1,179 @@
1
+ # Bootstrap Generators
2
+
3
+ This is a fork from https://github.com/decioferreira/bootstrap-generators
4
+
5
+ * All fields are translated
6
+
7
+ *Caution* : it only work for haml
8
+
9
+ ## Current Twitter Bootstrap version
10
+
11
+ The current supported version of Twitter Bootstrap is 3.3.4.
12
+
13
+ ## Installing Gem
14
+
15
+ In your Gemfile, add this line:
16
+
17
+ gem 'toronto'
18
+
19
+ Or you can install from latest build:
20
+
21
+ gem 'bootstrap-generators', git: 'git://github.com/decioferreira/bootstrap-generators.git'
22
+
23
+ Run bundle install:
24
+
25
+ bundle install
26
+
27
+ ## Generators
28
+
29
+ Get started:
30
+
31
+ rails generate bootstrap:install
32
+
33
+ To overwrite files that already exist, pass the `--force` (`-f`) option.
34
+
35
+ Once you've done that, any time you generate a controller or scaffold, you'll get [Bootstrap](http://twitter.github.com/bootstrap/) templates.
36
+
37
+ ### Give it a try
38
+
39
+ In Rails >= 4.1 you need to run `spring stop` so than Rails preloader knows about new templates.
40
+
41
+ rails generate scaffold post title body:text published:boolean
42
+
43
+ You can easily customize colors, grid system, fonts, and much more by editing `bootstrap-variables.[less|scss]` on your application assets folder.
44
+
45
+ ## Usage
46
+
47
+ To print the options and usage run the command `rails generate bootstrap:install --help`
48
+
49
+ Usage:
50
+ rails generate bootstrap:install [options]
51
+
52
+ Options:
53
+ -e, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
54
+ # Default: erb
55
+ -se, [--stylesheet-engine=STYLESHEET_ENGINE] # Indicates when to generate stylesheet engine
56
+ # Default: scss
57
+ [--skip-turbolinks], [--no-skip-turbolinks] # Indicates when to generate skip turbolinks
58
+
59
+ Runtime options:
60
+ -f, [--force] # Overwrite files that already exist
61
+ -p, [--pretend], [--no-pretend] # Run but do not make any changes
62
+ -q, [--quiet], [--no-quiet] # Suppress status output
63
+ -s, [--skip], [--no-skip] # Skip files that already exist
64
+
65
+ Copy BootstrapGenerators default files
66
+
67
+ ### Options
68
+
69
+ #### Template engines
70
+
71
+ Supported template engines:
72
+
73
+ * ~~ERB~~
74
+ * Haml
75
+ * ~~Slim~~
76
+
77
+ ##### Haml
78
+
79
+ Add the dependency on your Gemfile:
80
+
81
+ gem 'haml-rails'
82
+
83
+ And then run:
84
+
85
+ rails generate bootstrap:install --template-engine=haml
86
+
87
+ ##### Slim
88
+
89
+ Add the dependency on your Gemfile:
90
+
91
+ gem 'slim-rails'
92
+
93
+ And then run:
94
+
95
+ rails generate bootstrap:install --template-engine=slim
96
+
97
+
98
+ #### Stylesheet engines
99
+
100
+ Supported stylesheet engines:
101
+
102
+ * CSS
103
+ * SCSS
104
+ * LESS
105
+
106
+ ##### SCSS
107
+
108
+ Make sure you have `sass-rails` dependency on your Gemfile:
109
+
110
+ gem 'sass-rails'
111
+
112
+ And then run:
113
+
114
+ rails generate bootstrap:install --stylesheet-engine=scss
115
+
116
+ Now you can customize the look and feel of Bootstrap.
117
+
118
+ ##### LESS
119
+
120
+ Add the dependency on your Gemfile:
121
+
122
+ gem 'therubyracer', platforms: :ruby
123
+ gem 'less-rails'
124
+
125
+ And then run:
126
+
127
+ rails generate bootstrap:install --stylesheet-engine=less
128
+
129
+ Now you can customize the look and feel of Bootstrap.
130
+
131
+ #### Skip turbolinks
132
+
133
+ Run the generator with option `--skip-turbolinks` to remove turbolinks references from the generated layout.
134
+
135
+ ## Assets
136
+
137
+ ### Customize and extend Bootstrap
138
+
139
+ If you select LESS or SCSS as your stylesheet engine, you will get an `app/assets/stylesheets/bootstrap-variables.[less|scss]` file with all of the default variables of Bootstrap. This way you can customize the look and feel of Bootstrap without having to download any extra file.
140
+
141
+ ### Javascript
142
+
143
+ Select all jQuery plugins (`app/assets/javascripts/bootstrap.js`)
144
+
145
+ //= require bootstrap
146
+
147
+ Or quickly add only the necessary javascript (Transitions: required for any animation; Popovers: requires Tooltips)
148
+
149
+ //= require bootstrap/collapse
150
+ //= require bootstrap/modal
151
+ //= require bootstrap/button
152
+ //= require bootstrap/affix
153
+ //= require bootstrap/tab
154
+ //= require bootstrap/alert
155
+ //= require bootstrap/transition
156
+ //= require bootstrap/tooltip
157
+ //= require bootstrap/popover
158
+ //= require bootstrap/scrollspy
159
+ //= require bootstrap/dropdown
160
+ //= require bootstrap/carousel
161
+
162
+
163
+ ## Customizing Templates
164
+
165
+ In Rails 3.0 and above, generators don’t just look in the source root for templates, they also search for templates in other paths. And one of them is lib/templates.
166
+
167
+ Since Bootstrap Generators installs its templates under lib/templates, you can go and customize them.
168
+
169
+ ## Update Bootstrap Version
170
+
171
+ To update the version of Bootstrap on this Gem you can run the following command:
172
+
173
+ rake bootstrap:update
174
+
175
+ There might be some manual changes needed after running this command. But most of the process is automatic.
176
+
177
+ ## Credits
178
+
179
+ * [Twitter Bootstrap](http://getbootstrap.com)
@@ -14,10 +14,6 @@ module Toronto
14
14
  directory 'lib/rails'
15
15
  end
16
16
 
17
- def copy_locale_file
18
- copy_file 'config/initializers/locales.rb', 'config/initializers/locales.rb'
19
- end
20
-
21
17
  def copy_lib
22
18
  directory "lib/templates/#{options[:template_engine]}"
23
19
  end
@@ -27,6 +23,9 @@ module Toronto
27
23
  end
28
24
 
29
25
  def create_layout
26
+ # Remove the default layout.
27
+ remove_file 'app/views/layouts/application.html.erb'
28
+ # Create the new one.
30
29
  template "layouts/starter.html.#{options[:template_engine]}", "app/views/layouts/application.html.#{options[:template_engine]}"
31
30
  end
32
31
 
@@ -34,13 +33,38 @@ module Toronto
34
33
  stylesheet_extension = options[:stylesheet_engine] || 'css'
35
34
 
36
35
  copy_file "assets/stylesheets/starter.#{stylesheet_extension}", "app/assets/stylesheets/bootstrap-generators.#{stylesheet_extension}"
36
+ copy_file 'assets/stylesheets/flags.css', 'app/assets/stylesheets/flags.css'
37
+ copy_file 'assets/images/flags.png', 'app/assets/images/flags.png'
37
38
 
38
39
  if [:less, :scss].include?(options[:stylesheet_engine].to_sym)
39
40
  copy_file "assets/stylesheets/bootstrap-variables.#{stylesheet_extension}", "app/assets/stylesheets/bootstrap-variables.#{stylesheet_extension}"
40
41
  end
41
42
  end
42
43
 
44
+ def copy_locale_files
45
+ copy_file 'config/initializers/locales.rb', 'config/initializers/locales.rb'
46
+ copy_file 'controllers/locales_controller.rb', 'app/controllers/locales_controller.rb'
47
+
48
+ # TODO : use a template file
49
+ data = %{
50
+ def set_locale
51
+ I18n.locale = session[:locale] || I18n.default_locale
52
+ end
53
+ }
54
+ insert_into_file 'app/controllers/application_controller.rb', data, :before => /^end/
55
+
56
+ data = "\n before_action :set_locale"
57
+
58
+ insert_into_file 'app/controllers/application_controller.rb', data, :after => /^class ApplicationController < ActionController::Base/
59
+ end
60
+
61
+ def inject_locales_route
62
+ route = "\n put 'set_locale/:locale', constraints: { locale: /en|fr/ }, to: 'locales#set'\n"
63
+ insert_into_file 'config/routes.rb', route, :before => /^end/
64
+ end
65
+
43
66
  def inject_menu_helper
67
+ # TODO : use a template file
44
68
  data = %{
45
69
  def nav_link(link_text, link_path)
46
70
  class_name = current_page?(link_path) ? 'active' : ''
@@ -0,0 +1,1024 @@
1
+ /*!
2
+ * Generated with CSS Flag Sprite generator (https://www.flag-sprites.com/)
3
+ */
4
+
5
+ #flags-area {
6
+ float: right;
7
+ padding-top: 15px;
8
+ padding-right: 15px;
9
+ }
10
+
11
+ .flag {
12
+ display: inline-block;
13
+ width: 16px;
14
+ height: 11px;
15
+ background: url('flags.png') no-repeat;
16
+ }
17
+
18
+ .flag.flag-tm {
19
+ background-position: -208px -143px;
20
+ }
21
+
22
+ .flag.flag-ao {
23
+ background-position: -128px 0;
24
+ }
25
+
26
+ .flag.flag-tn {
27
+ background-position: -224px -143px;
28
+ }
29
+
30
+ .flag.flag-th {
31
+ background-position: -128px -143px;
32
+ }
33
+
34
+ .flag.flag-ae {
35
+ background-position: -16px 0;
36
+ }
37
+
38
+ .flag.flag-ph {
39
+ background-position: -224px -110px;
40
+ }
41
+
42
+ .flag.flag-tt {
43
+ background-position: -16px -154px;
44
+ }
45
+
46
+ .flag.flag-bv {
47
+ background-position: -208px -11px;
48
+ }
49
+
50
+ .flag.flag-bj {
51
+ background-position: -96px -11px;
52
+ }
53
+
54
+ .flag.flag-lr {
55
+ background-position: -16px -88px;
56
+ }
57
+
58
+ .flag.flag-tw {
59
+ background-position: -48px -154px;
60
+ }
61
+
62
+ .flag.flag-ck {
63
+ background-position: -128px -22px;
64
+ }
65
+
66
+ .flag.flag-nz {
67
+ background-position: -128px -110px;
68
+ }
69
+
70
+ .flag.flag-bm {
71
+ background-position: -112px -11px;
72
+ }
73
+
74
+ .flag.flag-km {
75
+ background-position: -64px -77px;
76
+ }
77
+
78
+ .flag.flag-nl {
79
+ background-position: -48px -110px;
80
+ }
81
+
82
+ .flag.flag-ug {
83
+ background-position: -96px -154px;
84
+ }
85
+
86
+ .flag.flag-jp {
87
+ background-position: -240px -66px;
88
+ }
89
+
90
+ .flag.flag-so {
91
+ background-position: -176px -132px;
92
+ }
93
+
94
+ .flag.flag-ne {
95
+ background-position: -240px -99px;
96
+ }
97
+
98
+ .flag.flag-bd {
99
+ background-position: -16px -11px;
100
+ }
101
+
102
+ .flag.flag-pt {
103
+ background-position: -80px -121px;
104
+ }
105
+
106
+ .flag.flag-bt {
107
+ background-position: -192px -11px;
108
+ }
109
+
110
+ .flag.flag-mu {
111
+ background-position: -112px -99px;
112
+ }
113
+
114
+ .flag.flag-at {
115
+ background-position: -176px 0;
116
+ }
117
+
118
+ .flag.flag-tr {
119
+ background-position: 0 -154px;
120
+ }
121
+
122
+ .flag.flag-sm {
123
+ background-position: -144px -132px;
124
+ }
125
+
126
+ .flag.flag-dk {
127
+ background-position: -80px -33px;
128
+ }
129
+
130
+ .flag.flag-no {
131
+ background-position: -64px -110px;
132
+ }
133
+
134
+ .flag.flag-si {
135
+ background-position: -96px -132px;
136
+ }
137
+
138
+ .flag.flag-sr {
139
+ background-position: -208px -132px;
140
+ }
141
+
142
+ .flag.flag-es {
143
+ background-position: -240px -33px;
144
+ }
145
+
146
+ .flag.flag-cf {
147
+ background-position: -64px -22px;
148
+ }
149
+
150
+ .flag.flag-hm {
151
+ background-position: -192px -55px;
152
+ }
153
+
154
+ .flag.flag-sk {
155
+ background-position: -112px -132px;
156
+ }
157
+
158
+ .flag.flag-ps {
159
+ background-position: -64px -121px;
160
+ }
161
+
162
+ .flag.flag-xk {
163
+ background-position: -80px -165px;
164
+ }
165
+
166
+ .flag.flag-lb {
167
+ background-position: -208px -77px;
168
+ }
169
+
170
+ .flag.flag-kz {
171
+ background-position: -176px -77px;
172
+ }
173
+
174
+ .flag.flag-mp {
175
+ background-position: -32px -99px;
176
+ }
177
+
178
+ .flag.flag-fj {
179
+ background-position: -48px -44px;
180
+ }
181
+
182
+ .flag.flag-uz {
183
+ background-position: -160px -154px;
184
+ }
185
+
186
+ .flag.flag-sh {
187
+ background-position: -80px -132px;
188
+ }
189
+
190
+ .flag.flag-am {
191
+ background-position: -96px 0;
192
+ }
193
+
194
+ .flag.flag-eu {
195
+ background-position: -16px -44px;
196
+ }
197
+
198
+ .flag.flag-kn {
199
+ background-position: -80px -77px;
200
+ }
201
+
202
+ .flag.flag-lu {
203
+ background-position: -64px -88px;
204
+ }
205
+
206
+ .flag.flag-ly {
207
+ background-position: -96px -88px;
208
+ }
209
+
210
+ .flag.flag-tibet {
211
+ background-position: -144px -143px;
212
+ }
213
+
214
+ .flag.flag-bb {
215
+ background-position: 0 -11px;
216
+ }
217
+
218
+ .flag.flag-gi {
219
+ background-position: -240px -44px;
220
+ }
221
+
222
+ .flag.flag-ai {
223
+ background-position: -64px 0;
224
+ }
225
+
226
+ .flag.flag-br {
227
+ background-position: -160px -11px;
228
+ }
229
+
230
+ .flag.flag-gs {
231
+ background-position: -96px -55px;
232
+ }
233
+
234
+ .flag.flag-pa {
235
+ background-position: -160px -110px;
236
+ }
237
+
238
+ .flag.flag-ge {
239
+ background-position: -176px -44px;
240
+ }
241
+
242
+ .flag.flag-vn {
243
+ background-position: 0 -165px;
244
+ }
245
+
246
+ .flag.flag-gr {
247
+ background-position: -80px -55px;
248
+ }
249
+
250
+ .flag.flag-ni {
251
+ background-position: -32px -110px;
252
+ }
253
+
254
+ .flag.flag-me {
255
+ background-position: -160px -88px;
256
+ }
257
+
258
+ .flag.flag-ir {
259
+ background-position: -144px -66px;
260
+ }
261
+
262
+ .flag.flag-ss {
263
+ background-position: -224px -132px;
264
+ }
265
+
266
+ .flag.flag-al {
267
+ background-position: -80px 0;
268
+ }
269
+
270
+ .flag.flag-gu {
271
+ background-position: -128px -55px;
272
+ }
273
+
274
+ .flag.flag-cl {
275
+ background-position: -144px -22px;
276
+ }
277
+
278
+ .flag.flag-ng {
279
+ background-position: -16px -110px;
280
+ }
281
+
282
+ .flag.flag-gl {
283
+ background-position: 0 -55px;
284
+ }
285
+
286
+ .flag.flag-do {
287
+ background-position: -112px -33px;
288
+ }
289
+
290
+ .flag.flag-ls {
291
+ background-position: -32px -88px;
292
+ }
293
+
294
+ .flag.flag-sz {
295
+ background-position: -48px -143px;
296
+ }
297
+
298
+ .flag.flag-dm {
299
+ background-position: -96px -33px;
300
+ }
301
+
302
+ .flag.flag-sl {
303
+ background-position: -128px -132px;
304
+ }
305
+
306
+ .flag.flag-ba {
307
+ background-position: -240px 0;
308
+ }
309
+
310
+ .flag.flag-kp {
311
+ background-position: -96px -77px;
312
+ }
313
+
314
+ .flag.flag-nc {
315
+ background-position: -224px -99px;
316
+ }
317
+
318
+ .flag.flag-cg {
319
+ background-position: -80px -22px;
320
+ }
321
+
322
+ .flag.flag-ky {
323
+ background-position: -160px -77px;
324
+ }
325
+
326
+ .flag.flag-be {
327
+ background-position: -32px -11px;
328
+ }
329
+
330
+ .flag.flag-kh {
331
+ background-position: -32px -77px;
332
+ }
333
+
334
+ .flag.flag-yt {
335
+ background-position: -112px -165px;
336
+ }
337
+
338
+ .flag.flag-cz {
339
+ background-position: -32px -33px;
340
+ }
341
+
342
+ .flag.flag-re {
343
+ background-position: -144px -121px;
344
+ }
345
+
346
+ .flag.flag-sd {
347
+ background-position: -32px -132px;
348
+ }
349
+
350
+ .flag.flag-tf {
351
+ background-position: -96px -143px;
352
+ }
353
+
354
+ .flag.flag-qa {
355
+ background-position: -128px -121px;
356
+ }
357
+
358
+ .flag.flag-lc {
359
+ background-position: -224px -77px;
360
+ }
361
+
362
+ .flag.flag-la {
363
+ background-position: -192px -77px;
364
+ }
365
+
366
+ .flag.flag-jo {
367
+ background-position: -224px -66px;
368
+ }
369
+
370
+ .flag.flag-pw {
371
+ background-position: -96px -121px;
372
+ }
373
+
374
+ .flag.flag-rs {
375
+ background-position: -176px -121px;
376
+ }
377
+
378
+ .flag.flag-lv {
379
+ background-position: -80px -88px;
380
+ }
381
+
382
+ .flag.flag-ke {
383
+ background-position: 0 -77px;
384
+ }
385
+
386
+ .flag.flag-tl {
387
+ background-position: -192px -143px;
388
+ }
389
+
390
+ .flag.flag-gq {
391
+ background-position: -64px -55px;
392
+ }
393
+
394
+ .flag.flag-catalonia {
395
+ background-position: -32px -22px;
396
+ }
397
+
398
+ .flag.flag-gb {
399
+ background-position: -144px -44px;
400
+ }
401
+
402
+ .flag.flag-ci {
403
+ background-position: -112px -22px;
404
+ }
405
+
406
+ .flag.flag-my {
407
+ background-position: -176px -99px;
408
+ }
409
+
410
+ .flag.flag-ws {
411
+ background-position: -64px -165px;
412
+ }
413
+
414
+ .flag.flag-mq {
415
+ background-position: -48px -99px;
416
+ }
417
+
418
+ .flag.flag-se {
419
+ background-position: -48px -132px;
420
+ }
421
+
422
+ .flag.flag-bg {
423
+ background-position: -64px -11px;
424
+ }
425
+
426
+ .flag.flag-ml {
427
+ background-position: -224px -88px;
428
+ }
429
+
430
+ .flag.flag-mk {
431
+ background-position: -208px -88px;
432
+ }
433
+
434
+ .flag.flag-sx {
435
+ background-position: -16px -143px;
436
+ }
437
+
438
+ .flag.flag-bo {
439
+ background-position: -144px -11px;
440
+ }
441
+
442
+ .flag.flag-ma {
443
+ background-position: -112px -88px;
444
+ }
445
+
446
+ .flag.flag-iq {
447
+ background-position: -128px -66px;
448
+ }
449
+
450
+ .flag.flag-fi {
451
+ background-position: -32px -44px;
452
+ }
453
+
454
+ .flag.flag-sv {
455
+ background-position: 0 -143px;
456
+ }
457
+
458
+ .flag.flag-us {
459
+ background-position: -128px -154px;
460
+ }
461
+
462
+ .flag.flag-mm {
463
+ background-position: -240px -88px;
464
+ }
465
+
466
+ .flag.flag-va {
467
+ background-position: -176px -154px;
468
+ }
469
+
470
+ .flag.flag-bn {
471
+ background-position: -128px -11px;
472
+ }
473
+
474
+ .flag.flag-zw {
475
+ background-position: -176px -165px;
476
+ }
477
+
478
+ .flag.flag-mw {
479
+ background-position: -144px -99px;
480
+ }
481
+
482
+ .flag.flag-tc {
483
+ background-position: -64px -143px;
484
+ }
485
+
486
+ .flag.flag-mn {
487
+ background-position: 0 -99px;
488
+ }
489
+
490
+ .flag.flag-ch {
491
+ background-position: -96px -22px;
492
+ }
493
+
494
+ .flag.flag-gf {
495
+ background-position: -192px -44px;
496
+ }
497
+
498
+ .flag.flag-zm {
499
+ background-position: -160px -165px;
500
+ }
501
+
502
+ .flag.flag-ga {
503
+ background-position: -128px -44px;
504
+ }
505
+
506
+ .flag.flag-um {
507
+ background-position: -112px -154px;
508
+ }
509
+
510
+ .flag.flag-ht {
511
+ background-position: -240px -55px;
512
+ }
513
+
514
+ .flag.flag-co {
515
+ background-position: -192px -22px;
516
+ }
517
+
518
+ .flag.flag-ye {
519
+ background-position: -96px -165px;
520
+ }
521
+
522
+ .flag.flag-rw {
523
+ background-position: -208px -121px;
524
+ }
525
+
526
+ .flag.flag-ec {
527
+ background-position: -144px -33px;
528
+ }
529
+
530
+ .flag.flag-ki {
531
+ background-position: -48px -77px;
532
+ }
533
+
534
+ .flag.flag-sb {
535
+ background-position: -240px -121px;
536
+ }
537
+
538
+ .flag.flag-mh {
539
+ background-position: -192px -88px;
540
+ }
541
+
542
+ .flag.flag-mr {
543
+ background-position: -64px -99px;
544
+ }
545
+
546
+ .flag.flag-mo {
547
+ background-position: -16px -99px;
548
+ }
549
+
550
+ .flag.flag-eg {
551
+ background-position: -176px -33px;
552
+ }
553
+
554
+ .flag.flag-et {
555
+ background-position: 0 -44px;
556
+ }
557
+
558
+ .flag.flag-cd {
559
+ background-position: -48px -22px;
560
+ }
561
+
562
+ .flag.flag-mt {
563
+ background-position: -96px -99px;
564
+ }
565
+
566
+ .flag.flag-zanzibar {
567
+ background-position: -144px -165px;
568
+ }
569
+
570
+ .flag.flag-nu {
571
+ background-position: -112px -110px;
572
+ }
573
+
574
+ .flag.flag-ee {
575
+ background-position: -160px -33px;
576
+ }
577
+
578
+ .flag.flag-hk {
579
+ background-position: -176px -55px;
580
+ }
581
+
582
+ .flag.flag-dj {
583
+ background-position: -64px -33px;
584
+ }
585
+
586
+ .flag.flag-ic {
587
+ background-position: -16px -66px;
588
+ }
589
+
590
+ .flag.flag-ca {
591
+ background-position: -16px -22px;
592
+ }
593
+
594
+ .flag.flag-to {
595
+ background-position: -240px -143px;
596
+ }
597
+
598
+ .flag.flag-bs {
599
+ background-position: -176px -11px;
600
+ }
601
+
602
+ .flag.flag-fr {
603
+ background-position: -112px -44px;
604
+ }
605
+
606
+ .flag.flag-is {
607
+ background-position: -160px -66px;
608
+ }
609
+
610
+ .flag.flag-pm {
611
+ background-position: -16px -121px;
612
+ }
613
+
614
+ .flag.flag-vi {
615
+ background-position: -240px -154px;
616
+ }
617
+
618
+ .flag.flag-ad {
619
+ background-position: 0 0;
620
+ }
621
+
622
+ .flag.flag-eh {
623
+ background-position: -192px -33px;
624
+ }
625
+
626
+ .flag.flag-cr {
627
+ background-position: -208px -22px;
628
+ }
629
+
630
+ .flag.flag-vg {
631
+ background-position: -224px -154px;
632
+ }
633
+
634
+ .flag.flag-sy {
635
+ background-position: -32px -143px;
636
+ }
637
+
638
+ .flag.flag-ru {
639
+ background-position: -192px -121px;
640
+ }
641
+
642
+ .flag.flag-hn {
643
+ background-position: -208px -55px;
644
+ }
645
+
646
+ .flag.flag-gw {
647
+ background-position: -144px -55px;
648
+ }
649
+
650
+ .flag.flag-gg {
651
+ background-position: -208px -44px;
652
+ }
653
+
654
+ .flag.flag-an {
655
+ background-position: -112px 0;
656
+ }
657
+
658
+ .flag.flag-somaliland {
659
+ background-position: -192px -132px;
660
+ }
661
+
662
+ .flag.flag-cn {
663
+ background-position: -176px -22px;
664
+ }
665
+
666
+ .flag.flag-wales {
667
+ background-position: -32px -165px;
668
+ }
669
+
670
+ .flag.flag-fm {
671
+ background-position: -80px -44px;
672
+ }
673
+
674
+ .flag.flag-tz {
675
+ background-position: -64px -154px;
676
+ }
677
+
678
+ .flag.flag-scotland {
679
+ background-position: -16px -132px;
680
+ }
681
+
682
+ .flag.flag-it {
683
+ background-position: -176px -66px;
684
+ }
685
+
686
+ .flag.flag-pe {
687
+ background-position: -176px -110px;
688
+ }
689
+
690
+ .flag.flag-tk {
691
+ background-position: -176px -143px;
692
+ }
693
+
694
+ .flag.flag-sa {
695
+ background-position: -224px -121px;
696
+ }
697
+
698
+ .flag.flag-au {
699
+ background-position: -192px 0;
700
+ }
701
+
702
+ .flag.flag-ms {
703
+ background-position: -80px -99px;
704
+ }
705
+
706
+ .flag.flag-gh {
707
+ background-position: -224px -44px;
708
+ }
709
+
710
+ .flag.flag-mg {
711
+ background-position: -176px -88px;
712
+ }
713
+
714
+ .flag.flag-pl {
715
+ background-position: 0 -121px;
716
+ }
717
+
718
+ .flag.flag-de {
719
+ background-position: -48px -33px;
720
+ }
721
+
722
+ .flag.flag-lk {
723
+ background-position: 0 -88px;
724
+ }
725
+
726
+ .flag.flag-bh {
727
+ background-position: -80px -11px;
728
+ }
729
+
730
+ .flag.flag-py {
731
+ background-position: -112px -121px;
732
+ }
733
+
734
+ .flag.flag-za {
735
+ background-position: -128px -165px;
736
+ }
737
+
738
+ .flag.flag-cy {
739
+ background-position: -16px -33px;
740
+ }
741
+
742
+ .flag.flag-il {
743
+ background-position: -64px -66px;
744
+ }
745
+
746
+ .flag.flag-gd {
747
+ background-position: -160px -44px;
748
+ }
749
+
750
+ .flag.flag-nr {
751
+ background-position: -96px -110px;
752
+ }
753
+
754
+ .flag.flag-vu {
755
+ background-position: -16px -165px;
756
+ }
757
+
758
+ .flag.flag-jm {
759
+ background-position: -208px -66px;
760
+ }
761
+
762
+ .flag.flag-td {
763
+ background-position: -80px -143px;
764
+ }
765
+
766
+ .flag.flag-wf {
767
+ background-position: -48px -165px;
768
+ }
769
+
770
+ .flag.flag-pr {
771
+ background-position: -48px -121px;
772
+ }
773
+
774
+ .flag.flag-mv {
775
+ background-position: -128px -99px;
776
+ }
777
+
778
+ .flag.flag-id {
779
+ background-position: -32px -66px;
780
+ }
781
+
782
+ .flag.flag-tg {
783
+ background-position: -112px -143px;
784
+ }
785
+
786
+ .flag.flag-by {
787
+ background-position: -240px -11px;
788
+ }
789
+
790
+ .flag.flag-io {
791
+ background-position: -112px -66px;
792
+ }
793
+
794
+ .flag.flag-pn {
795
+ background-position: -32px -121px;
796
+ }
797
+
798
+ .flag.flag-je {
799
+ background-position: -192px -66px;
800
+ }
801
+
802
+ .flag.flag-bz {
803
+ background-position: 0 -22px;
804
+ }
805
+
806
+ .flag.flag-hu {
807
+ background-position: 0 -66px;
808
+ }
809
+
810
+ .flag.flag-tj {
811
+ background-position: -160px -143px;
812
+ }
813
+
814
+ .flag.flag-ie {
815
+ background-position: -48px -66px;
816
+ }
817
+
818
+ .flag.flag-kw {
819
+ background-position: -144px -77px;
820
+ }
821
+
822
+ .flag.flag-bf {
823
+ background-position: -48px -11px;
824
+ }
825
+
826
+ .flag.flag-uy {
827
+ background-position: -144px -154px;
828
+ }
829
+
830
+ .flag.flag-er {
831
+ background-position: -224px -33px;
832
+ }
833
+
834
+ .flag.flag-sc {
835
+ background-position: 0 -132px;
836
+ }
837
+
838
+ .flag.flag-fk {
839
+ background-position: -64px -44px;
840
+ }
841
+
842
+ .flag.flag-kr {
843
+ background-position: -112px -77px;
844
+ }
845
+
846
+ .flag.flag-ar {
847
+ background-position: -144px 0;
848
+ }
849
+
850
+ .flag.flag-ve {
851
+ background-position: -208px -154px;
852
+ }
853
+
854
+ .flag.flag-az {
855
+ background-position: -224px 0;
856
+ }
857
+
858
+ .flag.flag-md {
859
+ background-position: -144px -88px;
860
+ }
861
+
862
+ .flag.flag-tv {
863
+ background-position: -32px -154px;
864
+ }
865
+
866
+ .flag.flag-nf {
867
+ background-position: 0 -110px;
868
+ }
869
+
870
+ .flag.flag-fo {
871
+ background-position: -96px -44px;
872
+ }
873
+
874
+ .flag.flag-gt {
875
+ background-position: -112px -55px;
876
+ }
877
+
878
+ .flag.flag-af {
879
+ background-position: -32px 0;
880
+ }
881
+
882
+ .flag.flag-cu {
883
+ background-position: -224px -22px;
884
+ }
885
+
886
+ .flag.flag-aw {
887
+ background-position: -208px 0;
888
+ }
889
+
890
+ .flag.flag-mz {
891
+ background-position: -192px -99px;
892
+ }
893
+
894
+ .flag.flag-mx {
895
+ background-position: -160px -99px;
896
+ }
897
+
898
+ .flag.flag-om {
899
+ background-position: -144px -110px;
900
+ }
901
+
902
+ .flag.flag-gm {
903
+ background-position: -16px -55px;
904
+ }
905
+
906
+ .flag.flag-pf {
907
+ background-position: -192px -110px;
908
+ }
909
+
910
+ .flag.flag-bw {
911
+ background-position: -224px -11px;
912
+ }
913
+
914
+ .flag.flag-england {
915
+ background-position: -208px -33px;
916
+ }
917
+
918
+ .flag.flag-cw {
919
+ background-position: 0 -33px;
920
+ }
921
+
922
+ .flag.flag-sg {
923
+ background-position: -64px -132px;
924
+ }
925
+
926
+ .flag.flag-ro {
927
+ background-position: -160px -121px;
928
+ }
929
+
930
+ .flag.flag-ua {
931
+ background-position: -80px -154px;
932
+ }
933
+
934
+ .flag.flag-hr {
935
+ background-position: -224px -55px;
936
+ }
937
+
938
+ .flag.flag-gp {
939
+ background-position: -48px -55px;
940
+ }
941
+
942
+ .flag.flag-im {
943
+ background-position: -80px -66px;
944
+ }
945
+
946
+ .flag.flag-pk {
947
+ background-position: -240px -110px;
948
+ }
949
+
950
+ .flag.flag-cm {
951
+ background-position: -160px -22px;
952
+ }
953
+
954
+ .flag.flag-lt {
955
+ background-position: -48px -88px;
956
+ }
957
+
958
+ .flag.flag-li {
959
+ background-position: -240px -77px;
960
+ }
961
+
962
+ .flag.flag-st {
963
+ background-position: -240px -132px;
964
+ }
965
+
966
+ .flag.flag-mc {
967
+ background-position: -128px -88px;
968
+ }
969
+
970
+ .flag.flag-cv {
971
+ background-position: -240px -22px;
972
+ }
973
+
974
+ .flag.flag-pg {
975
+ background-position: -208px -110px;
976
+ }
977
+
978
+ .flag.flag-kurdistan {
979
+ background-position: -128px -77px;
980
+ }
981
+
982
+ .flag.flag-in {
983
+ background-position: -96px -66px;
984
+ }
985
+
986
+ .flag.flag-kg {
987
+ background-position: -16px -77px;
988
+ }
989
+
990
+ .flag.flag-as {
991
+ background-position: -160px 0;
992
+ }
993
+
994
+ .flag.flag-np {
995
+ background-position: -80px -110px;
996
+ }
997
+
998
+ .flag.flag-sn {
999
+ background-position: -160px -132px;
1000
+ }
1001
+
1002
+ .flag.flag-na {
1003
+ background-position: -208px -99px;
1004
+ }
1005
+
1006
+ .flag.flag-gn {
1007
+ background-position: -32px -55px;
1008
+ }
1009
+
1010
+ .flag.flag-vc {
1011
+ background-position: -192px -154px;
1012
+ }
1013
+
1014
+ .flag.flag-ag {
1015
+ background-position: -48px 0;
1016
+ }
1017
+
1018
+ .flag.flag-dz {
1019
+ background-position: -128px -33px;
1020
+ }
1021
+
1022
+ .flag.flag-gy {
1023
+ background-position: -160px -55px;
1024
+ }
@@ -0,0 +1,14 @@
1
+ class LocalesController < ApplicationController
2
+
3
+ def set
4
+ # TODO : implement it this way : https://lingohub.com/frameworks-file-formats/rails5-i18n-ruby-on-rails/
5
+
6
+ session[:return_to] ||= request.referer
7
+
8
+ # I18n.locale = params[:locale] || I18n.default_locale
9
+ session[:locale] = params[:locale]
10
+
11
+ redirect_to session.delete(:return_to)
12
+ end
13
+
14
+ end
@@ -1,4 +1,4 @@
1
- = form_for @<%= singular_table_name %>, html: { class: "form-horizontal", role: "form" } do |f|
1
+ = form_for @<%= singular_table_name %>, html: { class: 'form-horizontal', role: "form" } do |f|
2
2
  -if @<%= singular_table_name %>.errors.any?
3
3
  .alert.alert-danger.alert-dismissable{role: "alert"}
4
4
  %button.close{type: "button", data: {dismiss: "alert"} }
@@ -15,7 +15,7 @@
15
15
  = f.label :<%= attribute.name %>, class: 'col-sm-2 control-label'
16
16
  .col-sm-10
17
17
  <% if attribute.type == :references %>
18
- = f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelize %>.all, :id, :name, prompt: true
18
+ = f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelize %>.all, :id, :name, { prompt: true }, { class: 'form-control' }
19
19
  <% else %>
20
20
  = f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control'
21
21
  <% end %>
@@ -38,6 +38,11 @@
38
38
  = nav_link( 'About', '#about' )
39
39
  %li
40
40
  = nav_link( 'Contact', '#contact' )
41
+ #flags-area
42
+ = link_to '/set_locale/en', method: :put do
43
+ %span{ class: 'flag flag-gb' }
44
+ = link_to '/set_locale/fr', method: :put do
45
+ %span{ class: 'flag flag-fr' }
41
46
  .container
42
47
  - flash.each do |name, msg|
43
48
  = content_tag :div, class: "alert alert-#{name == :error ? 'danger' : 'success' } alert-dismissable", role: 'alert' do
@@ -1,3 +1,3 @@
1
1
  module Toronto
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toronto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cédric Zuger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-23 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,14 +65,18 @@ files:
65
65
  - Gemfile
66
66
  - MIT-LICENSE
67
67
  - README.md
68
+ - README.md.old
68
69
  - Rakefile
69
70
  - lib/generators/toronto/install/install_generator.rb
71
+ - lib/generators/toronto/install/templates/assets/images/flags.png
70
72
  - lib/generators/toronto/install/templates/assets/stylesheets/bootstrap-variables.less
71
73
  - lib/generators/toronto/install/templates/assets/stylesheets/bootstrap-variables.scss
74
+ - lib/generators/toronto/install/templates/assets/stylesheets/flags.css
72
75
  - lib/generators/toronto/install/templates/assets/stylesheets/starter.css
73
76
  - lib/generators/toronto/install/templates/assets/stylesheets/starter.less
74
77
  - lib/generators/toronto/install/templates/assets/stylesheets/starter.scss
75
78
  - lib/generators/toronto/install/templates/config/initializers/locales.rb
79
+ - lib/generators/toronto/install/templates/controllers/locales_controller.rb
76
80
  - lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.erb
77
81
  - lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.haml
78
82
  - lib/generators/toronto/install/templates/form_builders/form_builder/_form.html.slim