visualsearch-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.travis.yml +4 -0
- data/Changelog.md +4 -0
- data/Gemfile +2 -0
- data/Rakefile +5 -0
- data/Readme.md +24 -0
- data/app/assets/css/icons.css +19 -0
- data/app/assets/css/reset.css +30 -0
- data/app/assets/css/workspace.css +290 -0
- data/app/assets/images/cancel_search.png +0 -0
- data/app/assets/images/search_glyph.png +0 -0
- data/app/assets/javascripts/backbone-0.9.10.js +1498 -0
- data/app/assets/javascripts/dependencies.js +14843 -0
- data/app/assets/javascripts/jquery.ui.autocomplete.js +614 -0
- data/app/assets/javascripts/jquery.ui.core.js +324 -0
- data/app/assets/javascripts/jquery.ui.datepicker.js +5 -0
- data/app/assets/javascripts/jquery.ui.menu.js +621 -0
- data/app/assets/javascripts/jquery.ui.position.js +497 -0
- data/app/assets/javascripts/jquery.ui.widget.js +521 -0
- data/app/assets/javascripts/underscore-1.4.3.js +1221 -0
- data/app/assets/javascripts/visualsearch/js/models/search_facets.js +67 -0
- data/app/assets/javascripts/visualsearch/js/models/search_query.js +70 -0
- data/app/assets/javascripts/visualsearch/js/templates/search_box.jst +8 -0
- data/app/assets/javascripts/visualsearch/js/templates/search_facet.jst +9 -0
- data/app/assets/javascripts/visualsearch/js/templates/search_input.jst +1 -0
- data/app/assets/javascripts/visualsearch/js/templates/templates.js +7 -0
- data/app/assets/javascripts/visualsearch/js/utils/backbone_extensions.js +17 -0
- data/app/assets/javascripts/visualsearch/js/utils/hotkeys.js +99 -0
- data/app/assets/javascripts/visualsearch/js/utils/inflector.js +21 -0
- data/app/assets/javascripts/visualsearch/js/utils/jquery_extensions.js +197 -0
- data/app/assets/javascripts/visualsearch/js/utils/search_parser.js +87 -0
- data/app/assets/javascripts/visualsearch/js/views/search_box.js +447 -0
- data/app/assets/javascripts/visualsearch/js/views/search_facet.js +444 -0
- data/app/assets/javascripts/visualsearch/js/views/search_input.js +409 -0
- data/app/assets/javascripts/visualsearch/js/visualsearch.js +77 -0
- data/lib/generators/visual_search_install.rb +30 -0
- data/lib/visualsearch-rails.rb +2 -0
- data/lib/visualsearch/rails.rb +6 -0
- data/lib/visualsearch/version.rb +3 -0
- data/visualsearch-rails.gemspec +26 -0
- metadata +165 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
// This is the annotated source code for
|
2
|
+
// [VisualSearch.js](http://documentcloud.github.com/visualsearch/),
|
3
|
+
// a rich search box for real data.
|
4
|
+
//
|
5
|
+
// The annotated source HTML is generated by
|
6
|
+
// [Docco](http://jashkenas.github.com/docco/).
|
7
|
+
|
8
|
+
/** @license VisualSearch.js 0.4.0
|
9
|
+
* (c) 2011 Samuel Clay, @samuelclay, DocumentCloud Inc.
|
10
|
+
* VisualSearch.js may be freely distributed under the MIT license.
|
11
|
+
* For all details and documentation:
|
12
|
+
* http://documentcloud.github.com/visualsearch
|
13
|
+
*/
|
14
|
+
|
15
|
+
(function() {
|
16
|
+
|
17
|
+
var $ = jQuery; // Handle namespaced jQuery
|
18
|
+
|
19
|
+
// Setting up VisualSearch globals. These will eventually be made instance-based.
|
20
|
+
if (!window.VS) window.VS = {};
|
21
|
+
if (!VS.app) VS.app = {};
|
22
|
+
if (!VS.ui) VS.ui = {};
|
23
|
+
if (!VS.model) VS.model = {};
|
24
|
+
if (!VS.utils) VS.utils = {};
|
25
|
+
|
26
|
+
// Sets the version for VisualSearch to be used programatically elsewhere.
|
27
|
+
VS.VERSION = '0.4.0';
|
28
|
+
|
29
|
+
VS.VisualSearch = function(options) {
|
30
|
+
var defaults = {
|
31
|
+
container : '',
|
32
|
+
query : '',
|
33
|
+
autosearch : true,
|
34
|
+
unquotable : [],
|
35
|
+
remainder : 'text',
|
36
|
+
showFacets : true,
|
37
|
+
callbacks : {
|
38
|
+
search : $.noop,
|
39
|
+
focus : $.noop,
|
40
|
+
blur : $.noop,
|
41
|
+
facetMatches : $.noop,
|
42
|
+
valueMatches : $.noop
|
43
|
+
}
|
44
|
+
};
|
45
|
+
this.options = _.extend({}, defaults, options);
|
46
|
+
this.options.callbacks = _.extend({}, defaults.callbacks, options.callbacks);
|
47
|
+
|
48
|
+
VS.app.hotkeys.initialize();
|
49
|
+
this.searchQuery = new VS.model.SearchQuery();
|
50
|
+
this.searchBox = new VS.ui.SearchBox({
|
51
|
+
app: this,
|
52
|
+
showFacets: this.options.showFacets
|
53
|
+
});
|
54
|
+
|
55
|
+
if (options.container) {
|
56
|
+
var searchBox = this.searchBox.render().el;
|
57
|
+
$(this.options.container).html(searchBox);
|
58
|
+
}
|
59
|
+
this.searchBox.value(this.options.query || '');
|
60
|
+
|
61
|
+
// Disable page caching for browsers that incorrectly cache the visual search inputs.
|
62
|
+
// This is forced the browser to re-render the page when it is retrieved in its history.
|
63
|
+
$(window).bind('unload', function(e) {});
|
64
|
+
|
65
|
+
// Gives the user back a reference to the `searchBox` so they
|
66
|
+
// can use public methods.
|
67
|
+
return this;
|
68
|
+
};
|
69
|
+
|
70
|
+
// Entry-point used to tie all parts of VisualSearch together. It will either attach
|
71
|
+
// itself to `options.container`, or pass back the `searchBox` so it can be rendered
|
72
|
+
// at will.
|
73
|
+
VS.init = function(options) {
|
74
|
+
return new VS.VisualSearch(options);
|
75
|
+
};
|
76
|
+
|
77
|
+
})();
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
class VisualSearchInstallGenerator < ::Rails::Generators::Base
|
4
|
+
|
5
|
+
desc "This generator installs visual search javscripts and its dependencies"
|
6
|
+
source_root File.expand_path('../../../../../app/assets/javascripts', __FILE__)
|
7
|
+
|
8
|
+
|
9
|
+
def copy_backbone_js
|
10
|
+
say_status("copying", "backbone js", :green)
|
11
|
+
copy_file "backbone-0.9.10.js", "public/javascripts/backbone-0.9.10.js"
|
12
|
+
end
|
13
|
+
|
14
|
+
# def copy_jquery_ui
|
15
|
+
# if options.ui?
|
16
|
+
# say_status("copying", "jQuery UI (#{Jquery::Rails::JQUERY_UI_VERSION})", :green)
|
17
|
+
# copy_file "jquery-ui.js", "public/javascripts/jquery-ui.js"
|
18
|
+
# copy_file "jquery-ui.min.js", "public/javascripts/jquery-ui.min.js"
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
|
22
|
+
# def copy_ujs_driver
|
23
|
+
# say_status("copying", "jQuery UJS adapter (#{Jquery::Rails::JQUERY_UJS_VERSION[0..5]})", :green)
|
24
|
+
# remove_file "public/javascripts/rails.js"
|
25
|
+
# copy_file "jquery_ujs.js", "public/javascripts/jquery_ujs.js"
|
26
|
+
# end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "visualsearch/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "visualsearch-rails"
|
7
|
+
s.version = Visualsearch::VERSION
|
8
|
+
s.authors = ["Ekta Verma"]
|
9
|
+
s.date = '2014-02-24'
|
10
|
+
s.email = ["eku4evr@gmail.com"]
|
11
|
+
s.summary = %q{Gem for a Rich Search Box for Real Data}
|
12
|
+
s.description = %q{Gem that includes VisualSearch.js (VisualSearch.js enhances ordinary search boxes with the ability to autocomplete
|
13
|
+
faceted search queries.)}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.licenses = ['MIT']
|
20
|
+
s.homepage = 'https://github.com/visual-search/visualsearch-rails'
|
21
|
+
s.add_dependency "railties", ">= 3.1"
|
22
|
+
s.add_development_dependency "bundler", "~> 1.0"
|
23
|
+
s.add_development_dependency "rails", ">= 3.1"
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: visualsearch-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ekta Verma
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2014-02-24 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: railties
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 5
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 1
|
32
|
+
version: "3.1"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bundler
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 15
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
version: "1.0"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rails
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 5
|
59
|
+
segments:
|
60
|
+
- 3
|
61
|
+
- 1
|
62
|
+
version: "3.1"
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rake
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
79
|
+
description: |-
|
80
|
+
Gem that includes VisualSearch.js (VisualSearch.js enhances ordinary search boxes with the ability to autocomplete
|
81
|
+
faceted search queries.)
|
82
|
+
email:
|
83
|
+
- eku4evr@gmail.com
|
84
|
+
executables: []
|
85
|
+
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .travis.yml
|
93
|
+
- Changelog.md
|
94
|
+
- Gemfile
|
95
|
+
- Rakefile
|
96
|
+
- Readme.md
|
97
|
+
- app/assets/css/icons.css
|
98
|
+
- app/assets/css/reset.css
|
99
|
+
- app/assets/css/workspace.css
|
100
|
+
- app/assets/images/cancel_search.png
|
101
|
+
- app/assets/images/search_glyph.png
|
102
|
+
- app/assets/javascripts/backbone-0.9.10.js
|
103
|
+
- app/assets/javascripts/dependencies.js
|
104
|
+
- app/assets/javascripts/jquery.ui.autocomplete.js
|
105
|
+
- app/assets/javascripts/jquery.ui.core.js
|
106
|
+
- app/assets/javascripts/jquery.ui.datepicker.js
|
107
|
+
- app/assets/javascripts/jquery.ui.menu.js
|
108
|
+
- app/assets/javascripts/jquery.ui.position.js
|
109
|
+
- app/assets/javascripts/jquery.ui.widget.js
|
110
|
+
- app/assets/javascripts/underscore-1.4.3.js
|
111
|
+
- app/assets/javascripts/visualsearch/js/models/search_facets.js
|
112
|
+
- app/assets/javascripts/visualsearch/js/models/search_query.js
|
113
|
+
- app/assets/javascripts/visualsearch/js/templates/search_box.jst
|
114
|
+
- app/assets/javascripts/visualsearch/js/templates/search_facet.jst
|
115
|
+
- app/assets/javascripts/visualsearch/js/templates/search_input.jst
|
116
|
+
- app/assets/javascripts/visualsearch/js/templates/templates.js
|
117
|
+
- app/assets/javascripts/visualsearch/js/utils/backbone_extensions.js
|
118
|
+
- app/assets/javascripts/visualsearch/js/utils/hotkeys.js
|
119
|
+
- app/assets/javascripts/visualsearch/js/utils/inflector.js
|
120
|
+
- app/assets/javascripts/visualsearch/js/utils/jquery_extensions.js
|
121
|
+
- app/assets/javascripts/visualsearch/js/utils/search_parser.js
|
122
|
+
- app/assets/javascripts/visualsearch/js/views/search_box.js
|
123
|
+
- app/assets/javascripts/visualsearch/js/views/search_facet.js
|
124
|
+
- app/assets/javascripts/visualsearch/js/views/search_input.js
|
125
|
+
- app/assets/javascripts/visualsearch/js/visualsearch.js
|
126
|
+
- lib/generators/visual_search_install.rb
|
127
|
+
- lib/visualsearch-rails.rb
|
128
|
+
- lib/visualsearch/rails.rb
|
129
|
+
- lib/visualsearch/version.rb
|
130
|
+
- visualsearch-rails.gemspec
|
131
|
+
homepage: https://github.com/visual-search/visualsearch-rails
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
156
|
+
version: "0"
|
157
|
+
requirements: []
|
158
|
+
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 1.8.17
|
161
|
+
signing_key:
|
162
|
+
specification_version: 3
|
163
|
+
summary: Gem for a Rich Search Box for Real Data
|
164
|
+
test_files: []
|
165
|
+
|