sinatra-hexacta 1.2.9 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eae9b5d80ffcd16923473974837a7f17569ecf34ca3817595e6495d11e052ae8
4
- data.tar.gz: 2ff000bf77a66cb12b4d7c69ab784985f8e5db614a6e481bfdcfdaaec6206a7e
3
+ metadata.gz: 6095e2d991c112c4d4e7ddb11f69dc9ec74a10e2e1fb5c2b577834d7db62cbf0
4
+ data.tar.gz: ef9efcaad8b56f58b2cb9cb4d8ee3931192037805701915a411fccabb2995032
5
5
  SHA512:
6
- metadata.gz: c838fcd88d1fe11813c50806bf307ed97c1da4f862e1c5f562e63614399b9f55631f2adbf8fab10147988c19aeddbc0514c786ec7a0200cdd369f29c1d15670c
7
- data.tar.gz: 8aafa5be7d3e4d6ae81a7c6e9e2b6c2230bdca29e9269880eb31e28cede06fa578bb54f8881b9cecbeaf5b68e69b1a058246eba5817d6f375455267c8312a904
6
+ metadata.gz: 5e1c2cbafd19b644630eecb8542577adbaa702d1a1c8d3f44d553f7d3e32ec32792cc45b076eebbaea9d73b49884ebb892dd8345dec9eab87a1ead44267c3e4d
7
+ data.tar.gz: d5dd9ddbb57de13e3c7e4d008b01ca0c785d491f5d315aebd86ea90eeeb2b91ad76620096fe2a7bd4c7a206de4db919880b380fee1328d9ba6abace86fd1988a
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ module Sinatra
3
+ module CrossOriginHandler
4
+ extend Hexacta
5
+
6
+ def enable_cross_origin
7
+ p "Enabling cross origin..."
8
+
9
+ configure do
10
+ enable :cross_origin
11
+ end
12
+
13
+ before do
14
+ response.headers['Access-Control-Allow-Origin'] = '*'
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ register CrossOriginHandler
21
+ end
22
+
@@ -6,3 +6,4 @@ require_relative 'reports'
6
6
  require_relative 'processes'
7
7
  require_relative 'constants'
8
8
  require_relative 'user_configurations'
9
+ require_relative 'cross_origin'
@@ -5,6 +5,52 @@ module Sinatra
5
5
 
6
6
  def enable_reports
7
7
  p "Enabling reports..."
8
+
9
+ #In order to enable file streaming
10
+ helpers do
11
+ def slim(template, options = {}, locals = {}, &block)
12
+ # Slim calls the option :streaming, but Sinatra has a #stream method
13
+ # so we also support the :stream option.
14
+ options[:streaming] ||= options.delete(:stream)
15
+
16
+ # We are not streaming. Call super implementation and
17
+ # just ensure that the @_out_buf is restored afterwards.
18
+ unless options[:streaming]
19
+ old = @_out_buf
20
+ begin
21
+ return super
22
+ ensure
23
+ @_out_buf = old
24
+ end
25
+ end
26
+
27
+ # We use the Temple generator without preamble and postamble
28
+ # which is suitable for streaming.
29
+ options[:generator] = Temple::Generator
30
+
31
+ # We are already streaming, continue!
32
+ return super if @_out_buf.is_a? Sinatra::Helpers::Stream
33
+
34
+ # Create a new stream
35
+ stream do |out|
36
+ @_out_buf = out
37
+
38
+ if options[:layout] == false
39
+ # No layout given, start rendering template
40
+ super
41
+ else
42
+ # Layout given
43
+ layout = options[:layout] == nil || options[:layout] == true ? :layout : options[:layout]
44
+
45
+ # Invert layout and template rendering order
46
+ super layout, options.merge(layout: false), locals do
47
+ super(template, options.merge(layout: false), locals, &block)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
8
54
  before '/reports/*' do
9
55
  error(403) if authenticated(User).permissions.empty?
10
56
  end
@@ -18,7 +64,7 @@ module Sinatra
18
64
  date ||= Date.today
19
65
  headers "Content-Disposition" => "attachment;filename=#{report_name}.#{date}.xls",
20
66
  "Content-Type" => "application/octet-stream"
21
- slim "reports/#{report_name}".to_sym, locals: { :date => date }, :layout => false
67
+ slim "reports/#{report_name}".to_sym, locals: { :date => date }, :stream => true, :layout => false
22
68
  end
23
69
  end
24
70
 
@@ -14,7 +14,6 @@ module Sinatra
14
14
  p "Setting up user configurations directory..."
15
15
  setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/user_configurations")
16
16
  copy_all_files("/lib/sinatra/views/user_configurations","/app/views/#{Hexacta::GEM_FILE_DIR}/user_configurations")
17
-
18
17
  end
19
18
 
20
19
  helpers UserConfigurationHelper
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'sinatra/base'
3
+ require 'sinatra/cross_origin'
3
4
  require 'fileutils'
4
5
  require 'sucker_punch'
5
6
  require 'rufus-scheduler'
@@ -122,13 +122,8 @@ body {
122
122
  position: absolute;
123
123
  top: 0px;
124
124
  min-height: 700px;
125
- margin-top: 76px;
126
- width: 150px;
127
- -webkit-transform: translate3d(0, 0, 0);
128
- transform: translate3d(0, 0, 0);
129
- opacity: 1;
130
- filter: alpha(opacity=100);
131
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
125
+ margin-top: 75px;
126
+ width: 200px;
132
127
  }
133
128
 
134
129
  .container .block-header h2 {
@@ -286,7 +281,7 @@ body {
286
281
  .actions > a:before, .pagination > li > a, .pagination > li > span,
287
282
  #header input[type="text"], #header .results, .dropdown.open .dropdown-menu,
288
283
  .modal .modal-content, .pt-inner .pti-header, .ptih-title,
289
- .card .tab-nav, .dash-widget-item, .progress {
284
+ .card .tab-nav, .dash-widget-item {
290
285
  border-radius: 6px;
291
286
  }
292
287
 
@@ -325,9 +320,7 @@ t-view:after {
325
320
  }
326
321
 
327
322
 
328
- .profile-pic > img{
329
- padding: 5px;
330
- border: 1px solid rgba(0,0,0,0.05);
323
+ .profile-pic {
331
324
  }
332
325
 
333
326
  .results .card {
@@ -340,33 +333,6 @@ t-view:after {
340
333
  border-bottom: 0px !important;
341
334
  }
342
335
 
343
- @media (min-width: 1200px) {
344
- body #content {
345
- padding-left: 150px;
346
- }
347
- }
348
-
349
- @media (min-width: 1200px) {
350
- body #content > .container {
351
- width: calc(100% - 30px);
352
- }
353
- }
354
-
355
- @media (min-width: 1200px) {
356
- #header {
357
- padding-left: 15px;
358
- }
359
-
360
- #menu-trigger {
361
- display: none;
362
- }
363
- }
364
-
365
- body:not(.sw-toggled) #sidebar {
366
- box-shadow: none;
367
- }
368
-
369
-
370
336
  .lv-item span, .pt-inner .pti-header > h2 {
371
337
  color: #334152;
372
338
  font-weight: 700;
@@ -382,16 +348,6 @@ body:not(.sw-toggled) #sidebar {
382
348
  font-weight: 700;
383
349
  }
384
350
 
385
- .card .card-header {
386
- border-top-left-radius: 6px;
387
- border-top-right-radius: 6px;
388
- }
389
-
390
- .card .card-body {
391
- border-bottom-left-radius: 6px;
392
- border-bottom-right-radius: 6px;
393
- }
394
-
395
351
  .card .card-header h2 small {
396
352
  font-size: 10px;
397
353
  letter-spacing: 1px;
@@ -414,8 +370,8 @@ body:not(.sw-toggled) #sidebar {
414
370
 
415
371
  .modal .modal-header {
416
372
  padding: 23px 26px;
417
- border-bottom: 1px solid rgba(0,0,0,0.05);
418
- margin-bottom: 20px;
373
+ border-bottom: 0px;
374
+ margin-bottom: 0px;
419
375
  }
420
376
 
421
377
  .modal .modal-footer {
@@ -452,13 +408,12 @@ body:not(.sw-toggled) #sidebar {
452
408
  background: transparent;
453
409
  }
454
410
 
455
- .preloader {
411
+ #loader .preloader {
456
412
  background: rgba(255,255,255,0.5);
457
413
  border-radius: 100px;
458
- left: 8px !important;
414
+ left: 67px !important;
459
415
  top: 6px !important;
460
416
  }
461
-
462
417
  /* ----- Pegaso related ----- */
463
418
 
464
419
  .idx {
@@ -475,20 +430,4 @@ body:not(.sw-toggled) #sidebar {
475
430
  height: 38px;
476
431
  border-radius: 100px;
477
432
  padding-top: 9px;
478
- }
479
-
480
- .ha-menu {
481
- background-color: transparent !important;
482
- border-bottom: 1px solid rgba(0,0,0,0.05);
483
- }
484
-
485
- .ha-menu > ul > li:not(.active) > *:not(ul) {
486
- color: #334152;
487
- font-weight: 700;
488
- }
489
-
490
- .ha-menu > ul > li.active > *:not(ul) {
491
- color: #334152;
492
- box-shadow: inset 0px -3px 0 0px #047bf8;
493
- font-weight: 700;
494
- }
433
+ }
@@ -0,0 +1,15 @@
1
+ class View {
2
+
3
+ static get(url,params,destination){
4
+ $(destination).html('<div class="text-center" style="padding:100px;"><div class="preloader pls-teal bgm-none"><svg class="pl-circular" viewBox="25 25 50 50"><circle class="plc-path" cx="50" cy="50" r="20"></circle></svg></div><h5>Cargando...</h5></div>');
5
+ $.ajax({
6
+ url: url,
7
+ type: 'GET',
8
+ data: params
9
+ }).done(function(result) {
10
+ $(destination).html(result);
11
+ }).error(function(result) {
12
+ $(destination).html('<div class="lv-item p-20 bgm-red m-b-5 animated fadeIn"><div class="media"><div class="pull-left"><i class="zmdi zmdi-hc-3x zmdi-alert-octagon c-white"></i></div><div class="media-body"><div class="lv-title c-white">Algo salió mal</div><small class="lv-small c-white">Los administradores acaban de ser informados de este error, ni bien tengan una solución se te notificará. Disculpá las molestias.</small></div></div></div>');
13
+ });
14
+ }
15
+ }
@@ -8,7 +8,9 @@
8
8
  - chosen = nil
9
9
  - unless defined? clazz
10
10
  - clazz = nil
11
-
11
+ -unless defined? readonly
12
+ -readonly = false
13
+
12
14
  -if required
13
15
  .form-group.has-success
14
16
  label #{placeholder}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-26 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sucker_punch
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.0.4
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra-cross_origin
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.3.1
69
83
  description: A gem to support general functionality accross all apps
70
84
  email: mzanger@hexacta.com
71
85
  executables: []
@@ -84,6 +98,7 @@ files:
84
98
  - lib/sinatra/extensions/notification.rb
85
99
  - lib/sinatra/extensions/processmanager.rb
86
100
  - lib/sinatra/handlers/constants.rb
101
+ - lib/sinatra/handlers/cross_origin.rb
87
102
  - lib/sinatra/handlers/errors.rb
88
103
  - lib/sinatra/handlers/init.rb
89
104
  - lib/sinatra/handlers/notifications.rb
@@ -143,6 +158,7 @@ files:
143
158
  - lib/sinatra/public/js/app.js
144
159
  - lib/sinatra/public/js/finder.js
145
160
  - lib/sinatra/public/js/process.js
161
+ - lib/sinatra/public/js/view.js
146
162
  - lib/sinatra/public/vendors/animate.css/animate.min.css
147
163
  - lib/sinatra/public/vendors/bootstrap-validator/validator.js
148
164
  - lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js