assetable 0.1.2

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 (83) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +181 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/images/assetable/icon-upload.png +0 -0
  6. data/app/assets/images/assetable/icons/icon-ai.png +0 -0
  7. data/app/assets/images/assetable/icons/icon-css.png +0 -0
  8. data/app/assets/images/assetable/icons/icon-desmos.png +0 -0
  9. data/app/assets/images/assetable/icons/icon-doc.png +0 -0
  10. data/app/assets/images/assetable/icons/icon-document.png +0 -0
  11. data/app/assets/images/assetable/icons/icon-docx.png +0 -0
  12. data/app/assets/images/assetable/icons/icon-eps.png +0 -0
  13. data/app/assets/images/assetable/icons/icon-flash.png +0 -0
  14. data/app/assets/images/assetable/icons/icon-html.png +0 -0
  15. data/app/assets/images/assetable/icons/icon-jpg.png +0 -0
  16. data/app/assets/images/assetable/icons/icon-js.png +0 -0
  17. data/app/assets/images/assetable/icons/icon-mov.png +0 -0
  18. data/app/assets/images/assetable/icons/icon-mp3.png +0 -0
  19. data/app/assets/images/assetable/icons/icon-mp4.png +0 -0
  20. data/app/assets/images/assetable/icons/icon-pdf.png +0 -0
  21. data/app/assets/images/assetable/icons/icon-php.png +0 -0
  22. data/app/assets/images/assetable/icons/icon-png.png +0 -0
  23. data/app/assets/images/assetable/icons/icon-ppt.png +0 -0
  24. data/app/assets/images/assetable/icons/icon-pptx.png +0 -0
  25. data/app/assets/images/assetable/icons/icon-txt.png +0 -0
  26. data/app/assets/images/assetable/icons/icon-xls.png +0 -0
  27. data/app/assets/images/assetable/icons/icon-xlsx.png +0 -0
  28. data/app/assets/images/assetable/icons/icon-xml.png +0 -0
  29. data/app/assets/javascripts/assetable/asset_gallery.js.coffee +74 -0
  30. data/app/assets/javascripts/assetable/assetable_uploader.js.coffee +204 -0
  31. data/app/assets/javascripts/assetable/gallery.js.coffee +33 -0
  32. data/app/assets/javascripts/assetable/uploader.js.coffee +10 -0
  33. data/app/assets/javascripts/vendor/bootstrap-modal.js +246 -0
  34. data/app/assets/javascripts/vendor/jquery-ui-1.10.3.custom.js +2252 -0
  35. data/app/assets/stylesheets/assetable/_assetable.css.sass +9 -0
  36. data/app/assets/stylesheets/assetable/_bootstrap.css.sass +5 -0
  37. data/app/assets/stylesheets/assetable/components/_buttons.css.sass +99 -0
  38. data/app/assets/stylesheets/assetable/components/_close.css.sass +28 -0
  39. data/app/assets/stylesheets/assetable/components/_forms.css.sass +219 -0
  40. data/app/assets/stylesheets/assetable/components/_gallery.css.sass +118 -0
  41. data/app/assets/stylesheets/assetable/components/_modals.css.sass +116 -0
  42. data/app/assets/stylesheets/assetable/components/_progress.css.sass +91 -0
  43. data/app/assets/stylesheets/assetable/components/_uploader.css.sass +175 -0
  44. data/app/assets/stylesheets/assetable/core/_mixins.css.sass +754 -0
  45. data/app/assets/stylesheets/assetable/core/_utilities.css.sass +5 -0
  46. data/app/assets/stylesheets/assetable/core/_variables.css.sass +165 -0
  47. data/app/controllers/assetable/assets_controller.rb +38 -0
  48. data/app/controllers/assetable/external_services_controller.rb +36 -0
  49. data/app/models/asset.rb +53 -0
  50. data/app/models/asset_attachment.rb +4 -0
  51. data/app/models/document.rb +5 -0
  52. data/app/models/external_service.rb +14 -0
  53. data/app/models/gallery.rb +7 -0
  54. data/app/models/image.rb +5 -0
  55. data/app/models/video.rb +5 -0
  56. data/app/uploaders/document_uploader.rb +50 -0
  57. data/app/uploaders/image_uploader.rb +67 -0
  58. data/app/uploaders/video_uploader.rb +40 -0
  59. data/app/views/assetable/assets/_asset.html.haml +20 -0
  60. data/app/views/assetable/assets/_gallery.html.haml +12 -0
  61. data/app/views/assetable/external_services/new.html.haml +31 -0
  62. data/config/initializers/carrierwave.rb +6 -0
  63. data/config/initializers/gallery_input.rb +37 -0
  64. data/config/initializers/uploader_input.rb +80 -0
  65. data/config/routes.rb +8 -0
  66. data/db/migrate/20131122232735_create_assets.rb +19 -0
  67. data/db/migrate/20131123172825_create_asset_attachments.rb +15 -0
  68. data/db/migrate/20131125200943_create_galleries.rb +14 -0
  69. data/lib/assetable.rb +18 -0
  70. data/lib/assetable/config.rb +23 -0
  71. data/lib/assetable/core.rb +41 -0
  72. data/lib/assetable/engine.rb +15 -0
  73. data/lib/assetable/version.rb +3 -0
  74. data/lib/tasks/assetable_tasks.rake +4 -0
  75. data/test/fixtures/asset_attachments.yml +11 -0
  76. data/test/fixtures/assets.yml +11 -0
  77. data/test/fixtures/images.yml +11 -0
  78. data/test/fixtures/videos.yml +11 -0
  79. data/test/models/asset_attachment_test.rb +7 -0
  80. data/test/models/asset_test.rb +7 -0
  81. data/test/models/image_test.rb +7 -0
  82. data/test/models/video_test.rb +7 -0
  83. metadata +371 -0
@@ -0,0 +1,9 @@
1
+ // Core styles, functions and utilities
2
+ @import assetable/core/variables
3
+ @import assetable/core/mixins
4
+ @import assetable/core/utilities
5
+
6
+ // Primary compnents
7
+ @import assetable/components/uploader
8
+ @import assetable/components/progress
9
+ @import assetable/components/gallery
@@ -0,0 +1,5 @@
1
+ @import assetable/components/modals
2
+ @import assetable/components/close
3
+
4
+ @import assetable/components/forms
5
+ @import assetable/components/buttons
@@ -0,0 +1,99 @@
1
+ //
2
+ // Buttons
3
+ // --------------------------------------------------
4
+
5
+ // Base styles
6
+ // --------------------------------------------------
7
+
8
+ // Core styles
9
+ .btn
10
+ display: inline-block
11
+ padding: $padding-base-vertical $padding-base-horizontal
12
+ margin-bottom: 0
13
+ // For input.btn
14
+ font-size: $font-size-base
15
+ font-weight: $btn-font-weight
16
+ line-height: $line-height-base
17
+ text-align: center
18
+ vertical-align: middle
19
+ cursor: pointer
20
+ border: 1px solid transparent
21
+ border-radius: $border-radius-base
22
+ white-space: nowrap
23
+ +user-select(none)
24
+ &:focus
25
+ +tab-focus
26
+ &:hover,
27
+ &:focus
28
+ color: $btn-default-color
29
+ text-decoration: none
30
+ &:active,
31
+ &.active
32
+ outline: 0
33
+ background-image: none
34
+ +box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.125))
35
+ &.disabled,
36
+ &[disabled],
37
+ fieldset[disabled] &
38
+ cursor: not-allowed
39
+ pointer-events: none
40
+ // Future-proof disabling of clicks
41
+ +opacity(0.65)
42
+ +box-shadow(none)
43
+
44
+ // Alternate buttons
45
+ // --------------------------------------------------
46
+
47
+ .btn-default
48
+ +button-variant($btn-default-color, $btn-default-bg, $btn-default-border)
49
+
50
+ .btn-primary
51
+ +button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border)
52
+
53
+ // Warning appears as orange
54
+ .btn-warning
55
+ +button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border)
56
+
57
+ // Danger and error appear as red
58
+ .btn-danger
59
+ +button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border)
60
+
61
+ // Success appears as green
62
+ .btn-success
63
+ +button-variant($btn-success-color, $btn-success-bg, $btn-success-border)
64
+
65
+ // Info appears as blue-green
66
+ .btn-info
67
+ +button-variant($btn-info-color, $btn-info-bg, $btn-info-border)
68
+
69
+ // Link buttons
70
+ // -------------------------
71
+
72
+ // Make a button look and behave like a link
73
+ .btn-link
74
+ color: $link-color
75
+ font-weight: normal
76
+ cursor: pointer
77
+ border-radius: 0
78
+ &,
79
+ &:active,
80
+ &[disabled],
81
+ fieldset[disabled] &
82
+ background-color: transparent
83
+ +box-shadow(none)
84
+ &,
85
+ &:hover,
86
+ &:focus,
87
+ &:active
88
+ border-color: transparent
89
+ &:hover,
90
+ &:focus
91
+ color: $link-hover-color
92
+ text-decoration: underline
93
+ background-color: transparent
94
+ &[disabled],
95
+ fieldset[disabled] &
96
+ &:hover,
97
+ &:focus
98
+ color: $btn-link-disabled-color
99
+ text-decoration: none
@@ -0,0 +1,28 @@
1
+ //
2
+ // Close icons
3
+ // --------------------------------------------------
4
+
5
+ .close
6
+ float: right
7
+ font-size: $font-size-base * 1.5
8
+ font-weight: $close-font-weight
9
+ line-height: 1
10
+ color: $close-color
11
+ text-shadow: $close-text-shadow
12
+ +opacity(0.2)
13
+ &:hover,
14
+ &:focus
15
+ color: $close-color
16
+ text-decoration: none
17
+ cursor: pointer
18
+ +opacity(0.5)
19
+
20
+ // Additional properties for button version
21
+ // iOS requires the button element instead of an anchor tag.
22
+ // If you want the anchor version, it requires `href="#"`.
23
+ button.close
24
+ padding: 0
25
+ cursor: pointer
26
+ background: transparent
27
+ border: 0
28
+ -webkit-appearance: none
@@ -0,0 +1,219 @@
1
+ //
2
+ // Forms
3
+ // --------------------------------------------------
4
+
5
+ // Normalize non-controls
6
+ //
7
+ // Restyle and baseline non-control form elements.
8
+
9
+ fieldset
10
+ padding: 0
11
+ margin: 0 0 20px 0
12
+ border: 0
13
+
14
+ legend
15
+ display: block
16
+ width: 100%
17
+ padding: 0
18
+ font-size: $font-size-base * 1.5
19
+ line-height: inherit
20
+ border: 0
21
+ // border-bottom: 1px solid $legend-border-color
22
+
23
+ label,
24
+ .control-label
25
+ display: inline-block
26
+ margin-bottom: 5px
27
+ font-weight: bold
28
+
29
+ input,
30
+ button,
31
+ select,
32
+ textarea
33
+ font-family: inherit
34
+ font-size: inherit
35
+ line-height: inherit
36
+
37
+ // Normalize form controls
38
+
39
+ // Override content-box in Normalize (* isn't specific enough)
40
+ input[type="search"]
41
+ +box-sizing(border-box)
42
+
43
+ // Position radios and checkboxes better
44
+
45
+ input[type="radio"],
46
+ input[type="checkbox"]
47
+ margin: 4px 0 0
48
+ margin-top: 1px \9
49
+ line-height: normal
50
+
51
+ // Set the height of select and file controls to match text inputs
52
+ input[type="file"]
53
+ display: block
54
+
55
+ // Make multiple select elements height not fixed
56
+
57
+ select[multiple],
58
+ select[size]
59
+ height: auto
60
+
61
+ // Fix optgroup Firefox bug per https://github.com/twbs/bootstrap/issues/7611
62
+ select optgroup
63
+ font-size: inherit
64
+ font-style: inherit
65
+ font-family: inherit
66
+
67
+ // Focus for select, file, radio, and checkbox
68
+
69
+ input[type="file"]:focus,
70
+ input[type="radio"]:focus,
71
+ input[type="checkbox"]:focus
72
+ +tab-focus
73
+
74
+ // Fix for Chrome number input
75
+ // Setting certain font-sizes causes the `I` bar to appear on hover of the bottom increment button.
76
+ // See https://github.com/twbs/bootstrap/issues/8350 for more.
77
+ input[type="number"]
78
+ &::-webkit-outer-spin-button,
79
+ &::-webkit-inner-spin-button
80
+ height: auto
81
+
82
+ // Placeholder
83
+ //
84
+ // Placeholder text gets special styles because when browsers invalidate entire
85
+ // lines if it doesn't understand a selector/
86
+ .form-control
87
+ +placeholder
88
+
89
+ // Common form controls
90
+ //
91
+ // Shared size and type resets for form controls. Apply `.form-control` to any
92
+ // of the following form controls:
93
+ //
94
+ select,
95
+ textarea,
96
+ input[type="text"],
97
+ input[type="password"],
98
+ input[type="datetime"],
99
+ input[type="datetime-local"],
100
+ input[type="date"],
101
+ input[type="month"],
102
+ input[type="time"],
103
+ input[type="week"],
104
+ input[type="number"],
105
+ input[type="email"],
106
+ input[type="url"],
107
+ input[type="search"],
108
+ input[type="tel"],
109
+ input[type="color"],
110
+ .form-control
111
+ +box-sizing(border-box)
112
+ display: block
113
+ height: $input-height-base
114
+ // Make inputs at least the height of their button counterpart (base line-height + padding + border)
115
+ padding: $padding-base-vertical $padding-base-horizontal
116
+ font-size: $font-size-base
117
+ line-height: $line-height-base
118
+ color: $input-color
119
+ vertical-align: middle
120
+ background-color: $input-bg
121
+ border: 1px solid $input-border
122
+ border-radius: $input-border-radius
123
+
124
+ // Disabled and read-only inputs
125
+ // Note: HTML5 says that controls under a fieldset > legend:first-child won't
126
+ // be disabled if the fieldset is disabled. Due to implementation difficulty,
127
+ // we don't honor that edge case; we style them as disabled anyway.
128
+ &[disabled],
129
+ &[readonly],
130
+ fieldset[disabled] &
131
+ cursor: not-allowed
132
+ background-color: $input-bg-disabled
133
+
134
+ // Reset height for `textarea`s
135
+ textarea.form-control
136
+ height: auto
137
+
138
+ textarea#asset_body
139
+ height: 200px
140
+
141
+ // Form groups
142
+ //
143
+ // Designed to help with the organization and spacing of vertical forms. For
144
+ // horizontal forms, use the predefined grid classes.
145
+
146
+ .form-group
147
+ margin-bottom: 15px
148
+
149
+ // Checkboxes and radios
150
+ //
151
+ // Indent the labels to position radios/checkboxes as hanging controls.
152
+
153
+ .radio,
154
+ .checkbox,
155
+ display: block
156
+ min-height: $line-height-computed
157
+ // clear the floating input if there is no label text
158
+ margin-top: 10px
159
+ margin-bottom: 10px
160
+ padding-left: 20px
161
+ vertical-align: middle
162
+
163
+ .radio
164
+ .checkbox,
165
+ .checkbox-inline,
166
+ .radio-inline
167
+ label
168
+ display: inline
169
+ margin-bottom: 0
170
+ font-weight: normal
171
+ cursor: pointer
172
+
173
+ .radio input[type="radio"],
174
+ .radio-inline input[type="radio"],
175
+ .checkbox input[type="checkbox"],
176
+ .checkbox-inline input[type="checkbox"]
177
+ float: left
178
+ margin-left: -20px
179
+
180
+ .radio + .radio,
181
+ .checkbox + .checkbox
182
+ margin-top: -5px
183
+ // Move up sibling radios or checkboxes for tighter spacing
184
+
185
+ // Radios and checkboxes on same line
186
+
187
+ .radio-inline,
188
+ .checkbox-inline
189
+ display: inline-block
190
+ padding-left: 20px
191
+ margin-bottom: 0
192
+ vertical-align: middle
193
+ font-weight: normal
194
+ cursor: pointer
195
+
196
+ .radio-inline + .radio-inline,
197
+ .checkbox-inline + .checkbox-inline
198
+ margin-top: 0
199
+ margin-left: 10px
200
+ // space out consecutive inline controls
201
+
202
+ // Apply same disabled cursor tweak as for inputs
203
+ //
204
+ // Note: Neither radios nor checkboxes can be readonly.
205
+
206
+ input[type="radio"],
207
+ input[type="checkbox"],
208
+ .radio,
209
+ .radio-inline,
210
+ .checkbox,
211
+ .checkbox-inline
212
+ &[disabled],
213
+ fieldset[disabled] &
214
+ cursor: not-allowed
215
+
216
+
217
+ input.input-fluid
218
+ +box-sizing(border-box)
219
+ width: 100%
@@ -0,0 +1,118 @@
1
+ // Backdrop dimmer
2
+ .assetable-gallery-backdrop
3
+ background-color: rgba(0, 0, 0, .85)
4
+ left: 0
5
+ position: fixed
6
+ top: 0
7
+ height: 100%
8
+ width: 100%
9
+ z-index: 1001
10
+
11
+
12
+ // Gallery wrapper
13
+ .assetable-gallery-wrapper
14
+ +clearfix
15
+ border-radius: 2px
16
+ background: white
17
+ height: 90%
18
+ left: 5%
19
+ overflow-y: scroll
20
+ position: fixed
21
+ text-align: left
22
+ top: 5%
23
+ width: 90%
24
+ z-index: 1010
25
+
26
+
27
+
28
+
29
+
30
+ // Gallery header and footer
31
+ // -------------------------
32
+ .assetable-gallery-header,
33
+ .assetable-gallery-footer
34
+ box-sizing: border-box
35
+ padding: 10px 20px
36
+ position: absolute
37
+ width: 100%
38
+
39
+ .assetable-gallery-header
40
+ border-bottom: 1px solid #ddd
41
+ height: $assetable-gallery-header-height
42
+ top: 0
43
+
44
+ a,
45
+ h3
46
+ line-height: $assetable-gallery-header-height - 20px
47
+
48
+ a
49
+ float: right
50
+ font-size: 18px
51
+ font-weight: bold
52
+ text-decoration: none
53
+
54
+ h3
55
+ display: inline-block
56
+ margin: 0
57
+
58
+ .assetable-gallery-footer
59
+ border-top: 1px solid #ddd
60
+ height: $assetable-gallery-footer-height
61
+ bottom: 0
62
+
63
+
64
+
65
+
66
+
67
+ // Main gallery components
68
+ // -------------------------
69
+
70
+ .assetable-gallery-wrapper .assetable-gallery
71
+ +clearfix
72
+ border-left: $uploader-border
73
+ border-top: $uploader-border
74
+ display: table
75
+ padding: $assetable-gallery-header-height 0 $assetable-gallery-footer-height 0
76
+
77
+ // Preview item
78
+ div.uploader-preview
79
+ border-right: $uploader-border
80
+ border-bottom: $uploader-border
81
+ display: table-cell
82
+ float: left
83
+ box-sizing: border-box
84
+ width: $uploader-width
85
+ vertical-align: middle
86
+
87
+
88
+ @media (min-width: 1200px)
89
+ .assetable-gallery-wrapper
90
+ left: 50%
91
+ margin-left: -600px
92
+ max-width: 1200px
93
+ width: auto
94
+
95
+
96
+ .assetable-gallery > div.uploader-preview
97
+ width: 16.66666666%
98
+
99
+
100
+ @media (min-width: 992px) and (max-width: 1199px)
101
+ .assetable-gallery-wrapper
102
+ max-width: 992px
103
+ margin-left: -496px
104
+ left: 50%
105
+
106
+ .assetable-gallery > div.uploader-preview
107
+ width: 20%
108
+
109
+
110
+ @media (min-width: 768px) and (max-width: 992px)
111
+ .assetable-gallery-wrapper
112
+ max-width: 768px
113
+ margin-left: -384px
114
+ left: 50%
115
+
116
+ .assetable-gallery > div.uploader-preview
117
+ width: 25%
118
+