picky-client 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/picky-client +14 -0
- data/lib/picky-client/generator.rb +180 -0
- data/sinatra_prototype/Gemfile +13 -0
- data/sinatra_prototype/app.rb +59 -0
- data/sinatra_prototype/book.rb +42 -0
- data/sinatra_prototype/config.ru +2 -0
- data/sinatra_prototype/images/picky.png +0 -0
- data/sinatra_prototype/javascripts/compiler.jar +0 -0
- data/sinatra_prototype/javascripts/generate_bundles +25 -0
- data/sinatra_prototype/javascripts/jquery-1.3.2.js +4376 -0
- data/sinatra_prototype/javascripts/jquery-1.4.3.min.js +166 -0
- data/sinatra_prototype/javascripts/jquery.scrollTo-1.4.2.js +215 -0
- data/sinatra_prototype/javascripts/jquery.timer.js +75 -0
- data/sinatra_prototype/javascripts/picky.addination.js +36 -0
- data/sinatra_prototype/javascripts/picky.allocation_renderer.js +291 -0
- data/sinatra_prototype/javascripts/picky.allocations_cloud.js +91 -0
- data/sinatra_prototype/javascripts/picky.backend.js +86 -0
- data/sinatra_prototype/javascripts/picky.client.js +62 -0
- data/sinatra_prototype/javascripts/picky.controller.js +107 -0
- data/sinatra_prototype/javascripts/picky.data.js +78 -0
- data/sinatra_prototype/javascripts/picky.extensions.js +15 -0
- data/sinatra_prototype/javascripts/picky.min.js +17 -0
- data/sinatra_prototype/javascripts/picky.results_renderer.js +103 -0
- data/sinatra_prototype/javascripts/picky.source.js.tar +0 -0
- data/sinatra_prototype/javascripts/picky.translations.js +50 -0
- data/sinatra_prototype/javascripts/picky.view.js +214 -0
- data/sinatra_prototype/library.csv +540 -0
- data/sinatra_prototype/stylesheets/stylesheet.css +175 -0
- data/sinatra_prototype/stylesheets/stylesheet.sass +216 -0
- data/sinatra_prototype/views/search.haml +107 -0
- data/spec/picky-client/generator_spec.rb +141 -0
- metadata +38 -6
@@ -0,0 +1,175 @@
|
|
1
|
+
body {
|
2
|
+
text-align: center;
|
3
|
+
font-family: Lucida Grande; }
|
4
|
+
|
5
|
+
img {
|
6
|
+
margin: -2px 0px 0px; }
|
7
|
+
|
8
|
+
p span.explanation {
|
9
|
+
color: #999999; }
|
10
|
+
|
11
|
+
#picky {
|
12
|
+
text-align: left;
|
13
|
+
margin: 0px auto;
|
14
|
+
width: 560px;
|
15
|
+
overflow: hidden; }
|
16
|
+
#picky .dashboard {
|
17
|
+
position: relative;
|
18
|
+
overflow: hidden;
|
19
|
+
background-color: lightGrey;
|
20
|
+
padding: 5px 5px 7px 5px;
|
21
|
+
height: 26px;
|
22
|
+
margin-bottom: 3px; }
|
23
|
+
#picky .status {
|
24
|
+
float: left;
|
25
|
+
width: 45px;
|
26
|
+
height: 26px;
|
27
|
+
line-height: 26px;
|
28
|
+
text-align: center;
|
29
|
+
padding: 0 0 0 2px;
|
30
|
+
font-weight: bold;
|
31
|
+
color: white;
|
32
|
+
margin-right: 5px; }
|
33
|
+
#picky .status.alert {
|
34
|
+
background-color: lightgreen; }
|
35
|
+
#picky .results {
|
36
|
+
margin-top: 0px;
|
37
|
+
padding: 0px; }
|
38
|
+
#picky .results div.book {
|
39
|
+
background-color: #ffeeee;
|
40
|
+
padding: 5px 25px;
|
41
|
+
margin: 3px 0px; }
|
42
|
+
#picky .results em {
|
43
|
+
font-style: normal;
|
44
|
+
background-color: #fff196; }
|
45
|
+
#picky .results .item {
|
46
|
+
display: block;
|
47
|
+
padding: 10px; }
|
48
|
+
#picky .results .addination {
|
49
|
+
position: relative;
|
50
|
+
text-align: center;
|
51
|
+
padding: 7px 5px 5px 5px;
|
52
|
+
background-color: #eeeeee;
|
53
|
+
color: #276abb;
|
54
|
+
cursor: pointer; }
|
55
|
+
#picky .results .addination .tothetop {
|
56
|
+
position: absolute;
|
57
|
+
top: 4px;
|
58
|
+
right: 0px; }
|
59
|
+
#picky .results .addination .tothetop a {
|
60
|
+
display: block;
|
61
|
+
width: 20px;
|
62
|
+
height: 20px; }
|
63
|
+
#picky .results .info {
|
64
|
+
color: #555555;
|
65
|
+
background-color: #eeeeee;
|
66
|
+
padding: 6px 5px 5px 8px; }
|
67
|
+
#picky .results .info .tothetop {
|
68
|
+
float: right;
|
69
|
+
margin-top: -4px; }
|
70
|
+
#picky .feedback {
|
71
|
+
width: 460px;
|
72
|
+
float: left;
|
73
|
+
border: 1px solid #cccccc;
|
74
|
+
padding: 0;
|
75
|
+
margin: 0; }
|
76
|
+
#picky .feedback .reset {
|
77
|
+
float: right;
|
78
|
+
width: 18px;
|
79
|
+
height: 18px;
|
80
|
+
margin: 3px 3px 0px 0px;
|
81
|
+
cursor: pointer;
|
82
|
+
opacity: 0; }
|
83
|
+
#picky .empty .status {
|
84
|
+
background-color: #8cacda; }
|
85
|
+
#picky .empty .feedback {
|
86
|
+
background-color: #d0e2ff; }
|
87
|
+
#picky .none .status {
|
88
|
+
background-color: red; }
|
89
|
+
#picky .none .feedback {
|
90
|
+
background-color: #ffdddd; }
|
91
|
+
#picky .support .status {
|
92
|
+
background-color: #ff6600; }
|
93
|
+
#picky .support .feedback {
|
94
|
+
background-color: #faf3d0; }
|
95
|
+
#picky .ok .status {
|
96
|
+
background-color: #09be01; }
|
97
|
+
#picky .ok .feedback {
|
98
|
+
background-color: #bcf0b3; }
|
99
|
+
#picky input.search_button {
|
100
|
+
margin: 5px 15px; }
|
101
|
+
#picky input.query {
|
102
|
+
float: left;
|
103
|
+
width: 380px;
|
104
|
+
height: 100%;
|
105
|
+
font-size: 1em;
|
106
|
+
font-weight: bold;
|
107
|
+
border-style: solid;
|
108
|
+
border-width: 0px 0px 3px 0px;
|
109
|
+
border-color: transparent;
|
110
|
+
margin: 0;
|
111
|
+
padding: 4px 0 0 0;
|
112
|
+
outline: none;
|
113
|
+
background: none; }
|
114
|
+
#picky .allocations {
|
115
|
+
clear: both;
|
116
|
+
overflow: hidden;
|
117
|
+
background-color: white;
|
118
|
+
padding-bottom: 2px; }
|
119
|
+
#picky .allocations ol.hidden {
|
120
|
+
display: none; }
|
121
|
+
#picky .allocations ol.more:hover {
|
122
|
+
background-color: #cccccc;
|
123
|
+
cursor: pointer; }
|
124
|
+
#picky .allocations ol.more {
|
125
|
+
background-color: #eeeeee;
|
126
|
+
display: none;
|
127
|
+
text-align: center;
|
128
|
+
height: 32px;
|
129
|
+
line-height: 32px; }
|
130
|
+
#picky .allocations ol.more li {
|
131
|
+
text-align: center; }
|
132
|
+
#picky .allocations ol {
|
133
|
+
list-style-position: outside;
|
134
|
+
list-style: none;
|
135
|
+
padding: 0;
|
136
|
+
margin: 0px;
|
137
|
+
overflow: hidden; }
|
138
|
+
#picky .allocations ol li {
|
139
|
+
margin: 0px;
|
140
|
+
margin-bottom: 3px;
|
141
|
+
padding: 10px 13px;
|
142
|
+
cursor: pointer;
|
143
|
+
display: block;
|
144
|
+
font: menu;
|
145
|
+
font-size: 1em;
|
146
|
+
line-height: 16px;
|
147
|
+
background-color: #f3f3f3;
|
148
|
+
overflow: hidden;
|
149
|
+
color: #276abb; }
|
150
|
+
#picky .allocations ol li .text {
|
151
|
+
max-width: 90%;
|
152
|
+
float: left; }
|
153
|
+
#picky .allocations ol li .count {
|
154
|
+
float: right;
|
155
|
+
color: #cccccc; }
|
156
|
+
#picky .allocations ol li:hover {
|
157
|
+
background-color: #d0e2ff; }
|
158
|
+
#picky .allocations .company, #picky .allocations .person {
|
159
|
+
width: 49%; }
|
160
|
+
#picky .allocations .person {
|
161
|
+
float: left;
|
162
|
+
margin-right: 10px; }
|
163
|
+
#picky .allocations .company {
|
164
|
+
float: right; }
|
165
|
+
#picky .no_results {
|
166
|
+
display: none;
|
167
|
+
clear: both;
|
168
|
+
overflow: hidden; }
|
169
|
+
#picky .no_results ul {
|
170
|
+
list-style-type: disc;
|
171
|
+
padding-left: 13px; }
|
172
|
+
#picky .no_results a {
|
173
|
+
display: block; }
|
174
|
+
#picky > .info {
|
175
|
+
display: none; }
|
@@ -0,0 +1,216 @@
|
|
1
|
+
body
|
2
|
+
:text-align center
|
3
|
+
:font-family Lucida Grande
|
4
|
+
|
5
|
+
img
|
6
|
+
:margin -2px 0px 0px
|
7
|
+
|
8
|
+
p
|
9
|
+
span.explanation
|
10
|
+
:color #999
|
11
|
+
|
12
|
+
#picky
|
13
|
+
:text-align left
|
14
|
+
:margin 0px auto
|
15
|
+
:width 560px
|
16
|
+
|
17
|
+
.dashboard
|
18
|
+
:position relative
|
19
|
+
:overflow hidden
|
20
|
+
:background-color lightGrey
|
21
|
+
:padding 5px 5px 7px 5px
|
22
|
+
:height 26px
|
23
|
+
:margin-bottom 3px
|
24
|
+
|
25
|
+
.status
|
26
|
+
:float left
|
27
|
+
:width 45px
|
28
|
+
:height 26px
|
29
|
+
:line-height 26px
|
30
|
+
:text-align center
|
31
|
+
:padding 0 0 0 2px
|
32
|
+
:font-weight bold
|
33
|
+
:color white
|
34
|
+
:margin-right 5px
|
35
|
+
.status.alert
|
36
|
+
:background-color lightgreen
|
37
|
+
|
38
|
+
.results
|
39
|
+
:margin-top 0px
|
40
|
+
:padding 0px
|
41
|
+
|
42
|
+
div.book
|
43
|
+
:background-color #ffeeee
|
44
|
+
:padding 5px 25px
|
45
|
+
:margin 3px 0px
|
46
|
+
|
47
|
+
em
|
48
|
+
:font-style normal
|
49
|
+
:background-color #FFF196
|
50
|
+
|
51
|
+
.item
|
52
|
+
:display block
|
53
|
+
:padding 10px
|
54
|
+
|
55
|
+
.addination
|
56
|
+
:position relative
|
57
|
+
:text-align center
|
58
|
+
:padding 7px 5px 5px 5px
|
59
|
+
:background-color #eee
|
60
|
+
:color #276ABB
|
61
|
+
:cursor pointer
|
62
|
+
|
63
|
+
.tothetop
|
64
|
+
:position absolute
|
65
|
+
:top 4px
|
66
|
+
:right 0px
|
67
|
+
|
68
|
+
a
|
69
|
+
:display block
|
70
|
+
:width 20px
|
71
|
+
:height 20px
|
72
|
+
|
73
|
+
.info
|
74
|
+
:color #555
|
75
|
+
:background-color #eee
|
76
|
+
:padding 6px 5px 5px 8px
|
77
|
+
|
78
|
+
.tothetop
|
79
|
+
:float right
|
80
|
+
:margin-top -4px
|
81
|
+
|
82
|
+
:overflow hidden
|
83
|
+
|
84
|
+
// width only set because of IE
|
85
|
+
.feedback
|
86
|
+
:width 460px
|
87
|
+
:float left
|
88
|
+
:border 1px solid #ccc
|
89
|
+
:padding 0
|
90
|
+
:margin 0
|
91
|
+
|
92
|
+
.reset
|
93
|
+
:float right
|
94
|
+
:width 18px
|
95
|
+
:height 18px
|
96
|
+
:margin 3px 3px 0px 0px
|
97
|
+
:cursor pointer
|
98
|
+
:opacity 0
|
99
|
+
|
100
|
+
// Blue
|
101
|
+
.empty
|
102
|
+
.status
|
103
|
+
:background-color #8cacda
|
104
|
+
.feedback
|
105
|
+
:background-color #D0E2FF
|
106
|
+
// Red
|
107
|
+
.none
|
108
|
+
.status
|
109
|
+
:background-color #ff0000
|
110
|
+
.feedback
|
111
|
+
:background-color #ffdddd
|
112
|
+
// Orange
|
113
|
+
.support
|
114
|
+
.status
|
115
|
+
:background-color #ff6600
|
116
|
+
.feedback
|
117
|
+
:background-color #faf3d0
|
118
|
+
// Green
|
119
|
+
.ok
|
120
|
+
.status
|
121
|
+
:background-color #09be01
|
122
|
+
.feedback
|
123
|
+
:background-color #bcf0b3
|
124
|
+
|
125
|
+
input.search_button
|
126
|
+
:margin 5px 15px
|
127
|
+
|
128
|
+
input.query
|
129
|
+
:float left
|
130
|
+
:width 380px
|
131
|
+
:height 100%
|
132
|
+
:font-size 1em
|
133
|
+
:font-weight bold
|
134
|
+
:border-style solid
|
135
|
+
:border-width 0px 0px 3px 0px
|
136
|
+
:border-color transparent
|
137
|
+
:margin 0
|
138
|
+
:padding 4px 0 0 0
|
139
|
+
:outline none
|
140
|
+
:background none
|
141
|
+
|
142
|
+
.allocations
|
143
|
+
:clear both
|
144
|
+
:overflow hidden
|
145
|
+
:background-color white
|
146
|
+
:padding-bottom 2px
|
147
|
+
|
148
|
+
ol.hidden
|
149
|
+
:display none
|
150
|
+
|
151
|
+
ol.more:hover
|
152
|
+
:background-color #ccc
|
153
|
+
:cursor pointer
|
154
|
+
ol.more
|
155
|
+
:background-color #eee
|
156
|
+
:display none
|
157
|
+
:text-align center
|
158
|
+
:height 32px
|
159
|
+
:line-height 32px
|
160
|
+
|
161
|
+
li
|
162
|
+
:text-align center
|
163
|
+
|
164
|
+
ol
|
165
|
+
:list-style-position outside
|
166
|
+
:list-style none
|
167
|
+
:padding 0
|
168
|
+
:margin 0px
|
169
|
+
:overflow hidden
|
170
|
+
|
171
|
+
li
|
172
|
+
:margin 0px
|
173
|
+
:margin-bottom 3px
|
174
|
+
:padding 10px 13px
|
175
|
+
:cursor pointer
|
176
|
+
:display block
|
177
|
+
:font menu
|
178
|
+
:font-size 1em
|
179
|
+
:line-height 16px
|
180
|
+
:background-color #f3f3f3
|
181
|
+
:overflow hidden
|
182
|
+
:color #276ABB
|
183
|
+
|
184
|
+
.text
|
185
|
+
:max-width 90%
|
186
|
+
:float left
|
187
|
+
|
188
|
+
.count
|
189
|
+
:float right
|
190
|
+
:color #ccc
|
191
|
+
|
192
|
+
li:hover
|
193
|
+
:background-color #D0E2FF
|
194
|
+
|
195
|
+
.company, .person
|
196
|
+
:width 49%
|
197
|
+
.person
|
198
|
+
:float left
|
199
|
+
:margin-right 10px
|
200
|
+
.company
|
201
|
+
:float right
|
202
|
+
|
203
|
+
.no_results
|
204
|
+
:display none
|
205
|
+
:clear both
|
206
|
+
:overflow hidden
|
207
|
+
|
208
|
+
ul
|
209
|
+
:list-style-type disc
|
210
|
+
:padding-left 13px
|
211
|
+
|
212
|
+
a
|
213
|
+
:display block
|
214
|
+
|
215
|
+
& > .info
|
216
|
+
:display none
|
@@ -0,0 +1,107 @@
|
|
1
|
+
!!!
|
2
|
+
%html{ :lang => 'en' }
|
3
|
+
%head
|
4
|
+
%link{:href => "stylesheets/stylesheet.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
|
5
|
+
= js 'jquery-1.4.3.min'
|
6
|
+
= js 'jquery.scrollTo-1.4.2'
|
7
|
+
= js 'jquery.timer'
|
8
|
+
|
9
|
+
= js 'picky.extensions'
|
10
|
+
= js 'picky.translations'
|
11
|
+
= js 'picky.data'
|
12
|
+
= js 'picky.view'
|
13
|
+
= js 'picky.backend'
|
14
|
+
= js 'picky.controller'
|
15
|
+
= js 'picky.client'
|
16
|
+
= js 'picky.addination'
|
17
|
+
= js 'picky.results_renderer'
|
18
|
+
= js 'picky.allocation_renderer'
|
19
|
+
= js 'picky.allocations_cloud'
|
20
|
+
|
21
|
+
/ = js 'picky.min'
|
22
|
+
%body
|
23
|
+
%img{:src => "images/picky.png"}/
|
24
|
+
%p
|
25
|
+
%a{:href => "http://floere.github.com/picky"} Back to the Picky documentation.
|
26
|
+
%p
|
27
|
+
Try a few examples
|
28
|
+
= succeed ":" do
|
29
|
+
%span.explanation (on a simple database with 540 books - note that the server is on Heroku and needs a little time to ramp up)
|
30
|
+
%p
|
31
|
+
A simple word,
|
32
|
+
= succeed "." do
|
33
|
+
%a{:href => "#", :onclick => "pickyClient.insert('alan');"} alan
|
34
|
+
%span.explanation
|
35
|
+
(Finds Alan in the title, and Alans who wrote books. The title is ranked higher due to weighing.)
|
36
|
+
%span
|
37
|
+
%p
|
38
|
+
With qualifier,
|
39
|
+
= succeed "." do
|
40
|
+
%a{:href => "#", :onclick => "pickyClient.insert('title:women');"} title:women
|
41
|
+
%span.explanation
|
42
|
+
(Finds "women*" just in titles.)
|
43
|
+
%span
|
44
|
+
%p
|
45
|
+
With similarity,
|
46
|
+
= succeed "." do
|
47
|
+
%a{:href => "#", :onclick => "pickyClient.insert('pinchn~');"} pinchn~
|
48
|
+
%span.explanation (Finds "pynchon", note: Only title in example with similarity. Uses a combination of double metaphone and Levenshtein.)
|
49
|
+
%p
|
50
|
+
More complex,
|
51
|
+
= succeed "." do
|
52
|
+
%a{:href => "#", :onclick => "pickyClient.insert('title:lyterature~');"} title:lyterature~
|
53
|
+
%span.explanation (Finds similar titles)
|
54
|
+
%p
|
55
|
+
With choice,
|
56
|
+
= succeed "." do
|
57
|
+
%a{:href => "#", :onclick => "pickyClient.insert('sp');"} sp
|
58
|
+
%span.explanation (Finds "sp*" in multiple categories. Choose the one you're looking for.)
|
59
|
+
%p
|
60
|
+
More complex,
|
61
|
+
= succeed "." do
|
62
|
+
%a{:href => "#", :onclick => "pickyClient.insert('soc* s');"} soc* s
|
63
|
+
%span.explanation (this is where Picky really shines, "the title started with soc, and the author starts with s")
|
64
|
+
= Picky::Helper.cached_interface
|
65
|
+
:javascript
|
66
|
+
pickyClient = new PickyClient({
|
67
|
+
// A full query displays the rendered results.
|
68
|
+
//
|
69
|
+
full: '/search/full',
|
70
|
+
|
71
|
+
// A live query just updates the count.
|
72
|
+
//
|
73
|
+
live: '/search/live',
|
74
|
+
|
75
|
+
// showResultsLimit: 10, // Optional. Default is 10.
|
76
|
+
|
77
|
+
// before: function(params, query, offset) { }, // Optional. Before Picky sends any data.
|
78
|
+
// success: function(data, query) { }, // Optional. Just after Picky receives data. (Get a PickyData object)
|
79
|
+
// after: function(data, query) { }, // Optional. After Picky has handled the data and updated the view.
|
80
|
+
|
81
|
+
// This is used to generate the correct query strings, localized. E.g. "subject:war".
|
82
|
+
// Optional. If you don't give these, the field identifier given in the Picky server is used.
|
83
|
+
//
|
84
|
+
qualifiers: {
|
85
|
+
en:{
|
86
|
+
subjects: 'subject'
|
87
|
+
}
|
88
|
+
},
|
89
|
+
|
90
|
+
// This is used to explain the preceding word in the suggestion text, localized. E.g. "Peter (author)".
|
91
|
+
// Optional. Default are the field identifiers from the Picky server.
|
92
|
+
//
|
93
|
+
explanations: {
|
94
|
+
en:{
|
95
|
+
title: 'titled',
|
96
|
+
author: 'written by',
|
97
|
+
isbn: 'ISBN-13',
|
98
|
+
year: 'published in',
|
99
|
+
publisher: 'published by',
|
100
|
+
subjects: 'topics'
|
101
|
+
}
|
102
|
+
}
|
103
|
+
});
|
104
|
+
|
105
|
+
// An initial search text, prefilled.
|
106
|
+
//
|
107
|
+
pickyClient.insert('italy');
|