carnival 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/stylesheets/carnival/main.css +73 -0
- data/app/controllers/carnival/base_admin_controller.rb +4 -9
- data/app/controllers/carnival/sessions_controller.rb +4 -3
- data/app/datatable/carnival/generic_datatable.rb +1 -1
- data/app/presenters/carnival/admin_user_notification_presenter.rb +0 -56
- data/app/presenters/carnival/admin_user_presenter.rb +1 -23
- data/app/presenters/carnival/base_admin_presenter.rb +46 -29
- data/app/views/{devise → admin_users}/confirmations/new.html.erb +0 -0
- data/app/views/{devise → admin_users}/mailer/confirmation_instructions.html.erb +0 -0
- data/app/views/{devise → admin_users}/mailer/reset_password_instructions.html.erb +0 -0
- data/app/views/{devise → admin_users}/mailer/unlock_instructions.html.erb +0 -0
- data/app/views/{devise → admin_users}/passwords/edit.html.erb +0 -0
- data/app/views/{devise → admin_users}/passwords/new.html.erb +0 -0
- data/app/views/{devise → admin_users}/registrations/edit.html.erb +0 -0
- data/app/views/{devise → admin_users}/registrations/new.html.erb +0 -0
- data/app/views/admin_users/sessions/new.html.haml +13 -0
- data/app/views/admin_users/shared/_links.html.haml +14 -0
- data/app/views/{devise → admin_users}/unlocks/new.html.erb +0 -0
- data/app/views/carnival/shared/form/show.html.haml +2 -2
- data/app/views/layouts/carnival/_menu.html.haml +24 -23
- data/app/views/layouts/carnival/_notifications_list.html.haml +2 -2
- data/app/views/layouts/carnival/admin.html.haml +1 -1
- data/config/initializers/carnival_initializer.rb +1 -0
- data/config/initializers/devise.rb +1 -1
- data/config/locales/carnival.pt.yml +2 -1
- data/config/routes.rb +2 -3
- data/lib/carnival/routes.rb +6 -6
- data/lib/carnival/version.rb +1 -1
- data/lib/generators/carnival/install_generator.rb +1 -1
- data/test/dummy/config/initializers/carnival_initializer.rb +41 -0
- data/test/dummy/config/locales/carnival.en.yml +1 -0
- data/test/dummy/config/locales/carnival.pt.yml +232 -0
- data/test/dummy/config/locales/devise.en.yml +59 -0
- data/test/dummy/config/locales/devise.pt.yml +59 -0
- data/test/dummy/config/routes.rb +2 -3
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +12727 -18
- data/test/dummy/tmp/cache/assets/development/sprockets/02b691bcf7570e21acab45d320ac92cf +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0f7b5da581fb3730800607447951008a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/141987f5d019e60604cd75d2e340942f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/39d34c0caaa6f36d684fac1898a7f88f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3a2fdd82041ab4b5ce8a082ec9b270fb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3d8100b6e405407290dcf994ef05e0b7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/577f4d9c0b4703cbfffd7159a232e60e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5ff6c7a42ff7a4d062640d9211b42275 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/604d964a22a33e7a1dc917eb10328fb6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6d806eaa317f200bbf2832a0abf1c1cc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9658141bfa282274f1da9155c32ae206 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e0352d0f97751491adbe6a94832772af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e9c81ca91323dab8977ffd8a459cab06 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f5c9348795319821f3309d4e03bb9fdb +0 -0
- metadata +49 -29
- data/app/views/carnival/admin_users/_form.html.haml +0 -21
- data/app/views/carnival/admin_users/edit.html.haml +0 -3
- data/app/views/carnival/admin_users/new.html.haml +0 -4
- data/app/views/carnival/admin_users/show.html.haml +0 -14
- data/app/views/devise/sessions/new.html.erb +0 -19
- data/app/views/devise/shared/_links.erb +0 -25
- data/test/dummy/tmp/pids/server.pid +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTRlNDdkMjYxZjJmYTBiZDljZDk3ZDk0OTI2YjE3ODM4ZWE1MjA1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQ4NTkxODlmMDJkNjg4MjRjNTE4OTc2M2UyZmM2M2JhYTczYmI4NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTNjMTA0MDg5ZTA0ZjIyYjJiMzY4MTMyZGRjYTYzMTI5MjQxZjFjMmJjNjk0
|
10
|
+
MDBlODliNjM2YTZjZGRmMTE3MWE5MzQ1ODIyZDhlNDkyNjU0N2Q0ZWE4NDIw
|
11
|
+
NDBjYTY2MWEwMGIzMmEwOWY0NGMxM2JkNTQ4ZjIxYmRjMTkwZTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTEyZWJlZWUxMTlmNjg3NzUzNTE5YzY4MDYzYzZjNTViOWFkMDFlNDc5NDk1
|
14
|
+
ZjM4MTdkMTViN2Y0MjQwNjUwODEwMWE2YWY2OTNjMzhhZjNiM2ZkNWMwMDRl
|
15
|
+
MWZjN2UwZTFiMDg4ZmJmMTJlYzBmOTA0N2Q5YmUxYzgwOTBhZjg=
|
@@ -2221,3 +2221,76 @@ table input{
|
|
2221
2221
|
padding-left: 15px;
|
2222
2222
|
padding-right: 15px;
|
2223
2223
|
}
|
2224
|
+
|
2225
|
+
.login-container form{
|
2226
|
+
background-color: #f7f7f7;
|
2227
|
+
padding: 20px 25px 30px;
|
2228
|
+
margin: 0 auto 25px;
|
2229
|
+
width: 304px;
|
2230
|
+
-moz-border-radius: 2px;
|
2231
|
+
-webkit-border-radius: 2px;
|
2232
|
+
border-radius: 2px;
|
2233
|
+
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
2234
|
+
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
2235
|
+
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
.login-container form input[type=email], .login-container form input[type=password]{
|
2239
|
+
-moz-appearance: none;
|
2240
|
+
-webkit-appearance: none;
|
2241
|
+
appearance: none;
|
2242
|
+
display: inline-block;
|
2243
|
+
height: 36px;
|
2244
|
+
padding: 0 8px;
|
2245
|
+
margin: 0;
|
2246
|
+
background: #fff;
|
2247
|
+
border: 1px solid #d9d9d9;
|
2248
|
+
border-top: 1px solid #c0c0c0;
|
2249
|
+
-moz-box-sizing: border-box;
|
2250
|
+
-webkit-box-sizing: border-box;
|
2251
|
+
box-sizing: border-box;
|
2252
|
+
-moz-border-radius: 1px;
|
2253
|
+
-webkit-border-radius: 1px;
|
2254
|
+
border-radius: 1px;
|
2255
|
+
font-size: 15px;
|
2256
|
+
color: #404040;
|
2257
|
+
width: 100%;
|
2258
|
+
}
|
2259
|
+
|
2260
|
+
.login-container h2{
|
2261
|
+
margin-bottom: 30px;
|
2262
|
+
text-align: center;
|
2263
|
+
}
|
2264
|
+
|
2265
|
+
.login-container .button{
|
2266
|
+
width: 100%;
|
2267
|
+
margin-top:20px;
|
2268
|
+
margin-bottom:10px;
|
2269
|
+
}
|
2270
|
+
|
2271
|
+
.button{
|
2272
|
+
-moz-appearance: none;
|
2273
|
+
-webkit-appearance: none;
|
2274
|
+
appearance: none;
|
2275
|
+
display: inline-block;
|
2276
|
+
height: 36px;
|
2277
|
+
padding: 0 8px;
|
2278
|
+
margin: 0;
|
2279
|
+
-moz-box-sizing: border-box;
|
2280
|
+
-webkit-box-sizing: border-box;
|
2281
|
+
box-sizing: border-box;
|
2282
|
+
-moz-border-radius: 1px;
|
2283
|
+
-webkit-border-radius: 1px;
|
2284
|
+
border-radius: 1px;
|
2285
|
+
font-size: 15px;
|
2286
|
+
box-shadow: 0 -1px 0px 0 #fff;
|
2287
|
+
color: #333;
|
2288
|
+
border: 1px solid #ccc;
|
2289
|
+
}
|
2290
|
+
|
2291
|
+
.button:hover{
|
2292
|
+
color: #fff;
|
2293
|
+
cursor: pointer;
|
2294
|
+
border: 1px solid #2A6198;
|
2295
|
+
background-color: #2D66A0;
|
2296
|
+
}
|
@@ -4,8 +4,8 @@ module Carnival
|
|
4
4
|
before_filter :authenticate_admin_user!
|
5
5
|
|
6
6
|
def generate_datatable
|
7
|
-
|
8
|
-
Carnival::GenericDatatable.new(view_context, instantiate_model, self,
|
7
|
+
model_presenter = instantiate_presenter
|
8
|
+
Carnival::GenericDatatable.new(view_context, instantiate_model(model_presenter), self, model_presenter)
|
9
9
|
end
|
10
10
|
|
11
11
|
def index
|
@@ -75,13 +75,8 @@ module Carnival
|
|
75
75
|
|
76
76
|
private
|
77
77
|
|
78
|
-
def instantiate_model
|
79
|
-
|
80
|
-
if namespace.present?
|
81
|
-
"#{extract_namespace}::#{controller_name.classify}".constantize
|
82
|
-
else
|
83
|
-
"#{controller_name.classify}".constantize
|
84
|
-
end
|
78
|
+
def instantiate_model(presenter)
|
79
|
+
presenter.full_model_name.classify.constantize
|
85
80
|
end
|
86
81
|
|
87
82
|
def instantiate_presenter
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module Carnival
|
2
2
|
class SessionsController < Devise::SessionsController
|
3
|
-
|
3
|
+
layout "carnival/admin"
|
4
|
+
def create
|
4
5
|
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
|
5
6
|
set_flash_message(:success, :signed_in) if is_navigational_format?
|
6
7
|
redirect_to admin_root_url
|
7
|
-
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
+
def destroy
|
10
11
|
redirect_path = after_sign_out_path_for(resource_name)
|
11
12
|
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
|
12
13
|
set_flash_message :success, :signed_out if signed_out && is_navigational_format?
|
@@ -59,7 +59,7 @@ module Carnival
|
|
59
59
|
CSV.generate(:col_sep => "\t") do |csv|
|
60
60
|
csv_line = []
|
61
61
|
@presenter.fields_for_action(:csv).each do |key, field|
|
62
|
-
csv_line << I18n.t("
|
62
|
+
csv_line << I18n.t("activerecord.attributes.#{@presenter.full_model_name}.#{field.name}")
|
63
63
|
end
|
64
64
|
csv << csv_line
|
65
65
|
|
@@ -1,61 +1,5 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
module Carnival
|
3
3
|
class AdminUserNotificationPresenter < Carnival::BaseAdminPresenter
|
4
|
-
def listagem(tipo = nil)
|
5
|
-
[:notification__title, :message_link, :created_at]
|
6
|
-
end
|
7
|
-
|
8
|
-
def _listagem_botoes_extras
|
9
|
-
[
|
10
|
-
{
|
11
|
-
:link => 'admin_mark_notification_as_read',
|
12
|
-
:nome => "#{I18n.t('notification.mark_as_read')}",
|
13
|
-
:remote => true,
|
14
|
-
:success => 'markAsReadCallback',
|
15
|
-
:error => 'errorCallback',
|
16
|
-
:method => 'POST',
|
17
|
-
:campo => :mark_as_read_button
|
18
|
-
}
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
|
-
def remoto?
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
def listagem_botoes
|
27
|
-
{:novo => false, :editar=> false, :apagar => false}
|
28
|
-
end
|
29
|
-
|
30
|
-
def busca_remoto?
|
31
|
-
true
|
32
|
-
end
|
33
|
-
|
34
|
-
def ordenacao_remoto
|
35
|
-
[:id]
|
36
|
-
end
|
37
|
-
|
38
|
-
def escopo
|
39
|
-
[:all, :unread]
|
40
|
-
end
|
41
|
-
|
42
|
-
def filtro_data
|
43
|
-
nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def escopo_padrao
|
47
|
-
:unread
|
48
|
-
end
|
49
|
-
|
50
|
-
def busca_remoto
|
51
|
-
[:title, :message]
|
52
|
-
end
|
53
|
-
|
54
|
-
def advanced_search
|
55
|
-
{
|
56
|
-
:notification__title => [:field, :like],
|
57
|
-
:notification__message => [:field, :like]
|
58
|
-
}
|
59
|
-
end
|
60
4
|
end
|
61
5
|
end
|
@@ -24,30 +24,8 @@ module Carnival
|
|
24
24
|
action :edit
|
25
25
|
action :destroy
|
26
26
|
action :new
|
27
|
-
action :teste1, :target => :record, :path=>"http://www.google.com.br"
|
28
|
-
action :teste2, :target => :page, :path=>"http://www.google.com.br"
|
29
27
|
|
30
|
-
|
31
|
-
{:novo => true, :editar=> true, :apagar => true}
|
32
|
-
end
|
33
|
-
|
34
|
-
def listagem_botoes_extras
|
35
|
-
[
|
36
|
-
{
|
37
|
-
:link => 'admin_admin_user',
|
38
|
-
:nome => I18n.t('details')
|
39
|
-
}
|
40
|
-
]
|
41
|
-
end
|
42
|
-
|
43
|
-
def filtro_data
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def escopo
|
49
|
-
[]
|
50
|
-
end
|
28
|
+
model_name "carnival/admin_user"
|
51
29
|
|
52
30
|
end
|
53
31
|
end
|
@@ -36,22 +36,11 @@ module Carnival
|
|
36
36
|
@@actions[presenter_class_name].present? && @@actions[presenter_class_name][action].present?
|
37
37
|
end
|
38
38
|
|
39
|
+
@@model_names = {}
|
39
40
|
@@fields = {}
|
40
41
|
@@scopes = {}
|
41
42
|
@@forms = {}
|
42
43
|
|
43
|
-
def self.scope(name, params = {})
|
44
|
-
self.instantiate_element(@@scopes, Carnival::Scope, name, params)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.field(name, params = {})
|
48
|
-
self.instantiate_element(@@fields, Carnival::Field, name, params)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.form(action, params = {})
|
52
|
-
self.instantiate_element(@@forms, Carnival::Form, name, params)
|
53
|
-
end
|
54
|
-
|
55
44
|
def scopes
|
56
45
|
@@scopes[presenter_class_name]
|
57
46
|
end
|
@@ -91,8 +80,17 @@ module Carnival
|
|
91
80
|
form
|
92
81
|
end
|
93
82
|
|
83
|
+
|
94
84
|
def model_name
|
95
|
-
|
85
|
+
if @@model_names[presenter_class_name].nil?
|
86
|
+
self.class.to_s.split("::").last().gsub("Presenter", "").underscore
|
87
|
+
else
|
88
|
+
if @@model_names[presenter_class_name].include?("/")
|
89
|
+
@@model_names[presenter_class_name].split("/").last
|
90
|
+
else
|
91
|
+
@@model_names[presenter_class_name]
|
92
|
+
end
|
93
|
+
end
|
96
94
|
end
|
97
95
|
|
98
96
|
def model_path(action, extra_params=nil)
|
@@ -103,7 +101,11 @@ module Carnival
|
|
103
101
|
end
|
104
102
|
|
105
103
|
def full_model_name
|
106
|
-
|
104
|
+
if @@model_names[presenter_class_name].nil?
|
105
|
+
self.class.to_s.gsub("Presenter", "").underscore
|
106
|
+
else
|
107
|
+
@@model_names[presenter_class_name]
|
108
|
+
end
|
107
109
|
end
|
108
110
|
|
109
111
|
def controller_name
|
@@ -179,7 +181,7 @@ module Carnival
|
|
179
181
|
end
|
180
182
|
|
181
183
|
def model_class
|
182
|
-
|
184
|
+
full_model_name.classify.constantize
|
183
185
|
end
|
184
186
|
|
185
187
|
def relation_field?(field)
|
@@ -195,7 +197,7 @@ module Carnival
|
|
195
197
|
if model_class.reflect_on_association(field).macro == :belongs_to
|
196
198
|
return record.send(field)
|
197
199
|
else
|
198
|
-
return I18n.t("
|
200
|
+
return I18n.t("activerecord.attibutes.#{full_model_name}.#{field}")
|
199
201
|
end
|
200
202
|
end
|
201
203
|
raise
|
@@ -251,14 +253,6 @@ module Carnival
|
|
251
253
|
actions
|
252
254
|
end
|
253
255
|
|
254
|
-
def self.presenter_class_name
|
255
|
-
if self.class.name == "Class"
|
256
|
-
self.to_s
|
257
|
-
else
|
258
|
-
self.class.name
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
256
|
def presenter_class_name
|
263
257
|
if self.class.name == "Class"
|
264
258
|
self.to_s
|
@@ -320,11 +314,6 @@ module Carnival
|
|
320
314
|
end
|
321
315
|
end
|
322
316
|
|
323
|
-
def self.instantiate_element(container, klass, name, params)
|
324
|
-
container[presenter_class_name] = {} if container[presenter_class_name].nil?
|
325
|
-
container[presenter_class_name][name] = klass.new(name, params)
|
326
|
-
end
|
327
|
-
|
328
317
|
def extract_namespace
|
329
318
|
namespace = ""
|
330
319
|
arr = self.class.to_s.split("::")
|
@@ -332,5 +321,33 @@ module Carnival
|
|
332
321
|
namespace
|
333
322
|
end
|
334
323
|
|
324
|
+
def self.instantiate_element(container, klass, name, params)
|
325
|
+
container[presenter_class_name] = {} if container[presenter_class_name].nil?
|
326
|
+
container[presenter_class_name][name] = klass.new(name, params)
|
327
|
+
end
|
328
|
+
|
329
|
+
def self.scope(name, params = {})
|
330
|
+
self.instantiate_element(@@scopes, Carnival::Scope, name, params)
|
331
|
+
end
|
332
|
+
|
333
|
+
def self.field(name, params = {})
|
334
|
+
self.instantiate_element(@@fields, Carnival::Field, name, params)
|
335
|
+
end
|
336
|
+
|
337
|
+
def self.form(action, params = {})
|
338
|
+
self.instantiate_element(@@forms, Carnival::Form, name, params)
|
339
|
+
end
|
340
|
+
|
341
|
+
def self.model_name(name)
|
342
|
+
@@model_names[presenter_class_name] = name
|
343
|
+
end
|
344
|
+
|
345
|
+
def self.presenter_class_name
|
346
|
+
if self.class.name == "Class"
|
347
|
+
self.to_s
|
348
|
+
else
|
349
|
+
self.class.name
|
350
|
+
end
|
351
|
+
end
|
335
352
|
end
|
336
353
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.login-container
|
2
|
+
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
3
|
+
%h2 Efetuar login
|
4
|
+
%div
|
5
|
+
= f.email_field :email, :autofocus => true, :placeholder => "E-mail"
|
6
|
+
%div
|
7
|
+
= f.password_field :password, :placeholder => "Senha"
|
8
|
+
%div= f.submit "Fazer login", :class => "button"
|
9
|
+
- if devise_mapping.rememberable?
|
10
|
+
%div
|
11
|
+
= f.check_box :remember_me
|
12
|
+
= f.label "Continuar conectado"
|
13
|
+
= render "admin_users/shared/links"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- if controller_name != 'sessions'
|
2
|
+
.sign_in
|
3
|
+
= link_to "Entrar", new_session_path(resource_name)
|
4
|
+
- if devise_mapping.registerable? && controller_name != 'registrations'
|
5
|
+
.sign_up
|
6
|
+
= link_to "Registrar-se", new_registration_path(resource_name)
|
7
|
+
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
|
8
|
+
.forgot_password
|
9
|
+
= link_to "Resetar senha", new_password_path(resource_name)
|
10
|
+
- if devise_mapping.omniauthable?
|
11
|
+
.oauth
|
12
|
+
- resource_class.omniauth_providers.each do |provider|
|
13
|
+
%div{class: provider}
|
14
|
+
= link_to "Login com #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- index_path = caminho_modelo(:index)
|
2
|
-
- item = instance_variable_get("@#{
|
2
|
+
- item = instance_variable_get("@#{@model_presenter.model_name}")
|
3
3
|
.gray_border.with_margin_bottom
|
4
4
|
%h1= t("#{@model_presenter.model_name}.exibir")
|
5
5
|
.action_back
|
@@ -10,7 +10,7 @@
|
|
10
10
|
.row
|
11
11
|
- line.each do |field|
|
12
12
|
.wrapper_show{class: "col-md-#{field.size}"}
|
13
|
-
%label="#{t("
|
13
|
+
%label="#{t("activerecord.attributes.#{@model_presenter.full_model_name}.#{field.name}")}:"
|
14
14
|
.value
|
15
15
|
= field_to_show @model_presenter,field.name,item
|
16
16
|
|