sinatra-hexacta 0.7.0 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/extensions/init.rb +1 -1
- data/lib/sinatra/extensions/processmanager.rb +2 -2
- data/lib/sinatra/handlers/init.rb +1 -1
- data/lib/sinatra/handlers/processes.rb +6 -4
- data/lib/sinatra/public/js/app.js +32 -13
- data/lib/sinatra/public/js/process.js +127 -0
- data/lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js +19 -0
- data/lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css +7 -0
- data/lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.js +7 -0
- data/lib/sinatra/views/inputs/range.slim +2 -4
- data/lib/sinatra/views/libraries/include_css.slim +3 -0
- data/lib/sinatra/views/libraries/include_js_after.slim +4 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede22a821385a22e70895f2e4983779a24b40018bcae60a04bb0041be745fda1
|
4
|
+
data.tar.gz: f3e1be8a928f82adc9b053e86625e7f525c84ca752992ebdf557b050a2da1c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7be98dc8b45776c71eab44679cd6f86e6fea7b59d8d905f8957c5370e0f9758a6ceb407501d56702c4185e9b33957d0c4c0266c91bf383e9be724a9284e5cb
|
7
|
+
data.tar.gz: 8d6eaaae0a76bed3ddc5431f1c592ad9a68407ae9bd9ecd1b52302ea68feaf89198c6ed38691e8a5b93ab4aa374cfe742cc8b15ced4d724410c263f949aa68bd
|
@@ -93,14 +93,14 @@ class ProcessManager
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def clean(clazz)
|
96
|
-
@handlers.select { |handler|
|
96
|
+
@handlers.select { |handler| handler.clazz == clazz }.each do |handler|
|
97
97
|
handler.interrupt
|
98
98
|
self.finish(handler)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
def running?(clazz)
|
103
|
-
!@handlers.select { |handler| handler.clazz == clazz }.empty
|
103
|
+
!@handlers.select { |handler| handler.clazz == clazz }.empty?
|
104
104
|
end
|
105
105
|
|
106
106
|
end
|
@@ -9,15 +9,17 @@ module Sinatra
|
|
9
9
|
get '/processes' do
|
10
10
|
return "" if ProcessManager.instance.find(params[:class]).nil?
|
11
11
|
content_type :json
|
12
|
-
return {
|
12
|
+
return { 'name' => ProcessManager.instance.find(params[:class]).name, 'progress' => ProcessManager.instance.find(params[:class]).progress }.to_json
|
13
13
|
end
|
14
14
|
|
15
|
-
post '/processes/:
|
16
|
-
ProcessManager.instance.
|
15
|
+
post '/processes/:clazz' do |clazz|
|
16
|
+
ProcessManager.instance.clean(clazz)
|
17
|
+
200
|
17
18
|
end
|
18
19
|
|
19
20
|
post '/process' do
|
20
|
-
|
21
|
+
klass = Object.const_get("#{params[:class]}")
|
22
|
+
a_handler = ProcessManager.instance.run(klass,params)
|
21
23
|
a_handler.to_json
|
22
24
|
end
|
23
25
|
end
|
@@ -5,19 +5,6 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(naviga
|
|
5
5
|
$('html').addClass('ismobile');
|
6
6
|
}
|
7
7
|
|
8
|
-
// configuration of the observer:
|
9
|
-
var config = { attributes: false, childList: true, characterData: false, subtree: true };
|
10
|
-
|
11
|
-
|
12
|
-
// Chosen touch support.
|
13
|
-
if ($('.chosen-container').length > 0) {
|
14
|
-
$('.chosen-container').on('touchstart', function(e){
|
15
|
-
e.stopPropagation(); e.preventDefault();
|
16
|
-
// Trigger the mousedown event.
|
17
|
-
$(this).trigger('mousedown');
|
18
|
-
});
|
19
|
-
}
|
20
|
-
|
21
8
|
$(document).ready(function(){
|
22
9
|
|
23
10
|
// Fix modal inside other components
|
@@ -270,6 +257,16 @@ $(document).ready(function(){
|
|
270
257
|
});
|
271
258
|
}
|
272
259
|
|
260
|
+
// Chosen touch support.
|
261
|
+
if ($('.chosen-container').length > 0) {
|
262
|
+
$('.chosen-container').on('touchstart', function(e){
|
263
|
+
e.stopPropagation(); e.preventDefault();
|
264
|
+
// Trigger the mousedown event.
|
265
|
+
$(this).trigger('mousedown');
|
266
|
+
});
|
267
|
+
}
|
268
|
+
|
269
|
+
|
273
270
|
/*
|
274
271
|
* Date Time Picker
|
275
272
|
*/
|
@@ -313,6 +310,28 @@ $(document).ready(function(){
|
|
313
310
|
});
|
314
311
|
}
|
315
312
|
|
313
|
+
if ($('.date-range')[0]) {
|
314
|
+
// to_data_source method is compliant with the calendar library used in holidays
|
315
|
+
$('.date-range').daterangepicker({
|
316
|
+
"parentEl" : $(this).id,
|
317
|
+
"autoApply": true,
|
318
|
+
"locale": {
|
319
|
+
"format": "D MMMM, YYYY",
|
320
|
+
"separator": " - ",
|
321
|
+
"applyLabel": "Aplicar",
|
322
|
+
"cancelLabel": "Cancelar",
|
323
|
+
"fromLabel": "Desde",
|
324
|
+
"toLabel": "Hasta",
|
325
|
+
"customRangeLabel": "Custom",
|
326
|
+
"weekLabel": "S",
|
327
|
+
"daysOfWeek": ["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],
|
328
|
+
"monthNames": ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],
|
329
|
+
"firstDay": 1
|
330
|
+
},
|
331
|
+
opens: 'center'
|
332
|
+
});
|
333
|
+
}
|
334
|
+
|
316
335
|
/*
|
317
336
|
* Waves Animation
|
318
337
|
*/
|
@@ -0,0 +1,127 @@
|
|
1
|
+
var pro_timeout = false;
|
2
|
+
|
3
|
+
class ProcessManager {
|
4
|
+
|
5
|
+
static start(clazz) {
|
6
|
+
|
7
|
+
}
|
8
|
+
|
9
|
+
static getProcesses(clazz) {
|
10
|
+
$.ajax({
|
11
|
+
url: "/processes",
|
12
|
+
type: 'GET',
|
13
|
+
data: { class : clazz },
|
14
|
+
success: function(result) {
|
15
|
+
if (result != "") {
|
16
|
+
$("#processes ." + clazz + " .progress-bar").css("width",result.progress + "%");
|
17
|
+
}
|
18
|
+
},
|
19
|
+
error: function(error) {
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
static cleanProcess() {
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
static monitor() {
|
29
|
+
this.#timeout = setTimeout(function() {
|
30
|
+
$.xhrPool.abortAll();
|
31
|
+
if (last_query != $.trim($('#header input').val())) {
|
32
|
+
last_query = $.trim($('#header input').val());
|
33
|
+
if (last_query.length > 2) {
|
34
|
+
Finder.find(last_query);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}, 5000);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
static find(query){
|
42
|
+
$.ajax({
|
43
|
+
url: "/find",
|
44
|
+
type: 'GET',
|
45
|
+
data: { query: query }
|
46
|
+
}).done(function(result) {
|
47
|
+
$("#header .results").html(result);
|
48
|
+
|
49
|
+
$('#header .results *').click(function() {
|
50
|
+
clearTimeout(hide_results_timeout);
|
51
|
+
$("#header input").focus();
|
52
|
+
});
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
static do_find(url,query,html){
|
57
|
+
$.ajax({
|
58
|
+
url: url,
|
59
|
+
type: 'GET',
|
60
|
+
data: { query: query }
|
61
|
+
}).done(function(result) {
|
62
|
+
$(html).html(result);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
var last_query = null;
|
68
|
+
var header_input_timeout = null;
|
69
|
+
$.xhrPool = [];
|
70
|
+
|
71
|
+
$.xhrPool.abortAll = function() {
|
72
|
+
$(this).each(function(idx, jqXHR) {
|
73
|
+
jqXHR.abort();
|
74
|
+
});
|
75
|
+
$(this).each(function(idx, jqXHR) {
|
76
|
+
var index = $.inArray(jqXHR, $.xhrPool);
|
77
|
+
if (index > -1) {
|
78
|
+
$.xhrPool.splice(index, 1);
|
79
|
+
}
|
80
|
+
});
|
81
|
+
};
|
82
|
+
|
83
|
+
$.ajaxSetup({
|
84
|
+
beforeSend: function(jqXHR) {
|
85
|
+
$.xhrPool.push(jqXHR);
|
86
|
+
},
|
87
|
+
complete: function(jqXHR) {
|
88
|
+
var index = $.inArray(jqXHR, $.xhrPool);
|
89
|
+
if (index > -1) {
|
90
|
+
$.xhrPool.splice(index, 1);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
$(document).ready(function(){
|
96
|
+
|
97
|
+
$("#header input").focusin(function() {
|
98
|
+
$("#header .results").addClass("toggled");
|
99
|
+
})
|
100
|
+
|
101
|
+
$("#header input").focusout(function() {
|
102
|
+
hide_results_timeout = setTimeout(function() {
|
103
|
+
$("#header .results").removeClass("toggled");
|
104
|
+
},200);
|
105
|
+
});
|
106
|
+
|
107
|
+
$('#header .results *').click(function() {
|
108
|
+
clearTimeout(hide_results_timeout);
|
109
|
+
$("#header input").focus();
|
110
|
+
});
|
111
|
+
|
112
|
+
$('#header input').keyup(function() {
|
113
|
+
clearTimeout(header_input_timeout);
|
114
|
+
|
115
|
+
if($('#header input').val().length > 2 && $.trim($('#header input').val())) {
|
116
|
+
header_input_timeout = setTimeout(function() {
|
117
|
+
$.xhrPool.abortAll();
|
118
|
+
if (last_query != $.trim($('#header input').val())) {
|
119
|
+
last_query = $.trim($('#header input').val());
|
120
|
+
if (last_query.length > 2) {
|
121
|
+
Finder.find(last_query);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}, 1000);
|
125
|
+
}
|
126
|
+
});
|
127
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Spanish translation for bootstrap-year-calendar
|
3
|
+
* Paul DAVID-SIVELLE
|
4
|
+
* Based on
|
5
|
+
* Spanish translation for bootstrap-datepicker
|
6
|
+
* Bruno Bonamin <bruno.bonamin@gmail.com>
|
7
|
+
*/
|
8
|
+
|
9
|
+
;(function($){
|
10
|
+
$.fn.calendar.dates['es'] = {
|
11
|
+
days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
|
12
|
+
daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
|
13
|
+
daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"],
|
14
|
+
months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
|
15
|
+
monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
|
16
|
+
weekShort: 'S',
|
17
|
+
weekStart: 1
|
18
|
+
};
|
19
|
+
}(jQuery));
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* Bootstrap year calendar v1.1.0
|
3
|
+
* Created by Paul David-Sivelle
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
5
|
+
*/
|
6
|
+
|
7
|
+
.calendar{padding:4px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;overflow:auto;direction:ltr;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.calendar.calendar-rtl{direction:rtl}.calendar.calendar-rtl table tr td span{float:right}.calendar table{margin:auto}.calendar table td,.calendar table th{text-align:center;width:20px;height:20px;border:none;padding:4px 5px;font-size:12px}.calendar .calendar-header{width:100%;margin-bottom:20px}.calendar .calendar-header table{width:100%}.calendar .calendar-header table th{font-size:22px;padding:5px 10px}.calendar .calendar-header table th:hover{background:#eee;cursor:pointer}.calendar .calendar-header table th.disabled,.calendar .calendar-header table th.disabled:hover{background:0 0;cursor:default;color:#fff}.calendar .calendar-header table th.next,.calendar .calendar-header table th.prev{width:20px}.calendar .year-title{font-weight:700;text-align:center;height:20px;width:auto}.calendar .year-neighbor{color:#aaa}.calendar .year-neighbor2,.calendar table.month tr td.disabled,.calendar table.month tr td.disabled:hover{color:#ddd}.calendar .months-container{width:100%;display:none}.calendar .month-container{min-width:180px;text-align:center;height:200px;padding:0}.calendar table.month th.month-title{font-size:16px;padding-bottom:5px}.calendar table.month th.day-header{font-size:14px}.calendar table.month tr td,.calendar table.month tr th{padding:0}.calendar table.month td.week-number{cursor:default;font-weight:700;border-right:1px solid #eee;padding:5px}.calendar .round-left{-webkit-border-radius:8px 0 0 8px;-moz-border-radius:8px 0 0 8px;border-radius:8px 0 0 8px}.calendar .round-right{webkit-border-radius:0 8px 8px 0;-moz-border-radius:0 8px 8px 0;border-radius:0 8px 8px 0}.calendar table.month tr td .day-content{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;padding:5px 6px}.table-striped .calendar table.month tr td,.table-striped .calendar table.month tr th{background-color:transparent}.calendar table.month td.day .day-content:hover{background:rgba(0,0,0,.2);cursor:pointer}.calendar table.month td.day.disabled .day-content:hover,.calendar table.month tr td.new,.calendar table.month tr td.new:hover,.calendar table.month tr td.old,.calendar table.month tr td.old:hover{background:0 0;cursor:default}.calendar table.month tr td.range .day-content{background:rgba(0,0,0,.2);-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.calendar table.month tr td.range.range-start .day-content{border-top-left-radius:4px;border-bottom-left-radius:4px}.calendar table.month tr td.range.range-end .day-content{border-top-right-radius:4px;border-bottom-right-radius:4px}.calendar-context-menu,.calendar-context-menu .submenu{border:1px solid #ddd;background-color:#fff;box-shadow:2px 2px 5px rgba(0,0,0,.2);-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.2);position:absolute;display:none}.calendar-context-menu .item{padding:5px 10px;cursor:pointer;display:table;width:100%}.calendar-context-menu .item:hover{background:#eee}.calendar-context-menu .item .content{display:table-cell}.calendar-context-menu .item span{display:table-cell;padding-left:10px;text-align:right}.calendar-context-menu .item span:last-child{display:none}.calendar-context-menu .submenu{left:100%;margin-top:-6px}.calendar-context-menu .item:hover>.submenu{display:block}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* Bootstrap year calendar v1.1.0
|
3
|
+
* Created by Paul David-Sivelle
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function(e){var t=function(e,t){this.element=e,this.element.addClass("calendar"),this._initializeEvents(t),this._initializeOptions(t),this._render()};t.prototype={constructor:t,_initializeOptions:function(t){null==t&&(t=[]),this.options={startYear:isNaN(parseInt(t.startYear))?(new Date).getFullYear():parseInt(t.startYear),minDate:t.minDate instanceof Date?t.minDate:null,maxDate:t.maxDate instanceof Date?t.maxDate:null,language:null!=t.language&&null!=n[t.language]?t.language:"en",allowOverlap:null!=t.allowOverlap?t.allowOverlap:!0,displayWeekNumber:null!=t.displayWeekNumber?t.displayWeekNumber:!1,alwaysHalfDay:null!=t.alwaysHalfDay?t.alwaysHalfDay:!1,enableRangeSelection:null!=t.enableRangeSelection?t.enableRangeSelection:!1,disabledDays:t.disabledDays instanceof Array?t.disabledDays:[],roundRangeLimits:null!=t.roundRangeLimits?t.roundRangeLimits:!1,dataSource:t.dataSource instanceof Array!=null?t.dataSource:[],style:"background"==t.style||"border"==t.style||"custom"==t.style?t.style:"border",enableContextMenu:null!=t.enableContextMenu?t.enableContextMenu:!1,contextMenuItems:t.contextMenuItems instanceof Array?t.contextMenuItems:[],customDayRenderer:e.isFunction(t.customDayRenderer)?t.customDayRenderer:null,customDataSourceRenderer:e.isFunction(t.customDataSourceRenderer)?t.customDataSourceRenderer:null},this._initializeDatasourceColors()},_initializeEvents:function(e){null==e&&(e=[]),e.renderEnd&&this.element.bind("renderEnd",e.renderEnd),e.clickDay&&this.element.bind("clickDay",e.clickDay),e.dayContextMenu&&this.element.bind("dayContextMenu",e.dayContextMenu),e.selectRange&&this.element.bind("selectRange",e.selectRange),e.mouseOnDay&&this.element.bind("mouseOnDay",e.mouseOnDay),e.mouseOutDay&&this.element.bind("mouseOutDay",e.mouseOutDay)},_initializeDatasourceColors:function(){for(var e in this.options.dataSource)null==this.options.dataSource[e].color&&(this.options.dataSource[e].color=a[e%a.length])},_render:function(){this.element.empty(),this._renderHeader(),this._renderBody(),this._renderDataSource(),this._applyEvents(),this.element.find(".months-container").fadeIn(500),this._triggerEvent("renderEnd",{currentYear:this.options.startYear})},_renderHeader:function(){var t=e(document.createElement("div"));t.addClass("calendar-header panel panel-default");var n=e(document.createElement("table")),a=e(document.createElement("th"));a.addClass("prev"),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&a.addClass("disabled");var s=e(document.createElement("span"));s.addClass("glyphicon glyphicon-chevron-left"),a.append(s),n.append(a);var i=e(document.createElement("th"));i.addClass("year-title year-neighbor2 hidden-sm hidden-xs"),i.text(this.options.startYear-2),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-2,11,31)&&i.addClass("disabled"),n.append(i);var o=e(document.createElement("th"));o.addClass("year-title year-neighbor hidden-xs"),o.text(this.options.startYear-1),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&o.addClass("disabled"),n.append(o);var r=e(document.createElement("th"));r.addClass("year-title"),r.text(this.options.startYear),n.append(r);var d=e(document.createElement("th"));d.addClass("year-title year-neighbor hidden-xs"),d.text(this.options.startYear+1),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&d.addClass("disabled"),n.append(d);var l=e(document.createElement("th"));l.addClass("year-title year-neighbor2 hidden-sm hidden-xs"),l.text(this.options.startYear+2),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+2,0,1)&&l.addClass("disabled"),n.append(l);var u=e(document.createElement("th"));u.addClass("next"),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&u.addClass("disabled");var c=e(document.createElement("span"));c.addClass("glyphicon glyphicon-chevron-right"),u.append(c),n.append(u),t.append(n),this.element.append(t)},_renderBody:function(){var t=e(document.createElement("div"));t.addClass("months-container");for(var a=0;12>a;a++){var s=e(document.createElement("div"));s.addClass("month-container"),s.data("month-id",a);var i=new Date(this.options.startYear,a,1),o=e(document.createElement("table"));o.addClass("month");var r=e(document.createElement("thead")),d=e(document.createElement("tr")),l=e(document.createElement("th"));l.addClass("month-title"),l.attr("colspan",this.options.displayWeekNumber?8:7),l.text(n[this.options.language].months[a]),d.append(l),r.append(d);var u=e(document.createElement("tr"));if(this.options.displayWeekNumber){var c=e(document.createElement("th"));c.addClass("week-number"),c.text(n[this.options.language].weekShort),u.append(c)}var h=n[this.options.language].weekStart;do{var m=e(document.createElement("th"));m.addClass("day-header"),m.text(n[this.options.language].daysMin[h]),u.append(m),h++,h>=7&&(h=0)}while(h!=n[this.options.language].weekStart);r.append(u),o.append(r);for(var p=new Date(i.getTime()),g=new Date(this.options.startYear,a+1,0),f=n[this.options.language].weekStart;p.getDay()!=f;)p.setDate(p.getDate()-1);for(;g>=p;){var D=e(document.createElement("tr"));if(this.options.displayWeekNumber){var c=e(document.createElement("td"));c.addClass("week-number"),c.text(this.getWeekNumber(p)),D.append(c)}do{var y=e(document.createElement("td"));if(y.addClass("day"),i>p)y.addClass("old");else if(p>g)y.addClass("new");else{if(null!=this.options.minDate&&p<this.options.minDate||null!=this.options.maxDate&&p>this.options.maxDate)y.addClass("disabled");else if(this.options.disabledDays.length>0)for(var h in this.options.disabledDays)if(p.getTime()==this.options.disabledDays[h].getTime()){y.addClass("disabled");break}var v=e(document.createElement("div"));v.addClass("day-content"),v.text(p.getDate()),y.append(v),this.options.customDayRenderer&&this.options.customDayRenderer(v,p)}D.append(y),p.setDate(p.getDate()+1)}while(p.getDay()!=f);o.append(D)}s.append(o),t.append(s)}this.element.append(t)},_renderDataSource:function(){var t=this;null!=this.options.dataSource&&this.options.dataSource.length>0&&this.element.find(".month-container").each(function(){var n=e(this).data("month-id"),a=new Date(t.options.startYear,n,1),s=new Date(t.options.startYear,n+1,0);if((null==t.options.minDate||s>=t.options.minDate)&&(null==t.options.maxDate||a<=t.options.maxDate)){var i=[];for(var o in t.options.dataSource)(!(t.options.dataSource[o].startDate>s)||t.options.dataSource[o].endDate<a)&&i.push(t.options.dataSource[o]);i.length>0&&e(this).find(".day-content").each(function(){var a=new Date(t.options.startYear,n,e(this).text()),s=[];if((null==t.options.minDate||a>=t.options.minDate)&&(null==t.options.maxDate||a<=t.options.maxDate)){for(var o in i)i[o].startDate<=a&&i[o].endDate>=a&&s.push(i[o]);s.length>0&&t._renderDataSourceDay(e(this),a,s)}})}})},_renderDataSourceDay:function(e,t,n){switch(this.options.style){case"border":var a=0;if(1==n.length?a=4:n.length<=3?a=2:e.parent().css("box-shadow","inset 0 -4px 0 0 black"),a>0){var s="";for(var i in n)""!=s&&(s+=","),s+="inset 0 -"+(parseInt(i)+1)*a+"px 0 0 "+n[i].color;e.parent().css("box-shadow",s)}break;case"background":e.parent().css("background-color",n[n.length-1].color);var o=t.getTime();if(n[n.length-1].startDate.getTime()==o)if(e.parent().addClass("day-start"),n[n.length-1].startHalfDay||this.options.alwaysHalfDay){e.parent().addClass("day-half");for(var r="transparent",i=n.length-2;i>=0;i--)if(n[i].startDate.getTime()!=o||!n[i].startHalfDay&&!this.options.alwaysHalfDay){r=n[i].color;break}e.parent().css("background","linear-gradient(-45deg, "+n[n.length-1].color+", "+n[n.length-1].color+" 49%, "+r+" 51%, "+r+")")}else this.options.roundRangeLimits&&e.parent().addClass("round-left");else if(n[n.length-1].endDate.getTime()==o)if(e.parent().addClass("day-end"),n[n.length-1].endHalfDay||this.options.alwaysHalfDay){e.parent().addClass("day-half");for(var r="transparent",i=n.length-2;i>=0;i--)if(n[i].endDate.getTime()!=o||!n[i].endHalfDay&&!this.options.alwaysHalfDay){r=n[i].color;break}e.parent().css("background","linear-gradient(135deg, "+n[n.length-1].color+", "+n[n.length-1].color+" 49%, "+r+" 51%, "+r+")")}else this.options.roundRangeLimits&&e.parent().addClass("round-right");break;case"custom":this.options.customDataSourceRenderer&&this.options.customDataSourceRenderer.call(this,e,t,n)}},_applyEvents:function(){var t=this;this.element.find(".year-neighbor, .year-neighbor2").click(function(){e(this).hasClass("disabled")||t.setYear(parseInt(e(this).text()))}),this.element.find(".calendar-header .prev").click(function(){e(this).hasClass("disabled")||t.element.find(".months-container").animate({"margin-left":"100%"},100,function(){t.element.find(".months-container").hide(),t.element.find(".months-container").css("margin-left","0"),setTimeout(function(){t.setYear(t.options.startYear-1)},50)})}),this.element.find(".calendar-header .next").click(function(){e(this).hasClass("disabled")||t.element.find(".months-container").animate({"margin-left":"-100%"},100,function(){t.element.find(".months-container").hide(),t.element.find(".months-container").css("margin-left","0"),setTimeout(function(){t.setYear(t.options.startYear+1)},50)})});var n=this.element.find(".day:not(.old, .new, .disabled)");n.click(function(n){n.stopPropagation();var a=t._getDate(e(this));t._triggerEvent("clickDay",{element:e(this),which:n.which,date:a,events:t.getEvents(a)})}),n.bind("contextmenu",function(n){t.options.enableContextMenu&&(n.preventDefault(),t.options.contextMenuItems.length>0&&t._openContextMenu(e(this)));var a=t._getDate(e(this));t._triggerEvent("dayContextMenu",{element:e(this),date:a,events:t.getEvents(a)})}),this.options.enableRangeSelection&&(n.mousedown(function(n){if(1==n.which){var a=t._getDate(e(this));(t.options.allowOverlap||0==t.getEvents(a).length)&&(t._mouseDown=!0,t._rangeStart=t._rangeEnd=a,t._refreshRange())}}),n.mouseenter(function(n){if(t._mouseDown){var a=t._getDate(e(this));if(!t.options.allowOverlap){var s=new Date(t._rangeStart.getTime());if(a>s)for(var i=new Date(s.getFullYear(),s.getMonth(),s.getDate()+1);a>s&&!(t.getEvents(i).length>0);)s.setDate(s.getDate()+1),i.setDate(i.getDate()+1);else for(var i=new Date(s.getFullYear(),s.getMonth(),s.getDate()-1);s>a&&!(t.getEvents(i).length>0);)s.setDate(s.getDate()-1),i.setDate(i.getDate()-1);a=s}var o=t._rangeEnd;t._rangeEnd=a,o.getTime()!=t._rangeEnd.getTime()&&t._refreshRange()}}),e(window).mouseup(function(e){if(t._mouseDown){t._mouseDown=!1,t._refreshRange();var n=t._rangeStart<t._rangeEnd?t._rangeStart:t._rangeEnd,a=t._rangeEnd>t._rangeStart?t._rangeEnd:t._rangeStart;t._triggerEvent("selectRange",{startDate:n,endDate:a})}})),n.mouseenter(function(n){if(!t._mouseDown){var a=t._getDate(e(this));t._triggerEvent("mouseOnDay",{element:e(this),date:a,events:t.getEvents(a)})}}),n.mouseleave(function(n){var a=t._getDate(e(this));t._triggerEvent("mouseOutDay",{element:e(this),date:a,events:t.getEvents(a)})}),setInterval(function(){var n=e(t.element).width(),a=e(t.element).find(".month").first().width()+10,s="month-container";s+=n>6*a?" col-xs-2":n>4*a?" col-xs-3":n>3*a?" col-xs-4":n>2*a?" col-xs-6":" col-xs-12",e(t.element).find(".month-container").attr("class",s)},300)},_refreshRange:function(){var t=this;if(this.element.find("td.day.range").removeClass("range"),this.element.find("td.day.range-start").removeClass("range-start"),this.element.find("td.day.range-end").removeClass("range-end"),this._mouseDown){var n=t._rangeStart<t._rangeEnd?t._rangeStart:t._rangeEnd,a=t._rangeEnd>t._rangeStart?t._rangeEnd:t._rangeStart;this.element.find(".month-container").each(function(){var s=e(this).data("month-id");n.getMonth()<=s&&a.getMonth()>=s&&e(this).find("td.day:not(.old, .new)").each(function(){var s=t._getDate(e(this));s>=n&&a>=s&&(e(this).addClass("range"),s.getTime()==n.getTime()&&e(this).addClass("range-start"),s.getTime()==a.getTime()&&e(this).addClass("range-end"))})})}},_openContextMenu:function(t){var n=e(".calendar-context-menu");n.length>0?(n.hide(),n.empty()):(n=e(document.createElement("div")),n.addClass("calendar-context-menu"),e("body").append(n));var a=this._getDate(t),s=this.getEvents(a);for(var i in s){var o=e(document.createElement("div"));o.addClass("item"),o.css("border-left","4px solid "+s[i].color);var r=e(document.createElement("div"));r.addClass("content"),r.text(s[i].name),o.append(r);var d=e(document.createElement("span"));d.addClass("glyphicon glyphicon-chevron-right"),o.append(d),this._renderContextMenuItems(o,this.options.contextMenuItems,s[i]),n.append(o)}n.children().length>0&&(n.css("left",t.offset().left+25+"px"),n.css("top",t.offset().top+25+"px"),n.show(),e(window).one("mouseup",function(){n.hide()}))},_renderContextMenuItems:function(t,n,a){var s=e(document.createElement("div"));s.addClass("submenu");for(var i in n)if(!n[i].visible||n[i].visible(a)){var o=e(document.createElement("div"));o.addClass("item");var r=e(document.createElement("div"));r.addClass("content"),r.text(n[i].text),o.append(r),n[i].click&&!function(e){o.click(function(){n[e].click(a)})}(i);var d=e(document.createElement("span"));d.addClass("glyphicon glyphicon-chevron-right"),o.append(d),n[i].items&&n[i].items.length>0&&this._renderContextMenuItems(o,n[i].items,a),s.append(o)}s.children().length>0&&t.append(s)},_getColor:function(t){var n=e("<div />");n.css("color",t)},_getDate:function(e){var t=e.children(".day-content").text(),n=e.closest(".month-container").data("month-id"),a=this.options.startYear;return new Date(a,n,t)},_triggerEvent:function(t,n){var a=e.Event(t);for(var s in n)a[s]=n[s];this.element.trigger(a)},getWeekNumber:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},getEvents:function(e){var t=[];if(this.options.dataSource&&e)for(var n in this.options.dataSource)this.options.dataSource[n].startDate<=e&&this.options.dataSource[n].endDate>=e&&t.push(this.options.dataSource[n]);return t},getYear:function(){return this.options.startYear},setYear:function(e){var t=parseInt(e);isNaN(t)||(this.options.startYear=t,this._render())},getMinDate:function(){return this.options.minDate},setMinDate:function(e){e instanceof Date&&(this.options.minDate=e,this._render())},getMaxDate:function(){return this.options.maxDate},setMaxDate:function(e){e instanceof Date&&(this.options.maxDate=e,this._render())},getStyle:function(){return this.options.style},setStyle:function(e){this.options.style="background"==e||"border"==e||"custom"==e?e:"border",this._render()},getAllowOverlap:function(){return this.options.allowOverlap},setAllowOverlap:function(e){this.options.allowOverlap=e},getDisplayWeekNumber:function(){return this.options.displayWeekNumber},setDisplayWeekNumber:function(e){this.options.displayWeekNumber=e,this._render()},getAlwaysHalfDay:function(){return this.options.alwaysHalfDay},setAlwaysHalfDay:function(e){this.options.alwaysHalfDay=e,this._render()},getEnableRangeSelection:function(){return this.options.enableRangeSelection},setEnableRangeSelection:function(e){this.options.enableRangeSelection=e,this._render()},getDisabledDays:function(){return this.options.disabledDays},setDisabledDays:function(e){this.options.disabledDays=e instanceof Array?e:[],this._render()},getRoundRangeLimits:function(){return this.options.roundRangeLimits},setRoundRangeLimits:function(e){this.options.roundRangeLimits=e,this._render()},getEnableContextMenu:function(){return this.options.enableContextMenu},setEnableContextMenu:function(e){this.options.enableContextMenu=e,this._render()},getContextMenuItems:function(){return this.options.contextMenuItems},setContextMenuItems:function(e){this.options.contextMenuItems=e instanceof Array?e:[],this._render()},getCustomDayRenderer:function(){return this.options.customDayRenderer},setCustomDayRenderer:function(t){this.options.customDayRenderer=e.isFunction(t)?t:null,this._render()},getCustomDataSourceRenderer:function(){return this.options.customDataSourceRenderer},setCustomDataSourceRenderer:function(t){this.options.customDataSourceRenderer=e.isFunction(t)?t:null,this._render()},getLanguage:function(){return this.options.language},setLanguage:function(e){null!=e&&null!=n[e]&&(this.options.language=e,this._render())},getDataSource:function(){return this.options.dataSource},setDataSource:function(e){this.options.dataSource=e instanceof Array?e:[],this._initializeDatasourceColors(),this._render()},addEvent:function(e){this.options.dataSource.push(e),this._render()}},e.fn.calendar=function(n){var a=new t(e(this),n);return e(this).data("calendar",a),a},e.fn.renderEnd=function(t){e(this).bind("renderEnd",t)},e.fn.clickDay=function(t){e(this).bind("clickDay",t)},e.fn.dayContextMenu=function(t){e(this).bind("dayContextMenu",t)},e.fn.selectRange=function(t){e(this).bind("selectRange",t)},e.fn.mouseOnDay=function(t){e(this).bind("mouseOnDay",t)},e.fn.mouseOutDay=function(t){e(this).bind("mouseOutDay",t)};var n=e.fn.calendar.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekShort:"W",weekStart:0}},a=e.fn.calendar.colors=["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"];e(function(){e('[data-provide="calendar"]').each(function(){e(this).calendar()})})}(window.jQuery);
|
@@ -8,16 +8,14 @@
|
|
8
8
|
- id = "#{name}_#{rand(1000)}"
|
9
9
|
- unless defined? clazz
|
10
10
|
- clazz = nil
|
11
|
-
- unless defined? all_days
|
12
|
-
- all_days = false
|
13
11
|
|
14
12
|
.form-group.fg-float
|
15
13
|
label #{title}
|
16
14
|
.fg-line
|
17
15
|
- if required
|
18
|
-
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" required="" value="#{date_range}" class="#{clazz}"
|
16
|
+
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" required="" value="#{date_range}" class="#{clazz}"
|
19
17
|
- else
|
20
|
-
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" value="#{date_range}" class="#{clazz}"
|
18
|
+
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" value="#{date_range}" class="#{clazz}"
|
21
19
|
input.hidden name="from" value="#{from}"
|
22
20
|
input.hidden name="to" value="#{to}"
|
23
21
|
|
@@ -28,6 +28,9 @@ link href="/sinatra-hexacta/vendors/daterangepicker/daterangepicker.css" rel="st
|
|
28
28
|
/calendar
|
29
29
|
link href="/sinatra-hexacta/vendors/fullcalendar/main.min.css" rel="stylesheet"
|
30
30
|
|
31
|
+
/year calendar
|
32
|
+
link href="/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css" rel="stylesheet"
|
33
|
+
|
31
34
|
/general app
|
32
35
|
link href="/sinatra-hexacta/css/app.min.1.css?version=#{settings.version}" rel="stylesheet"
|
33
36
|
link href="/sinatra-hexacta/css/app.min.2.css?version=#{settings.version}" rel="stylesheet"
|
@@ -34,3 +34,7 @@ script src="/sinatra-hexacta/vendors/daterangepicker/daterangepicker.js" type='t
|
|
34
34
|
/fullcalendar
|
35
35
|
script src="/sinatra-hexacta/vendors/fullcalendar/main.min.js" type='text/javascript'
|
36
36
|
script src="/sinatra-hexacta/vendors/fullcalendar/locales-all.min.js" type='text/javascript'
|
37
|
+
|
38
|
+
/year calendar
|
39
|
+
script src="/sinatra-hexacta/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.js" type='text/javascript'
|
40
|
+
script src="/sinatra-hexacta/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js" 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.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
@@ -129,8 +129,12 @@ files:
|
|
129
129
|
- lib/sinatra/public/img/select@2x.png
|
130
130
|
- lib/sinatra/public/js/app.js
|
131
131
|
- lib/sinatra/public/js/finder.js
|
132
|
+
- lib/sinatra/public/js/process.js
|
132
133
|
- lib/sinatra/public/vendors/animate.css/animate.min.css
|
133
134
|
- lib/sinatra/public/vendors/bootstrap-validator/validator.js
|
135
|
+
- lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js
|
136
|
+
- lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css
|
137
|
+
- lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.js
|
134
138
|
- lib/sinatra/public/vendors/bootstrap/bootstrap.min.js
|
135
139
|
- lib/sinatra/public/vendors/chartist/chartist-plugin-legend.js
|
136
140
|
- lib/sinatra/public/vendors/chartist/chartist.min.css
|