sinatra-hexacta 1.7.2 → 1.7.6

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: 78f1773a5ead7859db82845bc336a8b7604966c2615040b999d26fe68bdf7890
4
- data.tar.gz: 2fb2dcc0b7ffc764ae6f0144675211e18b16b4d8845e308546b4b137329cbff0
3
+ metadata.gz: b3f9bae9416a233d6e2dc0113c4ab93bc4ff1d7142559fa8f9e623f77e522a88
4
+ data.tar.gz: 5ca9530edf07753a6935839cb355d2442fad27da7ec0aba4303072763cbb80ea
5
5
  SHA512:
6
- metadata.gz: 394106abc4d70aee85c3a06c661f7516b5ecce020ff92b30de64e16c734d95a7fbdb1a593a7dd0d3992d6f001c05875c0c4af9a65749c761cab57d820cab7739
7
- data.tar.gz: 52714579e8106c1c0000e52e4a701d4f9b1ee685d2820f800ed5b3646783b01aa2925326639775146998aca047f8a853467d02b92cad711511eda69cef3aefa6
6
+ metadata.gz: d51bb2d9928d7ceb756cf5570666d462e3b74dbb234ca8e3a390738cdccbba5bb4f250c50bd842167f12eae7c5465d9f4c69a5f7ecf8dd1c5394daa605c4b64f
7
+ data.tar.gz: e8f5d62a2f81e69e4ec9ad0c86f9b0f1984009259cfceff77160113640db065a9544a203b19d650cc4e1a8f5c581baacde07a4cffd5301fa1e760767d01207f1
@@ -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
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ class DateTime
3
+
4
+ def display
5
+ "#{Configuration::DAYS[self.wday]} #{self.day} de #{Configuration::MONTHS[self.month-1]} #{self.year == Date.today.year ? '' : self.year}"
6
+ end
7
+
8
+ def short_display
9
+ self.strftime('%-d/%-m/%Y')
10
+ end
11
+
12
+ end
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require_relative 'antiquity'
3
3
  require_relative 'date'
4
+ require_relative 'date_item'
4
5
  require_relative 'mailbuilder'
5
6
  require_relative 'mailsender'
6
7
  require_relative 'mail'
@@ -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
  }
@@ -3,13 +3,11 @@ var hide_results_timeout = false;
3
3
  class Finder {
4
4
 
5
5
  static find(query){
6
- $('body').append('<div id="loading-modal"></div>'); //Compliant with automatic loader
7
6
  $.ajax({
8
7
  url: "/find",
9
8
  type: 'GET',
10
9
  data: { query: query }
11
10
  }).done(function(result) {
12
- $('#loading-modal').remove(); //Compliant with automatic loader
13
11
  $("#header .results").html(result);
14
12
 
15
13
  $('#header .results *').click(function() {
@@ -20,13 +18,11 @@ class Finder {
20
18
  }
21
19
 
22
20
  static do_find(url,query,html){
23
- $('body').append('<div id="loading-modal"></div>'); //Compliant with automatic loader
24
21
  $.ajax({
25
22
  url: url,
26
23
  type: 'GET',
27
24
  data: { query: query }
28
25
  }).done(function(result) {
29
- $('#loading-modal').remove(); //Compliant with automatic loader
30
26
  $(html).html(result);
31
27
  });
32
28
  }
@@ -86,7 +82,6 @@ $(document).ready(function(){
86
82
  if (last_query != $.trim($('#header input').val())) {
87
83
  last_query = $.trim($('#header input').val());
88
84
  if (last_query.length > 2) {
89
- $('body').append('<div id="loading-modal"></div>'); //Compliant with automatic loader
90
85
  Finder.find(last_query);
91
86
  }
92
87
  }
@@ -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.2
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - lib/sinatra/extensions/antiquity.rb
90
90
  - lib/sinatra/extensions/date.rb
91
+ - lib/sinatra/extensions/date_time.rb
91
92
  - lib/sinatra/extensions/generalmail.rb
92
93
  - lib/sinatra/extensions/generalmailnolink.rb
93
94
  - lib/sinatra/extensions/init.rb