flexi_generators 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +15 -0
  2. data/lib/generators/flexi/config/config_generator.rb +3 -3
  3. data/lib/generators/flexi/config/templates/field_error.rb +1 -12
  4. data/lib/generators/flexi/config/templates/inflector_portuguese.rb +0 -3
  5. data/lib/generators/flexi/config/templates/pt-BR.yml +13 -12
  6. data/lib/generators/flexi/install/install_generator.rb +1 -1
  7. data/lib/generators/flexi/install/templates/application.css +1 -1
  8. data/lib/generators/flexi/layout/layout_generator.rb +3 -4
  9. data/lib/generators/flexi/layout/templates/_navbar.html.erb +5 -6
  10. data/lib/generators/flexi/layout/templates/_sidebar.html.erb +13 -16
  11. data/lib/generators/flexi/layout/templates/_user_dropdown.html.erb +12 -11
  12. data/lib/generators/flexi/layout/templates/application.css +1 -1
  13. data/lib/generators/flexi/layout/templates/dashboard.html.erb +1 -48
  14. data/lib/generators/flexi/layout/templates/error_messages_helper.rb +6 -5
  15. data/lib/generators/flexi/layout/templates/layout.css +104 -3
  16. data/lib/generators/flexi/layout/templates/layout.html.erb +23 -46
  17. data/lib/generators/flexi/scaffold/scaffold_generator.rb +1 -1
  18. data/lib/generators/flexi/scaffold/templates/_form.html.erb +15 -17
  19. data/lib/generators/flexi/scaffold/templates/controller.rb +29 -15
  20. data/lib/generators/flexi/scaffold/templates/index.html.erb +25 -15
  21. data/lib/generators/flexi/scaffold/templates/show.html.erb +10 -11
  22. data/lib/twitter-bootstrap/version.rb +1 -1
  23. data/lib/version.rb +1 -1
  24. data/vendor/assets/fonts/flexi/glyphicons-halflings-regular.eot +0 -0
  25. data/vendor/assets/fonts/flexi/glyphicons-halflings-regular.svg +229 -0
  26. data/vendor/assets/fonts/flexi/glyphicons-halflings-regular.ttf +0 -0
  27. data/vendor/assets/fonts/flexi/glyphicons-halflings-regular.woff +0 -0
  28. data/vendor/assets/javascripts/flexi/bootstrap.js +1259 -1588
  29. data/vendor/assets/javascripts/flexi/bootstrap.min.js +5 -5
  30. data/vendor/assets/stylesheets/flexi/bootstrap-theme.css +347 -0
  31. data/vendor/assets/stylesheets/flexi/bootstrap-theme.min.css +7 -0
  32. data/vendor/assets/stylesheets/flexi/bootstrap.css +4696 -5078
  33. data/vendor/assets/stylesheets/flexi/bootstrap.min.css +7 -9
  34. metadata +11 -15
  35. data/vendor/assets/images/flexi/glyphicons-halflings-white.png +0 -0
  36. data/vendor/assets/images/flexi/glyphicons-halflings.png +0 -0
  37. data/vendor/assets/stylesheets/flexi/bootstrap-responsive.css +0 -1109
  38. data/vendor/assets/stylesheets/flexi/bootstrap-responsive.min.css +0 -9
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTdlMDhjZDM2ZDMwOGM3ZmYwODVjZjI1MTZiY2ExNzMxYjM2N2E5MA==
5
+ data.tar.gz: !binary |-
6
+ OTEzOWE5N2Q3YTg5NzY5OGRkYWI2N2Y2M2MxOGY5MzY4NWQ2MTBiZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmJiNWU0YTM1ZDMyOWFkODFmMzk1N2FkNzM0YWI4NTM4ZDg1NjVmYWQ2MGIw
10
+ YTEzZjlkMzA4YTJjODBkMmY2MzgwNWYzY2Q2YTk1OTY3Y2NjYjlmZGQ2OWVh
11
+ M2FmM2IyY2Y1NzhhNjA0ZjJiNDFhYmZkMjhmODQzYzAyNDcwMjg=
12
+ data.tar.gz: !binary |-
13
+ YmVjOGEyNWY3NTNlYTg0MWZlNTQwNmRmNjM2YTg0ZDBjNjBhMjUzMTk3NmUw
14
+ MjBkNDU0MzMxMjI5ZTMzNzIzZDBmZTlhYWU1NTc4ZjBkNjdlMDdjNjhlYjk0
15
+ ZDk5ZjcyMGQzYWEyNjc1MmE5Y2U5OGE2YmZhMWU0NDU0ZmRmZDI=
@@ -14,11 +14,11 @@ module Flexi
14
14
  copy_file "field_error.rb", "config/initializers/field_error.rb"
15
15
  copy_file "will_paginate.rb", "config/initializers/will_paginate.rb"
16
16
 
17
- inject_into_class "config/application.rb", "Application","\tconfig.i18n.default_locale = 'pt-BR'\n"
18
- inject_into_class "config/application.rb", "Application","\tconfig.time_zone = 'Brasilia'\n"
17
+ inject_into_class "config/application.rb", "Application"," config.i18n.default_locale = 'pt-BR'\n"
18
+ inject_into_class "config/application.rb", "Application"," config.time_zone = 'Brasilia'\n"
19
+ inject_into_class "config/application.rb", "Application"," config.i18n.load_path += Dir[Rails.root.join('config/locales/**/*.yml')]\n"
19
20
 
20
21
  gem 'will_paginate', '~> 3.0'
21
- gem 'nokogiri'
22
22
  end
23
23
 
24
24
  end
@@ -1,14 +1,3 @@
1
1
  ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
2
- html = html_tag.html_safe
3
- elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input, select, textarea"
4
- elements.each do |e|
5
- if e.node_name.eql? 'label'
6
- e['class'] = 'control-label error'
7
- html = %(#{e}).html_safe
8
- else
9
- e['class'] = "#{e['class']} error"
10
- html = %(#{e}).html_safe
11
- end
12
- end
13
- html
2
+ "<div class=\"has-error\">#{html_tag}</div>".html_safe
14
3
  end
@@ -48,10 +48,7 @@ module Inflector
48
48
  inflect.singular(/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i, '\1ês')
49
49
  inflect.singular(/^(g|)ases$/i, '\1ás')
50
50
 
51
- # #irregulares
52
51
  # irregulares = {'país' => 'paises'}
53
- #
54
- #
55
52
  # irregulares.each do |key, value|
56
53
  # inflect.plural(/^#{key.to_s}$/, value)
57
54
  # inflect.singular(/^#{value}$/, key.to_s)
@@ -9,7 +9,7 @@ pt-BR:
9
9
  - Sex
10
10
  - Sáb
11
11
  abbr_month_names:
12
- -
12
+ -
13
13
  - Jan
14
14
  - Fev
15
15
  - Mar
@@ -35,7 +35,7 @@ pt-BR:
35
35
  long: ! '%d de %B de %Y'
36
36
  short: ! '%d de %B'
37
37
  month_names:
38
- -
38
+ -
39
39
  - Janeiro
40
40
  - Fevereiro
41
41
  - Março
@@ -95,12 +95,16 @@ pt-BR:
95
95
  month: Mês
96
96
  second: Segundo
97
97
  year: Ano
98
- errors: &errors
98
+ errors:
99
99
  format: ! '%{attribute} %{message}'
100
+ header:
101
+ title: Verifique os campos marcados
102
+ body: Preencha corretamente os campos abaixo e tente novamente.
100
103
  messages:
101
104
  accepted: deve ser aceito
102
105
  blank: não pode ficar em branco
103
- confirmation: não está de acordo com a confirmação
106
+ present: deve ficar em branco
107
+ confirmation: não é igual a %{attribute}
104
108
  empty: não pode ficar vazio
105
109
  equal_to: deve ser igual a %{count}
106
110
  even: deve ser par
@@ -115,6 +119,9 @@ pt-BR:
115
119
  not_an_integer: não é um número inteiro
116
120
  odd: deve ser ímpar
117
121
  record_invalid: ! 'A validação falhou: %{errors}'
122
+ restrict_dependent_destroy:
123
+ one: "Não é possível excluir o registro pois existe um %{record} dependente"
124
+ many: "Não é possível excluir o registro pois existem %{record} dependentes"
118
125
  taken: já está em uso
119
126
  too_long: ! 'é muito longo (máximo: %{count} caracteres)'
120
127
  too_short: ! 'é muito curto (mínimo: %{count} caracteres)'
@@ -199,6 +206,7 @@ pt-BR:
199
206
  short: ! '%d/%m, %H:%M h'
200
207
  pm: ''
201
208
 
209
+ # Will Paginate
202
210
  will_paginate:
203
211
  next_label: Próximos &#8594;
204
212
  page_entries_info:
@@ -214,11 +222,4 @@ pt-BR:
214
222
  other: Exibindo <b>todos os&nbsp;%{count}</b> %{model}
215
223
  zero: Nenhum %{model} encontrado
216
224
  page_gap: ! '&hellip;'
217
- previous_label: ! '&#8592; Anteriores'
218
- # remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
219
- activemodel:
220
- errors:
221
- <<: *errors
222
- activerecord:
223
- errors:
224
- <<: *errors
225
+ previous_label: ! '&#8592; Anteriores'
@@ -8,7 +8,7 @@ module Flexi
8
8
 
9
9
  def add_stylesheets
10
10
  if File.exist?('app/assets/stylesheets/application.css')
11
- insert_into_file "app/assets/stylesheets/application.css", " *= require flexi/bootstrap-responsive\n", :after => "require_self\n"
11
+ insert_into_file "app/assets/stylesheets/application.css", " *= require flexi/bootstrap-theme\n", :after => "require_self\n"
12
12
  insert_into_file "app/assets/stylesheets/application.css", " *= require flexi/bootstrap\n", :after => "require_self\n"
13
13
  else
14
14
  copy_file "application.css", "app/assets/stylesheets/application.css"
@@ -10,6 +10,6 @@
10
10
  *
11
11
  *= require_self
12
12
  *= require flexi/bootstrap
13
- *= require flexi/bootstrap-responsive
13
+ *= require flexi/bootstrap-theme
14
14
  *= require_tree .
15
15
  */
@@ -7,15 +7,13 @@ module Flexi
7
7
  source_root File.expand_path("../templates", __FILE__)
8
8
 
9
9
  argument :layout_name, :type => :string, :default => "application"
10
- argument :layout_type, :type => :string, :default => "fluid",
11
- :banner => "*fixed or fluid"
12
10
  argument :dashboard_name, :type => :string, :default => "dashboard"
13
11
  attr_reader :app_name, :container_class
14
12
 
15
13
  def generate_layout
16
14
  app = ::Rails.application
17
15
  @app_name = app.class.to_s.split("::").first
18
- @container_class = layout_type == "fluid" ? "container-fluid" : "container"
16
+ remove_file "app/views/layouts/#{layout_name}.html.erb"
19
17
  template "layout.html.erb", "app/views/layouts/#{layout_name}.html.erb"
20
18
  generate "controller", "#{dashboard_name} index"
21
19
  remove_file "app/views/#{dashboard_name}/index.html.erb"
@@ -26,7 +24,8 @@ module Flexi
26
24
  def add_stylesheets
27
25
  copy_file 'layout.css', 'app/assets/stylesheets/layout.css'
28
26
  if File.exist?('app/assets/stylesheets/application.css')
29
- insert_into_file "app/assets/stylesheets/application.css", " *= require layout\n", :after => "require_self\n"
27
+ gsub_file "app/assets/stylesheets/application.css", " *= require_tree .\n", ""
28
+ insert_into_file "app/assets/stylesheets/application.css", " *= require layout\n", :after => "bootstrap-theme\n"
30
29
  else
31
30
  copy_file "application.css", "app/assets/stylesheets/application.css"
32
31
  end
@@ -1,6 +1,5 @@
1
- <div class="nav-collapse">
2
- <ul class="nav">
3
- <%%= menu('Home', root_path) %>
4
- <%%= menu('Help', '#help') %>
5
- </ul>
6
- </div><!--/.nav-collapse -->
1
+ <ul class="nav navbar-nav">
2
+ <%%= menu('Dashboard', root_path) %>
3
+ <%%= menu('Settings', '#settings') %>
4
+ <%%= menu('Help', '#help') %>
5
+ </ul>
@@ -1,16 +1,13 @@
1
- <div class="well sidebar-nav">
2
- <ul class="nav nav-list">
3
- <li class="nav-header">Sidebar</li>
4
- <%- (1..3).each do |i| -%>
5
- <li><a href="#">Link</a></li>
6
- <li><a href="#">Link</a></li>
7
- <li><a href="#">Link</a></li>
8
- <% end %>
9
- <li class="nav-header">Sidebar</li>
10
- <%- (1..3).each do |i| -%>
11
- <li><a href="#">Link</a></li>
12
- <li><a href="#">Link</a></li>
13
- <li><a href="#">Link</a></li>
14
- <% end %>
15
- </ul>
16
- </div><!--/.well -->
1
+ <ul class="nav nav-sidebar">
2
+ <li class="active"><a href="#">Menu</a></li>
3
+ <li><a href="#">Menu</a></li>
4
+ <li><a href="#">Menu</a></li>
5
+ <li><a href="#">Menu</a></li>
6
+ </ul>
7
+
8
+ <ul class="nav nav-sidebar">
9
+ <li><a href="#">Menu</a></li>
10
+ <li><a href="#">Menu</a></li>
11
+ <li><a href="#">Menu</a></li>
12
+ <li><a href="#">Menu</a></li>
13
+ </ul>
@@ -1,11 +1,12 @@
1
- <div class="btn-group pull-right">
2
- <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
3
- <i class="icon-user"></i> Username
4
- <span class="caret"></span>
5
- </a>
6
- <ul class="dropdown-menu">
7
- <li><a href="#">Profile</a></li>
8
- <li class="divider"></li>
9
- <li><a href="#">Sign Out</a></li>
10
- </ul>
11
- </div>
1
+ <ul class="nav navbar-nav navbar-right">
2
+ <li class="dropdown">
3
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
4
+ <span class="glyphicon glyphicon-user"></span> Username <b class="caret"></b>
5
+ </a>
6
+ <ul class="dropdown-menu">
7
+ <li><a href="#">Profile</a></li>
8
+ <li class="divider"></li>
9
+ <li><a href="#">Sign Out</a></li>
10
+ </ul>
11
+ </li>
12
+ </ul>
@@ -10,7 +10,7 @@
10
10
  *
11
11
  *= require_self
12
12
  *= require flexi/bootstrap
13
- *= require flexi/bootstrap-responsive
13
+ *= require flexi/bootstrap-theme
14
14
  *= require layout
15
15
  *= require_tree .
16
16
  */
@@ -1,49 +1,2 @@
1
1
  <% title("Dashboard#index") %>
2
- <p>Find me in app/views/dashboard/index.html.erb</p>
3
-
4
- <div class="hero-unit">
5
- <h1>Hello, world!</h1>
6
- <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
7
- <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
8
- </div>
9
-
10
- <div class="row-fluid">
11
- <div class="span4">
12
- <h2>Heading</h2>
13
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
14
- <p><a class="btn" href="#">View details &raquo;</a></p>
15
- </div><!--/span-->
16
-
17
- <div class="span4">
18
- <h2>Heading</h2>
19
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
20
- <p><a class="btn" href="#">View details &raquo;</a></p>
21
- </div><!--/span-->
22
-
23
- <div class="span4">
24
- <h2>Heading</h2>
25
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
26
- <p><a class="btn" href="#">View details &raquo;</a></p>
27
- </div><!--/span-->
28
- </div><!--/row-->
29
-
30
- <div class="row-fluid">
31
- <div class="span4">
32
- <h2>Heading</h2>
33
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
34
- <p><a class="btn" href="#">View details &raquo;</a></p>
35
- </div><!--/span-->
36
-
37
- <div class="span4">
38
- <h2>Heading</h2>
39
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
40
- <p><a class="btn" href="#">View details &raquo;</a></p>
41
- </div><!--/span-->
42
-
43
- <div class="span4">
44
- <h2>Heading</h2>
45
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
46
- <p><a class="btn" href="#">View details &raquo;</a></p>
47
- </div><!--/span-->
48
-
49
- </div><!--/row-->
2
+ <p>Find me in app/views/dashboard/index.html.erb</p>
@@ -2,18 +2,19 @@ module ErrorMessagesHelper
2
2
  # Render error messages for the given objects. The :message and :header_message options are allowed.
3
3
  def error_messages_for(*objects)
4
4
  options = objects.extract_options!
5
- options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields")
6
- options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "Correct the following errors and try again.")
5
+ options[:header_message] ||= I18n.t(:"errors.header.title", :default => "
6
+ Please check the marked fields")
7
+ options[:message] ||= I18n.t(:"errors.header.body", :default => "Correct the following fields and try again.")
7
8
  messages = objects.compact.map { |o| o.errors.full_messages }.flatten
8
9
  unless messages.empty?
9
- # forced as error but may not abstractly always be the case
10
+ # forced as error but may not abstractly always be the case
10
11
  content_tag(:div, :class => "alert alert-danger") do
11
12
  list_items = messages.map { |msg| content_tag(:li, msg.html_safe) }
12
13
  content_tag(:h3, options[:header_message].html_safe) + content_tag(:p, options[:message].html_safe) + content_tag(:ul, list_items.join.html_safe)
13
14
  end
14
15
  end
15
16
  end
16
-
17
+
17
18
  def display_flash_message
18
19
  partials = String.new
19
20
  flash.each do |key, value|
@@ -30,4 +31,4 @@ module ErrorMessagesHelper
30
31
  end
31
32
  end
32
33
 
33
- ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
34
+ ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
@@ -1,10 +1,10 @@
1
1
  /* Your custom css stylesheets goes here */
2
- body{padding-top:40px;padding-bottom:40px;}
2
+ /*body{padding-top:40px;padding-bottom:40px;}
3
3
  fieldset legend{margin-bottom:0;}
4
4
  .sidebar-nav{padding:9px 0;}
5
5
  .page-header{padding-bottom:0px !important;}
6
6
  .actions{text-align:center !important;width:15%}
7
- /* error fields */
7
+
8
8
  .control-label.error {color: #b94a48;}
9
9
  .control-group input.error,
10
10
  .control-group select.error,
@@ -13,4 +13,105 @@ fieldset legend{margin-bottom:0;}
13
13
  .control-group select.error:focus,
14
14
  .control-group textarea.error:focus {border-color: #953b39; -webkit-box-shadow: 0 0 6px #d59392; -moz-box-shadow: 0 0 6px #d59392; box-shadow: 0 0 6px #d59392;}
15
15
  .control-group .error .input-prepend .add-on,
16
- .control-group .error .input-append .add-on {color: #b94a48;background-color: #f2dede; border-color: #b94a48;}
16
+ .control-group .error .input-append .add-on {color: #b94a48;background-color: #f2dede; border-color: #b94a48;}*/
17
+
18
+ /*
19
+ * Base structure
20
+ */
21
+
22
+ /* Move down content because we have a fixed navbar that is 50px tall */
23
+ body {padding-top: 50px;}
24
+
25
+ /*
26
+ * Alerts
27
+ */
28
+ .alert h3 {margin: 0 0 10px 0;}
29
+ .alert p {margin: 0 0 10px 0;}
30
+
31
+
32
+ /*
33
+ * Global add-ons
34
+ */
35
+
36
+ .sub-header {
37
+ padding-bottom: 10px;
38
+ border-bottom: 1px solid #eee;
39
+ }
40
+
41
+
42
+ /*
43
+ * Sidebar
44
+ */
45
+
46
+ /* Hide for mobile, show later */
47
+ .sidebar {
48
+ display: none;
49
+ }
50
+ @media (min-width: 768px) {
51
+ .sidebar {
52
+ position: fixed;
53
+ top: 51px;
54
+ bottom: 0;
55
+ left: 0;
56
+ z-index: 1000;
57
+ display: block;
58
+ padding: 20px;
59
+ overflow-x: hidden;
60
+ overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
61
+ background-color: #f5f5f5;
62
+ border-right: 1px solid #eee;
63
+ }
64
+ }
65
+
66
+ /* Sidebar navigation */
67
+ .nav-sidebar {
68
+ margin-right: -21px; /* 20px padding + 1px border */
69
+ margin-bottom: 20px;
70
+ margin-left: -20px;
71
+ }
72
+ .nav-sidebar > li > a {
73
+ padding-right: 20px;
74
+ padding-left: 20px;
75
+ }
76
+ .nav-sidebar > .active > a {
77
+ color: #fff;
78
+ background-color: #428bca;
79
+ }
80
+
81
+
82
+ /*
83
+ * Main content
84
+ */
85
+
86
+ .main {
87
+ padding: 20px;
88
+ }
89
+ @media (min-width: 768px) {
90
+ .main {
91
+ padding-right: 40px;
92
+ padding-left: 40px;
93
+ }
94
+ }
95
+ .main .page-header {
96
+ margin-top: 0;
97
+ }
98
+
99
+
100
+ /*
101
+ * Placeholder dashboard ideas
102
+ */
103
+
104
+ .placeholders {
105
+ margin-bottom: 30px;
106
+ text-align: center;
107
+ }
108
+ .placeholders h4 {
109
+ margin-bottom: 0;
110
+ }
111
+ .placeholder {
112
+ margin-bottom: 20px;
113
+ }
114
+ .placeholder img {
115
+ display: inline-block;
116
+ border-radius: 50%;
117
+ }