sinatra-hexacta 1.7.0 → 1.7.5

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: eb151fa58d44e75d10580a87954b2e37185e5de3c55fed82a1889a40f0f8e19d
4
- data.tar.gz: 546c81b9dc5d27f3ba091741edee375eb42619c237ed68c66f6bfbcd7594ca77
3
+ metadata.gz: 326038800963651e5110e57becda6fe6def583a128d67e946ceebfface2bb5d5
4
+ data.tar.gz: 1e9cd82e1d24e38a5bb98af74157d50f4da20864b98dc0bd5b626c8bbbf7defa
5
5
  SHA512:
6
- metadata.gz: d3eb3ee99bcf704e5db18b3a78d125c01ab21a028b59088459838b435460318218af7b97ee1ad98345107f25f0637cf6c7a013a0e652a667953fefa5cea3eb52
7
- data.tar.gz: d13ae82dae1f5ab6afcdcdf2196bed052550b33edc07ef30ddeef6ae7f91a36a8bcb1e36889b5ae617e0ce9f48e43f1f90d38c954697d2b50a143c628e707eeb
6
+ metadata.gz: 04ae027cd06846f2368a00eae03f326154cd61e1b0906f504ddd8674aafb9d19fd47f73f69a3de624341729d8b3f34b347d5c463b4a9db7cf56664ef44a5b5a7
7
+ data.tar.gz: 0b995bd3cc3d1dae76c29371b6503073f5479004a64232f6c17e98b0694b7e8627ab715999fec09d3927e2b07b0cc9e6bb5ec3b7f57cfea0c47b91dd7554ceca
@@ -30,7 +30,7 @@ class Date
30
30
  end
31
31
 
32
32
  def short_display
33
- self.strftime('%-d/%-m/%y')
33
+ self.strftime('%-d/%-m/%Y')
34
34
  end
35
35
 
36
36
  def next_working_date
@@ -27,19 +27,42 @@ function update_html_elements() {
27
27
 
28
28
  $("form.async").unbind("submit").submit(function(e){
29
29
  e.preventDefault();
30
+
31
+
32
+ $(this).find(':input[required]').each(function() {
33
+ if ($(this).val() == "" || $(this).val() == null) {
34
+ $(this).parent().removeClass("success");
35
+ $(this).parent().addClass("error");
36
+ } else {
37
+ $(this).parent().removeClass("error");
38
+ $(this).parent().addClass("success");
39
+ }
40
+ });
41
+
42
+ $(this).find('.chosen[required]').each(function() {
43
+ if ($(this).val() == "" || $(this).val() == null) {
44
+ $(this).parent().removeClass("success");
45
+ $(this).parent().addClass("error");
46
+ } else {
47
+ $(this).parent().removeClass("error");
48
+ $(this).parent().addClass("success");
49
+ }
50
+ });
51
+ if ($(this).find('.error').length > 0 ) {
52
+ return;
53
+ }
54
+
30
55
  var datastring = $(this).serialize();
31
56
  var url = $(this).attr('action');
32
57
  $(this).closest('.modal').modal('hide');
33
- //$('body').append('<div aria-labelledby="loading" class="modal bounceIn animated" id="loading-modal" role="dialog" tabindex="-1" data-backdrop="static" data-keyboard="false"><div class="modal-dialog modal-sm" style="width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><div class="preloader pl-lg"><svg class="pl-circular" viewBox="25 25 50 50"><circle class="plc-path" cx="50" cy="50" r="20"></circle></svg></div></div><div class="modal-footer" style="text-align: center !Important;"><div class="btn btn-link waves-effect c-gray">Espere...</div></div></div></div></div>');
34
- //$('#loading-modal').modal('show');
58
+ start_load();
35
59
  $.ajax({
36
60
 
37
61
  type: "POST",
38
62
  url: url,
39
63
  data: datastring,
40
64
  success: function(data) {
41
- //$('#loading-modal').modal('hide');
42
- //$('#loading-modal').remove();
65
+ stop_load();
43
66
  $('body').append('<div aria-labelledby="ok" class="modal bounceIn animated" id="ok-modal" role="dialog" tabindex="-1"><div class="modal-dialog modal-sm" style="width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><i class="zmdi zmdi-hc-3x zmdi-check-circle c-green"></i></div><div class="modal-footer" style="text-align: center !Important;"><div class="btn btn-link waves-effect c-gray">¡Listo!</div></div></div></div></div>');
44
67
  $('#ok-modal').modal('show');
45
68
  setTimeout(function () {
@@ -47,8 +70,7 @@ function update_html_elements() {
47
70
  }, 1000)
48
71
  },
49
72
  error: function(error) {
50
- //$('#loading-modal').modal('hide');
51
- //$('#loading-modal').remove();
73
+ stop_load();
52
74
  if ($('#error-modal')[0]) {
53
75
  $('#error-modal').remove();
54
76
  }
@@ -128,63 +150,6 @@ function update_html_elements() {
128
150
  }
129
151
  }
130
152
 
131
- /*
132
- * Sidebar
133
- */
134
- (function(){
135
- //Toggle
136
- $('body').on('click', '#menu-trigger', function(e){
137
- e.preventDefault();
138
- var x = $(this).data('trigger');
139
-
140
- $(x).toggleClass('toggled');
141
- $(this).toggleClass('open');
142
-
143
- //Close opened sub-menus
144
- $('.sub-menu.toggled').not('.active').each(function(){
145
- $(this).removeClass('toggled');
146
- $(this).find('ul').hide();
147
- });
148
-
149
- $('.profile-menu .main-menu').hide();
150
-
151
- if (x == '#sidebar') {
152
-
153
- $elem = '#sidebar';
154
- $elem2 = '#menu-trigger';
155
-
156
- $('#chat-trigger').removeClass('open');
157
-
158
- if (!$('#chat').hasClass('toggled')) {
159
- $('#header').toggleClass('sidebar-toggled');
160
- }
161
- else {
162
- $('#chat').removeClass('toggled');
163
- }
164
- }
165
-
166
- //When clicking outside
167
- if ($('#header').hasClass('sidebar-toggled')) {
168
- $(document).on('click', function (e) {
169
- if (($(e.target).closest($elem).length === 0) && ($(e.target).closest($elem2).length === 0)) {
170
- setTimeout(function(){
171
- $($elem).removeClass('toggled');
172
- $('#header').removeClass('sidebar-toggled');
173
- $($elem2).removeClass('open');
174
- });
175
- }
176
- });
177
- }
178
- })
179
-
180
- //Submenu
181
- $('body').on('click', '.sub-menu > a', function(e){
182
- e.preventDefault();
183
- $(this).next().slideToggle(200);
184
- $(this).parent().toggleClass('toggled');
185
- });
186
- })();
187
-
188
153
  /*
189
154
  * Clear Notification
190
155
  */
@@ -542,6 +507,48 @@ function update_html_elements() {
542
507
  $(this).find(':submit').attr("disabled",false);
543
508
  });
544
509
 
510
+ /*
511
+ * Sidebar
512
+ */
513
+ (function(){
514
+ //Toggle
515
+ $('#menu-trigger').unbind('click').on('click', function(e){
516
+ e.preventDefault();
517
+ var x = $(this).data('trigger');
518
+
519
+ $(x).toggleClass('toggled');
520
+ $(this).toggleClass('open');
521
+
522
+ //Close opened sub-menus
523
+ $('.sub-menu.toggled').not('.active').each(function(){
524
+ $(this).removeClass('toggled');
525
+ $(this).find('ul').hide();
526
+ });
527
+
528
+ $('.profile-menu .main-menu').hide();
529
+
530
+ //When clicking outside
531
+ if ($('#header').hasClass('sidebar-toggled')) {
532
+ $(document).on('click', function (e) {
533
+ if (($(e.target).closest($elem).length === 0) && ($(e.target).closest($elem2).length === 0)) {
534
+ setTimeout(function(){
535
+ $($elem).removeClass('toggled');
536
+ $('#header').removeClass('sidebar-toggled');
537
+ $($elem2).removeClass('open');
538
+ });
539
+ }
540
+ });
541
+ }
542
+ })
543
+
544
+ //Submenu
545
+ $('.sub-menu > a').unbind('click').on('click', function(e){
546
+ e.preventDefault();
547
+ $(this).next().slideToggle(200);
548
+ $(this).parent().toggleClass('toggled');
549
+ });
550
+
551
+ })();
545
552
  }
546
553
 
547
554
  const elementToObserve = document.querySelector("body");
@@ -563,28 +570,14 @@ function stop_load() {
563
570
  $('#loading-modal').remove();
564
571
  }
565
572
 
566
-
567
- $( document ).ajaxSend(function( event, jqxhr, settings ) {
568
- if (!settings.url.includes(".json")) {
569
- start_load();
570
- }
571
- });
572
-
573
- $( document ).ajaxStop(function() {
574
- stop_load();
575
- });
576
-
577
-
578
573
  function rm_object(object,id) {
579
574
  $(".modal").modal('hide');
580
- $('body').append('<div aria-labelledby="loading" class="modal bounceIn animated" id="loading-modal" role="dialog" tabindex="-1" data-backdrop="static" data-keyboard="false"><div class="modal-dialog modal-sm" style="width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><div class="preloader pl-lg"><svg class="pl-circular" viewBox="25 25 50 50"><circle class="plc-path" cx="50" cy="50" r="20"></circle></svg></div></div><div class="modal-footer" style="text-align: center !Important;"><div class="btn btn-link waves-effect c-gray">Espere...</div></div></div></div></div>');
581
- $('#loading-modal').modal('show');
575
+ start_load();
582
576
  $.ajax({
583
577
  url: '/' + object + '/' + id,
584
578
  type: 'DELETE',
585
579
  success: function(data) {
586
- $('#loading-modal').modal('hide');
587
- $('#loading-modal').remove();
580
+ stop_load();
588
581
  $('body').append('<div aria-labelledby="ok" class="modal bounceIn animated" id="ok-modal" role="dialog" tabindex="-1"><div class="modal-dialog modal-sm" style="width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><i class="zmdi zmdi-hc-3x zmdi-check-circle c-green"></i></div><div class="modal-footer" style="text-align: center !Important;"><div class="btn btn-link waves-effect c-gray">¡Listo!</div></div></div></div></div>');
589
582
  $('#ok-modal').modal('show');
590
583
  setTimeout(function () {
@@ -592,8 +585,7 @@ function rm_object(object,id) {
592
585
  }, 1000)
593
586
  },
594
587
  error: function(data) {
595
- $('#loading-modal').modal('hide');
596
- $('#loading-modal').remove();
588
+ stop_load();
597
589
  $('body').append('<div aria-labelledby="error" class="modal bounceIn animated" id="error-modal" role="dialog" tabindex="-1"><div class="modal-dialog modal-sm" style="width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><i class="zmdi zmdi-hc-3x zmdi-alert-polygon c-red"></i></div><div class="modal-footer" style="text-align: center !Important;"><div class="btn btn-link waves-effect c-gray">Oops...</div></div></div></div></div>');
598
590
  $('#error-modal').modal('show');
599
591
  }
@@ -688,5 +680,9 @@ function read_notify(id,url) {
688
680
  }
689
681
 
690
682
  function capitalize(word) {
691
- return word[0].toUpperCase() + word.slice(1).toLowerCase();
683
+ if (word == "") {
684
+ return "";
685
+ } else {
686
+ return word[0].toUpperCase() + word.slice(1).toLowerCase();
687
+ }
692
688
  }
@@ -1,16 +1,41 @@
1
1
  class View {
2
2
 
3
- static get(url,data,destination){
3
+ static get(url,data,destination,callback = function() {}){
4
+ start_load();
4
5
  $.ajax({
5
6
  url: url,
6
7
  type: 'GET',
7
8
  data: data,
8
9
  }).done(function(result) {
10
+ stop_load();
9
11
  $(destination).html(result);
10
- $('.modal').appendTo("body");
12
+ update_html_elements();
13
+ callback();
11
14
  }).error(function(result) {
15
+ stop_load();
12
16
  $(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
17
  });
14
18
  }
19
+
20
+ static append(url,data,destination,callback = function() {}){
21
+ start_load();
22
+ $.ajax({
23
+ url: url,
24
+ type: 'GET',
25
+ data: data,
26
+ }).done(function(result) {
27
+ stop_load();
28
+ $(destination).append(result);
29
+ update_html_elements();
30
+ callback();
31
+ }).error(function(error) {
32
+ stop_load();
33
+ if ($('#error-modal')[0]) {
34
+ $('#error-modal').remove();
35
+ }
36
+ $('body').append('<div aria-labelledby="error" class="modal bounceIn animated" id="error-modal" role="dialog" tabindex="-1"><div class="modal-dialog modal-sm" style="min-width:150px !Important;"><div class="modal-content"><div class="modal-body p-20 text-center"><i class="zmdi zmdi-hc-3x zmdi-alert-polygon c-red"></i></div><div class="modal-footer" style="text-align: center !Important;"><div class="f-900 c-gray">' + error.responseText + '</div></div></div></div></div>');
37
+ $('#error-modal').modal('show');
38
+ });
39
+ }
15
40
  }
16
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger