sinatra-hexacta 0.3.16 → 0.4.2
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 +4 -4
- data/lib/sinatra/handlers/errors.rb +9 -2
- data/lib/sinatra/public/css/app.min.1.css +32 -5
- data/lib/sinatra/public/img/finder.jpg +0 -0
- data/lib/sinatra/public/js/finder.js +79 -0
- data/lib/sinatra/views/errors/DatabaseConnectionError.slim +27 -0
- data/lib/sinatra/views/errors/DatabaseDisconnectError.slim +29 -0
- data/lib/sinatra/views/libraries/include_js_before.slim +1 -0
- metadata +5 -2
- data/lib/sinatra/public/js/form_validator.js +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 728aa24903dfacd5848f5cf2fc1f88927f658951a69a5f92ef691851c42cd856
|
4
|
+
data.tar.gz: e80174daa95bb53cd75ad0478d96fde0ebbbb7616e2da79a6b52ec04378be60e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad49dbe7dcf2d8b4863455ba676313a8963b5569a322e73e5e1401db20d4a8b537b32827ede670c228673a10a4d2c50e703d60e785f79b76dcdb3c3effb043d
|
7
|
+
data.tar.gz: 5d9a06abb2fce33e637f5a9b436139d6c466e6992ad6aa937ff5fc90025e567581db96000e5a6dab8ae264c48135619a51e20e41e343b49f2b9058e9bf1df8b4
|
@@ -10,17 +10,24 @@ module Sinatra
|
|
10
10
|
error_template(404)
|
11
11
|
error_template(403)
|
12
12
|
error_template(500)
|
13
|
+
error_template(Sequel::DatabaseDisconnectError)
|
14
|
+
error_template(Sequel::DatabaseConnectionError)
|
13
15
|
end
|
14
16
|
|
15
17
|
def error_template(code)
|
16
|
-
|
18
|
+
if code.is_a? Numeric
|
19
|
+
template_code = code
|
20
|
+
else
|
21
|
+
template_code = code.to_s.split('::').last
|
22
|
+
end
|
23
|
+
ErrorHandler.copy_file("/lib/sinatra/views/errors/#{template_code}.slim","/app/views/#{Hexacta::GEM_FILE_DIR}/errors/#{template_code}.slim")
|
17
24
|
error code do
|
18
25
|
if code == 500
|
19
26
|
title = env['sinatra.error'].message.split(':')[0].gsub('#<','');
|
20
27
|
message = (["in #{request.url}"] + env['sinatra.error'].backtrace).join(',');
|
21
28
|
NotificationSender.instance.send_error(authenticated(User),title,message)
|
22
29
|
end
|
23
|
-
slim "#{Hexacta::GEM_FILE_DIR}/errors/#{
|
30
|
+
slim "#{Hexacta::GEM_FILE_DIR}/errors/#{template_code}".to_sym, locals: { :params => params }
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
@@ -11247,10 +11247,6 @@ body:not(.sw-toggled) #sidebar {
|
|
11247
11247
|
}
|
11248
11248
|
}
|
11249
11249
|
|
11250
|
-
.listview.lv-lg .lv-item:hover {
|
11251
|
-
background-color: #FFFFDB;
|
11252
|
-
}
|
11253
|
-
|
11254
11250
|
.listview .lv-item {
|
11255
11251
|
position: relative;
|
11256
11252
|
display: block;
|
@@ -16359,4 +16355,35 @@ svg.ct-chart-bar, svg.ct-chart-line{
|
|
16359
16355
|
.ct-legend .ct-series-14:before {
|
16360
16356
|
background-color: #a748ca;
|
16361
16357
|
border-color: #a748ca;
|
16362
|
-
}
|
16358
|
+
}
|
16359
|
+
|
16360
|
+
/* HEADER RESULTS */
|
16361
|
+
|
16362
|
+
#header .results {
|
16363
|
+
display:block;
|
16364
|
+
position: absolute;
|
16365
|
+
width: 500px;
|
16366
|
+
background: white;
|
16367
|
+
margin-left: 20px;
|
16368
|
+
margin-top: 5px;
|
16369
|
+
border-radius: 2px;
|
16370
|
+
overflow: auto;
|
16371
|
+
max-height: 0px;
|
16372
|
+
opacity: 0;
|
16373
|
+
-webkit-transition: all 0.2s ease-in-out;
|
16374
|
+
-o-transition: all 0.2s ease-in-out;
|
16375
|
+
transition: all 0.2s ease-in-out;
|
16376
|
+
}
|
16377
|
+
#header .results.toggled {
|
16378
|
+
opacity: 1;
|
16379
|
+
max-height: 400px;
|
16380
|
+
}
|
16381
|
+
|
16382
|
+
.progressive {
|
16383
|
+
animation: load 5s cubic-bezier(0.165, 0.840, 0.440, 1.000) forwards;
|
16384
|
+
}
|
16385
|
+
|
16386
|
+
@keyframes load {
|
16387
|
+
0% { width: 0; }
|
16388
|
+
100% { width: 100%; }
|
16389
|
+
}
|
Binary file
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Finder {
|
2
|
+
|
3
|
+
static find(query){
|
4
|
+
$.ajax({
|
5
|
+
url: "/find",
|
6
|
+
type: 'GET',
|
7
|
+
data: { query: query }
|
8
|
+
}).done(function(result) {
|
9
|
+
$("#header .results").html(result);
|
10
|
+
});
|
11
|
+
}
|
12
|
+
|
13
|
+
static do_find(url,query,html){
|
14
|
+
$.ajax({
|
15
|
+
url: url,
|
16
|
+
type: 'GET',
|
17
|
+
data: { query: query }
|
18
|
+
}).done(function(result) {
|
19
|
+
$(html).html(result);
|
20
|
+
});
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
var last_query = null;
|
25
|
+
var header_input_timeout = null;
|
26
|
+
$.xhrPool = [];
|
27
|
+
|
28
|
+
$.xhrPool.abortAll = function() {
|
29
|
+
$(this).each(function(idx, jqXHR) {
|
30
|
+
jqXHR.abort();
|
31
|
+
});
|
32
|
+
$(this).each(function(idx, jqXHR) {
|
33
|
+
var index = $.inArray(jqXHR, $.xhrPool);
|
34
|
+
if (index > -1) {
|
35
|
+
$.xhrPool.splice(index, 1);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
};
|
39
|
+
|
40
|
+
$.ajaxSetup({
|
41
|
+
beforeSend: function(jqXHR) {
|
42
|
+
$.xhrPool.push(jqXHR);
|
43
|
+
},
|
44
|
+
complete: function(jqXHR) {
|
45
|
+
var index = $.inArray(jqXHR, $.xhrPool);
|
46
|
+
if (index > -1) {
|
47
|
+
$.xhrPool.splice(index, 1);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
});
|
51
|
+
|
52
|
+
$(document).ready(function(){
|
53
|
+
|
54
|
+
$("#header input").focusin(function() {
|
55
|
+
$("#header .results").addClass("toggled");
|
56
|
+
})
|
57
|
+
$("#header input").focusout(function() {
|
58
|
+
$("#header .results").removeClass("toggled");
|
59
|
+
})
|
60
|
+
$('#header .results').click(function() {
|
61
|
+
$("#header input").focus();
|
62
|
+
});
|
63
|
+
$('#header input').keyup(function() {
|
64
|
+
clearTimeout(header_input_timeout);
|
65
|
+
|
66
|
+
if($('#header input').val().length > 2 && $.trim($('#header input').val())) {
|
67
|
+
header_input_timeout = setTimeout(function() {
|
68
|
+
$.xhrPool.abortAll();
|
69
|
+
if (last_query != $.trim($('#header input').val())) {
|
70
|
+
last_query = $.trim($('#header input').val());
|
71
|
+
console.log(last_query);
|
72
|
+
if (last_query.length > 2) {
|
73
|
+
Finder.find(last_query);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}, 1000);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.row
|
2
|
+
.col-xs-12
|
3
|
+
.progress.progress-striped.active.bgm-red style="height:80px;"
|
4
|
+
.progress-bar.progress-bar-danger aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
|
5
|
+
.lv-item.p-20.p-fixed
|
6
|
+
.media
|
7
|
+
.pull-left
|
8
|
+
i.zmdi.zmdi-hc-3x.zmdi-cloud-off.c-white
|
9
|
+
.media-body
|
10
|
+
.lv-title.c-white Error de conexión con la base de datos
|
11
|
+
small.lv-small.c-white Espera unos segundos mientras se reestablece la conexión.
|
12
|
+
|
13
|
+
|
14
|
+
javascript:
|
15
|
+
$(document).ready(function() {
|
16
|
+
setTimeout(function(){
|
17
|
+
window.location.reload(1);
|
18
|
+
}, 5000);
|
19
|
+
|
20
|
+
update_progress();
|
21
|
+
|
22
|
+
function update_progress() {
|
23
|
+
var current = $(".progress-bar").width() / $('.progress-bar').parent().width() * 100;
|
24
|
+
$(".progress-bar").width( current + 10 + "%");
|
25
|
+
setTimeout(update_progress, 100);
|
26
|
+
}
|
27
|
+
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
.row
|
2
|
+
.col-xs-12
|
3
|
+
.progress.progress-striped.active.bgm-orange style="height:80px;"
|
4
|
+
.progress-bar.progress-bar-warning aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
|
5
|
+
.lv-item.p-20.p-fixed
|
6
|
+
.media
|
7
|
+
.pull-left
|
8
|
+
i.zmdi.zmdi-hc-3x.zmdi-cloud-off.c-white
|
9
|
+
.media-body
|
10
|
+
.lv-title.c-white Conexión con la base de datos
|
11
|
+
small.lv-small.c-white Espera unos segundos mientras se reestablece la conexión.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
javascript:
|
16
|
+
$(document).ready(function() {
|
17
|
+
setTimeout(function(){
|
18
|
+
window.location.reload(1);
|
19
|
+
}, 5000);
|
20
|
+
|
21
|
+
update_progress();
|
22
|
+
|
23
|
+
function update_progress() {
|
24
|
+
var current = $(".progress-bar").width() / $('.progress-bar').parent().width() * 100;
|
25
|
+
$(".progress-bar").width( current + 10 + "%");
|
26
|
+
setTimeout(update_progress, 100);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
@@ -6,3 +6,4 @@ script src="/sinatra-hexacta/vendors/chartist/chartist.min.js"
|
|
6
6
|
script src="/sinatra-hexacta/vendors/chartist/chartist-plugin-legend.js"
|
7
7
|
|
8
8
|
script src="/sinatra-hexacta/js/app.js?ver=#{settings.version}" type='text/javascript'
|
9
|
+
script src="/sinatra-hexacta/js/finder.js?ver=#{settings.version}" type='text/javascript'
|
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: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
@@ -110,10 +110,11 @@ files:
|
|
110
110
|
- lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.svg
|
111
111
|
- lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.ttf
|
112
112
|
- lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.woff
|
113
|
+
- lib/sinatra/public/img/finder.jpg
|
113
114
|
- lib/sinatra/public/img/select.png
|
114
115
|
- lib/sinatra/public/img/select@2x.png
|
115
116
|
- lib/sinatra/public/js/app.js
|
116
|
-
- lib/sinatra/public/js/
|
117
|
+
- lib/sinatra/public/js/finder.js
|
117
118
|
- lib/sinatra/public/vendors/animate.css/animate.min.css
|
118
119
|
- lib/sinatra/public/vendors/bootstrap-validator/validator.js
|
119
120
|
- lib/sinatra/public/vendors/bootstrap/bootstrap.min.js
|
@@ -157,6 +158,8 @@ files:
|
|
157
158
|
- lib/sinatra/views/errors/403.slim
|
158
159
|
- lib/sinatra/views/errors/404.slim
|
159
160
|
- lib/sinatra/views/errors/500.slim
|
161
|
+
- lib/sinatra/views/errors/DatabaseConnectionError.slim
|
162
|
+
- lib/sinatra/views/errors/DatabaseDisconnectError.slim
|
160
163
|
- lib/sinatra/views/inputs/date.slim
|
161
164
|
- lib/sinatra/views/inputs/input.slim
|
162
165
|
- lib/sinatra/views/inputs/month.slim
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
$(':input[required]').each(function() {
|
3
|
-
console.log($(this).val());
|
4
|
-
if ($(this).val() == "" || $(this).val() == null) {
|
5
|
-
$(this).parent().removeClass("has-success");
|
6
|
-
$(this).parent().addClass("has-error");
|
7
|
-
} else {
|
8
|
-
$(this).parent().removeClass("has-error");
|
9
|
-
$(this).parent().addClass("has-success");
|
10
|
-
}
|
11
|
-
})
|
12
|
-
|
13
|
-
|
14
|
-
$(function() { //shorthand document.ready function
|
15
|
-
$('form').on('submit', function(e) { //use on if jQuery 1.7+
|
16
|
-
$(this).find(':input[required]').each(function() {
|
17
|
-
if ($(this).val() == "" || $(this).val() == null) {
|
18
|
-
$(this).parent().removeClass("success");
|
19
|
-
$(this).parent().addClass("error");
|
20
|
-
} else {
|
21
|
-
$(this).parent().removeClass("error");
|
22
|
-
$(this).parent().addClass("success");
|
23
|
-
}
|
24
|
-
})
|
25
|
-
if ($(this).find(':input[required]').length > 0) {
|
26
|
-
e.preventDefault();
|
27
|
-
}
|
28
|
-
});
|
29
|
-
});
|