carnival 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-regular-webfont.eot +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-regular-webfont.svg +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-regular-webfont.ttf +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-regular-webfont.woff +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-semibold-webfont.eot +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-semibold-webfont.svg +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-semibold-webfont.ttf +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/opensans-semibold-webfont.woff +0 -0
- data/app/assets/{images/carnival/fonts → fonts/carnival}/up-not.png +0 -0
- data/app/assets/javascripts/carnival/{vizir_admin.js → vizir_admin.js.erb} +44 -18
- data/app/assets/stylesheets/carnival/actions.css.scss +3 -7
- data/app/assets/stylesheets/carnival/carnival-table.css.scss +12 -3
- data/app/assets/stylesheets/carnival/forms.css.scss +1 -0
- data/app/assets/stylesheets/carnival/menu.css.scss +3 -3
- data/app/assets/stylesheets/carnival/period.css.scss +1 -1
- data/app/assets/stylesheets/carnival/search.css.scss +9 -6
- data/app/assets/stylesheets/carnival/structure.css.scss +10 -10
- data/app/controllers/carnival/base_admin_controller.rb +37 -57
- data/app/helpers/carnival/base_admin_helper.rb +52 -70
- data/app/inputs/admin_date_input.rb +2 -1
- data/app/models/carnival/batch_action.rb +1 -2
- data/app/models/carnival/field.rb +3 -2
- data/app/presenters/carnival/base_admin_presenter.rb +47 -192
- data/app/presenters/carnival/dsl.rb +55 -0
- data/app/services/carnival/klass_service.rb +5 -1
- data/app/services/carnival/presenters/advanced_search_parser.rb +4 -5
- data/app/services/carnival/query_service.rb +15 -24
- data/app/view_objects/carnival/paginator.rb +10 -12
- data/app/view_objects/carnival/thead_renderer.rb +11 -18
- data/app/views/carnival/base_admin/_index_as_table.html.haml +6 -4
- data/app/views/carnival/base_admin/index.html.haml +8 -4
- data/app/views/carnival/shared/_advanced_search.html.haml +6 -5
- data/app/views/carnival/shared/form/_form.html.haml +3 -2
- data/config/locales/carnival.en.yml +13 -5
- data/config/locales/carnival.pt-br.yml +1 -1
- data/lib/carnival.rb +10 -12
- data/lib/carnival/engine.rb +3 -2
- data/lib/carnival/routes.rb +4 -4
- data/lib/carnival/version.rb +1 -1
- data/spec/dummy/app/controllers/admin/todo_lists_controller.rb +7 -0
- data/spec/dummy/app/controllers/admin/todos_controller.rb +7 -0
- data/spec/dummy/app/models/todo.rb +7 -0
- data/spec/dummy/app/models/todo_list.rb +4 -0
- data/spec/dummy/app/presenters/admin/todo_list_presenter.rb +13 -0
- data/spec/dummy/app/presenters/admin/todo_presenter.rb +32 -0
- data/spec/dummy/config/application.rb +3 -0
- data/spec/dummy/config/database.yml +1 -1
- data/spec/dummy/config/environments/development.rb +2 -0
- data/spec/dummy/config/initializers/carnival_initializer.rb +25 -0
- data/spec/dummy/config/locales/carnival.en.yml +28 -0
- data/spec/dummy/config/locales/carnival.pt-br.yml +259 -0
- data/spec/dummy/config/routes.rb +7 -52
- data/spec/dummy/db/migrate/20150316021645_create_todos.rb +10 -0
- data/spec/dummy/db/migrate/20150408165317_create_todo_lists.rb +8 -0
- data/spec/dummy/db/migrate/20150408165333_add_todo_list_relation_to_todos.rb +5 -0
- data/spec/dummy/db/schema.rb +32 -0
- data/spec/factories/todo_lists_factory.rb +5 -0
- data/spec/factories/todos_factory.rb +18 -0
- data/spec/features/create_spec.rb +28 -0
- data/spec/features/destroy_spec.rb +11 -0
- data/spec/features/index/basic_index_spec.rb +14 -0
- data/spec/features/index/pagination_spec.rb +19 -0
- data/spec/features/index/scope_spec.rb +29 -0
- data/spec/features/index/search_spec.rb +28 -0
- data/spec/features/show_spec.rb +15 -0
- data/spec/features/update_spec.rb +26 -0
- data/spec/rails_helper.rb +25 -5
- data/spec/support/features/index_helpers.rb +15 -0
- metadata +386 -284
- checksums.yaml +0 -7
- data/app/views/carnival/base_admin/index.pdf.haml +0 -13
- data/app/views/carnival/shared/_header.pdf.haml +0 -13
- data/app/views/carnival/shared/_list_cel.pdf.haml +0 -9
- data/app/views/carnival/shared/_report.pdf.haml +0 -21
- data/config/initializers/wicked_pdf.rb +0 -5
data/lib/carnival.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require "csv"
|
1
|
+
require 'rubygems'
|
2
|
+
require 'simple_form'
|
3
|
+
require 'inherited_resources'
|
4
|
+
require 'carnival/engine'
|
5
|
+
require 'carnival/config'
|
6
|
+
require 'carnival/routes'
|
7
|
+
require 'carnival/version'
|
8
|
+
require 'haml-rails'
|
9
|
+
require 'will_paginate'
|
10
|
+
require 'csv'
|
12
11
|
|
13
12
|
module Carnival
|
14
|
-
|
15
13
|
def self.configure
|
16
14
|
yield(Carnival::Config)
|
17
15
|
end
|
data/lib/carnival/engine.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Carnival
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
require 'jquery-rails'
|
3
4
|
config.generators do |g|
|
4
5
|
g.test_framework :rspec
|
5
|
-
g.test_framework
|
6
|
-
g.fixture_replacement :factory_girl, :
|
6
|
+
g.test_framework :rspec, fixture: false
|
7
|
+
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
7
8
|
g.assets false
|
8
9
|
g.helper false
|
9
10
|
end
|
data/lib/carnival/routes.rb
CHANGED
@@ -2,11 +2,11 @@ module ActionDispatch::Routing
|
|
2
2
|
class Mapper
|
3
3
|
def mount_carnival_at(mount_location)
|
4
4
|
Carnival::Config.mount_at = mount_location
|
5
|
-
get
|
5
|
+
get '/carnival/load_select_options' => 'carnival/base_admin#load_select_options', as: :load_select_options
|
6
6
|
scope mount_location do
|
7
|
-
get
|
8
|
-
get
|
9
|
-
root to: Carnival::Config.root_action, :
|
7
|
+
get 'carnival-base/load_dependent_select_options/:presenter/:field/:dependency_field/:dependency_value' => 'carnival/base_admin#load_dependent_select_options', as: :load_dependent_select_options
|
8
|
+
get 'render_inner_form' => 'carnival/base_admin#render_inner_form'
|
9
|
+
root to: Carnival::Config.root_action, as: :carnival_root
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/carnival/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
class Admin::TodoListPresenter < Carnival::BaseAdminPresenter
|
2
|
+
|
3
|
+
field :id, actions: [:index, :show]
|
4
|
+
|
5
|
+
field :name,
|
6
|
+
actions: [:index, :new, :show, :edit],
|
7
|
+
advanced_search: { operator: :equal }
|
8
|
+
|
9
|
+
action :new
|
10
|
+
action :show
|
11
|
+
action :edit
|
12
|
+
action :destroy
|
13
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Admin::TodoPresenter < Carnival::BaseAdminPresenter
|
2
|
+
|
3
|
+
field :id, actions: [:index, :show]
|
4
|
+
|
5
|
+
field :title,
|
6
|
+
actions: [:index, :new, :show, :edit],
|
7
|
+
advanced_search: { operator: :equal }
|
8
|
+
|
9
|
+
field :status,
|
10
|
+
actions: [:index, :new, :show, :edit],
|
11
|
+
advanced_search: { operator: :equal },
|
12
|
+
as: :carnival_enum
|
13
|
+
|
14
|
+
field :created_at,
|
15
|
+
date_filter: true, date_filter_default: :this_year,
|
16
|
+
actions: [:index]
|
17
|
+
field :todo_list,
|
18
|
+
actions: [:new, :edit]
|
19
|
+
|
20
|
+
field 'todo_list.name',
|
21
|
+
actions: [:index, :show],
|
22
|
+
advanced_search: { operator: :like }
|
23
|
+
|
24
|
+
scope :todo, default: true
|
25
|
+
scope :doing
|
26
|
+
scope :done
|
27
|
+
|
28
|
+
action :new
|
29
|
+
action :show
|
30
|
+
action :edit
|
31
|
+
action :destroy
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Carnival.configure do |config|
|
2
|
+
Rails.application.config.assets.precompile += %w( carnival/* )
|
3
|
+
config.menu = {
|
4
|
+
administration: {
|
5
|
+
label: 'administration',
|
6
|
+
link: '/admin/customers',
|
7
|
+
class: 'administracao',
|
8
|
+
subs: [{
|
9
|
+
label: 'posts',
|
10
|
+
link: '/admin/posts'
|
11
|
+
}]
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
# Custom CSS Files
|
16
|
+
# config.custom_css_files = ["samplefile.css"]
|
17
|
+
|
18
|
+
# Custom Javascript Files
|
19
|
+
# config.custom_javascript_files = ["samplefile.js"]
|
20
|
+
|
21
|
+
# Determine root action
|
22
|
+
# config.root_action = 'carnival/admin_users#index'
|
23
|
+
|
24
|
+
config.use_full_model_name = false
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
en:
|
2
|
+
|
3
|
+
carnival:
|
4
|
+
show: View
|
5
|
+
new: New
|
6
|
+
edit: Edit
|
7
|
+
destroy: Delete
|
8
|
+
errors:
|
9
|
+
invalid_field: "The actions '%{actions}' are invalid for field '%{field}' for presenter '%{presenter}'"
|
10
|
+
|
11
|
+
menu:
|
12
|
+
posts: Posts
|
13
|
+
|
14
|
+
nested_form:
|
15
|
+
open: Open
|
16
|
+
close: Close
|
17
|
+
new: Create New
|
18
|
+
add_option: Add
|
19
|
+
new_subtitle: New
|
20
|
+
existing_option: Existing Options
|
21
|
+
existing_option_title: Options
|
22
|
+
choose_an_option: Choose an option
|
23
|
+
minimize: Minimize
|
24
|
+
paginate_first: First
|
25
|
+
paginate_previous: « Previous
|
26
|
+
paginate_next: Next »
|
27
|
+
paginate_last: Last
|
28
|
+
paginate_total: Total
|
@@ -0,0 +1,259 @@
|
|
1
|
+
pt-BR:
|
2
|
+
|
3
|
+
carnival:
|
4
|
+
show: Visualizar
|
5
|
+
new: Novo
|
6
|
+
edit: Editar
|
7
|
+
destroy: Apagar
|
8
|
+
errors:
|
9
|
+
invalid_field: "As actions '%{actions}' não são válidas para o campo '%{field}' do presenter '%{presenter}'"
|
10
|
+
|
11
|
+
nested_form:
|
12
|
+
open: Abrir
|
13
|
+
close: Fechar
|
14
|
+
new: Criar Novo
|
15
|
+
add_option: Adicionar
|
16
|
+
new_subtitle: Novos
|
17
|
+
existing_option: Opções Existentes
|
18
|
+
existing_option_title: Opções
|
19
|
+
choose_an_option: Escolha uma opção
|
20
|
+
|
21
|
+
menu:
|
22
|
+
dashboard: Dashboard
|
23
|
+
admin_user: Usuários administradores
|
24
|
+
messages:
|
25
|
+
created: Criado com sucesso!
|
26
|
+
updated: Alterado com sucesso!
|
27
|
+
select: Selecione
|
28
|
+
minimize: Minimizar
|
29
|
+
sort_by: Ordenar por
|
30
|
+
download_as_csv: Baixar como CSV
|
31
|
+
no_results: Não foram encontrados resultados
|
32
|
+
advanced_search: Busca
|
33
|
+
select_an_option: Selecione uma opção
|
34
|
+
without_country: Sem país
|
35
|
+
without_state: Sem estado
|
36
|
+
without_city: Sem cidade
|
37
|
+
search: Busca
|
38
|
+
clear: Limpar
|
39
|
+
login: Entrar
|
40
|
+
logout: Sair
|
41
|
+
edit: Editar
|
42
|
+
send: Enviar
|
43
|
+
create: Criar
|
44
|
+
delete: Apagar
|
45
|
+
remove: Remover
|
46
|
+
destroy: Apagar
|
47
|
+
details: Detalhes
|
48
|
+
view: Ver
|
49
|
+
please_wait: Aguarde...
|
50
|
+
are_you_sure: Você tem certeza que deseja apagar?
|
51
|
+
are_you_sure_block: Você tem certeza que deseja bloquear?
|
52
|
+
are_you_sure_unblock: Você tem certeza que deseja desbloquear?
|
53
|
+
select: Selecione
|
54
|
+
search: Buscar
|
55
|
+
previous: Anterior
|
56
|
+
next: Próxima
|
57
|
+
update: Atualizar
|
58
|
+
new: Adicionar
|
59
|
+
back: Voltar
|
60
|
+
save: Salvar
|
61
|
+
yyes: Sim
|
62
|
+
nno: Não
|
63
|
+
from: De
|
64
|
+
to: Até
|
65
|
+
master_user: SafeGuard Admin
|
66
|
+
blocked: Bloqueado
|
67
|
+
unblocked: Desbloqueado
|
68
|
+
was: foi
|
69
|
+
of: de
|
70
|
+
by: por
|
71
|
+
at: às
|
72
|
+
new_support: Abrir solicitação de suporte
|
73
|
+
batch_actions: Operações em Lote
|
74
|
+
paginate_first: Primeira
|
75
|
+
paginate_previous: « Anterior
|
76
|
+
paginate_next: Próxima »
|
77
|
+
paginate_last: Última
|
78
|
+
paginate_total: Total
|
79
|
+
data_tables:
|
80
|
+
first: Primeira
|
81
|
+
last: Última
|
82
|
+
next: Próxima
|
83
|
+
previous: Anterior
|
84
|
+
row_counter: Mostrando _START_ a _END_ de _TOTAL_ entradas
|
85
|
+
row_counter_empty: Mostrando de 0 até 0 de 0 registros
|
86
|
+
table_empty: Não há registros para exibir
|
87
|
+
rows_filtered: (filtrando de _MAX_)
|
88
|
+
rows_postfix:
|
89
|
+
rows_per_page: Exibir _MENU_ registros
|
90
|
+
processing: Processando
|
91
|
+
search:
|
92
|
+
zero_records: Não há registros para exibir
|
93
|
+
date_filter:
|
94
|
+
today: Hoje
|
95
|
+
yesterday: Ontem
|
96
|
+
this_week: Esta semana
|
97
|
+
last_week: Semana passada
|
98
|
+
this_month: Este mês
|
99
|
+
last_month: Mês passado
|
100
|
+
this_year: Este ano
|
101
|
+
last_year: Ano passado
|
102
|
+
|
103
|
+
|
104
|
+
# formatos de data e hora
|
105
|
+
date:
|
106
|
+
formats:
|
107
|
+
default: "%d/%m/%Y"
|
108
|
+
short: "%d de %B"
|
109
|
+
long: "%d de %B de %Y"
|
110
|
+
only_day: "%d"
|
111
|
+
|
112
|
+
day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
|
113
|
+
abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
|
114
|
+
month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
|
115
|
+
abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
|
116
|
+
order:
|
117
|
+
- :day
|
118
|
+
- :month
|
119
|
+
- :year
|
120
|
+
|
121
|
+
time:
|
122
|
+
formats:
|
123
|
+
default: "%A, %d de %B de %Y, %H:%M hs"
|
124
|
+
time: "%H:%M hs"
|
125
|
+
short: "%d/%m, %H:%M hs"
|
126
|
+
long: "%A, %d de %B de %Y, %H:%M hs"
|
127
|
+
only_second: "%S"
|
128
|
+
datetime:
|
129
|
+
formats:
|
130
|
+
default: "%Y-%m-%dT%H:%M:%S%Z"
|
131
|
+
am: ''
|
132
|
+
pm: ''
|
133
|
+
|
134
|
+
# date helper distanci em palavras
|
135
|
+
datetime:
|
136
|
+
distance_in_words:
|
137
|
+
half_a_minute: 'meio minuto'
|
138
|
+
less_than_x_seconds:
|
139
|
+
one: 'menos de 1 segundo'
|
140
|
+
other: 'menos de %{count} segundos'
|
141
|
+
|
142
|
+
x_seconds:
|
143
|
+
one: '1 segundo'
|
144
|
+
other: '%{count} segundos'
|
145
|
+
|
146
|
+
less_than_x_minutes:
|
147
|
+
one: 'menos de um minuto'
|
148
|
+
other: 'menos de %{count} minutos'
|
149
|
+
|
150
|
+
x_minutes:
|
151
|
+
one: '1 minuto'
|
152
|
+
other: '%{count} minutos'
|
153
|
+
|
154
|
+
about_x_hours:
|
155
|
+
one: 'aproximadamente 1 hora'
|
156
|
+
other: 'aproximadamente %{count} horas'
|
157
|
+
|
158
|
+
x_days:
|
159
|
+
one: '1 dia'
|
160
|
+
other: '%{count} dias'
|
161
|
+
|
162
|
+
about_x_months:
|
163
|
+
one: 'aproximadamente 1 mês'
|
164
|
+
other: 'aproximadamente %{count} meses'
|
165
|
+
|
166
|
+
x_months:
|
167
|
+
one: '1 mês'
|
168
|
+
other: '%{count} meses'
|
169
|
+
|
170
|
+
about_x_years:
|
171
|
+
one: 'aproximadamente 1 ano'
|
172
|
+
other: 'aproximadamente %{count} anos'
|
173
|
+
|
174
|
+
over_x_years:
|
175
|
+
one: 'mais de 1 ano'
|
176
|
+
other: 'mais de %{count} anos'
|
177
|
+
|
178
|
+
# numeros
|
179
|
+
number:
|
180
|
+
format:
|
181
|
+
precision: 3
|
182
|
+
separator: ','
|
183
|
+
delimiter: '.'
|
184
|
+
currency:
|
185
|
+
format:
|
186
|
+
unit: 'R$'
|
187
|
+
precision: 2
|
188
|
+
format: '%u %n'
|
189
|
+
separator: ','
|
190
|
+
delimiter: '.'
|
191
|
+
percentage:
|
192
|
+
format:
|
193
|
+
delimiter: '.'
|
194
|
+
precision:
|
195
|
+
format:
|
196
|
+
delimiter: '.'
|
197
|
+
human:
|
198
|
+
format:
|
199
|
+
precision: 1
|
200
|
+
delimiter: '.'
|
201
|
+
support:
|
202
|
+
array:
|
203
|
+
sentence_connector: "e"
|
204
|
+
skip_last_comma: true
|
205
|
+
|
206
|
+
default_columns: &default_columns
|
207
|
+
created_at: Criado em
|
208
|
+
updated_at: Atualizado em
|
209
|
+
id: ID
|
210
|
+
|
211
|
+
admin_user:
|
212
|
+
name: Nome
|
213
|
+
lista: Usuários administradores
|
214
|
+
admin: Administrador
|
215
|
+
account_name: Contaform
|
216
|
+
notification: Notificação
|
217
|
+
<<: *default_columns
|
218
|
+
|
219
|
+
# Active Record
|
220
|
+
activerecord:
|
221
|
+
attributes:
|
222
|
+
carnival/admin_user:
|
223
|
+
avatar: Foto
|
224
|
+
current_sign_in_at: Acesso atual em
|
225
|
+
email: E-mail
|
226
|
+
id: Código
|
227
|
+
last_sign_in_at: Último acesso em
|
228
|
+
name: Nome
|
229
|
+
photo: Foto
|
230
|
+
sign_in_count: Total de acessos
|
231
|
+
errors:
|
232
|
+
template:
|
233
|
+
header:
|
234
|
+
one: "Não pôde ser salvo: 1 erro"
|
235
|
+
other: "Não pôde ser salvo: %{count} erros."
|
236
|
+
body: "Por favor, cheque os seguintes campos:"
|
237
|
+
messages:
|
238
|
+
inclusion: "não está incluso na lista"
|
239
|
+
exclusion: "não está disponível"
|
240
|
+
invalid: "não é válido"
|
241
|
+
confirmation: "não bate com a confirmação"
|
242
|
+
accepted: "precisa ser aceito"
|
243
|
+
empty: "não pode ser vazio"
|
244
|
+
blank: "não pode ser vazio"
|
245
|
+
too_long: "é muito longo (não mais do que %{count} caracteres)"
|
246
|
+
too_short: "é muito curto (não menos do que %{count} caracteres)"
|
247
|
+
wrong_length: "não é do tamanho correto (precisa ter %{count} caracteres)"
|
248
|
+
taken: "não está disponível"
|
249
|
+
not_a_number: "não é um número"
|
250
|
+
greater_than: "precisa ser maior do que %{count}"
|
251
|
+
greater_than_or_equal_to: "precisa ser maior ou igual a %{count}"
|
252
|
+
equal_to: "precisa ser igual a %{count}"
|
253
|
+
less_than: "precisa ser menor do que %{count}"
|
254
|
+
less_than_or_equal_to: "precisa ser menor ou igual a %{count}"
|
255
|
+
odd: "precisa ser ímpar"
|
256
|
+
even: "precisa ser par"
|
257
|
+
models:
|
258
|
+
admin_user: Usuário Administrador
|
259
|
+
|