sinatra-hexacta 1.5.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0bc5b02f5e6b461318773afa357ab6f22a90123c5253a90077575d90c5a639a
4
- data.tar.gz: fb57adaf1d49b6b744504b7e25e7708c98cf11e5f8baee8c0bd32f8d2872e240
3
+ metadata.gz: d569497a337ad41584b964887b5685c72128e51e20f197444f646ca54e958328
4
+ data.tar.gz: 496c85e904b87af77d78edf0ba9e6e24a86797dc9593657761691310d97e57cc
5
5
  SHA512:
6
- metadata.gz: 2820db09ad01271011903d10a37ac905a4a5739e300bd6a28d6385352300f99d59f99bacae9fe5070000e15f73d9c6f88908f36503b49aa27ffea4f642f85caf
7
- data.tar.gz: 21f7bc48f1a05a019e1c84ff9900f035290d9a4e2d60d41e9e2a1ca2c6770a28ff2c972322b3bc849d6d20f5c8ec3f7024771850f2652018113c6428a3cff8fc
6
+ metadata.gz: 72d273962da241e92ae5d0a8a1b28035cd5d62211642cf6bef33a406e1bbd0138b2aabe04fce47d1f5f4ecfb268acbba15e1763c1e29040a7e58da4420f0f449
7
+ data.tar.gz: a4325f140e4de501a18ed7406eae8855b2aac2d8279e436b1dd36b809651f2f762ed74569b636e80c9e593ec29c6a26ffa3b592bac0c3cf4d10e19b5eca7d0e7
@@ -23,7 +23,7 @@ module Sinatra
23
23
  ErrorHandler.copy_file("/lib/sinatra/views/errors/#{template_code}.slim","/app/views/#{Hexacta::GEM_FILE_DIR}/errors/#{template_code}.slim")
24
24
  error code do
25
25
  if code == 500
26
- title = env['sinatra.error'].message.split(':')[0].gsub('#<','');
26
+ title = env['sinatra.error'].message
27
27
  message = (["in #{request.url}"] + env['sinatra.error'].backtrace).join(',');
28
28
  NotificationSender.instance.send_error(authenticated(User),title,message)
29
29
  end
@@ -82,7 +82,7 @@ module Sinatra
82
82
  if logged_in?(request, session)
83
83
  url = CAS_CLIENT.logout_url()
84
84
  session.clear
85
- str = request.referer
85
+ str = request.referer || ''
86
86
  comeback = "=" + (str.include?("?")? str.slice(0..(str.index('?')-1)) : str) #Hack mal!
87
87
  redirect url + (url.include?("?service")? "" : "?service") + comeback
88
88
  end
@@ -25,6 +25,35 @@ $(document).ready(function(){
25
25
 
26
26
  function update_html_elements() {
27
27
 
28
+ $("form.async").submit(function(e){
29
+ e.preventDefault();
30
+ var datastring = $(this).serialize();
31
+ var url = $(this).attr('action');
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');
35
+ $.ajax({
36
+ type: "POST",
37
+ url: url,
38
+ data: datastring,
39
+ success: function(data) {
40
+ $('#loading-modal').modal('hide');
41
+ $('#loading-modal').remove();
42
+ $('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>');
43
+ $('#ok-modal').modal('show');
44
+ setTimeout(function () {
45
+ location.reload();
46
+ }, 1000)
47
+ },
48
+ error: function(data) {
49
+ $('#loading-modal').modal('hide');
50
+ $('#loading-modal').remove();
51
+ $('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>');
52
+ $('#error-modal').modal('show');
53
+ }
54
+ });
55
+ });
56
+
28
57
  // Fix modal inside other components
29
58
  $('.modal').appendTo("body");
30
59
 
@@ -538,76 +567,32 @@ $( document ).ajaxStop(function() {
538
567
  stop_load();
539
568
  });
540
569
 
541
- function rm(url) {
542
- disableButtons();
543
- if (confirm('¿Estás seguro que deseas realizar esta operación?')) {
544
- $.ajax({
545
- url: url,
546
- type: 'DELETE',
547
- done: function(result) {
548
- location.reload();
549
- },
550
- success: function(result) {
551
- location.reload();
552
- },
553
- error: function(error) {
554
- alert("Ha ocurrido un error, intentalo nuevamente!");
555
- enableButtons();
556
- }
557
- });
558
- } else {
559
- enableButtons();
560
- }
561
- }
562
-
563
570
 
564
571
  function rm_object(object,id) {
565
- disableButtons();
572
+ $(".modal").modal('hide');
573
+ $('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>');
574
+ $('#loading-modal').modal('show');
566
575
  $.ajax({
567
576
  url: '/' + object + '/' + id,
568
577
  type: 'DELETE',
569
- data: {},
570
- success: function(result) {
571
- location.reload();
578
+ success: function(data) {
579
+ $('#loading-modal').modal('hide');
580
+ $('#loading-modal').remove();
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>');
582
+ $('#ok-modal').modal('show');
583
+ setTimeout(function () {
584
+ location.reload();
585
+ }, 1000)
586
+ },
587
+ error: function(data) {
588
+ $('#loading-modal').modal('hide');
589
+ $('#loading-modal').remove();
590
+ $('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>');
591
+ $('#error-modal').modal('show');
572
592
  }
573
593
  });
574
594
  }
575
595
 
576
- function post(url) {
577
- disableButtons();
578
- if (confirm('¿Estás seguro que deseas realizar esta operación?')) {
579
- $.ajax({
580
- url: url,
581
- type: 'POST',
582
- done: function(result) {
583
- location.reload();
584
- },
585
- success: function(result) {
586
- location.reload();
587
- },
588
- error: function(error) {
589
- alert("Ha ocurrido un error, intentalo nuevamente!");
590
- enableButtons();
591
- }
592
- });
593
- } else {
594
- enableButtons();
595
- }
596
- }
597
-
598
- function disableButtons() {
599
- $(".btn").each(function() {
600
- $(this).data("temp",$(this).val());
601
- $(this).attr("disabled",true);
602
- });
603
- return true
604
- }
605
- function enableButtons() {
606
- $(".btn").each(function() {
607
- $(this).attr("disabled",false);
608
- });
609
- return true
610
- }
611
596
  (function( $ ){
612
597
  $.fn.disableSelect = function() {
613
598
  $(this).prop("disabled", true);
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.5.1
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger