sinatra-hexacta 0.4.2 → 0.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: 728aa24903dfacd5848f5cf2fc1f88927f658951a69a5f92ef691851c42cd856
4
- data.tar.gz: e80174daa95bb53cd75ad0478d96fde0ebbbb7616e2da79a6b52ec04378be60e
3
+ metadata.gz: 694392b00d11c7b1b437b8838922b7cc83f93ab70e7c62e7000a92b67601427f
4
+ data.tar.gz: 0ee0b32f43626cee4f7928c7870cc2b2eaa68db4f1194fc0433bbc333baf9ec7
5
5
  SHA512:
6
- metadata.gz: 6ad49dbe7dcf2d8b4863455ba676313a8963b5569a322e73e5e1401db20d4a8b537b32827ede670c228673a10a4d2c50e703d60e785f79b76dcdb3c3effb043d
7
- data.tar.gz: 5d9a06abb2fce33e637f5a9b436139d6c466e6992ad6aa937ff5fc90025e567581db96000e5a6dab8ae264c48135619a51e20e41e343b49f2b9058e9bf1df8b4
6
+ metadata.gz: 239d619572002ac227bd4afc1a017fcd36b2951b6bd20ee3b5ea85bb02d05279bd18dad2708aa0e45a8479332e47fccf05591c838de89d17de83a8ceefe93788
7
+ data.tar.gz: b7e4319975ac64926acb9ee47b887b1d985f81c837e8719aca70e8fcae58e0018f1f75206168bcbae0c52ffddfc7de4ee1ac5aeea51a3a0f9e4f6f6d22cc2af9
@@ -1,5 +1,6 @@
1
1
  require 'active_support/all' #bug in rubycas client requires this
2
2
  require 'rubycas-client'
3
+ require 'yaml' #for Casino
3
4
 
4
5
  module Sinatra
5
6
  module CasHelper
@@ -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
@@ -3,6 +3,7 @@ require 'sinatra/base'
3
3
  require 'fileutils'
4
4
  require 'sucker_punch'
5
5
  require 'rufus-scheduler'
6
+ require 'similar_text'
6
7
 
7
8
  module Sinatra
8
9
 
@@ -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
 
@@ -54,12 +61,18 @@ $(document).ready(function(){
54
61
  $("#header input").focusin(function() {
55
62
  $("#header .results").addClass("toggled");
56
63
  })
64
+
57
65
  $("#header input").focusout(function() {
58
- $("#header .results").removeClass("toggled");
59
- })
60
- $('#header .results').click(function() {
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);
61
73
  $("#header input").focus();
62
74
  });
75
+
63
76
  $('#header input').keyup(function() {
64
77
  clearTimeout(header_input_timeout);
65
78
 
@@ -68,7 +81,6 @@ $(document).ready(function(){
68
81
  $.xhrPool.abortAll();
69
82
  if (last_query != $.trim($('#header input').val())) {
70
83
  last_query = $.trim($('#header input').val());
71
- console.log(last_query);
72
84
  if (last_query.length > 2) {
73
85
  Finder.find(last_query);
74
86
  }
@@ -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.2
4
+ version: 0.6.1
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