mtl 1.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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +104 -0
- data/Rakefile +6 -0
- data/app/assets/javascripts/mtl/clickables.coffee +25 -0
- data/app/assets/javascripts/mtl/collapsible.coffee +43 -0
- data/app/assets/javascripts/mtl/configuration.coffee.erb +1 -0
- data/app/assets/javascripts/mtl/document_modal.coffee +130 -0
- data/app/assets/javascripts/mtl/dropdown.coffee +24 -0
- data/app/assets/javascripts/mtl/hooks.coffee +14 -0
- data/app/assets/javascripts/mtl/icon.coffee.erb +17 -0
- data/app/assets/javascripts/mtl/modal.coffee +32 -0
- data/app/assets/javascripts/mtl/select.coffee +44 -0
- data/app/assets/javascripts/mtl/templates.coffee +4 -0
- data/app/assets/javascripts/mtl/toc.coffee +31 -0
- data/app/assets/javascripts/mtl.js +42 -0
- data/app/assets/stylesheets/mtl/all.scss +69 -0
- data/app/assets/stylesheets/mtl/extend/_avatars.scss +37 -0
- data/app/assets/stylesheets/mtl/extend/_buttons.scss +31 -0
- data/app/assets/stylesheets/mtl/extend/_cards.scss +21 -0
- data/app/assets/stylesheets/mtl/extend/_chips.scss +3 -0
- data/app/assets/stylesheets/mtl/extend/_collection-files.scss +108 -0
- data/app/assets/stylesheets/mtl/extend/_document-modals.scss +95 -0
- data/app/assets/stylesheets/mtl/extend/_dropdown.scss +12 -0
- data/app/assets/stylesheets/mtl/extend/_forms.scss +66 -0
- data/app/assets/stylesheets/mtl/extend/_global.scss +77 -0
- data/app/assets/stylesheets/mtl/extend/_grid.scss +25 -0
- data/app/assets/stylesheets/mtl/extend/_material-icons.scss +37 -0
- data/app/assets/stylesheets/mtl/extend/_mixins.scss +10 -0
- data/app/assets/stylesheets/mtl/extend/_roboto-rails.scss +49 -0
- data/app/assets/stylesheets/mtl/extend/_side-nav.scss +22 -0
- data/app/assets/stylesheets/mtl/extend/_toc.scss +12 -0
- data/app/assets/stylesheets/mtl/extend/_typography.scss +32 -0
- data/app/assets/stylesheets/mtl/extend/forms/_input-fields.scss +50 -0
- data/app/assets/stylesheets/mtl/layouts/_default.scss +220 -0
- data/app/assets/stylesheets/mtl/layouts/_single.scss +25 -0
- data/app/views/mtl/header.html.erb +25 -0
- data/bin/coffeelint.rb +16 -0
- data/lib/generators/mtl/install_generator.rb +20 -0
- data/lib/generators/mtl/templates/_color.scss +410 -0
- data/lib/generators/mtl/templates/_variables.scss +330 -0
- data/lib/generators/mtl/templates/mtl.scss +8 -0
- data/lib/generators/mtl/templates/simple_form.rb +211 -0
- data/lib/mtl/rails/card_file_presenter.rb +70 -0
- data/lib/mtl/rails/view_helpers.rb +412 -0
- data/lib/mtl/simple_form/suffix.rb +52 -0
- data/lib/mtl/version.rb +6 -0
- data/lib/mtl.rb +38 -0
- data/mtl.gemspec +35 -0
- data/package.json +11 -0
- data/spec/mtl/rails/card_file_presenter_spec.rb +126 -0
- data/spec/mtl/rails/view_helpers_spec.rb +193 -0
- data/spec/mtl/simple_form/suffix_spec.rb +39 -0
- data/spec/mtl_spec.rb +34 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/dom.rb +15 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.eot +0 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.ijmap +1 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.svg +2373 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.ttf +0 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.woff +0 -0
- data/vendor/assets/fonts/material-icons/MaterialIcons-Regular.woff2 +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Bold.eot +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Light.eot +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Light.ttf +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Medium.eot +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Regular.eot +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Thin.eot +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/vendor/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/vendor/assets/javascripts/lodash.js +16607 -0
- data/vendor/assets/javascripts/materialize/animation.js +9 -0
- data/vendor/assets/javascripts/materialize/buttons.js +91 -0
- data/vendor/assets/javascripts/materialize/cards.js +26 -0
- data/vendor/assets/javascripts/materialize/carousel.js +454 -0
- data/vendor/assets/javascripts/materialize/character_counter.js +72 -0
- data/vendor/assets/javascripts/materialize/chips.js +267 -0
- data/vendor/assets/javascripts/materialize/collapsible.js +160 -0
- data/vendor/assets/javascripts/materialize/date_picker/picker.date.js +1430 -0
- data/vendor/assets/javascripts/materialize/date_picker/picker.js +1123 -0
- data/vendor/assets/javascripts/materialize/dropdown.js +265 -0
- data/vendor/assets/javascripts/materialize/forms.js +681 -0
- data/vendor/assets/javascripts/materialize/global.js +45 -0
- data/vendor/assets/javascripts/materialize/hammer.min.js +1 -0
- data/vendor/assets/javascripts/materialize/init.js +173 -0
- data/vendor/assets/javascripts/materialize/initial.js +11 -0
- data/vendor/assets/javascripts/materialize/jquery.easing.1.3.js +205 -0
- data/vendor/assets/javascripts/materialize/jquery.hammer.js +33 -0
- data/vendor/assets/javascripts/materialize/jquery.timeago.min.js +1 -0
- data/vendor/assets/javascripts/materialize/leanModal.js +192 -0
- data/vendor/assets/javascripts/materialize/materialbox.js +269 -0
- data/vendor/assets/javascripts/materialize/parallax.js +58 -0
- data/vendor/assets/javascripts/materialize/prism.js +8 -0
- data/vendor/assets/javascripts/materialize/pushpin.js +71 -0
- data/vendor/assets/javascripts/materialize/scrollFire.js +48 -0
- data/vendor/assets/javascripts/materialize/scrollspy.js +283 -0
- data/vendor/assets/javascripts/materialize/sideNav.js +352 -0
- data/vendor/assets/javascripts/materialize/slider.js +321 -0
- data/vendor/assets/javascripts/materialize/tabs.js +148 -0
- data/vendor/assets/javascripts/materialize/toasts.js +136 -0
- data/vendor/assets/javascripts/materialize/tooltip.js +230 -0
- data/vendor/assets/javascripts/materialize/transitions.js +169 -0
- data/vendor/assets/javascripts/materialize/velocity.min.js +5 -0
- data/vendor/assets/javascripts/materialize/waves.js +338 -0
- data/vendor/assets/javascripts/pdfobject.js +254 -0
- data/vendor/assets/stylesheets/materialize/_buttons.scss +211 -0
- data/vendor/assets/stylesheets/materialize/_cards.scss +185 -0
- data/vendor/assets/stylesheets/materialize/_carousel.scss +85 -0
- data/vendor/assets/stylesheets/materialize/_chips.scss +74 -0
- data/vendor/assets/stylesheets/materialize/_collapsible.scss +90 -0
- data/vendor/assets/stylesheets/materialize/_color.scss +412 -0
- data/vendor/assets/stylesheets/materialize/_dropdown.scss +57 -0
- data/vendor/assets/stylesheets/materialize/_global.scss +781 -0
- data/vendor/assets/stylesheets/materialize/_grid.scss +147 -0
- data/vendor/assets/stylesheets/materialize/_icons-material-design.scss +5 -0
- data/vendor/assets/stylesheets/materialize/_materialbox.scss +42 -0
- data/vendor/assets/stylesheets/materialize/_mixins.scss +5 -0
- data/vendor/assets/stylesheets/materialize/_modal.scss +90 -0
- data/vendor/assets/stylesheets/materialize/_navbar.scss +182 -0
- data/vendor/assets/stylesheets/materialize/_normalize.scss +424 -0
- data/vendor/assets/stylesheets/materialize/_prefixer.scss +384 -0
- data/vendor/assets/stylesheets/materialize/_preloader.scss +334 -0
- data/vendor/assets/stylesheets/materialize/_roboto.scss +49 -0
- data/vendor/assets/stylesheets/materialize/_sideNav.scss +219 -0
- data/vendor/assets/stylesheets/materialize/_slider.scss +92 -0
- data/vendor/assets/stylesheets/materialize/_table_of_contents.scss +33 -0
- data/vendor/assets/stylesheets/materialize/_tabs.scss +56 -0
- data/vendor/assets/stylesheets/materialize/_toast.scss +65 -0
- data/vendor/assets/stylesheets/materialize/_tooltip.scss +32 -0
- data/vendor/assets/stylesheets/materialize/_typography.scss +61 -0
- data/vendor/assets/stylesheets/materialize/_variables.scss +313 -0
- data/vendor/assets/stylesheets/materialize/_waves.scss +177 -0
- data/vendor/assets/stylesheets/materialize/date_picker/_default.date.scss +435 -0
- data/vendor/assets/stylesheets/materialize/date_picker/_default.scss +201 -0
- data/vendor/assets/stylesheets/materialize/date_picker/_default.time.scss +125 -0
- data/vendor/assets/stylesheets/materialize/forms/_checkboxes.scss +220 -0
- data/vendor/assets/stylesheets/materialize/forms/_file-input.scss +38 -0
- data/vendor/assets/stylesheets/materialize/forms/_forms.scss +22 -0
- data/vendor/assets/stylesheets/materialize/forms/_input-fields.scss +273 -0
- data/vendor/assets/stylesheets/materialize/forms/_radio-buttons.scss +119 -0
- data/vendor/assets/stylesheets/materialize/forms/_range.scss +159 -0
- data/vendor/assets/stylesheets/materialize/forms/_select.scss +116 -0
- data/vendor/assets/stylesheets/materialize/forms/_switches.scss +78 -0
- metadata +309 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================================
|
|
3
|
+
// Materialize variables
|
|
4
|
+
// ========================================================================== */
|
|
5
|
+
//
|
|
6
|
+
// Table of Contents:
|
|
7
|
+
//
|
|
8
|
+
// 1. Colors
|
|
9
|
+
// 2. Badges
|
|
10
|
+
// 3. Buttons
|
|
11
|
+
// 4. Cards
|
|
12
|
+
// 5. Collapsible
|
|
13
|
+
// 6. Chips
|
|
14
|
+
// 7. Date Picker
|
|
15
|
+
// 8. Dropdown
|
|
16
|
+
// 10. Forms
|
|
17
|
+
//
|
|
18
|
+
// 11. Global
|
|
19
|
+
// 12. Grid
|
|
20
|
+
// 13. Navigation Bar
|
|
21
|
+
// 14. Side Navigation
|
|
22
|
+
// 15. Photo Slider
|
|
23
|
+
// 16. Spinners | Loaders
|
|
24
|
+
// 17. Tabs
|
|
25
|
+
// 18. Tables
|
|
26
|
+
// 19. Toasts
|
|
27
|
+
//
|
|
28
|
+
// 20. Typography
|
|
29
|
+
// 21. Footer
|
|
30
|
+
// 22. Flow Text
|
|
31
|
+
// 23. Collections
|
|
32
|
+
// 24. Progress Bar
|
|
33
|
+
//
|
|
34
|
+
// 99. Custom ATP/MTL Elements
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// 1. Colors ================================================================
|
|
38
|
+
|
|
39
|
+
$primary-color: color('materialize-red', 'lighten-2') !default;
|
|
40
|
+
$primary-color-light: lighten($primary-color, 15%) !default;
|
|
41
|
+
$primary-color-dark: darken($primary-color, 15%) !default;
|
|
42
|
+
|
|
43
|
+
$secondary-color: color('teal', 'lighten-1') !default;
|
|
44
|
+
$success-color: color('green', 'base') !default;
|
|
45
|
+
$error-color: color('red', 'base') !default;
|
|
46
|
+
$link-color: color('light-blue', 'darken-1') !default;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// 2. Badges ================================================================
|
|
50
|
+
|
|
51
|
+
$badge-bg-color: $secondary-color !default;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// 3. Buttons ===============================================================
|
|
55
|
+
|
|
56
|
+
// Shared styles
|
|
57
|
+
$button-border: none !default;
|
|
58
|
+
$button-background-focus: lighten($secondary-color, 4%) !default;
|
|
59
|
+
$button-font-size: 1.3rem !default;
|
|
60
|
+
$button-height: 36px !default;
|
|
61
|
+
$button-padding: 0 2rem !default;
|
|
62
|
+
$button-radius: 2px !default;
|
|
63
|
+
|
|
64
|
+
// Disabled styles
|
|
65
|
+
$button-disabled-background: color('grey', 'lighten-1') !default;
|
|
66
|
+
$button-disabled-color: color('grey', 'lighten-1') !default;
|
|
67
|
+
|
|
68
|
+
// Raised buttons
|
|
69
|
+
$button-raised-background: $secondary-color !default;
|
|
70
|
+
$button-raised-background-hover: lighten($button-raised-background, 5%) !default;
|
|
71
|
+
$button-raised-color: color('shades', 'white') !default;
|
|
72
|
+
|
|
73
|
+
// Large buttons
|
|
74
|
+
$button-large-icon-font-size: 1.6rem !default;
|
|
75
|
+
$button-large-height: $button-height * 1.5 !default;
|
|
76
|
+
|
|
77
|
+
// Flat buttons
|
|
78
|
+
$button-flat-color: #343434 !default;
|
|
79
|
+
$button-flat-disabled-color: lighten(color('grey', 'lighten-1'), 10%) !default;
|
|
80
|
+
|
|
81
|
+
// Floating buttons
|
|
82
|
+
$button-floating-background: $secondary-color !default;
|
|
83
|
+
$button-floating-background-hover: $button-floating-background !default;
|
|
84
|
+
$button-floating-color: #fff !default;
|
|
85
|
+
$button-floating-size: 37px !default;
|
|
86
|
+
$button-floating-large-size: $button-floating-size * 1.5 !default;
|
|
87
|
+
$button-floating-radius: 50% !default;
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// 4. Cards =================================================================
|
|
91
|
+
|
|
92
|
+
$card-padding: 20px !default;
|
|
93
|
+
$card-bg-color: #fff !default;
|
|
94
|
+
$card-link-color: color('orange', 'accent-2') !default;
|
|
95
|
+
$card-link-color-light: lighten($card-link-color, 20%) !default;
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// 5. Collapsible ===========================================================
|
|
99
|
+
|
|
100
|
+
$collapsible-height: 3rem !default;
|
|
101
|
+
$collapsible-header-color: #fff !default;
|
|
102
|
+
$collapsible-border-color: #ddd !default;
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// 6. Chips =================================================================
|
|
106
|
+
|
|
107
|
+
$chip-bg-color: #e4e4e4 !default;
|
|
108
|
+
$chip-border-color: #9e9e9e !default;
|
|
109
|
+
$chip-selected-color: #26a69a !default;
|
|
110
|
+
$chip-margin: 5px !default;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
// 7. Date Picker ===========================================================
|
|
114
|
+
|
|
115
|
+
$datepicker-weekday-bg: darken($secondary-color, 7%) !default;
|
|
116
|
+
$datepicker-date-bg: $secondary-color !default;
|
|
117
|
+
$datepicker-year: rgba(255, 255, 255, .4) !default;
|
|
118
|
+
$datepicker-focus: rgba(0, 0, 0, .05) !default;
|
|
119
|
+
$datepicker-selected: $secondary-color !default;
|
|
120
|
+
$datepicker-selected-outfocus: desaturate(lighten($secondary-color, 35%), 15%) !default;
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// 8. Dropdown ==============================================================
|
|
124
|
+
|
|
125
|
+
$dropdown-bg-color: #fff !default;
|
|
126
|
+
$dropdown-hover-bg-color: #eee !default;
|
|
127
|
+
$dropdown-color: $secondary-color !default;
|
|
128
|
+
$dropdown-item-height: 50px !default;
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
// 9. Fonts =================================================================
|
|
132
|
+
|
|
133
|
+
$roboto-font-path: '../fonts/roboto/' !default;
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
// 10. Forms ================================================================
|
|
137
|
+
|
|
138
|
+
// Text Inputs + Textarea
|
|
139
|
+
$input-height: 3rem !default;
|
|
140
|
+
$input-border-color: color('grey', 'base') !default;
|
|
141
|
+
$input-border: 1px solid $input-border-color !default;
|
|
142
|
+
$input-background: #fff !default;
|
|
143
|
+
$input-error-color: $error-color !default;
|
|
144
|
+
$input-success-color: $success-color !default;
|
|
145
|
+
$input-focus-color: $secondary-color !default;
|
|
146
|
+
$input-font-size: 1rem !default;
|
|
147
|
+
$input-margin: 0 0 20px 0 !default;
|
|
148
|
+
$input-padding: 0 !default;
|
|
149
|
+
$input-transition: all .3s !default;
|
|
150
|
+
$label-font-size: .8rem !default;
|
|
151
|
+
$input-disabled-color: rgba(0, 0, 0, .26) !default;
|
|
152
|
+
$input-disabled-solid-color: #bdbdbd !default;
|
|
153
|
+
$input-disabled-border: 1px dotted $input-disabled-color !default;
|
|
154
|
+
$input-invalid-border: 1px solid $input-error-color !default;
|
|
155
|
+
$placeholder-text-color: lighten($input-border-color, 20%) !default;
|
|
156
|
+
|
|
157
|
+
// Radio Buttons
|
|
158
|
+
$radio-fill-color: $secondary-color !default;
|
|
159
|
+
$radio-empty-color: #5a5a5a !default;
|
|
160
|
+
$radio-border: 2px solid $radio-fill-color !default;
|
|
161
|
+
|
|
162
|
+
// Range
|
|
163
|
+
$range-height: 14px !default;
|
|
164
|
+
$range-width: 14px !default;
|
|
165
|
+
$track-height: 3px !default;
|
|
166
|
+
|
|
167
|
+
// Select
|
|
168
|
+
$select-border: 1px solid color('grey', 'lighten-3') !default;
|
|
169
|
+
$select-background: rgba(255, 255, 255, .9) !default;
|
|
170
|
+
$select-focus: 1px solid lighten($secondary-color, 47%) !default;
|
|
171
|
+
$select-padding: 5px !default;
|
|
172
|
+
$select-radius: 2px !default;
|
|
173
|
+
$select-disabled-color: rgba(color('shades', 'black'), .3) !default;
|
|
174
|
+
|
|
175
|
+
// Switches
|
|
176
|
+
$switch-bg-color: $secondary-color !default;
|
|
177
|
+
$switch-checked-lever-bg: desaturate(lighten($secondary-color, 25%), 25%) !default;
|
|
178
|
+
$switch-unchecked-bg: #f1f1f1 !default;
|
|
179
|
+
$switch-unchecked-lever-bg: #818181 !default;
|
|
180
|
+
$switch-radius: 15px !default;
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
// 11. Global ===============================================================
|
|
184
|
+
|
|
185
|
+
// Media Query Ranges
|
|
186
|
+
$small-screen-up: 601px !default;
|
|
187
|
+
$medium-screen-up: 993px !default;
|
|
188
|
+
$large-screen-up: 1201px !default;
|
|
189
|
+
$small-screen: 600px !default;
|
|
190
|
+
$medium-screen: 992px !default;
|
|
191
|
+
$large-screen: 1200px !default;
|
|
192
|
+
|
|
193
|
+
$medium-and-up: 'only screen and (min-width : #{$small-screen-up})' !default;
|
|
194
|
+
$large-and-up: 'only screen and (min-width : #{$medium-screen-up})' !default;
|
|
195
|
+
$small-and-down: 'only screen and (max-width : #{$small-screen})' !default;
|
|
196
|
+
$medium-and-down: 'only screen and (max-width : #{$medium-screen})' !default;
|
|
197
|
+
$medium-only: 'only screen and (min-width : #{$small-screen-up}) and (max-width : #{$medium-screen})' !default;
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
// 12. Grid =================================================================
|
|
201
|
+
|
|
202
|
+
$num-cols: 12 !default;
|
|
203
|
+
$gutter-width: 1.5rem !default;
|
|
204
|
+
$element-top-margin: $gutter-width / 3 !default;
|
|
205
|
+
$element-bottom-margin: ($gutter-width * 2) / 3 !default;
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
// 13. Navigation Bar =======================================================
|
|
209
|
+
|
|
210
|
+
$navbar-height: 64px !default;
|
|
211
|
+
$navbar-height-mobile: 56px !default;
|
|
212
|
+
$navbar-font-color: #fff !default;
|
|
213
|
+
$navbar-font-size: 1rem !default;
|
|
214
|
+
$navbar-brand-font-size: 2.1rem !default;
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
// 14. Side Navigation ======================================================
|
|
218
|
+
|
|
219
|
+
$sidenav-font-size: 1rem !default;
|
|
220
|
+
$sidenav-font-color: rgba(0,0,0,.87) !default;
|
|
221
|
+
$sidenav-bg-color: #fff !default;
|
|
222
|
+
$sidenav-padding: 16px !default;
|
|
223
|
+
$sidenav-item-height: 40px !default;
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
// 15. Photo Slider =========================================================
|
|
227
|
+
|
|
228
|
+
$slider-bg-color: color('grey', 'base') !default;
|
|
229
|
+
$slider-bg-color-light: color('grey', 'lighten-2') !default;
|
|
230
|
+
$slider-indicator-color: color('green', 'base') !default;
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
// 16. Spinners | Loaders ===================================================
|
|
234
|
+
|
|
235
|
+
$spinner-default-color: $secondary-color !default;
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
// 17. Tabs =================================================================
|
|
239
|
+
|
|
240
|
+
$tabs-underline-color: $primary-color-light !default;
|
|
241
|
+
$tabs-text-color: $primary-color !default;
|
|
242
|
+
$tabs-bg-color: #fff !default;
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
// 18. Tables ===============================================================
|
|
246
|
+
|
|
247
|
+
$table-border-color: #d0d0d0 !default;
|
|
248
|
+
$table-striped-color: #f2f2f2 !default;
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
// 19. Toasts ===============================================================
|
|
252
|
+
|
|
253
|
+
$toast-height: 48px !default;
|
|
254
|
+
$toast-color: #323232 !default;
|
|
255
|
+
$toast-text-color: #fff !default;
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
// 20. Typography ===========================================================
|
|
259
|
+
|
|
260
|
+
$off-black: rgba(color('shades', 'black'), .87) !default;
|
|
261
|
+
|
|
262
|
+
// Header Styles
|
|
263
|
+
$h1-fontsize: 1.43rem !default;
|
|
264
|
+
$h2-fontsize: 1.71rem !default;
|
|
265
|
+
$h3-fontsize: 1.14rem !default;
|
|
266
|
+
$h4-fontsize: 1rem !default;
|
|
267
|
+
$h5-fontsize: .8rem !default;
|
|
268
|
+
$h6-fontsize: 1rem !default;
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
// 21. Footer ===============================================================
|
|
272
|
+
|
|
273
|
+
$footer-bg-color: $primary-color !default;
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
// 22. Flow Text ============================================================
|
|
277
|
+
|
|
278
|
+
$range: $large-screen - $small-screen !default;
|
|
279
|
+
$intervals: 20 !default;
|
|
280
|
+
$interval-size: $range / $intervals !default;
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
// 23. Collections ==========================================================
|
|
284
|
+
|
|
285
|
+
$collection-border-color: #e0e0e0 !default;
|
|
286
|
+
$collection-bg-color: #fff !default;
|
|
287
|
+
$collection-active-bg-color: $secondary-color !default;
|
|
288
|
+
$collection-active-color: lighten($secondary-color, 55%) !default;
|
|
289
|
+
$collection-hover-bg-color: #ddd !default;
|
|
290
|
+
$collection-link-color: $secondary-color !default;
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
// 24. Progress Bar =========================================================
|
|
294
|
+
|
|
295
|
+
$progress-bar-color: $secondary-color !default;
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
// 99. Custom ATP/MTL Elements =============================================
|
|
299
|
+
|
|
300
|
+
// sidenav elements
|
|
301
|
+
$mtl-sidenav-bg-active-color: color('blue', 'base') !default;
|
|
302
|
+
$mtl-sidenav-font-active-color: #fff !default;
|
|
303
|
+
|
|
304
|
+
// default layout
|
|
305
|
+
$mtl-layout-default-sidenav-width: 240px !default;
|
|
306
|
+
|
|
307
|
+
$mtl-layout-default-bg: color('grey', 'lighten-5') !default;
|
|
308
|
+
$mtl-layout-default-text: color('grey', 'darken-4') !default;
|
|
309
|
+
|
|
310
|
+
$mtl-layout-default-header-bg: color('grey', 'darken-2') !default;
|
|
311
|
+
$mtl-layout-default-header-text: color('shades', 'white') !default;
|
|
312
|
+
|
|
313
|
+
$mtl-layout-default-sidenav-bg: color('shades', 'white') !default;
|
|
314
|
+
$mtl-layout-default-sidenav-text: color('grey', 'darken-4') !default;
|
|
315
|
+
|
|
316
|
+
$mtl-layout-default-usernav-bg: color('grey', 'darken-4') !default;
|
|
317
|
+
$mtl-layout-default-usernav-text: color('shades', 'white') !default;
|
|
318
|
+
|
|
319
|
+
// single layout
|
|
320
|
+
$mtl-layout-single-bg: color('grey', 'lighten-4') !default;
|
|
321
|
+
$mtl-layout-single-header-bg: color('grey', 'lighten-2') !default;
|
|
322
|
+
|
|
323
|
+
// table of contents
|
|
324
|
+
$mtl-toc-text: color('grey', 'darken-4') !default;
|
|
325
|
+
$mtl-toc-border: $primary-color !default;
|
|
326
|
+
|
|
327
|
+
// avatar sizes
|
|
328
|
+
$mtl-avatar-size-small: 25px !default;
|
|
329
|
+
$mtl-avatar-size-medium: 32px !default;
|
|
330
|
+
$mtl-avatar-size-large: 52px !default;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
require 'mtl/simple_form/suffix'
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Patrick Lindsay
|
|
4
|
+
# https://github.com/patricklindsay/simple_form-materialize
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
# Use this setup block to configure all options available in SimpleForm.
|
|
26
|
+
SimpleForm.setup do |config|
|
|
27
|
+
# Wrappers are used by the form builder to generate a
|
|
28
|
+
# complete input. You can remove any component from the
|
|
29
|
+
# wrapper, change the order or even add your own to the
|
|
30
|
+
# stack. The options given below are used to wrap the
|
|
31
|
+
# whole input.
|
|
32
|
+
config.wrappers :material_checkbox,
|
|
33
|
+
hint_class: :field_with_hint, error_class: 'has-error' do |b|
|
|
34
|
+
b.use :input
|
|
35
|
+
b.use :label
|
|
36
|
+
|
|
37
|
+
b.use :hint, wrap_with: { tag: :span, class: 'help-block' }
|
|
38
|
+
b.use :error, wrap_with: { tag: :span, class: 'error-block' }
|
|
39
|
+
|
|
40
|
+
b.use :html5
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
config.wrappers :disabled_form do |b|
|
|
44
|
+
b.use :label
|
|
45
|
+
b.use :input, disabled: true, readonly: true
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
config.wrappers :default, class: 'input-field col s12',
|
|
49
|
+
hint_class: :field_with_hint, error_class: 'has-error' do |b|
|
|
50
|
+
## Extensions enabled by default
|
|
51
|
+
# Any of these extensions can be disabled for a
|
|
52
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
|
53
|
+
# You can make any of these extensions optional by
|
|
54
|
+
# renaming `b.use` to `b.optional`.
|
|
55
|
+
|
|
56
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
|
57
|
+
# and required attributes
|
|
58
|
+
b.use :html5
|
|
59
|
+
|
|
60
|
+
# Calculates placeholders automatically from I18n
|
|
61
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
|
62
|
+
b.use :placeholder
|
|
63
|
+
|
|
64
|
+
## Optional extensions
|
|
65
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
|
66
|
+
# to the input. If so, they will retrieve the values from the model
|
|
67
|
+
# if any exists. If you want to enable any of those
|
|
68
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
|
69
|
+
|
|
70
|
+
# Calculates maxlength from length validations for string inputs
|
|
71
|
+
b.use :maxlength
|
|
72
|
+
|
|
73
|
+
# Calculates pattern from format validations for string inputs
|
|
74
|
+
b.optional :pattern
|
|
75
|
+
|
|
76
|
+
# Calculates min and max from length validations for numeric inputs
|
|
77
|
+
b.use :min_max
|
|
78
|
+
|
|
79
|
+
# Calculates readonly automatically from readonly attributes
|
|
80
|
+
b.optional :readonly
|
|
81
|
+
|
|
82
|
+
## Inputs
|
|
83
|
+
b.use :input
|
|
84
|
+
b.use :label
|
|
85
|
+
b.optional :suffix
|
|
86
|
+
|
|
87
|
+
b.use :hint, wrap_with: { tag: :span, class: 'help-block' }
|
|
88
|
+
b.use :error, wrap_with: { tag: :span, class: 'error-block' }
|
|
89
|
+
|
|
90
|
+
## full_messages_for
|
|
91
|
+
# If you want to display the full error message for the attribute, you can
|
|
92
|
+
# use the component :full_error, like:
|
|
93
|
+
#
|
|
94
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# The default wrapper to be used by the FormBuilder.
|
|
98
|
+
config.default_wrapper = :default
|
|
99
|
+
|
|
100
|
+
# Define the way to render check boxes / radio buttons with labels.
|
|
101
|
+
# Defaults to :nested for bootstrap config.
|
|
102
|
+
# inline: input + label
|
|
103
|
+
# nested: label > input
|
|
104
|
+
config.boolean_style = :inline
|
|
105
|
+
|
|
106
|
+
# Default class for buttons
|
|
107
|
+
config.button_class = "btn #{Mtl.effects}"
|
|
108
|
+
|
|
109
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
|
110
|
+
# :first lists the first message for each field.
|
|
111
|
+
# Use :to_sentence to list all errors for each field.
|
|
112
|
+
# config.error_method = :first
|
|
113
|
+
|
|
114
|
+
# Default tag used for error notification helper.
|
|
115
|
+
config.error_notification_tag = :div
|
|
116
|
+
|
|
117
|
+
# CSS class to add for error notification helper.
|
|
118
|
+
config.error_notification_class = 'alert alert-danger'
|
|
119
|
+
|
|
120
|
+
# ID to add for error notification helper.
|
|
121
|
+
# config.error_notification_id = nil
|
|
122
|
+
|
|
123
|
+
# Series of attempts to detect a default label method for collection.
|
|
124
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
|
125
|
+
|
|
126
|
+
# Series of attempts to detect a default value method for collection.
|
|
127
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
|
128
|
+
|
|
129
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
|
130
|
+
# config.collection_wrapper_tag = nil
|
|
131
|
+
|
|
132
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
|
133
|
+
# config.collection_wrapper_class = nil
|
|
134
|
+
|
|
135
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
|
136
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
|
137
|
+
# SimpleForm will force this option to be a label.
|
|
138
|
+
config.item_wrapper_tag = :p
|
|
139
|
+
|
|
140
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
|
141
|
+
# config.item_wrapper_class = nil
|
|
142
|
+
|
|
143
|
+
# How the label text should be generated altogether with the required text.
|
|
144
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
|
145
|
+
|
|
146
|
+
# You can define the class to use on all labels. Default is nil.
|
|
147
|
+
# config.label_class = nil
|
|
148
|
+
|
|
149
|
+
# You can define the default class to be used on forms. Can be overriden
|
|
150
|
+
# with `html: { :class }`. Defaulting to none.
|
|
151
|
+
# config.default_form_class = nil
|
|
152
|
+
|
|
153
|
+
# You can define which elements should obtain additional classes
|
|
154
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
|
155
|
+
|
|
156
|
+
# Whether attributes are required by default (or not). Default is true.
|
|
157
|
+
# config.required_by_default = true
|
|
158
|
+
|
|
159
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
|
160
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
|
161
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
|
162
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
|
163
|
+
# change this configuration to true.
|
|
164
|
+
config.browser_validations = false
|
|
165
|
+
|
|
166
|
+
# Collection of methods to detect if a file type was given.
|
|
167
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
|
168
|
+
|
|
169
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
|
170
|
+
# to match as key, and the input type that will be used when the field name
|
|
171
|
+
# matches the regexp as value.
|
|
172
|
+
# config.input_mappings = { /count/ => :integer }
|
|
173
|
+
|
|
174
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
|
175
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
|
176
|
+
config.wrapper_mappings = {
|
|
177
|
+
switch: :material_checkbox
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
|
181
|
+
# override default inputs.
|
|
182
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
|
183
|
+
|
|
184
|
+
# Default priority for time_zone inputs.
|
|
185
|
+
# config.time_zone_priority = nil
|
|
186
|
+
|
|
187
|
+
# Default priority for country inputs.
|
|
188
|
+
# config.country_priority = nil
|
|
189
|
+
|
|
190
|
+
# When false, do not use translations for labels.
|
|
191
|
+
# config.translate_labels = true
|
|
192
|
+
|
|
193
|
+
# Automatically discover new inputs in Rails' autoload path.
|
|
194
|
+
# config.inputs_discovery = true
|
|
195
|
+
|
|
196
|
+
# Cache SimpleForm inputs discovery
|
|
197
|
+
# config.cache_discovery = !Rails.env.development?
|
|
198
|
+
|
|
199
|
+
# Default class for inputs
|
|
200
|
+
# config.input_class = nil
|
|
201
|
+
|
|
202
|
+
# Define the default class of the input wrapper of the boolean input.
|
|
203
|
+
config.boolean_label_class = 'checkbox'
|
|
204
|
+
|
|
205
|
+
# Defines if the default input wrapper class should be included in radio
|
|
206
|
+
# collection wrappers.
|
|
207
|
+
# config.include_default_input_wrapper_class = true
|
|
208
|
+
|
|
209
|
+
# Defines which i18n scope will be used in Simple Form.
|
|
210
|
+
# config.i18n_scope = 'simple_form'
|
|
211
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'uri'
|
|
2
|
+
|
|
3
|
+
module Mtl
|
|
4
|
+
module Rails
|
|
5
|
+
# Private
|
|
6
|
+
# Specialised renderer for the file card element used in a file collection
|
|
7
|
+
class CardFilePresenter
|
|
8
|
+
attr_reader :view
|
|
9
|
+
|
|
10
|
+
def initialize(view)
|
|
11
|
+
@view = view
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def render(filename, href, params = {})
|
|
15
|
+
params = params.reverse_merge type: File.extname(filename).delete('.')
|
|
16
|
+
|
|
17
|
+
view.link_to render_body(filename, params), href,
|
|
18
|
+
title: params[:title] || filename,
|
|
19
|
+
target: '_blank',
|
|
20
|
+
class: ['card-panel', params[:preview] ? 'card-panel-image' : nil],
|
|
21
|
+
data: data(filename, params),
|
|
22
|
+
style: if params[:preview]
|
|
23
|
+
"background-image: url(#{URI.encode(params[:preview])})"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def render_body(filename, params)
|
|
28
|
+
view.safe_join [label(filename, params[:title]), infos(params), delete(params)]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def label(filename, title = nil)
|
|
34
|
+
return filename_tag(filename) unless title
|
|
35
|
+
view.safe_join [view.content_tag(:strong, title, class: 'truncate'), filename_tag(filename)]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def filename_tag(filename)
|
|
39
|
+
view.content_tag(:span, filename, class: 'truncate')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def infos(params)
|
|
43
|
+
view.content_tag :span, icon(params[:type]) + " #{params[:type].upcase}", class: 'secondary'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def icon(type)
|
|
47
|
+
icon, icon_class = Mtl.file_icons[type.to_s.downcase] ||
|
|
48
|
+
Mtl.file_icons['other'] ||
|
|
49
|
+
[:insert_drive_file, 'blue-text']
|
|
50
|
+
view.mtl_icon(icon, class: icon_class)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def delete(params)
|
|
54
|
+
return unless params[:delete]
|
|
55
|
+
data = { method: :delete, 'mtl-href': params[:delete], confirm: params[:confirm] }
|
|
56
|
+
view.mtl_icon :close, class: 'close', data: data.reject { |_, v| v.blank? }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def data(filename, params)
|
|
60
|
+
data = params[:data] || {}
|
|
61
|
+
data.merge(modal_data(filename, params))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def modal_data(filename, params)
|
|
65
|
+
return {} unless params[:modal]
|
|
66
|
+
{ mtl_document_modal: 'open', mtl_document_name: filename }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|