mdd 3.1.1 → 3.1.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 +4 -4
- data/app/helpers/mdwa_helper.rb +13 -4
- data/app/views/template/mdwa/_autocomplete_multiple_tag.html.erb +3 -3
- data/app/views/template/mdwa/_autocomplete_remote_multiple_tag.html.erb +5 -2
- data/app/views/template/mdwa/_autocomplete_remote_tag.html.erb +21 -1
- data/lib/generators/mdwa/sandbox/sandbox_generator.rb +30 -7
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/login_manifest.js +1 -1
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/system_manifest.js +1 -1
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/template/ajaxloader.js +16 -16
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/template/all_pages.js +34 -30
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/template/batch_update.js +35 -0
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/template/xls_export.js +14 -0
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/jquery/{jquery-ui-1.10.0.custom.css → jquery-ui.css} +60 -57
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/login/login.css +26 -2
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/system_manifest.css +1 -0
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/template/backend.css.erb +11 -91
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/template/menu.css +86 -0
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/template/template.css.erb +71 -18
- data/lib/generators/mdwa/sandbox/templates/app/controllers/a/backend_controller.rb +14 -0
- data/lib/generators/mdwa/sandbox/templates/app/models/permission.rb +2 -2
- data/lib/generators/mdwa/sandbox/templates/app/views/layouts/login.html.erb +4 -1
- data/lib/generators/mdwa/sandbox/templates/app/views/layouts/public.html.erb +3 -3
- data/lib/generators/mdwa/sandbox/templates/app/views/layouts/system.html.erb +6 -4
- data/lib/generators/mdwa/sandbox/templates/app/views/template/mdwa/_login_text.html.erb +4 -0
- data/lib/generators/mdwa/sandbox/templates/app/views/template/mdwa/_menubar.html.erb +3 -0
- data/lib/generators/mdwa/sandbox/templates/app/views/template/mdwa/menubar/_administrators.html.erb +10 -0
- data/lib/generators/mdwa/sandbox/templates/config/initializers/mime_types.rb +2 -0
- data/lib/generators/mdwa/sandbox/templates/config/locales/mdwa.en.yml +8 -0
- data/lib/generators/mdwa/sandbox/templates/deploy.sh +17 -0
- data/lib/generators/mdwa/templates/templates/scaffold/controller.erb +23 -5
- data/lib/generators/mdwa/templates/templates/scaffold/model.erb +61 -19
- data/lib/generators/mdwa/templates/templates/scaffold/views/_form.html.erb +3 -5
- data/lib/generators/mdwa/templates/templates/scaffold/views/_form_fields.html.erb +23 -15
- data/lib/generators/mdwa/templates/templates/scaffold/views/_list.html.erb +38 -26
- data/lib/generators/mdwa/templates/templates/scaffold/views/batch_update.js.erb +3 -0
- data/lib/generators/mdwa/templates/templates/scaffold/views/index.html.erb +19 -4
- data/lib/generators/mdwa/templates/templates/scaffold/views/index.xls.erb +23 -0
- data/lib/generators/mdwa/templates/templates/scaffold/views/menu/menu.html.erb +13 -0
- data/lib/generators/mdwa/templates/templates_generator.rb +5 -0
- data/lib/generators/mdwa/transform/transform_generator.rb +91 -49
- data/lib/generators/mdwa/translate/templates/br/config/initializers/inflections.rb +58 -0
- data/lib/generators/mdwa/translate/templates/br/config/locales/devise.pt-BR.yml +59 -0
- data/lib/generators/mdwa/translate/templates/br/config/locales/mdwa.pt-BR.yml +294 -0
- data/lib/generators/mdwa/translate/templates/br/config/locales/mdwa.specific.pt-BR.yml +2 -0
- data/lib/generators/mdwa/translate/translate_generator.rb +38 -0
- data/lib/mdwa/dsl/entity.rb +1 -0
- data/lib/mdwa/generators/model_attribute.rb +5 -3
- data/lib/mdwa/version.rb +1 -1
- data/mdd.gemspec +4 -1
- data/test/entity_actions_test.rb +0 -1
- data/test/entity_attributes_options_test.rb +1 -2
- data/test/entity_specifications_test.rb +0 -1
- data/test/entity_status_test.rb +40 -0
- data/test/entity_test.rb +6 -7
- data/test/layout_test.rb +0 -1
- data/test/process_test.rb +0 -1
- data/test/requirements_test.rb +0 -1
- data/test/users_test.rb +0 -1
- metadata +52 -8
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/jquery/jquery.popup_window.js +0 -62
- data/lib/generators/mdwa/sandbox/templates/app/views/template/_leftbar.html.erb +0 -11
@@ -2,11 +2,25 @@
|
|
2
2
|
<div id="<%= @model.plural_name %>_index" class="mdwa_index">
|
3
3
|
<div class="page_header">
|
4
4
|
<h1><%%= t '<%= @model.plural_name %>.title.index' %></h1>
|
5
|
-
<%- if @entity.ajax -%>
|
6
5
|
<div class="page_header_right_tab">
|
6
|
+
<%% if can? :destroy, <%= @model.klass %> %>
|
7
|
+
<%%= link_to t('<%= @model.plural_name %>.index.remove'), <%= @model.object_name.pluralize %>_batch_update_path, attribute: :removed, value: 1, class: :batch_update %>
|
8
|
+
<%% end %>
|
9
|
+
|
10
|
+
<%% if can? :update, <%= @model.klass %> %>
|
11
|
+
<%- @entity.attributes.select{|name, attr| attr.type.to_sym == :status}.each do |name, attr| -%>
|
12
|
+
<%- attr.options[:possible_values].each do |value| -%>
|
13
|
+
<%%= link_to t('<%= @model.plural_name %>.<%= name %>.<%= value.to_s.underscore %>_alter'), <%= @model.object_name.pluralize %>_batch_update_path, attribute: :<%= name %>, value: <%= @model.klass %>::<%= value.to_s.underscore.upcase %>, class: :batch_update %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- end -%>
|
16
|
+
<%% end %>
|
17
|
+
|
18
|
+
<%- if @entity.ajax -%>
|
19
|
+
<%% if can? :create, <%= @model.klass %> %>
|
7
20
|
<%%= link_to t('<%= @model.plural_name %>.index.add'), new_<%= @model.object_name %>_path, :class => 'lightbox various fancybox.ajax' %>
|
8
|
-
|
21
|
+
<%% end %>
|
9
22
|
<%- end -%>
|
23
|
+
</div>
|
10
24
|
</div>
|
11
25
|
|
12
26
|
<div class="inside">
|
@@ -22,7 +36,7 @@
|
|
22
36
|
<%- if !atributos_com_filtro.count.zero? or !associacoes_com_filtro.count.zero? -%>
|
23
37
|
<%- atributos_com_filtro.each do |atributo| -%>
|
24
38
|
<div class="yui3-u-1-5">
|
25
|
-
<div class="field">
|
39
|
+
<div class="field <%= 'datas' if atributo.type.to_sym == :date %>">
|
26
40
|
<%%= label_tag :<%= atributo.name %>, t('<%= @model.plural_name %>.filtros.<%= atributo.name %>') %>
|
27
41
|
<%- atributo.to_model_attribute.filter_input.each do |input| -%>
|
28
42
|
<%%= <%= input %> %>
|
@@ -45,8 +59,9 @@
|
|
45
59
|
<!-- Botão buscar -->
|
46
60
|
<div class="yui3-u-1-5">
|
47
61
|
<div class="field">
|
48
|
-
<
|
62
|
+
<div class="label_height"></div>
|
49
63
|
<%%= submit_tag t('system.search_button'), :class => :button %>
|
64
|
+
<%%= link_to t('system.export_xls'), 'javascript:void(0)', :class => [:export, :xls], :form => :<%= @model.plural_name %>_filter_form %>
|
50
65
|
</div>
|
51
66
|
</div>
|
52
67
|
<%- end -%>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
3
|
+
xmlns:o="urn:schemas-microsoft-com:office:office"
|
4
|
+
xmlns:x="urn:schemas-microsoft-com:office:excel"
|
5
|
+
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
6
|
+
xmlns:html="http://www.w3.org/TR/REC-html40">
|
7
|
+
<Worksheet ss:Name="Sheet1">
|
8
|
+
<Table>
|
9
|
+
<Row>
|
10
|
+
<%- @model.attributes.select{|a| a.type.to_sym != :file}.each do |attr| -%>
|
11
|
+
<Cell><Data ss:Type="String"><%%= t '<%= @model.plural_name %>.index.<%= attr.name %>' %></Data></Cell>
|
12
|
+
<%- end -%>
|
13
|
+
</Row>
|
14
|
+
<%% @<%= @model.plural_name %>.each do |<%= @model.singular_name %>| %>
|
15
|
+
<Row>
|
16
|
+
<%- @model.attributes.select{|a| a.type.to_sym != :file}.each do |attr| -%>
|
17
|
+
<Cell><Data ss:Type="String"><%%= <%= @model.singular_name %>.<%= attr.name %><%= '_to_s' if attr.type.to_sym == :status %> %></Data></Cell>
|
18
|
+
<%- end -%>
|
19
|
+
</Row>
|
20
|
+
<%% end %>
|
21
|
+
</Table>
|
22
|
+
</Worksheet>
|
23
|
+
</Workbook>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
===entity_code===
|
2
|
+
<%% if can? :index, <%= @model.klass %> %>
|
3
|
+
<li>
|
4
|
+
<%%= link_to <%= @model.object_name.pluralize %>_path do %><span><%%= t '<%= @model.plural_name %>.menu.index' %></span><%% end %>
|
5
|
+
<%- unless @entity.ajax? -%>
|
6
|
+
<%% if can? :create, <%= @model.klass %> %>
|
7
|
+
<ul class="submenu">
|
8
|
+
<li><%%= link_to new_<%= @model.object_name %>_path do %><span><%%= t( '<%= @model.plural_name %>.menu.new' ) %></span><%% end %></li>
|
9
|
+
</ul>
|
10
|
+
<%% end %>
|
11
|
+
<%- end -%>
|
12
|
+
</li>
|
13
|
+
<%% end %>
|
@@ -61,13 +61,18 @@ module Mdwa
|
|
61
61
|
copy_with_header 'scaffold/views/_form.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/_form.html.erb", entity.name
|
62
62
|
copy_with_header 'scaffold/views/_list.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/_list.html.erb", entity.name
|
63
63
|
copy_with_header 'scaffold/views/create.js.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/create.js.erb", entity.name
|
64
|
+
copy_with_header 'scaffold/views/batch_update.js.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/batch_update.js.erb", entity.name
|
64
65
|
copy_with_header 'scaffold/views/destroy.js.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/destroy.js.erb", entity.name
|
65
66
|
copy_with_header 'scaffold/views/edit.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/edit.html.erb", entity.name
|
66
67
|
copy_with_header 'scaffold/views/index.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/index.html.erb", entity.name
|
68
|
+
copy_with_header 'scaffold/views/index.xls.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/index.xls.erb", entity.name
|
67
69
|
copy_with_header 'scaffold/views/index.js.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/index.js.erb", entity.name
|
68
70
|
copy_with_header 'scaffold/views/new.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/new.html.erb", entity.name
|
69
71
|
copy_with_header 'scaffold/views/show.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/show.html.erb", entity.name
|
70
72
|
copy_with_header 'scaffold/views/update.js.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/update.js.erb", entity.name
|
73
|
+
|
74
|
+
# menu
|
75
|
+
copy_with_header 'scaffold/views/menu/menu.html.erb', "#{MDWA::DSL::TEMPLATES_PATH}#{entity.file_name}/#{model.space + '/'}views/menu/menu.html.erb", entity.name
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
@@ -67,15 +67,26 @@ module Mdwa
|
|
67
67
|
mdwa_template "#{entity.file_name}/#{namespace}/controller.erb", "app/controllers/#{namespace_destino}/#{generator_model.plural_name}_controller.rb" if File.exists?(templates_deste_namespace + 'controller.erb')
|
68
68
|
|
69
69
|
# Gera as views
|
70
|
-
Dir.glob("#{templates_deste_namespace}/views/*").each do |file|
|
70
|
+
Dir.glob("#{templates_deste_namespace}/views/*").select{|d| !File.directory?(d)}.each do |file|
|
71
71
|
file_name = File.basename(file)
|
72
72
|
mdwa_template "#{entity.file_name}/#{namespace}/views/#{file_name}", "app/views/#{namespace_destino}/#{generator_model.plural_name}/#{file_name}"
|
73
73
|
end
|
74
|
+
# Item de menu
|
75
|
+
mdwa_template "#{entity.file_name}/#{namespace}/views/menu/menu.html.erb", "app/views/template/mdwa/menubar/_#{generator_model.plural_name}.html.erb"
|
74
76
|
|
75
77
|
end # nm.each
|
76
78
|
end # if nm == 0
|
77
79
|
end # each
|
78
80
|
end # def
|
81
|
+
|
82
|
+
def create_menu_item
|
83
|
+
@entities.each do |entity|
|
84
|
+
generator_model = entity.generator_model
|
85
|
+
insert_into_file 'app/views/template/mdwa/_menubar.html.erb', before: '</ul>' do
|
86
|
+
" <%= render '/template/mdwa/menubar/#{generator_model.plural_name}' %>\n"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
79
90
|
|
80
91
|
def generate_routes
|
81
92
|
|
@@ -107,6 +118,7 @@ module Mdwa
|
|
107
118
|
route_str = []
|
108
119
|
route_str << "\n namespace :#{generator_model.space} do" if generator_model.namespace?
|
109
120
|
route_str << " controller :#{generator_model.plural_name} do"
|
121
|
+
route_str << " post '#{generator_model.plural_name}/batch_update' => :batch_update, as: :#{generator_model.plural_name}_batch_update"
|
110
122
|
route_str << " end"
|
111
123
|
route_str << " resources :#{generator_model.plural_name}"
|
112
124
|
route_str << " end\n" if generator_model.namespace?
|
@@ -130,60 +142,86 @@ module Mdwa
|
|
130
142
|
return nil if options.skip_locales
|
131
143
|
|
132
144
|
locales_file = 'config/locales/mdwa.specific.en.yml'
|
133
|
-
locales_content = File.read(locales_file)
|
134
145
|
# make sure the file exist
|
135
146
|
create_file locales_file unless File.exist?(Rails.root + locales_file)
|
147
|
+
locales_content = File.read(locales_file)
|
148
|
+
|
149
|
+
# translated
|
150
|
+
if I18n.locale.to_sym != :en
|
151
|
+
locales_translated_file = "config/locales/mdwa.specific.#{I18n.locale}.yml"
|
152
|
+
create_file locales_translated_file unless File.exist?(Rails.root + locales_translated_file)
|
153
|
+
locales_translated_content = File.read(locales_translated_file)
|
154
|
+
end
|
136
155
|
|
137
156
|
@entities.each do |entity|
|
138
157
|
model = entity.generator_model
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
166
|
-
end
|
167
|
-
# EDIT
|
168
|
-
lines << " edit:"
|
169
|
-
model.attributes.each do |attr|
|
170
|
-
lines << " #{attr.name}: \"#{attr.name.humanize}\""
|
171
|
-
end
|
172
|
-
model.associations.each do |assoc|
|
173
|
-
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
174
|
-
end
|
175
|
-
# SHOW
|
176
|
-
lines << " show:"
|
177
|
-
model.attributes.each do |attr|
|
178
|
-
lines << " #{attr.name}: \"#{attr.name.humanize}\""
|
179
|
-
end
|
180
|
-
model.associations.each do |assoc|
|
181
|
-
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
158
|
+
|
159
|
+
lines = []
|
160
|
+
lines << "\n"
|
161
|
+
lines << " #{model.plural_name}:"
|
162
|
+
lines << " notice:"
|
163
|
+
lines << " create: \"#{model.singular_name.humanize} created.\""
|
164
|
+
lines << " update: \"#{model.singular_name.humanize} updated.\""
|
165
|
+
lines << " destroy: \"#{model.singular_name.humanize} destroyed.\""
|
166
|
+
lines << " batch_update: \"#{model.singular_name.humanize} updated.\""
|
167
|
+
lines << " title:"
|
168
|
+
lines << " index: \"#{model.plural_name.humanize}\""
|
169
|
+
lines << " show: \"#{model.singular_name.humanize}\""
|
170
|
+
lines << " new: \"New #{model.singular_name.humanize}\""
|
171
|
+
lines << " edit: \"Edit #{model.singular_name.humanize}\""
|
172
|
+
lines << " menu:"
|
173
|
+
lines << " index: \"#{model.plural_name.humanize}\""
|
174
|
+
lines << " new: \"New #{model.singular_name.humanize}\""
|
175
|
+
# Status
|
176
|
+
if entity.attributes.select{|name, attr| attr.type.to_sym == :status}.count > 0
|
177
|
+
entity.attributes.select{|name, attr| attr.type.to_sym == :status}.each do |name, attr|
|
178
|
+
lines << " #{name}:"
|
179
|
+
lines << " prompt_select: '- Status -'"
|
180
|
+
attr.options[:possible_values].each_with_index do |value, index|
|
181
|
+
lines << " #{value.to_s.underscore}: '#{value.to_s.humanize}'"
|
182
|
+
lines << " #{value.to_s.underscore}_alter: 'Change #{name} to #{value.to_s.humanize}'"
|
183
|
+
end
|
182
184
|
end
|
183
|
-
|
185
|
+
end
|
186
|
+
# INDEX
|
187
|
+
lines << " index:"
|
188
|
+
lines << " add: 'Add'"
|
189
|
+
lines << " edit: 'Edit'"
|
190
|
+
lines << " edit_label: 'Edit'"
|
191
|
+
lines << " remove: 'Remove'"
|
192
|
+
lines << " remove_label: 'Remove'"
|
193
|
+
lines << " confirm_deletion: 'Are you sure?'"
|
194
|
+
model.attributes.each do |attr|
|
195
|
+
lines << " #{attr.name}: \"#{attr.name.humanize}\""
|
196
|
+
end
|
197
|
+
model.associations.each do |assoc|
|
198
|
+
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
199
|
+
end
|
200
|
+
# EDIT
|
201
|
+
lines << " edit:"
|
202
|
+
model.attributes.each do |attr|
|
203
|
+
lines << " #{attr.name}: \"#{attr.name.humanize}\""
|
204
|
+
end
|
205
|
+
model.associations.each do |assoc|
|
206
|
+
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
207
|
+
end
|
208
|
+
# SHOW
|
209
|
+
lines << " show:"
|
210
|
+
model.attributes.each do |attr|
|
211
|
+
lines << " #{attr.name}: \"#{attr.name.humanize}\""
|
212
|
+
end
|
213
|
+
model.associations.each do |assoc|
|
214
|
+
lines << ((assoc.belongs_to? or assoc.nested_one? or assoc.has_one?) ? " #{assoc.model2.singular_name}: \"#{assoc.model2.singular_name.humanize}\"" : " #{assoc.model2.singular_name}: \"#{assoc.model2.plural_name.humanize}\"")
|
215
|
+
end
|
216
|
+
lines << "\n"
|
184
217
|
|
218
|
+
if !locales_content.include?( " #{model.plural_name}:" )
|
185
219
|
append_file locales_file, lines.join("\n"), :after => "en:"
|
186
220
|
end
|
221
|
+
|
222
|
+
if I18n.locale.to_sym != :en and !locales_translated_content.include?( " #{model.plural_name}:" )
|
223
|
+
append_file locales_translated_file, lines.join("\n"), :after => "#{I18n.locale}:"
|
224
|
+
end
|
187
225
|
|
188
226
|
end # @entities loop
|
189
227
|
|
@@ -258,7 +296,7 @@ module Mdwa
|
|
258
296
|
# attribute exists in model and entity, but changed type
|
259
297
|
elsif entity_attribute.type.to_sym != column.type.to_sym
|
260
298
|
# ignores files, passwords and float, decimal, integer variations
|
261
|
-
next if entity_attribute.type.to_sym == :password or ((column.type.to_sym == :integer or column.type.to_sym == :decimal) and entity_attribute.type.to_sym == :float)
|
299
|
+
next if entity_attribute.type.to_sym == :password or (entity_attribute.type.to_sym == :status and column.type.to_sym == :integer) or ((column.type.to_sym == :integer or column.type.to_sym == :decimal) and entity_attribute.type.to_sym == :float)
|
262
300
|
@changes << {:entity => entity, :type => 'change_column', :column => column.name, :attr_type => entity_attribute.type, :from => column.type}
|
263
301
|
end
|
264
302
|
end
|
@@ -336,14 +374,18 @@ module Mdwa
|
|
336
374
|
migration_string << "\n\tdef self.up"
|
337
375
|
migration_string << "\t\tcreate_table :#{generator_model.plural_name} do |t|"
|
338
376
|
generator_model.attributes.select{|a| !['id', 'created_at', 'updated_at'].include?(a.name)}.each do |attr|
|
339
|
-
|
377
|
+
if attr.name.to_sym == :removed
|
378
|
+
migration_string << "\t\t\tt.#{attr.migration_field} :#{attr.name}, default: false"
|
379
|
+
else
|
380
|
+
migration_string << "\t\t\tt.#{attr.migration_field} :#{attr.name}"
|
381
|
+
end
|
340
382
|
end
|
341
383
|
generator_model.associations.each do |assoc|
|
342
384
|
if assoc.belongs_to? or assoc.nested_one?
|
343
385
|
migration_string << "\t\t\tt.integer :#{assoc.model2.singular_name.foreign_key}"
|
344
386
|
end
|
345
387
|
end
|
346
|
-
migration_string << "\n\t\tt.timestamps"
|
388
|
+
migration_string << "\n\t\t\tt.timestamps"
|
347
389
|
migration_string << "\t\tend" # fim do create_table
|
348
390
|
generator_model.associations.each do |assoc|
|
349
391
|
if assoc.belongs_to? or assoc.nested_one?
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
3
|
+
|
4
|
+
inflect.clear
|
5
|
+
|
6
|
+
inflect.plural(/$/, 's')
|
7
|
+
inflect.plural(/(s)$/i, '\1')
|
8
|
+
inflect.plural(/^(paí)s$/i, '\1ses')
|
9
|
+
inflect.plural(/(z|r)$/i, '\1es')
|
10
|
+
inflect.plural(/al$/i, 'ais')
|
11
|
+
inflect.plural(/el$/i, 'eis')
|
12
|
+
inflect.plural(/ol$/i, 'ois')
|
13
|
+
inflect.plural(/ul$/i, 'uis')
|
14
|
+
inflect.plural(/([^aeou])il$/i, '\1is')
|
15
|
+
inflect.plural(/m$/i, 'ns')
|
16
|
+
inflect.plural(/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i, '\1eses')
|
17
|
+
inflect.plural(/^(|g)ás$/i, '\1ases')
|
18
|
+
inflect.plural(/ão$/i, 'ões')
|
19
|
+
inflect.plural(/^(irm|m)ão$/i, '\1ãos')
|
20
|
+
inflect.plural(/^(alem|c|p)ão$/i, '\1ães')
|
21
|
+
|
22
|
+
# Sem acentos...
|
23
|
+
inflect.plural(/ao$/i, 'oes')
|
24
|
+
inflect.plural(/^(irm|m)ao$/i, '\1aos')
|
25
|
+
inflect.plural(/^(alem|c|p)ao$/i, '\1aes')
|
26
|
+
|
27
|
+
inflect.singular(/([^ê])s$/i, '\1')
|
28
|
+
inflect.singular(/^(á|gá|paí)s$/i, '\1s')
|
29
|
+
inflect.singular(/(r|z)es$/i, '\1')
|
30
|
+
inflect.singular(/([^p])ais$/i, '\1al')
|
31
|
+
inflect.singular(/eis$/i, 'el')
|
32
|
+
inflect.singular(/ois$/i, 'ol')
|
33
|
+
inflect.singular(/uis$/i, 'ul')
|
34
|
+
inflect.singular(/(r|t|f|v)is$/i, '\1il')
|
35
|
+
inflect.singular(/ns$/i, 'm')
|
36
|
+
inflect.singular(/sses$/i, 'sse')
|
37
|
+
inflect.singular(/^(.*[^s]s)es$/i, '\1')
|
38
|
+
inflect.singular(/ães$/i, 'ão')
|
39
|
+
inflect.singular(/aes$/i, 'ao')
|
40
|
+
inflect.singular(/ãos$/i, 'ão')
|
41
|
+
inflect.singular(/aos$/i, 'ao')
|
42
|
+
inflect.singular(/ões$/i, 'ão')
|
43
|
+
inflect.singular(/oes$/i, 'ao')
|
44
|
+
inflect.singular(/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i, '\1ês')
|
45
|
+
inflect.singular(/^(g|)ases$/i, '\1ás')
|
46
|
+
|
47
|
+
# Incontáveis
|
48
|
+
inflect.uncountable %w( tórax tênis ônibus lápis fênix )
|
49
|
+
|
50
|
+
# Irregulares
|
51
|
+
inflect.irregular "país", "países"
|
52
|
+
####
|
53
|
+
|
54
|
+
# MDWA - Sandbox
|
55
|
+
inflect.irregular "user", "users"
|
56
|
+
inflect.irregular "administrator", "administrators"
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
pt-BR:
|
4
|
+
errors:
|
5
|
+
messages:
|
6
|
+
expired: "expirou, por favor requisite outro"
|
7
|
+
not_found: "não encontrado"
|
8
|
+
already_confirmed: "já foi confirmado, tente acessar novamente"
|
9
|
+
not_locked: "não foi bloqueada"
|
10
|
+
not_saved:
|
11
|
+
one: "1 erro:"
|
12
|
+
other: "%{count} erros:"
|
13
|
+
|
14
|
+
devise:
|
15
|
+
failure:
|
16
|
+
already_authenticated: 'Você já está logado.'
|
17
|
+
unauthenticated: 'Você precisa estar registrado antes de continuar.'
|
18
|
+
unconfirmed: 'Você precisa confirmar sua conta antes de continuar.'
|
19
|
+
locked: 'Sua conta está bloqueada.'
|
20
|
+
invalid: 'Email ou senha incorretos.'
|
21
|
+
invalid_token: 'Autenticação inválida.'
|
22
|
+
timeout: 'Sua sessão expirou. Faça o login antes de continuar.'
|
23
|
+
inactive: 'Sua conta está bloqueada.'
|
24
|
+
usuario_cliente:
|
25
|
+
not_found_in_database: 'O email ou senha estão incorretos.'
|
26
|
+
sessions:
|
27
|
+
signed_in: 'Login bem sucedido.'
|
28
|
+
signed_out: 'Você saiu do sistema.'
|
29
|
+
passwords:
|
30
|
+
send_instructions: 'Você receberá um email com instruções de como recuperar sua senha em poucos minutos.'
|
31
|
+
updated: 'Sua senha foi alterada com sucesso. Você já está logado.'
|
32
|
+
updated_not_active: 'Senha alterada com sucesso.'
|
33
|
+
send_paranoid_instructions: "Se seu email já existir, você receberá um email com a recuperação da senha."
|
34
|
+
confirmations:
|
35
|
+
send_instructions: 'Você receberá um email com instruções de como confirmar a criação da sua conta em alguns minutos.'
|
36
|
+
send_paranoid_instructions: 'Se seu email já existir, você receberá um email com instruções de como confirmar a criação da sua conta em alguns minutos.'
|
37
|
+
confirmed: 'Sua conta foi confirmada. Você foi logado no sistema.'
|
38
|
+
registrations:
|
39
|
+
signed_up: 'Bem vindo. Seu cadastro foi efetuado com sucesso.'
|
40
|
+
signed_up_but_unconfirmed: 'Uma mensagem com o link de confirmação foi enviada para seu e-mail. Por favor, acesse o link para ativar sua conta.'
|
41
|
+
signed_up_but_inactive: 'Cadastro realizado com sucesso. Porém, você não pode acessar o sistema pois sua conta ainda não foi ativada.'
|
42
|
+
signed_up_but_locked: 'Cadastro realizado com sucesso. Porém você não pode acessar o sistema pois sua conta está travada.'
|
43
|
+
updated: 'Você alterou sua conta com sucesso.'
|
44
|
+
update_needs_confirmation: "A atualização foi realizada com sucesso, porém precisamos verificar seu novo endereço de e-mail. Por favor verifique seu e-mail e acesse o link de confirmação para validar seu novo endereço de e-mail."
|
45
|
+
destroyed: 'Sua conta foi cancelada com sucesso. Esperamos vê-lo novamente em breve.'
|
46
|
+
unlocks:
|
47
|
+
send_instructions: 'Você receberá um email com instruções de como desbloquear sua conta em poucos minutos.'
|
48
|
+
unlocked: 'Sua conta foi desbloqueada com sucesso. Você está logado.'
|
49
|
+
send_paranoid_instructions: 'Se sua conta existir, Você receberá um email com instruções de como desbloquear sua conta em poucos minutos.'
|
50
|
+
omniauth_callbacks:
|
51
|
+
success: 'Autorização com sucesso em sua %{kind} conta.'
|
52
|
+
failure: 'Autorização falhou em sua %{kind} conta porque "%{reason}".'
|
53
|
+
mailer:
|
54
|
+
confirmation_instructions:
|
55
|
+
subject: '[Black Bull] Instruções de confirmação de conta'
|
56
|
+
reset_password_instructions:
|
57
|
+
subject: '[Black Bull] Instruções de recuperação de senha'
|
58
|
+
unlock_instructions:
|
59
|
+
subject: '[Black Bull] Instruções de desbloqueio de conta'
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# pt-BR translations for Ruby on Rails
|
3
|
+
pt-BR:
|
4
|
+
# formatos de data e hora
|
5
|
+
date:
|
6
|
+
formats:
|
7
|
+
default: "%d/%m/%Y"
|
8
|
+
short: "%d de %B"
|
9
|
+
long: "%d de %B de %Y"
|
10
|
+
month: "%B/%Y"
|
11
|
+
|
12
|
+
day_names:
|
13
|
+
- Domingo
|
14
|
+
- Segunda
|
15
|
+
- Terça
|
16
|
+
- Quarta
|
17
|
+
- Quinta
|
18
|
+
- Sexta
|
19
|
+
- Sábado
|
20
|
+
abbr_day_names:
|
21
|
+
- Dom
|
22
|
+
- Seg
|
23
|
+
- Ter
|
24
|
+
- Qua
|
25
|
+
- Qui
|
26
|
+
- Sex
|
27
|
+
- Sáb
|
28
|
+
|
29
|
+
month_names:
|
30
|
+
- ~
|
31
|
+
- Janeiro
|
32
|
+
- Fevereiro
|
33
|
+
- Março
|
34
|
+
- Abril
|
35
|
+
- Maio
|
36
|
+
- Junho
|
37
|
+
- Julho
|
38
|
+
- Agosto
|
39
|
+
- Setembro
|
40
|
+
- Outubro
|
41
|
+
- Novembro
|
42
|
+
- Dezembro
|
43
|
+
abbr_month_names:
|
44
|
+
- ~
|
45
|
+
- Jan
|
46
|
+
- Fev
|
47
|
+
- Mar
|
48
|
+
- Abr
|
49
|
+
- Mai
|
50
|
+
- Jun
|
51
|
+
- Jul
|
52
|
+
- Ago
|
53
|
+
- Set
|
54
|
+
- Out
|
55
|
+
- Nov
|
56
|
+
- Dez
|
57
|
+
order:
|
58
|
+
- :day
|
59
|
+
- :month
|
60
|
+
- :year
|
61
|
+
|
62
|
+
time:
|
63
|
+
formats:
|
64
|
+
default: "%A, %d de %B de %Y, %H:%M h"
|
65
|
+
short: "%d/%m/%Y às %H:%Mh"
|
66
|
+
long: "%A, %d de %B de %Y, %H:%M h"
|
67
|
+
time: "%H:%M"
|
68
|
+
am: ''
|
69
|
+
pm: ''
|
70
|
+
|
71
|
+
# Usado no Array.to_sentence
|
72
|
+
support:
|
73
|
+
array:
|
74
|
+
words_connector: ", "
|
75
|
+
two_words_connector: " e "
|
76
|
+
last_word_connector: " e "
|
77
|
+
|
78
|
+
select:
|
79
|
+
prompt: "Por favor selecione"
|
80
|
+
|
81
|
+
number:
|
82
|
+
format:
|
83
|
+
separator: ','
|
84
|
+
delimiter: '.'
|
85
|
+
precision: 3
|
86
|
+
significant: false
|
87
|
+
strip_insignificant_zeros: false
|
88
|
+
|
89
|
+
currency:
|
90
|
+
format:
|
91
|
+
format: '%u %n'
|
92
|
+
negative_format: '%u -%n'
|
93
|
+
unit: 'R$'
|
94
|
+
separator: ','
|
95
|
+
delimiter: '.'
|
96
|
+
precision: 2
|
97
|
+
significant: false
|
98
|
+
strip_insignificant_zeros: false
|
99
|
+
|
100
|
+
percentage:
|
101
|
+
format:
|
102
|
+
delimiter: '.'
|
103
|
+
|
104
|
+
precision:
|
105
|
+
format:
|
106
|
+
delimiter: '.'
|
107
|
+
|
108
|
+
human:
|
109
|
+
format:
|
110
|
+
delimiter: '.'
|
111
|
+
precision: 2
|
112
|
+
significant: true
|
113
|
+
strip_insignificant_zeros: true
|
114
|
+
storage_units:
|
115
|
+
format: "%n %u"
|
116
|
+
units:
|
117
|
+
byte:
|
118
|
+
one: "Byte"
|
119
|
+
other: "Bytes"
|
120
|
+
kb: "KB"
|
121
|
+
mb: "MB"
|
122
|
+
gb: "GB"
|
123
|
+
tb: "TB"
|
124
|
+
# number_to_human()
|
125
|
+
# new in rails 3: please add to other locales
|
126
|
+
decimal_units:
|
127
|
+
format: "%n %u"
|
128
|
+
units:
|
129
|
+
unit: ""
|
130
|
+
thousand: "mil"
|
131
|
+
million:
|
132
|
+
one: milhão
|
133
|
+
other: milhões
|
134
|
+
billion:
|
135
|
+
one: bilhão
|
136
|
+
other: bilhões
|
137
|
+
trillion:
|
138
|
+
one: trilhão
|
139
|
+
other: trilhões
|
140
|
+
quadrillion:
|
141
|
+
one: quatrilhão
|
142
|
+
other: quatrilhões
|
143
|
+
|
144
|
+
# distancia do tempo em palavras
|
145
|
+
datetime:
|
146
|
+
distance_in_words:
|
147
|
+
half_a_minute: 'meio minuto'
|
148
|
+
less_than_x_seconds:
|
149
|
+
one: 'menos de 1 segundo'
|
150
|
+
other: 'menos de %{count} segundos'
|
151
|
+
x_seconds:
|
152
|
+
one: '1 segundo'
|
153
|
+
other: '%{count} segundos'
|
154
|
+
less_than_x_minutes:
|
155
|
+
one: 'menos de um minuto'
|
156
|
+
other: 'menos de %{count} minutos'
|
157
|
+
x_minutes:
|
158
|
+
one: '1 minuto'
|
159
|
+
other: '%{count} minutos'
|
160
|
+
about_x_hours:
|
161
|
+
one: 'aproximadamente 1 hora'
|
162
|
+
other: 'aproximadamente %{count} horas'
|
163
|
+
x_days:
|
164
|
+
one: '1 dia'
|
165
|
+
other: '%{count} dias'
|
166
|
+
about_x_months:
|
167
|
+
one: 'aproximadamente 1 mês'
|
168
|
+
other: 'aproximadamente %{count} meses'
|
169
|
+
x_months:
|
170
|
+
one: '1 mês'
|
171
|
+
other: '%{count} meses'
|
172
|
+
about_x_years:
|
173
|
+
one: 'aproximadamente 1 ano'
|
174
|
+
other: 'aproximadamente %{count} anos'
|
175
|
+
over_x_years:
|
176
|
+
one: 'mais de 1 ano'
|
177
|
+
other: 'mais de %{count} anos'
|
178
|
+
almost_x_years:
|
179
|
+
one: 'quase 1 ano'
|
180
|
+
other: 'quase %{count} anos'
|
181
|
+
prompts:
|
182
|
+
year: "Ano"
|
183
|
+
month: "Mês"
|
184
|
+
day: "Dia"
|
185
|
+
hour: "Hora"
|
186
|
+
minute: "Minuto"
|
187
|
+
second: "Segundo"
|
188
|
+
|
189
|
+
helpers:
|
190
|
+
select:
|
191
|
+
prompt: "Por favor selecione"
|
192
|
+
|
193
|
+
submit:
|
194
|
+
create: 'Criar %{model}'
|
195
|
+
update: 'Atualizar %{model}'
|
196
|
+
submit: 'Salvar %{model}'
|
197
|
+
|
198
|
+
errors:
|
199
|
+
format: "%{attribute} %{message}"
|
200
|
+
|
201
|
+
template:
|
202
|
+
header:
|
203
|
+
one: "Não foi possível gravar %{model}: 1 erro"
|
204
|
+
other: "Não foi possível gravar %{model}: %{count} erros."
|
205
|
+
body: "Por favor, verifique o(s) seguinte(s) campo(s):"
|
206
|
+
|
207
|
+
messages: &errors_messages
|
208
|
+
inclusion: "não está incluído na lista"
|
209
|
+
exclusion: "não está disponível"
|
210
|
+
invalid: "não é válido"
|
211
|
+
confirmation: "não está de acordo com a confirmação"
|
212
|
+
accepted: "deve ser aceito"
|
213
|
+
empty: "não pode ficar vazio"
|
214
|
+
blank: "não pode ficar em branco"
|
215
|
+
too_long: "é muito longo (máximo: %{count} caracteres)"
|
216
|
+
too_short: "é muito curto (mínimo: %{count} caracteres)"
|
217
|
+
wrong_length: "não possui o tamanho esperado (%{count} caracteres)"
|
218
|
+
not_a_number: "não é um número"
|
219
|
+
not_an_integer: "não é um número inteiro"
|
220
|
+
greater_than: "deve ser maior que %{count}"
|
221
|
+
greater_than_or_equal_to: "deve ser maior ou igual a %{count}"
|
222
|
+
equal_to: "deve ser igual a %{count}"
|
223
|
+
less_than: "deve ser menor que %{count}"
|
224
|
+
less_than_or_equal_to: "deve ser menor ou igual a %{count}"
|
225
|
+
odd: "deve ser ímpar"
|
226
|
+
even: "deve ser par"
|
227
|
+
|
228
|
+
activerecord:
|
229
|
+
errors:
|
230
|
+
template:
|
231
|
+
header:
|
232
|
+
one: "Não foi possível gravar %{model}: 1 erro"
|
233
|
+
other: "Não foi possível gravar %{model}: %{count} erros."
|
234
|
+
body: "Por favor, verifique o(s) seguinte(s) campo(s):"
|
235
|
+
|
236
|
+
messages:
|
237
|
+
taken: "já está em uso"
|
238
|
+
record_invalid: "A validação falhou: %{errors}"
|
239
|
+
<<: *errors_messages
|
240
|
+
|
241
|
+
full_messages:
|
242
|
+
format: "%{attribute} %{message}"
|
243
|
+
|
244
|
+
will_paginate:
|
245
|
+
previous_label: "Anterior"
|
246
|
+
next_label: "Próxima"
|
247
|
+
page_gap: "…"
|
248
|
+
all: '- Todos -'
|
249
|
+
show_label: 'Exibir'
|
250
|
+
|
251
|
+
login:
|
252
|
+
email_label: "E-mail:"
|
253
|
+
password_label: "Senha:"
|
254
|
+
login_button_label: "Login"
|
255
|
+
login_text_pre_form: "Bem-vindo à área administrativa da aplicação MDWA. <br />Faça seu login."
|
256
|
+
|
257
|
+
system:
|
258
|
+
sim: "Sim"
|
259
|
+
nao: "Não"
|
260
|
+
ambos: "Ambos"
|
261
|
+
error: "erro"
|
262
|
+
no_file: "- Sem arquivo -"
|
263
|
+
logged_info_user: "Bem-vindo, <span>%{user}</span>."
|
264
|
+
logged_info_logout: "(Logout)"
|
265
|
+
logged_info_edit_account: "Minha conta"
|
266
|
+
cancel_button: "Cancelar"
|
267
|
+
index_id: "ID"
|
268
|
+
index_edit: "Editar"
|
269
|
+
index_edit_label: "Editar"
|
270
|
+
index_remove: "Remover"
|
271
|
+
index_remove_label: "Remover"
|
272
|
+
index_confirm_deletion: "Você tem certeza?"
|
273
|
+
index_activate: "Ativo"
|
274
|
+
add_by_ajax: "Adicionar novo %{name}"
|
275
|
+
edit_by_ajax: "Editar %{name}"
|
276
|
+
interval_separator: 'à'
|
277
|
+
interval_separator_to: 'até'
|
278
|
+
save_button: 'Salvar'
|
279
|
+
save_and_add_button: 'Salvar e adicionar novo'
|
280
|
+
search_button: 'Buscar'
|
281
|
+
reset_button: 'Buscar todos'
|
282
|
+
combo_estado: '-- Selecione um estado --'
|
283
|
+
combo_cidade_estado: '-- Selecione primeiro um estado --'
|
284
|
+
combo_cidade: '-- Selecione uma cidade --'
|
285
|
+
selecionar_todos: '(Selecionar / Retirar todos)'
|
286
|
+
export_xls: "Exportar para XLS"
|
287
|
+
export_all_xls: "Exportar tudo para XLS"
|
288
|
+
export_csv: "Exportar para CSV"
|
289
|
+
export_all_csv: "Exportar tudo para CSV"
|
290
|
+
|
291
|
+
nested:
|
292
|
+
add: "Adicionar %{name}"
|
293
|
+
remove: "Remover"
|
294
|
+
|