sinatra-hexacta 1.7.2 → 1.7.3

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: dc107478ca07acf14ac42fe83c84514cc09d2e86a1526005f6d22db7d1d3ac51
4
+ data.tar.gz: 67fd0bb1d758f908c3379c4f29788213597b9d0f9ab6cf6ab839afe9961b6b58
5
5
  SHA512:
6
- metadata.gz: 394106abc4d70aee85c3a06c661f7516b5ecce020ff92b30de64e16c734d95a7fbdb1a593a7dd0d3992d6f001c05875c0c4af9a65749c761cab57d820cab7739
7
- data.tar.gz: 52714579e8106c1c0000e52e4a701d4f9b1ee685d2820f800ed5b3646783b01aa2925326639775146998aca047f8a853467d02b92cad711511eda69cef3aefa6
6
+ metadata.gz: 866c5ad0b4a8e13dc2a2cb65f97589813ea885a021704fd6c80e8d76ad58f93b235e7e1fc6ac5e92d38d217e5571e0678520023b13f4418982633fbf6f9a737f
7
+ data.tar.gz: 85ac915c63faa7f36a4d5e117fbc440370ffd1772c9cf002628d123de0e0fd9ba65868681a955d32195347b196bdcd108ff6625153d7aefd815b32f2a1a1040d
@@ -30,16 +30,14 @@ function update_html_elements() {
30
30
  var datastring = $(this).serialize();
31
31
  var url = $(this).attr('action');
32
32
  $(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');
33
+ start_load();
35
34
  $.ajax({
36
35
 
37
36
  type: "POST",
38
37
  url: url,
39
38
  data: datastring,
40
39
  success: function(data) {
41
- //$('#loading-modal').modal('hide');
42
- //$('#loading-modal').remove();
40
+ stop_load();
43
41
  $('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
42
  $('#ok-modal').modal('show');
45
43
  setTimeout(function () {
@@ -47,8 +45,7 @@ function update_html_elements() {
47
45
  }, 1000)
48
46
  },
49
47
  error: function(error) {
50
- //$('#loading-modal').modal('hide');
51
- //$('#loading-modal').remove();
48
+ stop_load();
52
49
  if ($('#error-modal')[0]) {
53
50
  $('#error-modal').remove();
54
51
  }
@@ -563,28 +560,14 @@ function stop_load() {
563
560
  $('#loading-modal').remove();
564
561
  }
565
562
 
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
563
  function rm_object(object,id) {
579
564
  $(".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');
565
+ start_load();
582
566
  $.ajax({
583
567
  url: '/' + object + '/' + id,
584
568
  type: 'DELETE',
585
569
  success: function(data) {
586
- $('#loading-modal').modal('hide');
587
- $('#loading-modal').remove();
570
+ stop_load();
588
571
  $('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
572
  $('#ok-modal').modal('show');
590
573
  setTimeout(function () {
@@ -592,8 +575,7 @@ function rm_object(object,id) {
592
575
  }, 1000)
593
576
  },
594
577
  error: function(data) {
595
- $('#loading-modal').modal('hide');
596
- $('#loading-modal').remove();
578
+ stop_load();
597
579
  $('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
580
  $('#error-modal').modal('show');
599
581
  }
@@ -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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger