dataclips 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,53 @@
1
+ // Core variables and mixins
2
+ @import "bootstrap/variables";
3
+ @import "bootstrap/mixins";
4
+
5
+ // Reset and dependencies
6
+ @import "bootstrap/normalize";
7
+ @import "bootstrap/print";
8
+ @import "bootstrap/glyphicons";
9
+
10
+ // Core CSS
11
+ @import "bootstrap/scaffolding";
12
+ @import "bootstrap/type";
13
+ @import "bootstrap/code";
14
+ @import "bootstrap/grid";
15
+ @import "bootstrap/tables";
16
+ @import "bootstrap/forms";
17
+ @import "bootstrap/buttons";
18
+
19
+ // Components
20
+ @import "bootstrap/component-animations";
21
+ @import "bootstrap/dropdowns";
22
+ @import "bootstrap/button-groups";
23
+ @import "bootstrap/input-groups";
24
+ @import "bootstrap/navs";
25
+ @import "bootstrap/navbar";
26
+ @import "bootstrap/breadcrumbs";
27
+ @import "bootstrap/pagination";
28
+ @import "bootstrap/pager";
29
+ @import "bootstrap/labels";
30
+ @import "bootstrap/badges";
31
+ @import "bootstrap/jumbotron";
32
+ @import "bootstrap/thumbnails";
33
+ @import "bootstrap/alerts";
34
+ @import "bootstrap/progress-bars";
35
+ @import "bootstrap/media";
36
+ @import "bootstrap/list-group";
37
+ @import "bootstrap/panels";
38
+ @import "bootstrap/responsive-embed";
39
+ @import "bootstrap/wells";
40
+ @import "bootstrap/close";
41
+
42
+ // Components w/ JavaScript
43
+ @import "bootstrap/modals";
44
+ @import "bootstrap/tooltip";
45
+ @import "bootstrap/popovers";
46
+ @import "bootstrap/carousel";
47
+
48
+ // Utility classes
49
+ @import "bootstrap/utilities";
50
+ @import "bootstrap/responsive-utilities";
51
+
52
+
53
+
@@ -0,0 +1,18 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require ./_bootstrap
14
+ *= require bootstrap-datetimepicker
15
+
16
+ *= require_tree .
17
+ *= require_self
18
+ */
@@ -0,0 +1,341 @@
1
+ .slick-header.ui-state-default, .slick-headerrow.ui-state-default
2
+ width: 100%
3
+ overflow: hidden
4
+ border-left: 0px
5
+
6
+ .slick-header-columns, .slick-headerrow-columns
7
+ position: relative
8
+ white-space: nowrap
9
+ cursor: default
10
+ overflow: hidden
11
+
12
+
13
+ .slick-header-column.ui-state-default
14
+ position: relative
15
+ display: inline-block
16
+ overflow: hidden
17
+ -o-text-overflow: ellipsis
18
+ text-overflow: ellipsis
19
+ height: 16px
20
+ line-height: 16px
21
+ margin: 0
22
+ padding: 4px
23
+ border-right: 1px solid silver
24
+ border-left: 0px
25
+ border-top: 0px
26
+ border-bottom: 0px
27
+ float: left
28
+
29
+
30
+ .slick-headerrow-column.ui-state-default
31
+ padding: 4px
32
+
33
+
34
+ .slick-header-column-sorted
35
+ font-style: italic
36
+
37
+
38
+ .slick-sort-indicator
39
+ display: inline-block
40
+ width: 8px
41
+ height: 5px
42
+ margin-left: 4px
43
+ margin-top: 6px
44
+ float: left
45
+
46
+
47
+ .slick-sort-indicator-desc
48
+ background: image-url('dataclips/slickgrid/sort-desc.png')
49
+
50
+
51
+ .slick-sort-indicator-asc
52
+ background: image-url('dataclips/slickgrid/sort-asc.png')
53
+
54
+ .slick-resizable-handle
55
+ position: absolute
56
+ font-size: 0.1px
57
+ display: block
58
+ cursor: col-resize
59
+ width: 4px
60
+ right: 0px
61
+ top: 0
62
+ height: 100%
63
+
64
+
65
+ .grid-canvas
66
+ position: relative
67
+ outline: 0
68
+
69
+
70
+ .slick-row.ui-widget-content, .slick-row.ui-state-active
71
+ position: absolute
72
+ border: 0px
73
+ width: 100%
74
+
75
+
76
+ .slick-cell, .slick-headerrow-column
77
+ position: absolute
78
+ border: 1px solid transparent
79
+ border-right: 1px dotted silver
80
+ border-bottom-color: silver
81
+ overflow: hidden
82
+ -o-text-overflow: ellipsis
83
+ text-overflow: ellipsis
84
+ vertical-align: middle
85
+ z-index: 1
86
+ padding: 1px 2px 2px 1px
87
+ margin: 0
88
+ white-space: nowrap
89
+ cursor: default
90
+
91
+
92
+ .slick-group
93
+
94
+
95
+ .slick-group-toggle
96
+ display: inline-block
97
+
98
+
99
+ .slick-cell.highlighted
100
+ background: lightskyblue
101
+ background: rgba(0, 0, 255, 0.2)
102
+ -webkit-transition: all 0.5s
103
+ -moz-transition: all 0.5s
104
+ -o-transition: all 0.5s
105
+ transition: all 0.5s
106
+
107
+
108
+ .slick-cell.flashing
109
+ border: 1px solid red !important
110
+
111
+
112
+ .slick-cell.editable
113
+ z-index: 11
114
+ overflow: visible
115
+ background: white
116
+ border-color: black
117
+ border-style: solid
118
+
119
+
120
+ .slick-cell:focus
121
+ outline: none
122
+
123
+
124
+ .slick-reorder-proxy
125
+ display: inline-block
126
+ background: blue
127
+ opacity: 0.15
128
+ filter: alpha(opacity = 15)
129
+ cursor: move
130
+
131
+
132
+ .slick-reorder-guide
133
+ display: inline-block
134
+ height: 2px
135
+ background: blue
136
+ opacity: 0.7
137
+ filter: alpha(opacity = 70)
138
+
139
+
140
+ .slick-selection
141
+ z-index: 10
142
+ position: absolute
143
+ border: 2px dashed black
144
+
145
+
146
+
147
+
148
+ [class*="slickgrid"]
149
+ margin-bottom: 20px
150
+
151
+
152
+ [class*="slickgrid"] *
153
+ -webkit-box-sizing: content-box
154
+ -moz-box-sizing: content-box
155
+ box-sizing: content-box
156
+
157
+
158
+ .slick-header.ui-state-default, .slick-headerrow.ui-state-default
159
+ width: 100%
160
+ overflow: hidden
161
+ color: #505050
162
+ font-weight: bold
163
+ text-shadow: white 0 1px 0
164
+ background: gainsboro
165
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f2f2f2), color-stop(100%, #dcdcdc))
166
+ background-image: -webkit-linear-gradient(#f2f2f2, #dcdcdc)
167
+ background-image: -moz-linear-gradient(#f2f2f2, #dcdcdc)
168
+ background-image: -o-linear-gradient(#f2f2f2, #dcdcdc)
169
+ background-image: linear-gradient(#f2f2f2, #dcdcdc)
170
+ -webkit-box-shadow: rgba(255, 255, 255, 0.8) 0 1px 0 inset, rgba(0, 0, 0, 0.2) 0 1px 0
171
+ -moz-box-shadow: rgba(255, 255, 255, 0.8) 0 1px 0 inset, rgba(0, 0, 0, 0.2) 0 1px 0
172
+ box-shadow: rgba(255, 255, 255, 0.8) 0 1px 0 inset, rgba(0, 0, 0, 0.2) 0 1px 0
173
+ font-size: 11px
174
+ font-family: Menlo
175
+
176
+
177
+ .slick-header-columns, .slick-headerrow-columns
178
+ position: relative
179
+ white-space: nowrap
180
+ cursor: default
181
+ overflow: hidden
182
+
183
+
184
+ .slick-header-column.ui-state-default
185
+ position: relative
186
+ display: inline-block
187
+ overflow: hidden
188
+ text-overflow: ellipsis
189
+ height: 16px
190
+ line-height: 16px
191
+ margin: 0
192
+ padding: 10px
193
+ border-right: 1px solid silver
194
+ border-left: 0px
195
+ border-top: 0px
196
+ border-bottom: 0px
197
+ float: left
198
+
199
+
200
+ .slick-headerrow-column.ui-state-default
201
+ padding: 4px
202
+
203
+
204
+ .slick-header-column-sorted
205
+ background: #f2f2f2
206
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dcdcdc), color-stop(100%, #f2f2f2))
207
+ background-image: -webkit-linear-gradient(#dcdcdc, #f2f2f2)
208
+ background-image: -moz-linear-gradient(#dcdcdc, #f2f2f2)
209
+ background-image: -o-linear-gradient(#dcdcdc, #f2f2f2)
210
+ background-image: linear-gradient(#dcdcdc, #f2f2f2)
211
+ -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 1px inset
212
+ -moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 1px inset
213
+ box-shadow: rgba(0, 0, 0, 0.2) 0 1px 1px inset
214
+
215
+
216
+ .slick-sort-indicator
217
+ display: inline-block
218
+ width: 8px
219
+ height: 5px
220
+ margin-left: 4px
221
+
222
+
223
+ .slick-resizable-handle
224
+ position: absolute
225
+ font-size: 0.1px
226
+ display: block
227
+ cursor: col-resize
228
+ width: 4px
229
+ right: 0px
230
+ top: 0
231
+ height: 100%
232
+
233
+
234
+ .slick-header-sortable
235
+ background: gainsboro
236
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f2f2f2), color-stop(100%, #c0c0c0))
237
+ background-image: -webkit-linear-gradient(#f2f2f2, #c0c0c0)
238
+ background-image: -moz-linear-gradient(#f2f2f2, #c0c0c0)
239
+ background-image: -o-linear-gradient(#f2f2f2, #c0c0c0)
240
+ background-image: linear-gradient(#f2f2f2, #c0c0c0)
241
+
242
+
243
+ .grid-canvas
244
+ position: relative
245
+ outline: 0
246
+
247
+
248
+ .slick-row.ui-widget-content, .slick-row.ui-state-active
249
+ position: absolute
250
+ border: 0px
251
+ width: 100%
252
+
253
+ .slick-row.odd
254
+ background-color: #f5f5f5
255
+
256
+ .slick-row.active, .slick-row.selected
257
+ background-color: #e3e3e3
258
+
259
+
260
+ .slick-cell, .slick-headerrow-column
261
+ position: absolute
262
+ border: 1px solid transparent
263
+ border-right: 1px dotted silver
264
+ border-bottom-color: silver
265
+ overflow: hidden
266
+ text-overflow: ellipsis
267
+ white-space: nowrap
268
+ vertical-align: middle
269
+ z-index: 1
270
+ padding: 5px
271
+ margin: 0
272
+ cursor: default
273
+ background-color: white
274
+ background-color: rgba(255, 255, 255, 0.5)
275
+
276
+
277
+ .slick-group-toggle
278
+ display: inline-block
279
+
280
+
281
+ .slick-cell
282
+ font-size: 11px
283
+ font-family: Menlo
284
+
285
+ .slick-cell.highlighted
286
+ background: lightskyblue
287
+ background: rgba(0, 0, 255, 0.2)
288
+ -webkit-transition: all 0.5s
289
+ -moz-transition: all 0.5s
290
+ transition: all 0.5s
291
+
292
+ .slick-cell.flashing
293
+ border: 1px solid red !important
294
+
295
+ .slick-cell:focus
296
+ outline: none
297
+
298
+ .slick-cell.integer, .slick-cell.float, .slick-cell.email
299
+ text-align: right
300
+ color: darkblue
301
+
302
+
303
+ .slick-cell.date, .slick-cell.time, .slick-cell.datetime
304
+ text-align: right
305
+ color: darkgreen
306
+
307
+
308
+ .slick-cell.boolean
309
+ text-align: center
310
+
311
+
312
+ .slick-reorder-proxy
313
+ display: inline-block
314
+ background: blue
315
+ opacity: 0.15
316
+ filter: alpha(opacity=15)
317
+ cursor: move
318
+
319
+
320
+ .slick-reorder-guide
321
+ display: inline-block
322
+ height: 2px
323
+ background: blue
324
+ opacity: 0.7
325
+ filter: alpha(opacity=70)
326
+
327
+
328
+ .slick-selection
329
+ z-index: 10
330
+ position: absolute
331
+ border: 2px dashed black
332
+
333
+
334
+ #grid
335
+ background-color: #fff
336
+ border: 1px solid #c0c0c0
337
+
338
+
339
+
340
+
341
+
@@ -0,0 +1,31 @@
1
+ require "csv"
2
+
3
+ module Dataclips
4
+ class ApplicationController < ActionController::Base
5
+ include ActionView::Helpers::NumberHelper
6
+ protected
7
+
8
+ def initialize_clip(clip_id)
9
+ @klass = "Dataclips::#{clip_id.camelize}".constantize
10
+ @schema = @klass.schema
11
+ @variables = @klass.variables
12
+ end
13
+
14
+ def localize_headers(clip_id, keys)
15
+ keys.inject({}) do |memo, key|
16
+ memo[key] = I18n.t("#{clip_id}.schema.#{key}", scope: "dataclips", default: key.to_s.humanize)
17
+ memo
18
+ end
19
+ end
20
+
21
+ def process_json(clip, page = 1)
22
+ records = clip.paginate(params[:page] || 1)
23
+ render json: {
24
+ page: records.current_page,
25
+ total_pages: records.total_pages,
26
+ total_entries: records.total_entries,
27
+ records: records
28
+ }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,46 @@
1
+ module Dataclips
2
+ class ClipsController < ApplicationController
3
+ def show
4
+ @clip_id = params[:clip_id]
5
+
6
+ begin
7
+ initialize_clip(@clip_id)
8
+ rescue
9
+ raise ActionController::RoutingError.new('Not Found')
10
+ end
11
+
12
+ @headers = localize_headers(@clip_id, @schema.keys)
13
+
14
+ @clip = @klass.new params.slice(*@variables.keys)
15
+
16
+ respond_to do |format|
17
+ format.html do
18
+ begin
19
+ require_parameters
20
+ rescue ActionController::ParameterMissing => e
21
+ @error = e
22
+ render :edit
23
+ end
24
+ end
25
+
26
+ format.json do
27
+ begin
28
+ process_json(@clip, params[:page])
29
+ rescue ActiveRecord::StatementInvalid => e
30
+ render json: e.message, status: :unprocessable_entity
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ def edit; end
37
+
38
+ private
39
+
40
+ def require_parameters
41
+ @variables.keys.map(&:to_sym).each do |variable|
42
+ params.require(variable)
43
+ end
44
+ end
45
+ end
46
+ end