sinatra-hexacta 1.4.4 → 1.5.0

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: 309f78d43f4e7447e920edaa8e90d36f4992e1cdc0fde8a40ee7ad8f0e17498a
4
- data.tar.gz: 66e5d4cceb9b6bf3e1f83919bc2f0962827ef6fba83d459eec4aceea85ac6675
3
+ metadata.gz: 8e27f66144b0ee4048817d8c92a6fc993ab63ca176a79ac1feb9288175e93103
4
+ data.tar.gz: 5abf03f218822c22896a9200c05912afed6994e2b3b9fc872dcad45a8cb32072
5
5
  SHA512:
6
- metadata.gz: 8c0c94b820a01db53ae1450f5dd014ca2d1541b6c9f2bb1a0f216e6579b64352ef59bfb2940e405e69a8ae7f19eef4b0f3e434d178a51d75cf3bfe75751b019e
7
- data.tar.gz: 3536f3971f4cb17aa0674a496b98d33d2794a0dfe84bf5418ce88b8b4b9e65354d7a7784226b2bf3378cf9de4a775d9f72ef740280b4afc6c0d134c8f5e55e74
6
+ metadata.gz: a4738793bb01253652be89cb9b8462c96663c9d4ffcfdd161cccd7fa6fa07437d48e2fb90ce82a74fa08548d878c0f827fcc31d515bcfa80421564645fce43a8
7
+ data.tar.gz: a9931739f2585cc09789a9a116f75b2303d967c9e2d73350386d79f5c9b71f073d4000bfb863ed80380be61564d0a5eaabbe59de9fa8a24ced6a140980d084cb
@@ -9,7 +9,7 @@ module Sinatra
9
9
  ConstantHandler.copy_all_files("/lib/sinatra/views/constants","/app/views/#{Hexacta::GEM_FILE_DIR}/constants")
10
10
 
11
11
  before '/constant*' do
12
- error(403) if authenticated(User).permissions.empty?
12
+ error(403) unless authenticated(User).admin?
13
13
  end
14
14
 
15
15
  get '/constants' do
@@ -52,7 +52,7 @@ module Sinatra
52
52
  end
53
53
 
54
54
  before '/reports/*' do
55
- error(403) if authenticated(User).permissions.empty?
55
+ error(403) unless authenticated(User).admin?
56
56
  end
57
57
 
58
58
  get '/reports' do
@@ -5,7 +5,24 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(naviga
5
5
  $('html').addClass('ismobile');
6
6
  }
7
7
 
8
+ // create a new instance of `MutationObserver` named `observer`,
9
+ // passing it a callback function
10
+ const observer = new MutationObserver(function() {
11
+ update_html_elements();
12
+ });
13
+
8
14
  $(document).ready(function(){
15
+ /*
16
+ * Waves Animation
17
+ */
18
+ (function(){
19
+ Waves.attach('.btn:not(.btn-icon):not(.btn-float)');
20
+ Waves.attach('.btn-icon, .btn-float', ['waves-circle', 'waves-float']);
21
+ Waves.init();
22
+ })();
23
+ });
24
+
25
+ function update_html_elements() {
9
26
 
10
27
  // Fix modal inside other components
11
28
  $('.modal').appendTo("body");
@@ -340,15 +357,6 @@ $(document).ready(function(){
340
357
  });
341
358
  }
342
359
 
343
- /*
344
- * Waves Animation
345
- */
346
- (function(){
347
- Waves.attach('.btn:not(.btn-icon):not(.btn-float)');
348
- Waves.attach('.btn-icon, .btn-float', ['waves-circle', 'waves-float']);
349
- Waves.init();
350
- })();
351
-
352
360
  /*
353
361
  * Lightbox
354
362
  */
@@ -499,7 +507,14 @@ $(document).ready(function(){
499
507
  $(this).find(':submit').attr("disabled",false);
500
508
  });
501
509
 
502
- });
510
+ }
511
+
512
+ const elementToObserve = document.querySelector("body");
513
+
514
+ if (elementToObserve != null) {
515
+ observer.observe(elementToObserve, {subtree: true, childList: true});
516
+ }
517
+
503
518
 
504
519
  function start_load() {
505
520
  if (!$("#loader")[0]) {
@@ -394,12 +394,26 @@
394
394
 
395
395
  // VALIDATOR DATA-API
396
396
  // ==================
397
+ const elementToObserve = document.querySelector("body");
397
398
 
398
- $(window).on('load', function () {
399
+ // create a new instance of `MutationObserver` named `observer`,
400
+ // passing it a callback function
401
+ const observer = new MutationObserver(function() {
399
402
  $('form[data-toggle="validator"]').each(function () {
400
403
  var $form = $(this)
401
404
  Plugin.call($form, $form.data())
402
405
  })
403
- })
406
+ });
407
+
408
+ // call `observe()` on that MutationObserver instance,
409
+ // passing it the element to observe, and the options object
410
+ observer.observe(elementToObserve, {subtree: true, childList: true});
411
+
412
+ //$(window).on('load', function () {
413
+ // $('form[data-toggle="validator"]').each(function () {
414
+ // var $form = $(this)
415
+ // Plugin.call($form, $form.data())
416
+ // })
417
+ //})
404
418
 
405
419
  }(jQuery);
@@ -45,7 +45,7 @@
45
45
  -total_pending = Notification.pending.for(authenticated(User)).exclude_message.count
46
46
 
47
47
  .footer-btn
48
- -unless authenticated(User).permissions.empty?
48
+ -if authenticated(User).admin?
49
49
  a.btn.btn-float.bgm-blue.m-btn.waves-effect.waves-circle.waves-float data-toggle="modal" data-target="#new-notification"
50
50
  i.zmdi.zmdi-notifications-active
51
51
  -if total_pending > 0
@@ -55,13 +55,13 @@
55
55
  i.zmdi.zmdi-delete
56
56
 
57
57
  .footer-text
58
- -unless authenticated(User).permissions.empty?
58
+ -if authenticated(User).admin?
59
59
  a.text.btn.bgm-white.c-gray data-toggle="modal" data-target="#new-notification" Nueva notificación
60
60
  -if total_pending > 0
61
61
  a.text.btn.bgm-white.c-gray onclick="read_all_notifications(#{{Notification.pending.for(authenticated(User)).exclude_message.all.collect { |notification| notification.id}}});this.onclick='';" Marcar como leidas
62
62
  a.text.btn.bgm-white.c-gray.delete-notifications.hidden.animated.bounceIn onclick="delete_all_notifications();this.onclick='';" Borrar notificaciones
63
63
 
64
- -unless authenticated(User).permissions.empty?
64
+ -if authenticated(User).admin?
65
65
  == slim :'sinatra-hexacta/notifications/new'
66
66
 
67
67
  javascript:
@@ -48,7 +48,7 @@
48
48
  .media-body
49
49
  .lv-title Fecha de lectura
50
50
  small.lv-small #{notification.read_date.display}
51
- -unless (authenticated(User).permissions.collect { |permission| permission.class } & [ Superadmin ]).empty?
51
+ -if authenticated(User).superadmin?
52
52
  a.lv-item
53
53
  .media
54
54
  .media-body
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2021-05-07 00:00:00.000000000 Z
@@ -250,7 +250,7 @@ homepage: https://rubygems.org/gems/sinatra-hexacta
250
250
  licenses:
251
251
  - MIT
252
252
  metadata: {}
253
- post_install_message:
253
+ post_install_message:
254
254
  rdoc_options: []
255
255
  require_paths:
256
256
  - lib
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  version: '0'
267
267
  requirements: []
268
268
  rubygems_version: 3.0.6
269
- signing_key:
269
+ signing_key:
270
270
  specification_version: 4
271
271
  summary: Hexacta general tools!
272
272
  test_files: []