sinatra-hexacta 0.4.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/helpers/cas.rb +1 -0
- data/lib/sinatra/helpers/inputs.rb +8 -0
- data/lib/sinatra/hexacta.rb +1 -0
- data/lib/sinatra/public/js/finder.js +23 -5
- data/lib/sinatra/views/inputs/paginator.slim +15 -0
- data/lib/sinatra/views/inputs/range.slim +28 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c11cd817a610d34a2776e3dee2c9f8f086004494537edb976d29d48208d175aa
|
4
|
+
data.tar.gz: a53b0d29d408dd10d7a882fb67d456978b4002423d53cc7c1cad12a349ea3d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c1ff9d07238a097414c7d8fd11590d2523fd2a54fb4ee1847e063673d8df998a3d99a5e47074702e6ebaf5d28ee5e32fcb8fe13448d575a9bb11cfdc5e9d75
|
7
|
+
data.tar.gz: a7685c6ce4c5c83af4b8544a682609ae0326b00cee246f95e4199c1512aa4ffe09a8df2a5c243e97e1ddbc7816cdd061bd57e8fc9b5d8d8e392e5a4d5d92857b
|
data/lib/sinatra/helpers/cas.rb
CHANGED
@@ -39,6 +39,14 @@ module Sinatra
|
|
39
39
|
slim "#{Hexacta::GEM_FILE_DIR}/inputs/year".to_sym, locals: option_hash
|
40
40
|
end
|
41
41
|
|
42
|
+
def paginator_input(option_hash)
|
43
|
+
slim "#{Hexacta::GEM_FILE_DIR}/inputs/paginator".to_sym, locals: option_hash
|
44
|
+
end
|
45
|
+
|
46
|
+
def range_input(option_hash)
|
47
|
+
slim "#{Hexacta::GEM_FILE_DIR}/inputs/range".to_sym, locals: option_hash
|
48
|
+
end
|
49
|
+
|
42
50
|
setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
|
43
51
|
copy_all_files("/lib/sinatra/views/inputs","/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
|
44
52
|
end
|
data/lib/sinatra/hexacta.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
var hide_results_timeout = false;
|
2
|
+
|
1
3
|
class Finder {
|
2
4
|
|
3
5
|
static find(query){
|
@@ -7,6 +9,11 @@ class Finder {
|
|
7
9
|
data: { query: query }
|
8
10
|
}).done(function(result) {
|
9
11
|
$("#header .results").html(result);
|
12
|
+
|
13
|
+
$('#header .results *').click(function() {
|
14
|
+
clearTimeout(hide_results_timeout);
|
15
|
+
$("#header input").focus();
|
16
|
+
});
|
10
17
|
});
|
11
18
|
}
|
12
19
|
|
@@ -21,6 +28,7 @@ class Finder {
|
|
21
28
|
}
|
22
29
|
}
|
23
30
|
|
31
|
+
var last_query = null;
|
24
32
|
var header_input_timeout = null;
|
25
33
|
$.xhrPool = [];
|
26
34
|
|
@@ -53,10 +61,15 @@ $(document).ready(function(){
|
|
53
61
|
$("#header input").focusin(function() {
|
54
62
|
$("#header .results").addClass("toggled");
|
55
63
|
})
|
64
|
+
|
56
65
|
$("#header input").focusout(function() {
|
57
|
-
|
58
|
-
|
59
|
-
|
66
|
+
hide_results_timeout = setTimeout(function() {
|
67
|
+
$("#header .results").removeClass("toggled");
|
68
|
+
},200);
|
69
|
+
});
|
70
|
+
|
71
|
+
$('#header .results *').click(function() {
|
72
|
+
clearTimeout(hide_results_timeout);
|
60
73
|
$("#header input").focus();
|
61
74
|
});
|
62
75
|
|
@@ -66,8 +79,13 @@ $(document).ready(function(){
|
|
66
79
|
if($('#header input').val().length > 2 && $.trim($('#header input').val())) {
|
67
80
|
header_input_timeout = setTimeout(function() {
|
68
81
|
$.xhrPool.abortAll();
|
69
|
-
|
70
|
-
|
82
|
+
if (last_query != $.trim($('#header input').val())) {
|
83
|
+
last_query = $.trim($('#header input').val());
|
84
|
+
if (last_query.length > 2) {
|
85
|
+
Finder.find(last_query);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}, 1000);
|
71
89
|
}
|
72
90
|
});
|
73
91
|
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-if pages > 1
|
2
|
+
.row.text-center
|
3
|
+
ul.pagination.no-margin style="vertical-align:middle"
|
4
|
+
li.page-first
|
5
|
+
a href="#" onclick="advance_search(#{url},0,#{format});" «
|
6
|
+
-if offset > 0
|
7
|
+
li.page-pre
|
8
|
+
a href="#" onclick="advance_search(#{url},#{offset - 1},#{format});" ‹
|
9
|
+
input.form-control.text-center name="offset" type="number" max="#{pages}" min="1" value="#{offset+1}" style="vertical-align:middle;display:inline-block;width:100px"
|
10
|
+
ul.pagination.no-margin style="vertical-align:middle"
|
11
|
+
-if offset < pages -1
|
12
|
+
li.page-next
|
13
|
+
a href="#" onclick="advance_search(#{url},#{offset + 1},#{format});" ›
|
14
|
+
li.page-last
|
15
|
+
a onclick="advance_search(#{url},#{pages-1},#{format});" »
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- if from.nil? || to.nil?
|
2
|
+
- date_range = ""
|
3
|
+
- else
|
4
|
+
- date_range = "#{from.strftime('%d %Bb, %y')} - #{to.strftime('%d %Bb, %y')}"
|
5
|
+
- unless defined? required
|
6
|
+
- required = false
|
7
|
+
- if !(defined? id) || id.blank?
|
8
|
+
- id = "#{name}_#{rand(1000)}"
|
9
|
+
- unless defined? clazz
|
10
|
+
- clazz = nil
|
11
|
+
- unless defined? all_days
|
12
|
+
- all_days = false
|
13
|
+
|
14
|
+
.form-group.fg-float
|
15
|
+
label #{title}
|
16
|
+
.fg-line
|
17
|
+
- if required
|
18
|
+
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" required="" value="#{date_range}" class="#{clazz}" all-days='#{all_days}'
|
19
|
+
- else
|
20
|
+
input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" value="#{date_range}" class="#{clazz}" all-days='#{all_days}'
|
21
|
+
input.hidden name="from" value="#{from}"
|
22
|
+
input.hidden name="to" value="#{to}"
|
23
|
+
|
24
|
+
javascript:
|
25
|
+
$('##{id}').on('apply.daterangepicker', function(ev, picker) {
|
26
|
+
$('##{id}').parent().find("input[name='from']").val(picker.startDate.format('DD/MM/YYYY'))
|
27
|
+
$('##{id}').parent().find("input[name='to']").val(picker.endDate.format('DD/MM/YYYY'))
|
28
|
+
});
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: similar_text
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.4
|
55
69
|
description: A gem to support general functionality accross all apps
|
56
70
|
email: mzanger@hexacta.com
|
57
71
|
executables: []
|
@@ -164,7 +178,9 @@ files:
|
|
164
178
|
- lib/sinatra/views/inputs/input.slim
|
165
179
|
- lib/sinatra/views/inputs/month.slim
|
166
180
|
- lib/sinatra/views/inputs/multiple_select.slim
|
181
|
+
- lib/sinatra/views/inputs/paginator.slim
|
167
182
|
- lib/sinatra/views/inputs/radio.slim
|
183
|
+
- lib/sinatra/views/inputs/range.slim
|
168
184
|
- lib/sinatra/views/inputs/select.slim
|
169
185
|
- lib/sinatra/views/inputs/textarea.slim
|
170
186
|
- lib/sinatra/views/inputs/tick.slim
|