assetable 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
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,116 @@
1
+ //
2
+ // Modals
3
+ // --------------------------------------------------
4
+
5
+ // .modal-open - body class for killing the scroll
6
+ // .modal - container to scroll within
7
+ // .modal-dialog - positioning shell for the actual modal
8
+ // .modal-content - actual modal w/ bg and corners and shit
9
+
10
+ // Kill the scroll on the body
11
+ .modal-open
12
+ overflow: hidden
13
+ // Account for hiding of scrollbar
14
+ .navbar-fixed-top,
15
+ .navbar-fixed-bottom
16
+ margin-right: 15px
17
+
18
+ body.modal-open
19
+ margin-right: 15px
20
+
21
+ // Container that the modal scrolls within
22
+ .modal
23
+ display: none
24
+ overflow: auto
25
+ overflow-y: scroll
26
+ position: fixed
27
+ top: 0
28
+ right: 0
29
+ bottom: 0
30
+ left: 0
31
+ z-index: $zindex-modal-background
32
+ // When fading in the modal, animate it to slide down
33
+ &.fade .modal-dialog
34
+ +translate(0, -25%)
35
+ +transition-transform(0.3s ease-out)
36
+ &.in .modal-dialog
37
+ +translate(0, 0)
38
+
39
+ // Shell div to position the modal with bottom padding
40
+ .modal-dialog
41
+ margin-left: auto
42
+ margin-right: auto
43
+ width: auto
44
+ padding: 10px
45
+ z-index: $zindex-modal-background + 10
46
+
47
+ // Actual modal
48
+ .modal-content
49
+ position: relative
50
+ background-color: $modal-content-bg
51
+ border: 1px solid $modal-content-fallback-border-color
52
+ //old browsers fallback (ie8 etc)
53
+ border: 1px solid $modal-content-border-color
54
+ border-radius: $border-radius-large
55
+ +box-shadow(0 3px 9px rgba(0, 0, 0, 0.5))
56
+ background-clip: padding-box
57
+ // Remove focus outline from opened modal
58
+ outline: none
59
+
60
+ // Modal background
61
+ .modal-backdrop
62
+ position: fixed
63
+ top: 0
64
+ right: 0
65
+ bottom: 0
66
+ left: 0
67
+ z-index: $zindex-modal-background - 10
68
+ background-color: $modal-backdrop-bg
69
+ // Fade for backdrop
70
+ &.fade
71
+ +opacity(0)
72
+ &.in
73
+ +opacity(0.5)
74
+
75
+ // Modal header
76
+ // Top section of the modal w/ title and dismiss
77
+ .modal-header
78
+ padding: $modal-title-padding
79
+ border-bottom: 1px solid $modal-header-border-color
80
+ min-height: $modal-title-padding + $modal-title-line-height
81
+
82
+ // Close icon
83
+ .modal-header .close
84
+ margin-top: -2px
85
+
86
+ // Title text within header
87
+ .modal-title
88
+ margin: 0
89
+ line-height: $modal-title-line-height
90
+
91
+ // Modal body
92
+ // Where all modal content resides (sibling of .modal-header and .modal-footer)
93
+ .modal-body
94
+ position: relative
95
+ padding: $modal-inner-padding
96
+
97
+ // Footer (for actions)
98
+ .modal-footer
99
+ margin-top: 15px
100
+ padding: $modal-inner-padding - 1 $modal-inner-padding $modal-inner-padding
101
+ text-align: right
102
+ // right align buttons
103
+ border-top: 1px solid $modal-footer-border-color
104
+ +clearfix
105
+ // clear it in case folks use .pull-* classes on buttons
106
+ // Properly space out buttons
107
+ .btn + .btn
108
+ margin-left: 5px
109
+ margin-bottom: 0
110
+ // account for input[type="submit"] which gets the bottom margin like all other inputs
111
+ // but override that for button groups
112
+ .btn-group .btn + .btn
113
+ margin-left: -1px
114
+ // and override it for block buttons as well
115
+ .btn-block + .btn-block
116
+ margin-left: 0
@@ -0,0 +1,91 @@
1
+ //
2
+ // Progress bars
3
+ // --------------------------------------------------
4
+
5
+ // Bar animations
6
+ // -------------------------
7
+
8
+ // Webkit
9
+ @-webkit-keyframes progress-bar-stripes
10
+ from
11
+ background-position: 40px 0
12
+ to
13
+ background-position: 0 0
14
+
15
+
16
+ // Firefox
17
+ @-moz-keyframes progress-bar-stripes
18
+ from
19
+ background-position: 40px 0
20
+ to
21
+ background-position: 0 0
22
+
23
+
24
+ // Opera
25
+ @-o-keyframes progress-bar-stripes
26
+ from
27
+ background-position: 0 0
28
+ to
29
+ background-position: 40px 0
30
+
31
+
32
+ // Spec and IE10+
33
+ @keyframes progress-bar-stripes
34
+ from
35
+ background-position: 40px 0
36
+ to
37
+ background-position: 0 0
38
+
39
+
40
+ // Bar itself
41
+ // -------------------------
42
+
43
+ // Outer container
44
+ .progress
45
+ +box-shadow(inset 0 1px 2px rgba(0, 0, 0, 0.1))
46
+ overflow: hidden
47
+ height: $progress-bar-height
48
+ margin-bottom: $progress-bar-height
49
+ background-color: $progress-bg
50
+ border-radius: $progress-bar-border-radius
51
+
52
+ // Bar of progress
53
+ .progress-bar
54
+ +box-shadow(inset 0 -1px 0 rgba(0, 0, 0, 0.15))
55
+ +transition(width 0.6s ease)
56
+ background-color: $progress-bar-bg
57
+ color: $progress-bar-color
58
+ font-size: $progress-bar-font-size
59
+ float: left
60
+ height: 100%
61
+ text-align: center
62
+ padding: 0 10px
63
+ width: 0%
64
+
65
+ // Striped bars
66
+ .progress-striped .progress-bar
67
+ +gradient-striped($progress-bar-bg)
68
+ background-size: 40px 40px
69
+
70
+ // Call animation for the active one
71
+ .progress.active .progress-bar
72
+ -webkit-animation: progress-bar-stripes 2s linear infinite
73
+ -moz-animation: progress-bar-stripes 2s linear infinite
74
+ -ms-animation: progress-bar-stripes 2s linear infinite
75
+ -o-animation: progress-bar-stripes 2s linear infinite
76
+ animation: progress-bar-stripes 2s linear infinite
77
+
78
+ // Variations
79
+ // -------------------------
80
+
81
+ .progress-bar-success
82
+ +progress-bar-variant($progress-bar-success-bg)
83
+
84
+ .progress-bar-info
85
+ +progress-bar-variant($progress-bar-info-bg)
86
+
87
+ .progress-bar-warning
88
+ +progress-bar-variant($progress-bar-warning-bg)
89
+
90
+ .progress-bar-danger
91
+ +progress-bar-variant($progress-bar-danger-bg)
@@ -0,0 +1,175 @@
1
+ //
2
+ // Uploader input and styles
3
+ // --------------------------------------------------
4
+
5
+
6
+ // Uploader general styles
7
+ .uploadable
8
+ background-color: $uploader-background-color
9
+ border: $uploader-border
10
+ border-radius: $uploader-border-radius
11
+ font-family: "Helvetica Neue", "Arial", sans-serif
12
+ line-height: 1.3
13
+ height: auto
14
+ position: relative
15
+ width: $uploader-width
16
+
17
+ // Droppable - when a file is dragged above the element
18
+ // and it becomes droppable
19
+ .droppable:not(.uploader-has-asset)
20
+ background-color: $droppable-bg
21
+
22
+ .droppable.uploader-has-asset > .uploader-directions
23
+ background-color: $droppable-bg
24
+
25
+
26
+
27
+
28
+ // Uploader directions
29
+ // -------------------------
30
+
31
+ .uploadable > .uploader-directions
32
+ color: $uploader-text-color
33
+ padding: $uploader-padding/2 $uploader-padding
34
+ text-align: center
35
+ z-index: 11
36
+
37
+ a
38
+ color: $uploader-link-color
39
+ text-decoration: none
40
+
41
+ .uploader-directions-image
42
+ background: $uploader-image center center no-repeat
43
+ height: 50px
44
+
45
+
46
+ // Uploader with an asset will not display
47
+ // the uploader directions
48
+ .uploader-has-asset .uploader-directions
49
+ background-color: #f8f8f8
50
+ border-top: $uploader-border
51
+
52
+ .uploader-directions-image
53
+ display: none
54
+
55
+ .uploader-directions-copy
56
+ font-size: $progress-bar-font-size - 2px
57
+
58
+
59
+
60
+
61
+
62
+ // Uploader queue
63
+ // -------------------------
64
+
65
+ .uploadable > .upload-queue
66
+ list-style: none
67
+ margin: 0
68
+ min-height: 1px
69
+ padding: 0
70
+ width: 100%
71
+ z-index: 12
72
+
73
+ li
74
+ +clearfix
75
+ clear: both
76
+ display: block
77
+ margin-bottom: 0
78
+ position: relative
79
+ width: 100%
80
+
81
+ span.uploader-file-name
82
+ color: $progress-bar-color
83
+ font-size: $progress-bar-font-size - 2px
84
+ left: 0
85
+ line-height: $progress-bar-height
86
+ height: $progress-bar-height
87
+ overflow: hidden
88
+ padding: 0 10px
89
+ position: absolute
90
+ top: 0
91
+
92
+
93
+
94
+
95
+
96
+ // Uploader Preview and actions
97
+ // -------------------------
98
+
99
+ .uploader-data-wrapper
100
+ +clearfix
101
+
102
+ div.uploader-preview
103
+ padding: $uploader-padding
104
+ text-align: center
105
+
106
+ &:empty
107
+ padding: 0
108
+
109
+ img
110
+ height: 150px
111
+ margin-bottom: 10px
112
+ width: 150px
113
+
114
+ span
115
+ font-size: $progress-bar-font-size
116
+
117
+ span.uploader-name
118
+ display: block
119
+ font-weight: bold
120
+ margin-bottom: 5px
121
+ word-wrap: break-word
122
+
123
+ .uploader-size-and-actions
124
+ span,
125
+ div
126
+ display: inline
127
+ font-size: $progress-bar-font-size
128
+
129
+ .uploader-actions
130
+ margin-left: 10px
131
+ text-align: center
132
+
133
+ a.btn-uploader
134
+ color: #777
135
+ margin: 0 5px
136
+ text-decoration: underline
137
+
138
+
139
+
140
+
141
+
142
+
143
+ // Gallery Uploader
144
+ // -------------------------
145
+
146
+ .gallery-uploader
147
+ padding: 0
148
+ width: 100%
149
+
150
+
151
+ .gallery-uploader .uploadar-data-wrapper
152
+ +clearfix
153
+ text-align: left
154
+
155
+ div.uploader-preview
156
+ border-right: $uploader-border
157
+ box-sizing: border-box
158
+ display: inline-block
159
+ height: 275px
160
+ max-height: 275px
161
+ width: $uploader-width
162
+ vertical-align: middle
163
+
164
+ &:hover
165
+ cursor: move
166
+
167
+
168
+ .uploader-sortable-placeholder
169
+ @extend div.uploader-preview
170
+ background-color: darken(white, 3%)
171
+ border: 3px dotted darken(white, 10%) !important
172
+
173
+
174
+ .gallery-uploader .uploader-directions
175
+ border-top: $uploader-border
@@ -0,0 +1,754 @@
1
+ //
2
+ // Mixins
3
+ // --------------------------------------------------
4
+
5
+
6
+ // Utilities
7
+ // -------------------------
8
+
9
+ // Clearfix
10
+ // Source: http://nicolasgallagher.com/micro-clearfix-hack/
11
+ //
12
+ // For modern browsers
13
+ // 1. The space content is one way to avoid an Opera bug when the
14
+ // contenteditable attribute is included anywhere else in the document.
15
+ // Otherwise it causes space to appear at the top and bottom of elements
16
+ // that are clearfixed.
17
+ // 2. The use of `table` rather than `block` is only necessary if using
18
+ // `:before` to contain the top-margins of child elements.
19
+
20
+ @mixin clearfix()
21
+ &:before,
22
+ &:after
23
+ content: " "
24
+ display: table
25
+
26
+ &:after
27
+ clear: both
28
+
29
+
30
+ // Webkit-style focus
31
+ @mixin tab-focus()
32
+ // Default
33
+ outline: thin dotted #333
34
+ // Webkit
35
+ outline: 5px auto -webkit-focus-ring-color
36
+ outline-offset: -2px
37
+
38
+ // Center-align a block level element
39
+ @mixin center-block()
40
+ display: block
41
+ margin-left: auto
42
+ margin-right: auto
43
+
44
+
45
+ // Sizing shortcuts
46
+ @mixin size($width, $height)
47
+ width: $width
48
+ height: $height
49
+
50
+ @mixin square($size)
51
+ @include size($size, $size)
52
+
53
+
54
+ // Placeholder text
55
+ @mixin placeholder($color: $input-color-placeholder)
56
+ &:-moz-placeholder
57
+ color: $color
58
+ &::-moz-placeholder
59
+ color: $color
60
+ &:-ms-input-placeholder
61
+ color: $color
62
+ &::-webkit-input-placeholder
63
+ color: $color
64
+
65
+
66
+ // Text overflow
67
+ // Requires inline-block or block for proper styling
68
+ @mixin text-overflow()
69
+ overflow: hidden
70
+ text-overflow: ellipsis
71
+ white-space: nowrap
72
+
73
+
74
+ // CSS image replacement
75
+ //
76
+ // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for
77
+ // mixins being reused as classes with the same name, this doesn't hold up. As
78
+ // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note
79
+ // that we cannot chain the mixins together in Less, so they are repeated.
80
+ //
81
+ // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
82
+
83
+ // Deprecated as of v3.0.1 (will be removed in v4)
84
+ @mixin hide-text()
85
+ font: 0/0 a
86
+ color: transparent
87
+ text-shadow: none
88
+ background-color: transparent
89
+ border: 0
90
+
91
+ // New mixin to use as of v3.0.1
92
+ @mixin text-hide()
93
+ font: 0/0 a
94
+ color: transparent
95
+ text-shadow: none
96
+ background-color: transparent
97
+ border: 0
98
+
99
+
100
+
101
+
102
+ // CSS3 PROPERTIES
103
+ // --------------------------------------------------
104
+
105
+ // Single side border-radius
106
+ @mixin border-top-radius($radius)
107
+ border-top-right-radius: $radius
108
+ border-top-left-radius: $radius
109
+
110
+ @mixin border-right-radius($radius)
111
+ border-bottom-right-radius: $radius
112
+ border-top-right-radius: $radius
113
+
114
+ @mixin border-bottom-radius($radius)
115
+ border-bottom-right-radius: $radius
116
+ border-bottom-left-radius: $radius
117
+
118
+ @mixin border-left-radius($radius)
119
+ border-bottom-left-radius: $radius
120
+ border-top-left-radius: $radius
121
+
122
+
123
+ // Drop shadows
124
+ @mixin box-shadow($shadow...)
125
+ -webkit-box-shadow: $shadow
126
+ box-shadow: $shadow
127
+
128
+
129
+ // Transitions
130
+ @mixin transition($transition...)
131
+ -webkit-transition: $transition
132
+ transition: $transition
133
+
134
+ @mixin transition-property($transition-property)
135
+ -webkit-transition-property: $transition-property
136
+ transition-property: $transition-property
137
+
138
+ @mixin transition-delay($transition-delay)
139
+ -webkit-transition-delay: $transition-delay
140
+ transition-delay: $transition-delay
141
+
142
+ @mixin transition-duration($transition-duration)
143
+ -webkit-transition-duration: $transition-duration
144
+ transition-duration: $transition-duration
145
+
146
+ @mixin transition-transform($transition...)
147
+ -webkit-transition: -webkit-transform $transition
148
+ -moz-transition: -moz-transform $transition
149
+ -o-transition: -o-transform $transition
150
+ transition: transform $transition
151
+
152
+
153
+ // Transformations
154
+ @mixin rotate($degrees)
155
+ -webkit-transform: rotate($degrees)
156
+ -ms-transform: rotate($degrees)
157
+ transform: rotate($degrees)
158
+
159
+ @mixin scale($ratio)
160
+ -webkit-transform: scale($ratio)
161
+ -ms-transform: scale($ratio)
162
+ transform: scale($ratio)
163
+
164
+ @mixin translate($x, $y)
165
+ -webkit-transform: translate($x, $y)
166
+ -ms-transform: translate($x, $y)
167
+ transform: translate($x, $y)
168
+
169
+ @mixin skew($x, $y)
170
+ -webkit-transform: skew($x, $y)
171
+ -ms-transform: skewX($x) skewY($y)
172
+ transform: skew($x, $y)
173
+
174
+ @mixin translate3d($x, $y, $z)
175
+ -webkit-transform: translate3d($x, $y, $z)
176
+ transform: translate3d($x, $y, $z)
177
+
178
+
179
+ // Backface visibility
180
+ // Prevent browsers from flickering when using CSS 3D transforms.
181
+ // Default value is `visible`, but can be changed to `hidden`
182
+ // See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples
183
+ @mixin backface-visibility($visibility)
184
+ -webkit-backface-visibility: $visibility
185
+ -moz-backface-visibility: $visibility
186
+ backface-visibility: $visibility
187
+
188
+
189
+ // Box sizing
190
+ @mixin box-sizing($boxmodel)
191
+ -webkit-box-sizing: $boxmodel
192
+ -moz-box-sizing: $boxmodel
193
+ box-sizing: $boxmodel
194
+
195
+
196
+ // User select
197
+ // For selecting text on the page
198
+ @mixin user-select($select)
199
+ -webkit-user-select: $select
200
+ -moz-user-select: $select
201
+ -ms-user-select: $select
202
+ -o-user-select: $select
203
+ user-select: $select
204
+
205
+
206
+ // Resize anything
207
+ @mixin resizable($direction)
208
+ resize: $direction
209
+ overflow: auto
210
+
211
+
212
+ // CSS3 Content Columns
213
+ @mixin content-columns($column-count, $column-gap: $grid-gutter-width)
214
+ -webkit-column-count: $column-count
215
+ -moz-column-count: $column-count
216
+ column-count: $column-count
217
+ -webkit-column-gap: $column-gap
218
+ -moz-column-gap: $column-gap
219
+ column-gap: $column-gap
220
+
221
+
222
+ // Optional hyphenation
223
+ @mixin hyphens($mode: auto)
224
+ word-wrap: break-word
225
+ -webkit-hyphens: $mode
226
+ -moz-hyphens: $mode
227
+ -ms-hyphens: $mode
228
+ -o-hyphens: $mode
229
+ hyphens: $mode
230
+
231
+
232
+ // Opacity
233
+ @mixin opacity($opacity)
234
+ opacity: $opacity
235
+ // IE8 filter
236
+ $opacity-ie: ($opacity * 100)
237
+ filter: alpha(opacity=$opacity-ie)
238
+
239
+
240
+
241
+
242
+ // GRADIENTS
243
+ // --------------------------------------------------
244
+
245
+
246
+
247
+ // Horizontal gradient, from left to right
248
+ //
249
+ // Creates two color stops, start and end, by specifying a color and position for each color stop.
250
+ // Color stops are not available in IE9 and below.
251
+ @mixin gradient-horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%)
252
+ background-image: -webkit-gradient(linear, $start-percent top, $end-percent top, from($start-color), to($end-color))
253
+ background-image: -webkit-linear-gradient(left, color-stop($start-color $start-percent), color-stop($end-color $end-percent))
254
+ background-image: -moz-linear-gradient(left, $start-color $start-percent, $end-color $end-percent)
255
+ background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent)
256
+ background-repeat: repeat-x
257
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($start-color)}, endColorstr=#{ie-hex-str($end-color)}, GradientType=1)
258
+
259
+
260
+ // Vertical gradient, from top to bottom
261
+ //
262
+ // Creates two color stops, start and end, by specifying a color and position for each color stop.
263
+ // Color stops are not available in IE9 and below.
264
+ @mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%)
265
+ background-image: -webkit-gradient(linear, left $start-percent, left $end-percent, from($start-color), to($end-color))
266
+ background-image: -webkit-linear-gradient(top, $start-color, $start-percent, $end-color, $end-percent)
267
+ background-image: -moz-linear-gradient(top, $start-color $start-percent, $end-color $end-percent)
268
+ background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent)
269
+ background-repeat: repeat-x
270
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($start-color)}, endColorstr=#{ie-hex-str($end-color)}, GradientType=0)
271
+
272
+
273
+ @mixin gradient-directional($start-color: #555, $end-color: #333, $deg: 45deg)
274
+ background-repeat: repeat-x
275
+ background-image: -webkit-linear-gradient($deg, $start-color, $end-color)
276
+ background-image: -moz-linear-gradient($deg, $start-color, $end-color)
277
+ background-image: linear-gradient($deg, $start-color, $end-color)
278
+
279
+ @mixin gradient-horizontal-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f)
280
+ background-image: -webkit-gradient(left, linear, 0 0, 0 100%, from($start-color), color-stop($color-stop, $mid-color), to($end-color))
281
+ background-image: -webkit-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color)
282
+ background-image: -moz-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color)
283
+ background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color)
284
+ background-repeat: no-repeat
285
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($start-color)}, endColorstr=#{ie-hex-str($end-color)}, GradientType=1)
286
+
287
+ @mixin gradient-vertical-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f)
288
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from($start-color), color-stop($color-stop, $mid-color), to($end-color))
289
+ background-image: -webkit-linear-gradient($start-color, $mid-color $color-stop, $end-color)
290
+ background-image: -moz-linear-gradient(top, $start-color, $mid-color $color-stop, $end-color)
291
+ background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color)
292
+ background-repeat: no-repeat
293
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($start-color)}, endColorstr=#{ie-hex-str($end-color)}, GradientType=0)
294
+
295
+ @mixin gradient-radial($inner-color: #555, $outer-color: #333)
296
+ background-image: -webkit-gradient(radial, center center, 0, center center, 460, from($inner-color), to($outer-color))
297
+ background-image: -webkit-radial-gradient(circle, $inner-color, $outer-color)
298
+ background-image: -moz-radial-gradient(circle, $inner-color, $outer-color)
299
+ background-image: radial-gradient(circle, $inner-color, $outer-color)
300
+ background-repeat: no-repeat
301
+
302
+ @mixin gradient-striped($color: #555, $angle: 45deg)
303
+ background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent))
304
+ background-image: -webkit-linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)
305
+ background-image: -moz-linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)
306
+ background-image: linear-gradient($angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)
307
+
308
+
309
+ // Reset filters for IE
310
+ //
311
+ // When you need to remove a gradient background, do not forget to use this to reset
312
+ // the IE filter for IE9 and below.
313
+ @mixin reset-filter()
314
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false)
315
+
316
+
317
+
318
+
319
+ // Retina images
320
+ //
321
+ // Short retina mixin for setting background-image and -size
322
+
323
+ @mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x)
324
+ background-image: image-url($file-1x)
325
+
326
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)
327
+ background-image: image-url($file-2x)
328
+ background-size: $width-1x $height-1x
329
+
330
+
331
+ // Responsive image
332
+ //
333
+ // Keep images from scaling beyond the width of their parents.
334
+
335
+ @mixin img-responsive($display: block)
336
+ display: $display
337
+ max-width: 100% // Part 1: Set a maximum relative to the parent
338
+ height: auto // Part 2: Scale the height according to the width, otherwise you get stretching
339
+
340
+
341
+ // COMPONENT MIXINS
342
+ // --------------------------------------------------
343
+
344
+ // Horizontal dividers
345
+ // -------------------------
346
+ // Dividers (basically an hr) within dropdowns and nav lists
347
+ @mixin nav-divider($color: #e5e5e5)
348
+ height: 1px
349
+ margin: (($line-height-computed / 2) - 1) 0
350
+ overflow: hidden
351
+ background-color: $color
352
+
353
+
354
+ // Panels
355
+ // -------------------------
356
+ @mixin panel-variant($border, $heading-text-color, $heading-bg-color, $heading-border)
357
+ border-color: $border
358
+ & > .panel-heading
359
+ color: $heading-text-color
360
+ background-color: $heading-bg-color
361
+ border-color: $heading-border
362
+ + .panel-collapse .panel-body
363
+ border-top-color: $border
364
+
365
+
366
+ & > .panel-footer
367
+ + .panel-collapse .panel-body
368
+ border-bottom-color: $border
369
+
370
+
371
+
372
+ // Alerts
373
+ // -------------------------
374
+ @mixin alert-variant($background, $border, $text-color)
375
+ background-color: $background
376
+ border-color: $border
377
+ color: $text-color
378
+ hr
379
+ border-top-color: darken($border, 5%)
380
+
381
+ .alert-link
382
+ color: darken($text-color, 10%)
383
+
384
+
385
+
386
+ // Tables
387
+ // -------------------------
388
+ @mixin table-row-variant($state, $background, $border)
389
+ // Exact selectors below required to override `.table-striped` and prevent
390
+ // inheritance to nested tables.
391
+ .table > thead > tr,
392
+ .table > tbody > tr,
393
+ .table > tfoot > tr
394
+ > td.#{$state},
395
+ > th.#{$state},
396
+ &.#{$state} > td,
397
+ &.#{$state} > th
398
+ background-color: $background
399
+ border-color: $border
400
+
401
+
402
+
403
+ // Hover states for `.table-hover`
404
+ // Note: this is not available for cells or rows within `thead` or `tfoot`.
405
+ .table-hover > tbody > tr
406
+ > td.#{$state}:hover,
407
+ > th.#{$state}:hover,
408
+ &.#{$state}:hover > td,
409
+ &.#{$state}:hover > th
410
+ background-color: darken($background, 5%)
411
+ border-color: darken($border, 5%)
412
+
413
+
414
+
415
+
416
+ // Button variants
417
+ // -------------------------
418
+ // Easily pump out default styles, as well as :hover, :focus, :active,
419
+ // and disabled options for all buttons
420
+ @mixin button-variant($color, $background, $border)
421
+ color: $color
422
+ background-color: $background
423
+ border-color: $border
424
+
425
+ &:hover,
426
+ &:focus,
427
+ &:active,
428
+ &.active
429
+ color: $color
430
+ background-color: darken($background, 8%)
431
+ border-color: darken($border, 12%)
432
+
433
+ .open &
434
+ &.dropdown-toggle
435
+ color: $color
436
+ background-color: darken($background, 8%)
437
+ border-color: darken($border, 12%)
438
+
439
+
440
+
441
+ &:active,
442
+ &.active
443
+ background-image: none
444
+
445
+ .open &
446
+ &.dropdown-toggle
447
+ background-image: none
448
+
449
+
450
+
451
+ &.disabled,
452
+ &[disabled],
453
+ fieldset[disabled] &
454
+ &,
455
+ &:hover,
456
+ &:focus,
457
+ &:active,
458
+ &.active
459
+ background-color: $background
460
+ border-color: $border
461
+
462
+
463
+
464
+
465
+ // Button sizes
466
+ // -------------------------
467
+ @mixin button-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius)
468
+ padding: $padding-vertical $padding-horizontal
469
+ font-size: $font-size
470
+ line-height: $line-height
471
+ border-radius: $border-radius
472
+
473
+
474
+ // Pagination
475
+ // -------------------------
476
+ @mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $border-radius)
477
+ > li
478
+ > a,
479
+ > span
480
+ padding: $padding-vertical $padding-horizontal
481
+ font-size: $font-size
482
+
483
+ &:first-child
484
+ > a,
485
+ > span
486
+ @include border-left-radius($border-radius)
487
+
488
+
489
+ &:last-child
490
+ > a,
491
+ > span
492
+ @include border-right-radius($border-radius)
493
+
494
+
495
+
496
+
497
+
498
+ // Labels
499
+ // -------------------------
500
+ @mixin label-variant($color)
501
+ background-color: $color
502
+ &[href]
503
+ &:hover,
504
+ &:focus
505
+ background-color: darken($color, 10%)
506
+
507
+
508
+
509
+
510
+ // Navbar vertical align
511
+ // -------------------------
512
+ // Vertically center elements in the navbar.
513
+ // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px)` to calculate the appropriate top margin.
514
+ @mixin navbar-vertical-align($element-height)
515
+ margin-top: (($navbar-height - $element-height) / 2)
516
+ margin-bottom: (($navbar-height - $element-height) / 2)
517
+
518
+
519
+ // Progress bars
520
+ // -------------------------
521
+ @mixin progress-bar-variant($color)
522
+ background-color: $color
523
+ .progress-striped &
524
+ @include gradient-striped($color)
525
+
526
+
527
+
528
+ // Responsive utilities
529
+ // -------------------------
530
+ // More easily include all the states for responsive-utilities.less.
531
+ @mixin responsive-visibility($parent)
532
+ #{$parent}
533
+ display: block !important
534
+ tr#{$parent}
535
+ display: table-row !important
536
+ th#{$parent},
537
+ td#{$parent}
538
+ display: table-cell !important
539
+
540
+
541
+ @mixin responsive-invisibility($parent)
542
+ #{$parent}
543
+ display: none !important
544
+ tr#{$parent}
545
+ display: none !important
546
+ th#{$parent},
547
+ td#{$parent}
548
+ display: none !important
549
+
550
+
551
+ // Grid System
552
+ // -----------
553
+
554
+ // Centered container element
555
+ @mixin container-fixed()
556
+ margin-right: auto
557
+ margin-left: auto
558
+ padding-left: ($grid-gutter-width / 2)
559
+ padding-right: ($grid-gutter-width / 2)
560
+ @include clearfix()
561
+
562
+
563
+ // Creates a wrapper for a series of columns
564
+ @mixin make-row($gutter: $grid-gutter-width)
565
+ margin-left: ($gutter / -2)
566
+ margin-right: ($gutter / -2)
567
+ @include clearfix()
568
+
569
+
570
+ // Generate the extra small columns
571
+ @mixin make-xs-column($columns, $gutter: $grid-gutter-width)
572
+ position: relative
573
+ float: left
574
+ width: percentage(($columns / $grid-columns))
575
+ // Prevent columns from collapsing when empty
576
+ min-height: 1px
577
+ // Inner gutter via padding
578
+ padding-left: ($gutter / 2)
579
+ padding-right: ($gutter / 2)
580
+
581
+
582
+ // Generate the small columns
583
+ @mixin make-sm-column($columns, $gutter: $grid-gutter-width)
584
+ position: relative
585
+ // Prevent columns from collapsing when empty
586
+ min-height: 1px
587
+ // Inner gutter via padding
588
+ padding-left: ($gutter / 2)
589
+ padding-right: ($gutter / 2)
590
+
591
+ // Calculate width based on number of columns available
592
+ @media (min-width: $screen-sm-min)
593
+ float: left
594
+ width: percentage(($columns / $grid-columns))
595
+
596
+
597
+
598
+ // Generate the small column offsets
599
+ @mixin make-sm-column-offset($columns)
600
+ @media (min-width: $screen-sm-min)
601
+ margin-left: percentage(($columns / $grid-columns))
602
+
603
+
604
+ @mixin make-sm-column-push($columns)
605
+ @media (min-width: $screen-sm-min)
606
+ left: percentage(($columns / $grid-columns))
607
+
608
+
609
+ @mixin make-sm-column-pull($columns)
610
+ @media (min-width: $screen-sm-min)
611
+ right: percentage(($columns / $grid-columns))
612
+
613
+
614
+
615
+ // Generate the medium columns
616
+ @mixin make-md-column($columns, $gutter: $grid-gutter-width)
617
+ position: relative
618
+ // Prevent columns from collapsing when empty
619
+ min-height: 1px
620
+ // Inner gutter via padding
621
+ padding-left: ($gutter / 2)
622
+ padding-right: ($gutter / 2)
623
+
624
+ // Calculate width based on number of columns available
625
+ @media (min-width: $screen-md-min)
626
+ float: left
627
+ width: percentage(($columns / $grid-columns))
628
+
629
+
630
+
631
+ // Generate the large column offsets
632
+ @mixin make-md-column-offset($columns)
633
+ @media (min-width: $screen-md-min)
634
+ margin-left: percentage(($columns / $grid-columns))
635
+
636
+
637
+ @mixin make-md-column-push($columns)
638
+ @media (min-width: $screen-md)
639
+ left: percentage(($columns / $grid-columns))
640
+
641
+
642
+ @mixin make-md-column-pull($columns)
643
+ @media (min-width: $screen-md-min)
644
+ right: percentage(($columns / $grid-columns))
645
+
646
+
647
+
648
+ // Generate the large columns
649
+ @mixin make-lg-column($columns, $gutter: $grid-gutter-width)
650
+ position: relative
651
+ // Prevent columns from collapsing when empty
652
+ min-height: 1px
653
+ // Inner gutter via padding
654
+ padding-left: ($gutter / 2)
655
+ padding-right: ($gutter / 2)
656
+
657
+ // Calculate width based on number of columns available
658
+ @media (min-width: $screen-lg-min)
659
+ float: left
660
+ width: percentage(($columns / $grid-columns))
661
+
662
+
663
+
664
+ // Generate the large column offsets
665
+ @mixin make-lg-column-offset($columns)
666
+ @media (min-width: $screen-lg-min)
667
+ margin-left: percentage(($columns / $grid-columns))
668
+
669
+
670
+ @mixin make-lg-column-push($columns)
671
+ @media (min-width: $screen-lg-min)
672
+ left: percentage(($columns / $grid-columns))
673
+
674
+
675
+ @mixin make-lg-column-pull($columns)
676
+ @media (min-width: $screen-lg-min)
677
+ right: percentage(($columns / $grid-columns))
678
+
679
+
680
+
681
+
682
+ // Form validation states
683
+ //
684
+ // Used in forms.less to generate the form validation CSS for warnings, errors,
685
+ // and successes.
686
+
687
+ @mixin form-control-validation($text-color: #555, $border-color: #ccc, $background-color: #f5f5f5)
688
+ // Color the label and help text
689
+ .help-block,
690
+ .control-label
691
+ color: $text-color
692
+
693
+ // Set the border and box shadow on specific inputs to match
694
+ .form-control
695
+ border-color: $border-color
696
+ @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075))
697
+ &:focus
698
+ border-color: darken($border-color, 10%)
699
+ $shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten($border-color, 20%)
700
+ @include box-shadow($shadow)
701
+
702
+
703
+ // Set validation states also for addons
704
+ .input-group-addon
705
+ color: $text-color
706
+ border-color: $border-color
707
+ background-color: $background-color
708
+
709
+
710
+
711
+ // Form control focus state
712
+ //
713
+ // Generate a customized focus state and for any input with the specified color,
714
+ // which defaults to the `$input-focus-border` variable.
715
+ //
716
+ // We highly encourage you to not customize the default value, but instead use
717
+ // this to tweak colors on an as-needed basis. This aesthetic change is based on
718
+ // WebKit's default styles, but applicable to a wider range of browsers. Its
719
+ // usability and accessibility should be taken into account with any change.
720
+ //
721
+ // Example usage: change the default blue border and shadow to white for better
722
+ // contrast against a dark gray background.
723
+
724
+ @mixin form-control-focus($color: $input-border-focus)
725
+ $color-rgba: rgba(red($color), green($color), blue($color), .6)
726
+ &:focus
727
+ border-color: $color
728
+ outline: 0
729
+ @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px $color-rgba)
730
+
731
+
732
+
733
+ // Form control sizing
734
+ //
735
+ // Relative text size, padding, and border-radii changes for form controls. For
736
+ // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
737
+ // element gets special love because it's special, and that's a fact!
738
+
739
+ @mixin input-size($parent, $input-height, $padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius)
740
+ #{$parent}
741
+ height: $input-height
742
+ padding: $padding-vertical $padding-horizontal
743
+ font-size: $font-size
744
+ line-height: $line-height
745
+ border-radius: $border-radius
746
+
747
+ select#{$parent}
748
+ height: $input-height
749
+ line-height: $input-height
750
+
751
+
752
+ textarea#{$parent}
753
+ height: auto
754
+