dataclips 0.0.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.
Files changed (158) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  6. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  7. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  8. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  9. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  10. data/app/assets/images/dataclips/slickgrid/sort-asc.png +0 -0
  11. data/app/assets/images/dataclips/slickgrid/sort-desc.png +0 -0
  12. data/app/assets/javascripts/dataclips/application.js +26 -0
  13. data/app/assets/javascripts/dataclips/backbone.js +1608 -0
  14. data/app/assets/javascripts/dataclips/dataclips.js.coffee +168 -0
  15. data/app/assets/javascripts/dataclips/formatters.js.coffee +14 -0
  16. data/app/assets/javascripts/dataclips/namespace.js.coffee +1 -0
  17. data/app/assets/javascripts/dataclips/record.js.coffee +39 -0
  18. data/app/assets/javascripts/dataclips/slickgrid.js +5 -0
  19. data/app/assets/javascripts/dataclips/slickgrid/jquery.event.drag-2.2.js +402 -0
  20. data/app/assets/javascripts/dataclips/slickgrid/plugins/slick.rowselectionmodel.js +187 -0
  21. data/app/assets/javascripts/dataclips/slickgrid/slick.core.js +458 -0
  22. data/app/assets/javascripts/dataclips/slickgrid/slick.dataview.js +1063 -0
  23. data/app/assets/javascripts/dataclips/slickgrid/slick.grid.js +3309 -0
  24. data/app/assets/javascripts/dataclips/underscore.js +1416 -0
  25. data/app/assets/stylesheets/bootstrap/_alerts.scss +68 -0
  26. data/app/assets/stylesheets/bootstrap/_badges.scss +63 -0
  27. data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  28. data/app/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
  29. data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  30. data/app/assets/stylesheets/bootstrap/_carousel.scss +267 -0
  31. data/app/assets/stylesheets/bootstrap/_close.scss +35 -0
  32. data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
  33. data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  34. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
  35. data/app/assets/stylesheets/bootstrap/_forms.scss +548 -0
  36. data/app/assets/stylesheets/bootstrap/_glyphicons.scss +234 -0
  37. data/app/assets/stylesheets/bootstrap/_grid.scss +84 -0
  38. data/app/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
  39. data/app/assets/stylesheets/bootstrap/_jumbotron.scss +49 -0
  40. data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
  41. data/app/assets/stylesheets/bootstrap/_list-group.scss +124 -0
  42. data/app/assets/stylesheets/bootstrap/_media.scss +47 -0
  43. data/app/assets/stylesheets/bootstrap/_mixins.scss +39 -0
  44. data/app/assets/stylesheets/bootstrap/_modals.scss +148 -0
  45. data/app/assets/stylesheets/bootstrap/_navbar.scss +662 -0
  46. data/app/assets/stylesheets/bootstrap/_navs.scss +244 -0
  47. data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  48. data/app/assets/stylesheets/bootstrap/_pager.scss +54 -0
  49. data/app/assets/stylesheets/bootstrap/_pagination.scss +88 -0
  50. data/app/assets/stylesheets/bootstrap/_panels.scss +261 -0
  51. data/app/assets/stylesheets/bootstrap/_popovers.scss +135 -0
  52. data/app/assets/stylesheets/bootstrap/_print.scss +107 -0
  53. data/app/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
  54. data/app/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  55. data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +174 -0
  56. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
  57. data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
  58. data/app/assets/stylesheets/bootstrap/_theme.scss +272 -0
  59. data/app/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
  60. data/app/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
  61. data/app/assets/stylesheets/bootstrap/_type.scss +298 -0
  62. data/app/assets/stylesheets/bootstrap/_utilities.scss +56 -0
  63. data/app/assets/stylesheets/bootstrap/_variables.scss +864 -0
  64. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  65. data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
  66. data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
  67. data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  68. data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
  69. data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  70. data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  71. data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  72. data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
  73. data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  74. data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  75. data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  76. data/app/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
  77. data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  78. data/app/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
  79. data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  80. data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  81. data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
  82. data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
  83. data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  84. data/app/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  85. data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  86. data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  87. data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
  88. data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  89. data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  90. data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  91. data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
  92. data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  93. data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  94. data/app/assets/stylesheets/dataclips/_bootstrap.scss +53 -0
  95. data/app/assets/stylesheets/dataclips/application.css +18 -0
  96. data/app/assets/stylesheets/dataclips/slickgrid/slickgrid.sass +341 -0
  97. data/app/controllers/dataclips/application_controller.rb +31 -0
  98. data/app/controllers/dataclips/clips_controller.rb +46 -0
  99. data/app/controllers/dataclips/insights_controller.rb +45 -0
  100. data/app/helpers/dataclips/application_helper.rb +4 -0
  101. data/app/models/dataclips/clip.rb +79 -0
  102. data/app/models/dataclips/insight.rb +18 -0
  103. data/app/models/dataclips/sql_query.rb +36 -0
  104. data/app/views/dataclips/application/_boolean.html.erb +1 -0
  105. data/app/views/dataclips/application/_date.html.erb +22 -0
  106. data/app/views/dataclips/application/_datetime.html.erb +25 -0
  107. data/app/views/dataclips/application/_float.html.erb +7 -0
  108. data/app/views/dataclips/application/_integer.html.erb +7 -0
  109. data/app/views/dataclips/application/_text.html.erb +10 -0
  110. data/app/views/dataclips/application/_time.html.erb +23 -0
  111. data/app/views/dataclips/clips/edit.html.erb +14 -0
  112. data/app/views/dataclips/clips/show.html.erb +109 -0
  113. data/app/views/dataclips/insights/show.html.erb +99 -0
  114. data/app/views/layouts/dataclips/application.html.erb +14 -0
  115. data/config/initializers/assets.rb +1 -0
  116. data/config/routes.rb +9 -0
  117. data/db/migrate/20150101143530_create_dataclips_insights.rb +12 -0
  118. data/lib/dataclips.rb +47 -0
  119. data/lib/dataclips/engine.rb +29 -0
  120. data/lib/dataclips/version.rb +3 -0
  121. data/lib/tasks/dataclips_tasks.rake +4 -0
  122. data/test/dataclips_test.rb +7 -0
  123. data/test/dummy/README.rdoc +28 -0
  124. data/test/dummy/Rakefile +6 -0
  125. data/test/dummy/app/assets/javascripts/application.js +13 -0
  126. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  127. data/test/dummy/app/controllers/application_controller.rb +5 -0
  128. data/test/dummy/app/helpers/application_helper.rb +2 -0
  129. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  130. data/test/dummy/bin/bundle +3 -0
  131. data/test/dummy/bin/rails +4 -0
  132. data/test/dummy/bin/rake +4 -0
  133. data/test/dummy/config.ru +4 -0
  134. data/test/dummy/config/application.rb +23 -0
  135. data/test/dummy/config/boot.rb +5 -0
  136. data/test/dummy/config/database.yml +25 -0
  137. data/test/dummy/config/environment.rb +5 -0
  138. data/test/dummy/config/environments/development.rb +37 -0
  139. data/test/dummy/config/environments/production.rb +78 -0
  140. data/test/dummy/config/environments/test.rb +39 -0
  141. data/test/dummy/config/initializers/assets.rb +8 -0
  142. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  143. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  144. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  145. data/test/dummy/config/initializers/inflections.rb +16 -0
  146. data/test/dummy/config/initializers/mime_types.rb +4 -0
  147. data/test/dummy/config/initializers/session_store.rb +3 -0
  148. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  149. data/test/dummy/config/locales/en.yml +23 -0
  150. data/test/dummy/config/routes.rb +4 -0
  151. data/test/dummy/config/secrets.yml +22 -0
  152. data/test/dummy/public/404.html +67 -0
  153. data/test/dummy/public/422.html +67 -0
  154. data/test/dummy/public/500.html +66 -0
  155. data/test/dummy/public/favicon.ico +0 -0
  156. data/test/integration/navigation_test.rb +10 -0
  157. data/test/test_helper.rb +17 -0
  158. metadata +348 -0
@@ -0,0 +1,548 @@
1
+ //
2
+ // Forms
3
+ // --------------------------------------------------
4
+
5
+
6
+ // Normalize non-controls
7
+ //
8
+ // Restyle and baseline non-control form elements.
9
+
10
+ fieldset {
11
+ padding: 0;
12
+ margin: 0;
13
+ border: 0;
14
+ // Chrome and Firefox set a `min-width: min-content;` on fieldsets,
15
+ // so we reset that to ensure it behaves more like a standard block element.
16
+ // See https://github.com/twbs/bootstrap/issues/12359.
17
+ min-width: 0;
18
+ }
19
+
20
+ legend {
21
+ display: block;
22
+ width: 100%;
23
+ padding: 0;
24
+ margin-bottom: $line-height-computed;
25
+ font-size: ($font-size-base * 1.5);
26
+ line-height: inherit;
27
+ color: $legend-color;
28
+ border: 0;
29
+ border-bottom: 1px solid $legend-border-color;
30
+ }
31
+
32
+ label {
33
+ display: inline-block;
34
+ max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)
35
+ margin-bottom: 5px;
36
+ font-weight: bold;
37
+ }
38
+
39
+
40
+ // Normalize form controls
41
+ //
42
+ // While most of our form styles require extra classes, some basic normalization
43
+ // is required to ensure optimum display with or without those classes to better
44
+ // address browser inconsistencies.
45
+
46
+ // Override content-box in Normalize (* isn't specific enough)
47
+ input[type="search"] {
48
+ @include box-sizing(border-box);
49
+ }
50
+
51
+ // Position radios and checkboxes better
52
+ input[type="radio"],
53
+ input[type="checkbox"] {
54
+ margin: 4px 0 0;
55
+ margin-top: 1px \9; // IE8-9
56
+ line-height: normal;
57
+ }
58
+
59
+ // Set the height of file controls to match text inputs
60
+ input[type="file"] {
61
+ display: block;
62
+ }
63
+
64
+ // Make range inputs behave like textual form controls
65
+ input[type="range"] {
66
+ display: block;
67
+ width: 100%;
68
+ }
69
+
70
+ // Make multiple select elements height not fixed
71
+ select[multiple],
72
+ select[size] {
73
+ height: auto;
74
+ }
75
+
76
+ // Focus for file, radio, and checkbox
77
+ input[type="file"]:focus,
78
+ input[type="radio"]:focus,
79
+ input[type="checkbox"]:focus {
80
+ @include tab-focus;
81
+ }
82
+
83
+ // Adjust output element
84
+ output {
85
+ display: block;
86
+ padding-top: ($padding-base-vertical + 1);
87
+ font-size: $font-size-base;
88
+ line-height: $line-height-base;
89
+ color: $input-color;
90
+ }
91
+
92
+
93
+ // Common form controls
94
+ //
95
+ // Shared size and type resets for form controls. Apply `.form-control` to any
96
+ // of the following form controls:
97
+ //
98
+ // select
99
+ // textarea
100
+ // input[type="text"]
101
+ // input[type="password"]
102
+ // input[type="datetime"]
103
+ // input[type="datetime-local"]
104
+ // input[type="date"]
105
+ // input[type="month"]
106
+ // input[type="time"]
107
+ // input[type="week"]
108
+ // input[type="number"]
109
+ // input[type="email"]
110
+ // input[type="url"]
111
+ // input[type="search"]
112
+ // input[type="tel"]
113
+ // input[type="color"]
114
+
115
+ .form-control {
116
+ display: block;
117
+ width: 100%;
118
+ height: $input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
119
+ padding: $padding-base-vertical $padding-base-horizontal;
120
+ font-size: $font-size-base;
121
+ line-height: $line-height-base;
122
+ color: $input-color;
123
+ background-color: $input-bg;
124
+ background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
125
+ border: 1px solid $input-border;
126
+ border-radius: $input-border-radius;
127
+ @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
128
+ @include transition(border-color ease-in-out .15s, box-shadow ease-in-out .15s);
129
+
130
+ // Customize the `:focus` state to imitate native WebKit styles.
131
+ @include form-control-focus;
132
+
133
+ // Placeholder
134
+ @include placeholder;
135
+
136
+ // Disabled and read-only inputs
137
+ //
138
+ // HTML5 says that controls under a fieldset > legend:first-child won't be
139
+ // disabled if the fieldset is disabled. Due to implementation difficulty, we
140
+ // don't honor that edge case; we style them as disabled anyway.
141
+ &[disabled],
142
+ &[readonly],
143
+ fieldset[disabled] & {
144
+ cursor: $cursor-disabled;
145
+ background-color: $input-bg-disabled;
146
+ opacity: 1; // iOS fix for unreadable disabled content
147
+ }
148
+
149
+ // [converter] extracted textarea& to textarea.form-control
150
+ }
151
+
152
+ // Reset height for `textarea`s
153
+ textarea.form-control {
154
+ height: auto;
155
+ }
156
+
157
+
158
+ // Search inputs in iOS
159
+ //
160
+ // This overrides the extra rounded corners on search inputs in iOS so that our
161
+ // `.form-control` class can properly style them. Note that this cannot simply
162
+ // be added to `.form-control` as it's not specific enough. For details, see
163
+ // https://github.com/twbs/bootstrap/issues/11586.
164
+
165
+ input[type="search"] {
166
+ -webkit-appearance: none;
167
+ }
168
+
169
+
170
+ // Special styles for iOS temporal inputs
171
+ //
172
+ // In Mobile Safari, setting `display: block` on temporal inputs causes the
173
+ // text within the input to become vertically misaligned. As a workaround, we
174
+ // set a pixel line-height that matches the given height of the input, but only
175
+ // for Safari.
176
+
177
+ @media screen and (-webkit-min-device-pixel-ratio: 0) {
178
+ input[type="date"],
179
+ input[type="time"],
180
+ input[type="datetime-local"],
181
+ input[type="month"] {
182
+ line-height: $input-height-base;
183
+ }
184
+ input[type="date"].input-sm,
185
+ input[type="time"].input-sm,
186
+ input[type="datetime-local"].input-sm,
187
+ input[type="month"].input-sm {
188
+ line-height: $input-height-small;
189
+ }
190
+ input[type="date"].input-lg,
191
+ input[type="time"].input-lg,
192
+ input[type="datetime-local"].input-lg,
193
+ input[type="month"].input-lg {
194
+ line-height: $input-height-large;
195
+ }
196
+ }
197
+
198
+
199
+ // Form groups
200
+ //
201
+ // Designed to help with the organization and spacing of vertical forms. For
202
+ // horizontal forms, use the predefined grid classes.
203
+
204
+ .form-group {
205
+ margin-bottom: 15px;
206
+ }
207
+
208
+
209
+ // Checkboxes and radios
210
+ //
211
+ // Indent the labels to position radios/checkboxes as hanging controls.
212
+
213
+ .radio,
214
+ .checkbox {
215
+ position: relative;
216
+ display: block;
217
+ margin-top: 10px;
218
+ margin-bottom: 10px;
219
+
220
+ label {
221
+ min-height: $line-height-computed; // Ensure the input doesn't jump when there is no text
222
+ padding-left: 20px;
223
+ margin-bottom: 0;
224
+ font-weight: normal;
225
+ cursor: pointer;
226
+ }
227
+ }
228
+ .radio input[type="radio"],
229
+ .radio-inline input[type="radio"],
230
+ .checkbox input[type="checkbox"],
231
+ .checkbox-inline input[type="checkbox"] {
232
+ position: absolute;
233
+ margin-left: -20px;
234
+ margin-top: 4px \9;
235
+ }
236
+
237
+ .radio + .radio,
238
+ .checkbox + .checkbox {
239
+ margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
240
+ }
241
+
242
+ // Radios and checkboxes on same line
243
+ .radio-inline,
244
+ .checkbox-inline {
245
+ display: inline-block;
246
+ padding-left: 20px;
247
+ margin-bottom: 0;
248
+ vertical-align: middle;
249
+ font-weight: normal;
250
+ cursor: pointer;
251
+ }
252
+ .radio-inline + .radio-inline,
253
+ .checkbox-inline + .checkbox-inline {
254
+ margin-top: 0;
255
+ margin-left: 10px; // space out consecutive inline controls
256
+ }
257
+
258
+ // Apply same disabled cursor tweak as for inputs
259
+ // Some special care is needed because <label>s don't inherit their parent's `cursor`.
260
+ //
261
+ // Note: Neither radios nor checkboxes can be readonly.
262
+ input[type="radio"],
263
+ input[type="checkbox"] {
264
+ &[disabled],
265
+ &.disabled,
266
+ fieldset[disabled] & {
267
+ cursor: $cursor-disabled;
268
+ }
269
+ }
270
+ // These classes are used directly on <label>s
271
+ .radio-inline,
272
+ .checkbox-inline {
273
+ &.disabled,
274
+ fieldset[disabled] & {
275
+ cursor: $cursor-disabled;
276
+ }
277
+ }
278
+ // These classes are used on elements with <label> descendants
279
+ .radio,
280
+ .checkbox {
281
+ &.disabled,
282
+ fieldset[disabled] & {
283
+ label {
284
+ cursor: $cursor-disabled;
285
+ }
286
+ }
287
+ }
288
+
289
+
290
+ // Static form control text
291
+ //
292
+ // Apply class to a `p` element to make any string of text align with labels in
293
+ // a horizontal form layout.
294
+
295
+ .form-control-static {
296
+ // Size it appropriately next to real form controls
297
+ padding-top: ($padding-base-vertical + 1);
298
+ padding-bottom: ($padding-base-vertical + 1);
299
+ // Remove default margin from `p`
300
+ margin-bottom: 0;
301
+
302
+ &.input-lg,
303
+ &.input-sm {
304
+ padding-left: 0;
305
+ padding-right: 0;
306
+ }
307
+ }
308
+
309
+
310
+ // Form control sizing
311
+ //
312
+ // Build on `.form-control` with modifier classes to decrease or increase the
313
+ // height and font-size of form controls.
314
+
315
+ @include input-size('.input-sm, .form-group-sm .form-control', $input-height-small, $padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $input-border-radius-small);
316
+
317
+ @include input-size('.input-lg, .form-group-lg .form-control', $input-height-large, $padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $input-border-radius-large);
318
+
319
+
320
+ // Form control feedback states
321
+ //
322
+ // Apply contextual and semantic states to individual form controls.
323
+
324
+ .has-feedback {
325
+ // Enable absolute positioning
326
+ position: relative;
327
+
328
+ // Ensure icons don't overlap text
329
+ .form-control {
330
+ padding-right: ($input-height-base * 1.25);
331
+ }
332
+ }
333
+ // Feedback icon (requires .glyphicon classes)
334
+ .form-control-feedback {
335
+ position: absolute;
336
+ top: 0;
337
+ right: 0;
338
+ z-index: 2; // Ensure icon is above input groups
339
+ display: block;
340
+ width: $input-height-base;
341
+ height: $input-height-base;
342
+ line-height: $input-height-base;
343
+ text-align: center;
344
+ pointer-events: none;
345
+ }
346
+ .input-lg + .form-control-feedback {
347
+ width: $input-height-large;
348
+ height: $input-height-large;
349
+ line-height: $input-height-large;
350
+ }
351
+ .input-sm + .form-control-feedback {
352
+ width: $input-height-small;
353
+ height: $input-height-small;
354
+ line-height: $input-height-small;
355
+ }
356
+
357
+ // Feedback states
358
+ .has-success {
359
+ @include form-control-validation($state-success-text, $state-success-text, $state-success-bg);
360
+ }
361
+ .has-warning {
362
+ @include form-control-validation($state-warning-text, $state-warning-text, $state-warning-bg);
363
+ }
364
+ .has-error {
365
+ @include form-control-validation($state-danger-text, $state-danger-text, $state-danger-bg);
366
+ }
367
+
368
+ // Reposition feedback icon if input has visible label above
369
+ .has-feedback label {
370
+
371
+ & ~ .form-control-feedback {
372
+ top: ($line-height-computed + 5); // Height of the `label` and its margin
373
+ }
374
+ &.sr-only ~ .form-control-feedback {
375
+ top: 0;
376
+ }
377
+ }
378
+
379
+
380
+ // Help text
381
+ //
382
+ // Apply to any element you wish to create light text for placement immediately
383
+ // below a form control. Use for general help, formatting, or instructional text.
384
+
385
+ .help-block {
386
+ display: block; // account for any element using help-block
387
+ margin-top: 5px;
388
+ margin-bottom: 10px;
389
+ color: lighten($text-color, 25%); // lighten the text some for contrast
390
+ }
391
+
392
+
393
+ // Inline forms
394
+ //
395
+ // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
396
+ // forms begin stacked on extra small (mobile) devices and then go inline when
397
+ // viewports reach <768px.
398
+ //
399
+ // Requires wrapping inputs and labels with `.form-group` for proper display of
400
+ // default HTML form controls and our custom form controls (e.g., input groups).
401
+ //
402
+ // Heads up! This is mixin-ed into `.navbar-form` in navbars.less.
403
+
404
+ // [converter] extracted from `.form-inline` for libsass compatibility
405
+ @mixin form-inline {
406
+
407
+ // Kick in the inline
408
+ @media (min-width: $screen-sm-min) {
409
+ // Inline-block all the things for "inline"
410
+ .form-group {
411
+ display: inline-block;
412
+ margin-bottom: 0;
413
+ vertical-align: middle;
414
+ }
415
+
416
+ // In navbar-form, allow folks to *not* use `.form-group`
417
+ .form-control {
418
+ display: inline-block;
419
+ width: auto; // Prevent labels from stacking above inputs in `.form-group`
420
+ vertical-align: middle;
421
+ }
422
+
423
+ // Make static controls behave like regular ones
424
+ .form-control-static {
425
+ display: inline-block;
426
+ }
427
+
428
+ .input-group {
429
+ display: inline-table;
430
+ vertical-align: middle;
431
+
432
+ .input-group-addon,
433
+ .input-group-btn,
434
+ .form-control {
435
+ width: auto;
436
+ }
437
+ }
438
+
439
+ // Input groups need that 100% width though
440
+ .input-group > .form-control {
441
+ width: 100%;
442
+ }
443
+
444
+ .control-label {
445
+ margin-bottom: 0;
446
+ vertical-align: middle;
447
+ }
448
+
449
+ // Remove default margin on radios/checkboxes that were used for stacking, and
450
+ // then undo the floating of radios and checkboxes to match (which also avoids
451
+ // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
452
+ .radio,
453
+ .checkbox {
454
+ display: inline-block;
455
+ margin-top: 0;
456
+ margin-bottom: 0;
457
+ vertical-align: middle;
458
+
459
+ label {
460
+ padding-left: 0;
461
+ }
462
+ }
463
+ .radio input[type="radio"],
464
+ .checkbox input[type="checkbox"] {
465
+ position: relative;
466
+ margin-left: 0;
467
+ }
468
+
469
+ // Re-override the feedback icon.
470
+ .has-feedback .form-control-feedback {
471
+ top: 0;
472
+ }
473
+ }
474
+ }
475
+ // [converter] extracted as `@mixin form-inline` for libsass compatibility
476
+ .form-inline {
477
+ @include form-inline;
478
+ }
479
+
480
+
481
+
482
+ // Horizontal forms
483
+ //
484
+ // Horizontal forms are built on grid classes and allow you to create forms with
485
+ // labels on the left and inputs on the right.
486
+
487
+ .form-horizontal {
488
+
489
+ // Consistent vertical alignment of radios and checkboxes
490
+ //
491
+ // Labels also get some reset styles, but that is scoped to a media query below.
492
+ .radio,
493
+ .checkbox,
494
+ .radio-inline,
495
+ .checkbox-inline {
496
+ margin-top: 0;
497
+ margin-bottom: 0;
498
+ padding-top: ($padding-base-vertical + 1); // Default padding plus a border
499
+ }
500
+ // Account for padding we're adding to ensure the alignment and of help text
501
+ // and other content below items
502
+ .radio,
503
+ .checkbox {
504
+ min-height: ($line-height-computed + ($padding-base-vertical + 1));
505
+ }
506
+
507
+ // Make form groups behave like rows
508
+ .form-group {
509
+ @include make-row;
510
+ }
511
+
512
+ // Reset spacing and right align labels, but scope to media queries so that
513
+ // labels on narrow viewports stack the same as a default form example.
514
+ @media (min-width: $screen-sm-min) {
515
+ .control-label {
516
+ text-align: right;
517
+ margin-bottom: 0;
518
+ padding-top: ($padding-base-vertical + 1); // Default padding plus a border
519
+ }
520
+ }
521
+
522
+ // Validation states
523
+ //
524
+ // Reposition the icon because it's now within a grid column and columns have
525
+ // `position: relative;` on them. Also accounts for the grid gutter padding.
526
+ .has-feedback .form-control-feedback {
527
+ right: ($grid-gutter-width / 2);
528
+ }
529
+
530
+ // Form group sizes
531
+ //
532
+ // Quick utility class for applying `.input-lg` and `.input-sm` styles to the
533
+ // inputs and labels within a `.form-group`.
534
+ .form-group-lg {
535
+ @media (min-width: $screen-sm-min) {
536
+ .control-label {
537
+ padding-top: (($padding-large-vertical * $line-height-large) + 1);
538
+ }
539
+ }
540
+ }
541
+ .form-group-sm {
542
+ @media (min-width: $screen-sm-min) {
543
+ .control-label {
544
+ padding-top: ($padding-small-vertical + 1);
545
+ }
546
+ }
547
+ }
548
+ }