base-project 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +196 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/base-project.gemspec +38 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/base/project.rb +7 -0
- data/lib/base/project/app/controllers/concerns/base_crud_controller.rb +104 -0
- data/lib/base/project/app/helpers/base_helper.rb +128 -0
- data/lib/base/project/app/helpers/button_helper.rb +101 -0
- data/lib/base/project/app/helpers/localizable_helper.rb +51 -0
- data/lib/base/project/app/helpers/panel_helper.rb +8 -0
- data/lib/base/project/app/models/concerns/addressable.rb +93 -0
- data/lib/base/project/app/models/concerns/base_user_concern.rb +39 -0
- data/lib/base/project/app/models/concerns/image_concern.rb +16 -0
- data/lib/base/project/app/models/concerns/localizable.rb +50 -0
- data/lib/base/project/app/models/concerns/scope_concern.rb +14 -0
- data/lib/base/project/app/validators/image_validator.rb +14 -0
- data/lib/base/project/app/views/_flash_messages.html.erb +12 -0
- data/lib/base/project/app/views/_menu.html.erb +16 -0
- data/lib/base/project/app/views/forms/_buttons.html.erb +4 -0
- data/lib/base/project/app/views/indexes/_buttons.html.erb +11 -0
- data/lib/base/project/app/views/indexes/_header.html.erb +10 -0
- data/lib/base/project/app/views/menu/_header_menu.html.erb +25 -0
- data/lib/base/project/app/views/menu/_sidebar.html.erb +44 -0
- data/lib/base/project/app/views/panels/_panel.html.erb +15 -0
- data/lib/base/project/app/views/versions/_model_dates.html.erb +12 -0
- data/lib/base/project/config/locales/error_pages.pt-BR.yml +9 -0
- data/lib/base/project/config/locales/pt-BR.yml +269 -0
- data/lib/base/project/config/locales/simple_form.pt-BR.yml +76 -0
- data/lib/base/project/lib/console_say.rb +17 -0
- data/lib/base/project/lib/string_sanitizer.rb +54 -0
- data/lib/base/project/version.rb +5 -0
- metadata +277 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
pt-BR:
|
2
|
+
simple_form:
|
3
|
+
"yes": 'Sim'
|
4
|
+
"no": 'Não'
|
5
|
+
"true": 'Sim'
|
6
|
+
"false": 'Não'
|
7
|
+
|
8
|
+
back: Voltar
|
9
|
+
confirm: Tem certeza?
|
10
|
+
edit: 'Editar %{message}'
|
11
|
+
delete: 'Deletar %{message}'
|
12
|
+
filter: Filtro
|
13
|
+
forward: Próximo
|
14
|
+
new: 'Novo %{message}'
|
15
|
+
save: Salvar
|
16
|
+
search: Buscar
|
17
|
+
download: Download
|
18
|
+
|
19
|
+
added: 'Criação de %{klass} realizada'
|
20
|
+
updated: 'Atualização de %{klass} realizada'
|
21
|
+
removed: 'Remoção de %{klass} realizada'
|
22
|
+
|
23
|
+
results:
|
24
|
+
zero: Nenhum registro encontrado!
|
25
|
+
one: Um registro encontrado
|
26
|
+
other: '%{count} registros encontrados'
|
27
|
+
|
28
|
+
image: Imagem
|
29
|
+
|
30
|
+
values:
|
31
|
+
initial: Mínimo
|
32
|
+
final: Máximo
|
33
|
+
|
34
|
+
titles:
|
35
|
+
new: 'Cadastrando %{model}'
|
36
|
+
edit: 'Editando %{model}'
|
37
|
+
|
38
|
+
options:
|
39
|
+
links:
|
40
|
+
user_type_link: Visualizar Tipo
|
41
|
+
bill_link: Visualizar conta
|
42
|
+
report_link: Visualizar relatório
|
43
|
+
|
44
|
+
required:
|
45
|
+
text: 'obrigatório'
|
46
|
+
mark: '*'
|
47
|
+
|
48
|
+
error_notification:
|
49
|
+
default_message: "Por favor, reveja os itens marcados abaixo"
|
50
|
+
|
51
|
+
filters:
|
52
|
+
filter_button: Aplicar filtros
|
53
|
+
open_button: Exibir filtros
|
54
|
+
close_button: Fechar filtros
|
55
|
+
|
56
|
+
model:
|
57
|
+
created_since: Criado deste
|
58
|
+
created_until: Criado até
|
59
|
+
created_between: Criado entre
|
60
|
+
updated_since: Atualizado desde
|
61
|
+
updated_until: Atualizado até
|
62
|
+
updated_between: Atualizado entre
|
63
|
+
|
64
|
+
bill:
|
65
|
+
start_price: Preço de
|
66
|
+
end_price: Preço até
|
67
|
+
start_date: Vencimento de
|
68
|
+
end_date: Vencimento até
|
69
|
+
bill_type: Por tipo
|
70
|
+
|
71
|
+
grocery:
|
72
|
+
start_price: Preço de
|
73
|
+
end_price: Preço até
|
74
|
+
start_available: Disponível desde
|
75
|
+
end_available: Disponível até
|
76
|
+
grocery_type: Por tipo
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Base::Project::Lib::ConsoleSay
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def say(message, subitem = false)
|
5
|
+
puts "#{subitem ? ' ->' : '--'} #{message}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def say_with_time(message)
|
9
|
+
say(message)
|
10
|
+
|
11
|
+
time = Benchmark.measure { result = yield }
|
12
|
+
|
13
|
+
time_message = format('%.4fs', time.real)
|
14
|
+
say(time_message, :subitem)
|
15
|
+
time_message
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Base::Project::Lib::StringSanitizer
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def remove_punctuation(str)
|
5
|
+
return '' if str.blank?
|
6
|
+
str.to_s.gsub(/[^a-zA-Z0-9]+/, '')
|
7
|
+
end
|
8
|
+
|
9
|
+
def mask_phone(str)
|
10
|
+
return '' if str.blank?
|
11
|
+
numbers = str.to_s.gsub(/[^0-9]+/, '')
|
12
|
+
|
13
|
+
case numbers.size
|
14
|
+
when 13
|
15
|
+
str.gsub(/\A(\d{2})(\d{2})(\d{3})(\d{3})(\d{3})\Z/, '+\\1 (\\2) \\3-\\4-\\5')
|
16
|
+
when 12
|
17
|
+
str.gsub(/\A(\d{2})(\d{2})(\d{4,5})(\d{4})\Z/, '+\\1 (\\2) \\3-\\4')
|
18
|
+
when 11
|
19
|
+
str.gsub(/[^\d]/, '').gsub(/\A(\d{2})(\d{3})(\d{3})(\d{3})\Z/, '(\\1) \\2-\\3-\\4')
|
20
|
+
when 10
|
21
|
+
str.gsub(/\A(\d{2})(\d{4})(\d{4})\Z/, '(\\1) \\2-\\3')
|
22
|
+
when 9
|
23
|
+
str.gsub(/\A(\d{3})(\d{3})(\d{3})\Z/, '\\1-\\2-\\3')
|
24
|
+
when 8
|
25
|
+
str.gsub(/\A(\d{4})(\d{4})\Z/, '\\1-\\2')
|
26
|
+
else
|
27
|
+
str
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_phone(number, base_number)
|
32
|
+
return '' if number.blank?
|
33
|
+
number = number.to_s.gsub(/[^0-9]+/, '')
|
34
|
+
|
35
|
+
case number.size
|
36
|
+
when 8, 9
|
37
|
+
number = number.insert(0, base_number[0, 4])
|
38
|
+
|
39
|
+
when 10, 11
|
40
|
+
number = number.insert(0, base_number[0, 2])
|
41
|
+
|
42
|
+
when 12, 13
|
43
|
+
return number
|
44
|
+
|
45
|
+
else
|
46
|
+
return ''
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def mask_cep(str)
|
51
|
+
return '' if str.blank? || str.size < 8
|
52
|
+
str.to_s.first(8).gsub(/\A(\d{5})(\d{3})\Z/, '\\1-\\2')
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,277 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: base-project
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- José Ricardo Carvalho Prado de Almeida
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.16.a
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.16.a
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: devise
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cpf_cnpj
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: validators
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: attribute_normalizer
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: money
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: money-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: nested_form
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simple_form
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: i18n_generators
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: paperclip
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: countries
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
description:
|
210
|
+
email:
|
211
|
+
- zehpavora@gmail.com
|
212
|
+
executables: []
|
213
|
+
extensions: []
|
214
|
+
extra_rdoc_files: []
|
215
|
+
files:
|
216
|
+
- ".gitignore"
|
217
|
+
- ".rspec"
|
218
|
+
- ".travis.yml"
|
219
|
+
- CODE_OF_CONDUCT.md
|
220
|
+
- Gemfile
|
221
|
+
- Gemfile.lock
|
222
|
+
- README.md
|
223
|
+
- Rakefile
|
224
|
+
- base-project.gemspec
|
225
|
+
- bin/console
|
226
|
+
- bin/setup
|
227
|
+
- lib/base/project.rb
|
228
|
+
- lib/base/project/app/controllers/concerns/base_crud_controller.rb
|
229
|
+
- lib/base/project/app/helpers/base_helper.rb
|
230
|
+
- lib/base/project/app/helpers/button_helper.rb
|
231
|
+
- lib/base/project/app/helpers/localizable_helper.rb
|
232
|
+
- lib/base/project/app/helpers/panel_helper.rb
|
233
|
+
- lib/base/project/app/models/concerns/addressable.rb
|
234
|
+
- lib/base/project/app/models/concerns/base_user_concern.rb
|
235
|
+
- lib/base/project/app/models/concerns/image_concern.rb
|
236
|
+
- lib/base/project/app/models/concerns/localizable.rb
|
237
|
+
- lib/base/project/app/models/concerns/scope_concern.rb
|
238
|
+
- lib/base/project/app/validators/image_validator.rb
|
239
|
+
- lib/base/project/app/views/_flash_messages.html.erb
|
240
|
+
- lib/base/project/app/views/_menu.html.erb
|
241
|
+
- lib/base/project/app/views/forms/_buttons.html.erb
|
242
|
+
- lib/base/project/app/views/indexes/_buttons.html.erb
|
243
|
+
- lib/base/project/app/views/indexes/_header.html.erb
|
244
|
+
- lib/base/project/app/views/menu/_header_menu.html.erb
|
245
|
+
- lib/base/project/app/views/menu/_sidebar.html.erb
|
246
|
+
- lib/base/project/app/views/panels/_panel.html.erb
|
247
|
+
- lib/base/project/app/views/versions/_model_dates.html.erb
|
248
|
+
- lib/base/project/config/locales/error_pages.pt-BR.yml
|
249
|
+
- lib/base/project/config/locales/pt-BR.yml
|
250
|
+
- lib/base/project/config/locales/simple_form.pt-BR.yml
|
251
|
+
- lib/base/project/lib/console_say.rb
|
252
|
+
- lib/base/project/lib/string_sanitizer.rb
|
253
|
+
- lib/base/project/version.rb
|
254
|
+
homepage: https://github.com/zehpavora/base-project
|
255
|
+
licenses: []
|
256
|
+
metadata: {}
|
257
|
+
post_install_message:
|
258
|
+
rdoc_options: []
|
259
|
+
require_paths:
|
260
|
+
- lib
|
261
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - ">="
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: 2.3.0
|
266
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - ">="
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
271
|
+
requirements: []
|
272
|
+
rubyforge_project:
|
273
|
+
rubygems_version: 2.6.13
|
274
|
+
signing_key:
|
275
|
+
specification_version: 4
|
276
|
+
summary: Base definitions for a project. Contains lots of usable reusables
|
277
|
+
test_files: []
|