carnival 0.0.11 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/app/assets/images/carnival/blank.gif +0 -0
  2. data/app/assets/images/carnival/fancybox_loading.gif +0 -0
  3. data/app/assets/images/carnival/fancybox_loading@2x.gif +0 -0
  4. data/app/assets/images/carnival/fancybox_overlay.png +0 -0
  5. data/app/assets/images/carnival/fancybox_sprite.png +0 -0
  6. data/app/assets/images/carnival/fancybox_sprite@2x.png +0 -0
  7. data/app/assets/javascripts/carnival/admin.js +1 -0
  8. data/app/assets/javascripts/carnival/external/jquery.fancybox.js +2020 -0
  9. data/app/assets/stylesheets/carnival/admin.css +1 -0
  10. data/app/assets/stylesheets/carnival/datatable.css +2 -2
  11. data/app/assets/stylesheets/carnival/jquery.fancybox.css +274 -0
  12. data/app/assets/stylesheets/carnival/main.css +1 -1
  13. data/app/controllers/carnival/admin_users_controller.rb +1 -1
  14. data/app/controllers/carnival/base_admin_controller.rb +26 -4
  15. data/app/datatable/carnival/generic_datatable.rb +5 -3
  16. data/app/helpers/carnival/base_admin_helper.rb +8 -2
  17. data/app/models/carnival/action.rb +4 -4
  18. data/app/models/carnival/admin_user.rb +4 -5
  19. data/{test/dummy/app/models/admin/association_common.rb → app/models/carnival/model_helper.rb} +1 -1
  20. data/app/presenters/carnival/admin_user_presenter.rb +2 -3
  21. data/app/presenters/carnival/base_admin_presenter.rb +10 -2
  22. data/app/views/carnival/index.html.haml +1 -1
  23. data/app/views/carnival/shared/_advanced_search.html.haml +1 -1
  24. data/app/views/carnival/shared/_list_cel.pdf.haml +2 -2
  25. data/config/initializers/devise.rb +0 -4
  26. data/{test/dummy/config/locales/carnival.pt.yml → config/locales/carnival.pt-br.yml} +16 -12
  27. data/{test/dummy/config/locales/devise.pt.yml → config/locales/devise.pt-br.yml} +1 -1
  28. data/lib/carnival.rb +2 -2
  29. data/lib/carnival/config.rb +2 -4
  30. data/lib/carnival/routes.rb +3 -3
  31. data/lib/carnival/version.rb +1 -1
  32. data/lib/generators/carnival/install_generator.rb +2 -2
  33. data/test/dummy/app/models/admin/city.rb +1 -1
  34. data/test/dummy/app/models/admin/company.rb +1 -1
  35. data/test/dummy/app/models/admin/country.rb +1 -1
  36. data/test/dummy/app/models/admin/job.rb +1 -1
  37. data/test/dummy/app/models/admin/professional_experience.rb +1 -1
  38. data/test/dummy/app/models/admin/state.rb +1 -1
  39. data/test/dummy/app/models/job.rb +1 -1
  40. data/test/dummy/app/presenters/admin/country_presenter.rb +1 -1
  41. data/test/dummy/config/application.rb +1 -1
  42. data/{config/locales/carnival.pt.yml → test/dummy/config/locales/carnival.pt-br.yml} +9 -1
  43. data/{config/locales/devise.pt.yml → test/dummy/config/locales/devise.pt-br.yml} +1 -1
  44. data/test/dummy/db/development.sqlite3 +0 -0
  45. data/test/dummy/log/development.log +891 -0
  46. metadata +63 -47
  47. checksums.yaml +0 -15
  48. data/config/initializers/carnival_initializer.rb +0 -42
@@ -10,4 +10,5 @@
10
10
  *= require carnival/main.css
11
11
  *= require carnival/jquery-ui-1.8.11.custom
12
12
  *= require carnival/perfect-scrollbar-0.4.6.min
13
+ *= require carnival/jquery.fancybox
13
14
  */
@@ -1,8 +1,8 @@
1
1
  thead tr.filters{display: none;}
2
2
  .dataTables_wrapper{
3
3
  float:left;
4
- width:99%;
5
- overflow-x:auto;
4
+ /* width:99%; */
5
+ overflow: hidden;
6
6
  position: relative;
7
7
  top:-37px;
8
8
  }
@@ -0,0 +1,274 @@
1
+ /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
2
+ .fancybox-wrap,
3
+ .fancybox-skin,
4
+ .fancybox-outer,
5
+ .fancybox-inner,
6
+ .fancybox-image,
7
+ .fancybox-wrap iframe,
8
+ .fancybox-wrap object,
9
+ .fancybox-nav,
10
+ .fancybox-nav span,
11
+ .fancybox-tmp
12
+ {
13
+ padding: 0;
14
+ margin: 0;
15
+ border: 0;
16
+ outline: none;
17
+ vertical-align: top;
18
+ }
19
+
20
+ .fancybox-wrap {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ z-index: 8020;
25
+ }
26
+
27
+ .fancybox-skin {
28
+ position: relative;
29
+ background: #f9f9f9;
30
+ color: #444;
31
+ text-shadow: none;
32
+ -webkit-border-radius: 4px;
33
+ -moz-border-radius: 4px;
34
+ border-radius: 4px;
35
+ }
36
+
37
+ .fancybox-opened {
38
+ z-index: 8030;
39
+ }
40
+
41
+ .fancybox-opened .fancybox-skin {
42
+ -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
43
+ -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
44
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
45
+ }
46
+
47
+ .fancybox-outer, .fancybox-inner {
48
+ position: relative;
49
+ }
50
+
51
+ .fancybox-inner {
52
+ overflow: hidden;
53
+ }
54
+
55
+ .fancybox-type-iframe .fancybox-inner {
56
+ -webkit-overflow-scrolling: touch;
57
+ }
58
+
59
+ .fancybox-error {
60
+ color: #444;
61
+ font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
62
+ margin: 0;
63
+ padding: 15px;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .fancybox-image, .fancybox-iframe {
68
+ display: block;
69
+ width: 100%;
70
+ height: 100%;
71
+ }
72
+
73
+ .fancybox-image {
74
+ max-width: 100%;
75
+ max-height: 100%;
76
+ }
77
+
78
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
79
+ background-image: url('fancybox_sprite.png');
80
+ }
81
+
82
+ #fancybox-loading {
83
+ position: fixed;
84
+ top: 50%;
85
+ left: 50%;
86
+ margin-top: -22px;
87
+ margin-left: -22px;
88
+ background-position: 0 -108px;
89
+ opacity: 0.8;
90
+ cursor: pointer;
91
+ z-index: 8060;
92
+ }
93
+
94
+ #fancybox-loading div {
95
+ width: 44px;
96
+ height: 44px;
97
+ background: url('fancybox_loading.gif') center center no-repeat;
98
+ }
99
+
100
+ .fancybox-close {
101
+ position: absolute;
102
+ top: -18px;
103
+ right: -18px;
104
+ width: 36px;
105
+ height: 36px;
106
+ cursor: pointer;
107
+ z-index: 8040;
108
+ }
109
+
110
+ .fancybox-nav {
111
+ position: absolute;
112
+ top: 0;
113
+ width: 40%;
114
+ height: 100%;
115
+ cursor: pointer;
116
+ text-decoration: none;
117
+ background: transparent url('blank.gif'); /* helps IE */
118
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
119
+ z-index: 8040;
120
+ }
121
+
122
+ .fancybox-prev {
123
+ left: 0;
124
+ }
125
+
126
+ .fancybox-next {
127
+ right: 0;
128
+ }
129
+
130
+ .fancybox-nav span {
131
+ position: absolute;
132
+ top: 50%;
133
+ width: 36px;
134
+ height: 34px;
135
+ margin-top: -18px;
136
+ cursor: pointer;
137
+ z-index: 8040;
138
+ visibility: hidden;
139
+ }
140
+
141
+ .fancybox-prev span {
142
+ left: 10px;
143
+ background-position: 0 -36px;
144
+ }
145
+
146
+ .fancybox-next span {
147
+ right: 10px;
148
+ background-position: 0 -72px;
149
+ }
150
+
151
+ .fancybox-nav:hover span {
152
+ visibility: visible;
153
+ }
154
+
155
+ .fancybox-tmp {
156
+ position: absolute;
157
+ top: -99999px;
158
+ left: -99999px;
159
+ visibility: hidden;
160
+ max-width: 99999px;
161
+ max-height: 99999px;
162
+ overflow: visible !important;
163
+ }
164
+
165
+ /* Overlay helper */
166
+
167
+ .fancybox-lock {
168
+ overflow: hidden !important;
169
+ width: auto;
170
+ }
171
+
172
+ .fancybox-lock body {
173
+ overflow: hidden !important;
174
+ }
175
+
176
+ .fancybox-lock-test {
177
+ overflow-y: hidden !important;
178
+ }
179
+
180
+ .fancybox-overlay {
181
+ position: absolute;
182
+ top: 0;
183
+ left: 0;
184
+ overflow: hidden;
185
+ display: none;
186
+ z-index: 8010;
187
+ background: url('fancybox_overlay.png');
188
+ }
189
+
190
+ .fancybox-overlay-fixed {
191
+ position: fixed;
192
+ bottom: 0;
193
+ right: 0;
194
+ }
195
+
196
+ .fancybox-lock .fancybox-overlay {
197
+ overflow: auto;
198
+ overflow-y: scroll;
199
+ }
200
+
201
+ /* Title helper */
202
+
203
+ .fancybox-title {
204
+ visibility: hidden;
205
+ font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
206
+ position: relative;
207
+ text-shadow: none;
208
+ z-index: 8050;
209
+ }
210
+
211
+ .fancybox-opened .fancybox-title {
212
+ visibility: visible;
213
+ }
214
+
215
+ .fancybox-title-float-wrap {
216
+ position: absolute;
217
+ bottom: 0;
218
+ right: 50%;
219
+ margin-bottom: -35px;
220
+ z-index: 8050;
221
+ text-align: center;
222
+ }
223
+
224
+ .fancybox-title-float-wrap .child {
225
+ display: inline-block;
226
+ margin-right: -100%;
227
+ padding: 2px 20px;
228
+ background: transparent; /* Fallback for web browsers that doesn't support RGBa */
229
+ background: rgba(0, 0, 0, 0.8);
230
+ -webkit-border-radius: 15px;
231
+ -moz-border-radius: 15px;
232
+ border-radius: 15px;
233
+ text-shadow: 0 1px 2px #222;
234
+ color: #FFF;
235
+ font-weight: bold;
236
+ line-height: 24px;
237
+ white-space: nowrap;
238
+ }
239
+
240
+ .fancybox-title-outside-wrap {
241
+ position: relative;
242
+ margin-top: 10px;
243
+ color: #fff;
244
+ }
245
+
246
+ .fancybox-title-inside-wrap {
247
+ padding-top: 10px;
248
+ }
249
+
250
+ .fancybox-title-over-wrap {
251
+ position: absolute;
252
+ bottom: 0;
253
+ left: 0;
254
+ color: #fff;
255
+ padding: 10px;
256
+ background: #000;
257
+ background: rgba(0, 0, 0, .8);
258
+ }
259
+
260
+ /*Retina graphics!*/
261
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
262
+ only screen and (min--moz-device-pixel-ratio: 1.5),
263
+ only screen and (min-device-pixel-ratio: 1.5){
264
+
265
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
266
+ background-image: url('fancybox_sprite@2x.png');
267
+ background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
268
+ }
269
+
270
+ #fancybox-loading div {
271
+ background-image: url('fancybox_loading@2x.gif');
272
+ background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
273
+ }
274
+ }
@@ -12,7 +12,7 @@ body, html{
12
12
  font-size:14px;
13
13
  line-height:22px;
14
14
  color:#666;
15
- overflow-x:hidden;
15
+ /* overflow-x:hidden; */
16
16
  font-family: 'OpenSansRegular', sans-serif;
17
17
  overflow-y: auto !important;
18
18
  height: 100%;
@@ -4,7 +4,7 @@ module Carnival
4
4
  layout "carnival/admin"
5
5
 
6
6
  def permitted_params
7
- params.permit(admin_admin_user: [:name, :email, :password, :password_confirmation])
7
+ params.permit(carnival_admin_user: [:name, :email, :password, :password_confirmation])
8
8
  end
9
9
  end
10
10
  end
@@ -19,7 +19,11 @@ module Carnival
19
19
 
20
20
  respond_to do |format|
21
21
  format.html do |render|
22
- render '/carnival/index'
22
+ begin
23
+ render 'index'
24
+ rescue
25
+ render '/carnival/index'
26
+ end
23
27
  end
24
28
  format.json do |render|
25
29
  render(json: @datatable)
@@ -36,7 +40,13 @@ module Carnival
36
40
  def show
37
41
  @model_presenter = instantiate_presenter
38
42
  show! do |format|
39
- format.html{render '/carnival/shared/form/show'}
43
+ format.html do |render|
44
+ begin
45
+ render 'show'
46
+ rescue
47
+ render '/carnival/shared/form/show'
48
+ end
49
+ end
40
50
  end
41
51
  end
42
52
 
@@ -44,7 +54,13 @@ module Carnival
44
54
  @model_presenter = instantiate_presenter
45
55
  new! do |format|
46
56
  @model = instance_variable_get("@#{controller_name.classify.underscore}")
47
- format.html{render '/carnival/shared/form/new'}
57
+ format.html do |render|
58
+ begin
59
+ render 'new'
60
+ rescue
61
+ render '/carnival/shared/form/new'
62
+ end
63
+ end
48
64
  end
49
65
  end
50
66
 
@@ -52,7 +68,13 @@ module Carnival
52
68
  @model_presenter = instantiate_presenter
53
69
  edit! do |format|
54
70
  @model = instance_variable_get("@#{controller_name.classify.underscore}")
55
- format.html{render '/carnival/shared/form/edit'}
71
+ format.html do |render|
72
+ begin
73
+ render 'edit'
74
+ rescue
75
+ render '/carnival/shared/form/edit'
76
+ end
77
+ end
56
78
  end
57
79
  end
58
80
 
@@ -30,7 +30,7 @@ module Carnival
30
30
 
31
31
  date_filter_field = @presenter.date_filter_field
32
32
  if(date_filter_field.present? && params[:from].present? && params[:from] != "" && params[:to].present? && params[:to] != "")
33
- @model = @model.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", params[:from], params[:to])
33
+ @model = @model.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", "#{params[:from]} 00:00:00", "#{params[:to]} 23:59:59")
34
34
  end
35
35
 
36
36
  count = @model.count
@@ -124,12 +124,14 @@ module Carnival
124
124
 
125
125
  date_filter_field = @presenter.date_filter_field
126
126
  if(date_filter_field.present? && params[:from].present? && params[:from] != "" && params[:to].present? && params[:to] != "")
127
- @model = @model.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", params[:from], params[:to])
127
+ @model = @model.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", "#{params[:from]} 00:00:00", "#{params[:to]} 23:59:59")
128
128
  add_filter 'Período',"#{params[:from]} - #{params[:to]}"
129
129
  end
130
130
 
131
131
  records = records.order("#{@presenter.table_name}.#{sort_column} #{sort_direction}")
132
- records = records.page(page).per_page(per_page)
132
+ if params['format'] == 'json'
133
+ records = records.page(page).per_page(per_page)
134
+ end
133
135
  filtros = []
134
136
  if params[:advancedquery].present?
135
137
  records = @presenter.parse_advanced_search(records, params[:advancedquery])
@@ -64,8 +64,14 @@ module Carnival
64
64
  return link_to presenter.relation_label(field.to_sym, record), presenter.relation_path(field.to_sym, record)
65
65
  end
66
66
  else
67
- result = record.send(field)
68
- return result.strftime("%d/%m/%y %H:%M:%S") if current_type == :date
67
+ result = record.send(field.to_s)
68
+ if current_type == :date
69
+ if result.nil?
70
+ return result
71
+ else
72
+ return result.strftime("%d/%m/%y %H:%M:%S")
73
+ end
74
+ end
69
75
  return number_with_precision(result, :precision => 2, :separator => ",") if current_type == :number
70
76
  return record.class.const_get(field.to_s.upcase)[result] if current_type == :enum
71
77
  result
@@ -16,12 +16,12 @@ module Carnival
16
16
  def path(extra_params={})
17
17
  if @path.nil?
18
18
  params = {controller: @presenter.controller_name, action: @name}
19
- params = params.merge(extra_params) if extra_params.present?
20
- params = params.merge(:only_path => true)
21
- url_for(params)
22
19
  else
23
- @path
20
+ params = {path: @path}
24
21
  end
22
+ params = params.merge(extra_params) if extra_params.present?
23
+ params = params.merge(:only_path => true)
24
+ url_for(params)
25
25
  end
26
26
 
27
27
  def partial
@@ -1,10 +1,8 @@
1
1
  module Carnival
2
+
2
3
  class AdminUser < ActiveRecord::Base
3
- # Include default devise modules. Others available are:
4
- # :confirmable, :lockable, :timeoutable and :omniauthable
5
- devise :database_authenticatable, :registerable,
6
- :recoverable, :rememberable, :trackable, :validatable,
7
- :omniauthable, :omniauth_providers => [:facebook, :google_oauth2]
4
+
5
+ devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
8
6
 
9
7
  has_many :admin_user_notifications
10
8
 
@@ -37,4 +35,5 @@ module Carnival
37
35
  end
38
36
  end
39
37
  end
38
+
40
39
  end