caruby-scat 1.2.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.
@@ -0,0 +1,99 @@
1
+ module Scat
2
+ class Field
3
+ # The underscore label with any other special characters removed,
4
+ # converted to a symbol. For example, an element with label +Tissue Site+
5
+ # has name +:tissue_site+.
6
+ attr_reader :name
7
+
8
+ # The +checkbox+ or +text+ element type.
9
+ attr_reader :type
10
+
11
+ # The element label attribute.
12
+ attr_reader :label
13
+
14
+ # The HTML input element id.
15
+ attr_reader :input_id
16
+
17
+ # The (class, +Jinx::Property+) tuples which determine which property is
18
+ # set by the input value.
19
+ attr_reader :properties
20
+
21
+ # The optional help text displayed in a web hover pop-up.
22
+ attr_reader :help
23
+
24
+ # This field's value if the field type is +checkbox+, otherwise nil.
25
+ attr_reader :value
26
+
27
+ # If the field type is +checkbox+, then this flag determines whether
28
+ # the box is initially checked.
29
+ attr_reader :default
30
+
31
+ # @param [String] label the field label
32
+ # @param [Symbol] name the field name
33
+ def self.name_for(label)
34
+ name = label.gsub(' ', '_').gsub(/[^\w]/, '').downcase
35
+ # Strip the trailing ?, if any.
36
+ name[-1, 1] == '?' ? name[0...-1] : name
37
+ end
38
+
39
+ # Parses the given field specification.
40
+ #
41
+ # @param [String] label the configuration field specification key
42
+ # @param [{String => String}] spec the configuration field specification value
43
+ def initialize(label, spec)
44
+ @name = Field.name_for(label)
45
+ @input_id = @name + '_input'
46
+ @label = label
47
+ # Parse the property list.
48
+ @properties = spec['properties'].delete(' ').split(',').map do |pspec|
49
+ klass_s, attr_s = pspec.split('.')
50
+ begin
51
+ klass = CaTissue.module_with_name(klass_s)
52
+ [klass, klass.property(attr_s.to_sym)]
53
+ rescue
54
+ raise ScatError.new("Scat configuration field not recognized: #{pspec} - " + $!)
55
+ end
56
+ end
57
+ @type = spec['type']
58
+ # The default type is checkbox if the label ends in ?, text otherwise.
59
+ @type ||= label[-1, 1] == '?' ? 'checkbox' : 'text'
60
+ # A checkbox has a value.
61
+ if @type == 'checkbox' then
62
+ @value = spec['value']
63
+ @value ||= label[-1, 1] == '?' ? label[0...-1] : label
64
+ end
65
+ @help = spec['help']
66
+ @default = spec['default']
67
+ end
68
+
69
+ # Returns this field's HTML input element attributes and target caTissue properties.
70
+ #
71
+ # The attributes are determined by the field configuration as follows:
72
+ # * +id+: this field's HTML input element id
73
+ # * +type+: this field's type
74
+ # * +checked+: +true+ if the field type is +checkbox+ and the field default is set
75
+ # * +name+: if the field type is not +checkbox+, then this field's name
76
+ #
77
+ # @param [String, nil] value the request parameter value
78
+ # @return [{Symbol => String}] the form input element attributes
79
+ def input_attributes(value)
80
+ params = {:id => input_id, :type => type, :name => name, :value => value }
81
+ if type == 'checkbox' then
82
+ params[:value] ||= self.value
83
+ params[:checked] = true if default
84
+ end
85
+ params
86
+ end
87
+
88
+ # @param q the PrettyPrint queue
89
+ # @return [String] the formatted content of this field
90
+ def pretty_print(q)
91
+ q.text(name)
92
+ avh = [:label, :type, :help, :value, :default].to_compact_hash { |a| send(a) }
93
+ avh[:properties] = properties.map { |k, p| [k.name.demodulize, p.to_s].join('.') }
94
+ q.pp_hash(avh)
95
+ end
96
+
97
+ alias :to_s :name
98
+ end
99
+ end
@@ -0,0 +1,3 @@
1
+ module Scat
2
+ VERSION = '1.2.1'
3
+ end
Binary file
Binary file
@@ -0,0 +1,29 @@
1
+
2
+ /**
3
+ * Skeleton V1.1
4
+ * Copyright 2011, Dave Gamache
5
+ * www.getskeleton.com
6
+ * Free to use under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * 8/17/2011
9
+ */
10
+
11
+ (function ($) {
12
+ // hash change handler
13
+ function hashchange () {
14
+ var hash = window.location.hash
15
+ , el = $('ul.tabs [href*="' + hash + '"]')
16
+ , content = $(hash)
17
+
18
+ if (el.length && !el.hasClass('active') && content.length) {
19
+ el.closest('.tabs').find('.active').removeClass('active');
20
+ el.addClass('active');
21
+ content.show().addClass('active').siblings().hide().removeClass('active');
22
+ }
23
+ }
24
+
25
+ // listen on event and fire right away
26
+ $(window).on('hashchange.skeleton', hashchange);
27
+ hashchange();
28
+ $(hashchange);
29
+ })(jQuery);
@@ -0,0 +1,5 @@
1
+ # www.robotstxt.org/
2
+ # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
3
+
4
+ User-agent: *
5
+
@@ -0,0 +1,342 @@
1
+ /*
2
+ * Skeleton V1.1
3
+ * Copyright 2011, Dave Gamache
4
+ * www.getskeleton.com
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * 8/17/2011
8
+ */
9
+
10
+
11
+ /* Table of Content
12
+ ==================================================
13
+ #Reset & Basics
14
+ #Basic Styles
15
+ #Site Styles
16
+ #Typography
17
+ #Links
18
+ #Lists
19
+ #Images
20
+ #Buttons
21
+ #Tabs
22
+ #Forms
23
+ #Misc */
24
+
25
+
26
+ /* #Reset & Basics (Inspired by E. Meyers)
27
+ ================================================== */
28
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
29
+ margin: 0;
30
+ padding: 0;
31
+ border: 0;
32
+ font-size: 100%;
33
+ font: inherit;
34
+ vertical-align: baseline; }
35
+ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
36
+ display: block; }
37
+ body {
38
+ line-height: 1; }
39
+ ol, ul {
40
+ list-style: none; }
41
+ blockquote, q {
42
+ quotes: none; }
43
+ blockquote:before, blockquote:after,
44
+ q:before, q:after {
45
+ content: '';
46
+ content: none; }
47
+ table {
48
+ border-collapse: collapse;
49
+ border-spacing: 0; }
50
+
51
+
52
+ /* #Basic Styles
53
+ ================================================== */
54
+ body {
55
+ background: #fff;
56
+ font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
57
+ color: #444;
58
+ -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */
59
+ -webkit-text-size-adjust: 100%; }
60
+
61
+
62
+ /* #Typography
63
+ ================================================== */
64
+ h1, h2, h3, h4, h5, h6 {
65
+ color: #181818;
66
+ font-family: "Georgia", "Times New Roman", serif;
67
+ font-weight: normal; }
68
+ h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; }
69
+ h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;}
70
+ h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; }
71
+ h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; }
72
+ h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; }
73
+ h5 { font-size: 17px; line-height: 24px; }
74
+ h6 { font-size: 14px; line-height: 21px; }
75
+ .subheader { color: #777; }
76
+
77
+ p { margin: 0 0 20px 0; }
78
+ p img { margin: 0; }
79
+ p.lead { font-size: 21px; line-height: 27px; color: #777; }
80
+
81
+ em { font-style: italic; }
82
+ strong { font-weight: bold; color: #333; }
83
+ small { font-size: 80%; }
84
+
85
+ /* Blockquotes */
86
+ blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; }
87
+ blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; }
88
+ blockquote cite { display: block; font-size: 12px; color: #555; }
89
+ blockquote cite:before { content: "\2014 \0020"; }
90
+ blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; }
91
+
92
+ hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; }
93
+
94
+
95
+ /* #Links
96
+ ================================================== */
97
+ a, a:visited { color: #333; text-decoration: underline; outline: 0; }
98
+ a:hover, a:focus { color: #000; }
99
+ p a, p a:visited { line-height: inherit; }
100
+
101
+
102
+ /* #Lists
103
+ ================================================== */
104
+ ul, ol { margin-bottom: 20px; }
105
+ ul { list-style: none outside; }
106
+ ol { list-style: decimal; }
107
+ ol, ul.square, ul.circle, ul.disc { margin-left: 30px; }
108
+ ul.square { list-style: square outside; }
109
+ ul.circle { list-style: circle outside; }
110
+ ul.disc { list-style: disc outside; }
111
+ ul ul, ul ol,
112
+ ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; }
113
+ ul ul li, ul ol li,
114
+ ol ol li, ol ul li { margin-bottom: 6px; }
115
+ li { line-height: 18px; margin-bottom: 12px; }
116
+ ul.large li { line-height: 21px; }
117
+ li p { line-height: 21px; }
118
+
119
+ /* #Images
120
+ ================================================== */
121
+
122
+ img.scale-with-grid {
123
+ max-width: 100%;
124
+ height: auto; }
125
+
126
+
127
+ /* #Buttons
128
+ ================================================== */
129
+
130
+ .button,
131
+ button,
132
+ input[type="submit"],
133
+ input[type="reset"],
134
+ input[type="button"] {
135
+ background: #eee; /* Old browsers */
136
+ background: #eee -moz-linear-gradient(top, rgba(255,255,255,.2) 0%, rgba(0,0,0,.2) 100%); /* FF3.6+ */
137
+ background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.2))); /* Chrome,Safari4+ */
138
+ background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Chrome10+,Safari5.1+ */
139
+ background: #eee -o-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Opera11.10+ */
140
+ background: #eee -ms-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* IE10+ */
141
+ background: #eee linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* W3C */
142
+ border: 1px solid #aaa;
143
+ border-top: 1px solid #ccc;
144
+ border-left: 1px solid #ccc;
145
+ padding: 4px 12px;
146
+ -moz-border-radius: 3px;
147
+ -webkit-border-radius: 3px;
148
+ border-radius: 3px;
149
+ color: #444;
150
+ display: inline-block;
151
+ font-size: 11px;
152
+ font-weight: bold;
153
+ text-decoration: none;
154
+ text-shadow: 0 1px rgba(255, 255, 255, .75);
155
+ cursor: pointer;
156
+ margin-bottom: 20px;
157
+ line-height: normal;
158
+ padding: 8px 10px;
159
+ font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; }
160
+
161
+ .button:hover,
162
+ button:hover,
163
+ input[type="submit"]:hover,
164
+ input[type="reset"]:hover,
165
+ input[type="button"]:hover {
166
+ color: #222;
167
+ background: #ddd; /* Old browsers */
168
+ background: #ddd -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); /* FF3.6+ */
169
+ background: #ddd -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.3)), color-stop(100%,rgba(0,0,0,.3))); /* Chrome,Safari4+ */
170
+ background: #ddd -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Chrome10+,Safari5.1+ */
171
+ background: #ddd -o-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Opera11.10+ */
172
+ background: #ddd -ms-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* IE10+ */
173
+ background: #ddd linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* W3C */
174
+ border: 1px solid #888;
175
+ border-top: 1px solid #aaa;
176
+ border-left: 1px solid #aaa; }
177
+
178
+ .button:active,
179
+ button:active,
180
+ input[type="submit"]:active,
181
+ input[type="reset"]:active,
182
+ input[type="button"]:active {
183
+ border: 1px solid #666;
184
+ background: #ccc; /* Old browsers */
185
+ background: #ccc -moz-linear-gradient(top, rgba(255,255,255,.35) 0%, rgba(10,10,10,.4) 100%); /* FF3.6+ */
186
+ background: #ccc -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.35)), color-stop(100%,rgba(10,10,10,.4))); /* Chrome,Safari4+ */
187
+ background: #ccc -webkit-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Chrome10+,Safari5.1+ */
188
+ background: #ccc -o-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Opera11.10+ */
189
+ background: #ccc -ms-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* IE10+ */
190
+ background: #ccc linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* W3C */ }
191
+
192
+ .button.full-width,
193
+ button.full-width,
194
+ input[type="submit"].full-width,
195
+ input[type="reset"].full-width,
196
+ input[type="button"].full-width {
197
+ width: 100%;
198
+ padding-left: 0 !important;
199
+ padding-right: 0 !important;
200
+ text-align: center; }
201
+
202
+ /* Fix for odd Mozilla border & padding issues */
203
+ button::-moz-focus-inner,
204
+ input::-moz-focus-inner {
205
+ border: 0;
206
+ padding: 0;
207
+ }
208
+
209
+
210
+ /* #Tabs (activate in tabs.js)
211
+ ================================================== */
212
+ ul.tabs {
213
+ display: block;
214
+ margin: 0 0 20px 0;
215
+ padding: 0;
216
+ border-bottom: solid 1px #ddd; }
217
+ ul.tabs li {
218
+ display: block;
219
+ width: auto;
220
+ height: 30px;
221
+ padding: 0;
222
+ float: left;
223
+ margin-bottom: 0; }
224
+ ul.tabs li a {
225
+ display: block;
226
+ text-decoration: none;
227
+ width: auto;
228
+ height: 29px;
229
+ padding: 0px 20px;
230
+ line-height: 30px;
231
+ border: solid 1px #ddd;
232
+ border-width: 1px 1px 0 0;
233
+ margin: 0;
234
+ background: #f5f5f5;
235
+ font-size: 13px; }
236
+ ul.tabs li a.active {
237
+ background: #fff;
238
+ height: 30px;
239
+ position: relative;
240
+ top: -4px;
241
+ padding-top: 4px;
242
+ border-left-width: 1px;
243
+ margin: 0 0 0 -1px;
244
+ color: #111;
245
+ -moz-border-radius-topleft: 2px;
246
+ -webkit-border-top-left-radius: 2px;
247
+ border-top-left-radius: 2px;
248
+ -moz-border-radius-topright: 2px;
249
+ -webkit-border-top-right-radius: 2px;
250
+ border-top-right-radius: 2px; }
251
+ ul.tabs li:first-child a.active {
252
+ margin-left: 0; }
253
+ ul.tabs li:first-child a {
254
+ border-width: 1px 1px 0 1px;
255
+ -moz-border-radius-topleft: 2px;
256
+ -webkit-border-top-left-radius: 2px;
257
+ border-top-left-radius: 2px; }
258
+ ul.tabs li:last-child a {
259
+ -moz-border-radius-topright: 2px;
260
+ -webkit-border-top-right-radius: 2px;
261
+ border-top-right-radius: 2px; }
262
+
263
+ ul.tabs-content { margin: 0; display: block; }
264
+ ul.tabs-content > li { display:none; }
265
+ ul.tabs-content > li.active { display: block; }
266
+
267
+ /* Clearfixing tabs for beautiful stacking */
268
+ ul.tabs:before,
269
+ ul.tabs:after {
270
+ content: '\0020';
271
+ display: block;
272
+ overflow: hidden;
273
+ visibility: hidden;
274
+ width: 0;
275
+ height: 0; }
276
+ ul.tabs:after {
277
+ clear: both; }
278
+ ul.tabs {
279
+ zoom: 1; }
280
+
281
+
282
+ /* #Forms
283
+ ================================================== */
284
+
285
+ form {
286
+ margin-bottom: 20px; }
287
+ fieldset {
288
+ margin-bottom: 20px; }
289
+ input[type="text"],
290
+ input[type="password"],
291
+ input[type="email"],
292
+ textarea,
293
+ select {
294
+ border: 1px solid #ccc;
295
+ padding: 6px 4px;
296
+ outline: none;
297
+ -moz-border-radius: 2px;
298
+ -webkit-border-radius: 2px;
299
+ border-radius: 2px;
300
+ font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
301
+ color: #777;
302
+ margin: 0;
303
+ width: 210px;
304
+ max-width: 100%;
305
+ display: block;
306
+ margin-bottom: 20px;
307
+ background: #fff; }
308
+ select {
309
+ padding: 0; }
310
+ input[type="text"]:focus,
311
+ input[type="password"]:focus,
312
+ input[type="email"]:focus,
313
+ textarea:focus {
314
+ border: 1px solid #aaa;
315
+ color: #444;
316
+ -moz-box-shadow: 0 0 3px rgba(0,0,0,.2);
317
+ -webkit-box-shadow: 0 0 3px rgba(0,0,0,.2);
318
+ box-shadow: 0 0 3px rgba(0,0,0,.2); }
319
+ textarea {
320
+ min-height: 60px; }
321
+ label,
322
+ legend {
323
+ display: block;
324
+ font-weight: bold;
325
+ font-size: 13px; }
326
+ select {
327
+ width: 220px; }
328
+ input[type="checkbox"] {
329
+ display: inline; }
330
+ label span,
331
+ legend span {
332
+ font-weight: normal;
333
+ font-size: 13px;
334
+ color: #444; }
335
+
336
+ /* #Misc
337
+ ================================================== */
338
+ .remove-bottom { margin-bottom: 0 !important; }
339
+ .half-bottom { margin-bottom: 10px !important; }
340
+ .add-bottom { margin-bottom: 20px !important; }
341
+
342
+