wcc-styles 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/README-GEM.md +43 -0
  3. data/lib/assets/images/wcc/styles/logo-dark.png +0 -0
  4. data/lib/assets/images/wcc/styles/logo-dark.svg +19 -0
  5. data/lib/assets/images/wcc/styles/logo-text.png +0 -0
  6. data/lib/assets/images/wcc/styles/logo.png +0 -0
  7. data/lib/assets/images/wcc/styles/logo.svg +15 -0
  8. data/lib/assets/javascripts/wcc/styles/application.js +3 -0
  9. data/lib/assets/javascripts/wcc/styles/selectize.js +13 -0
  10. data/lib/assets/javascripts/wcc/styles/tessa.js.coffee +173 -0
  11. data/lib/assets/javascripts/wcc/styles/wcc.datetimepicker.js +50 -0
  12. data/lib/assets/stylesheets/wcc/styles/admin/_admin_base.scss +24 -0
  13. data/lib/assets/stylesheets/wcc/styles/admin/_all.scss +1 -0
  14. data/lib/assets/stylesheets/wcc/styles/apps/_all.scss +2 -0
  15. data/lib/assets/stylesheets/wcc/styles/apps/_events.scss +22 -0
  16. data/lib/assets/stylesheets/wcc/styles/apps/_staff.scss +151 -0
  17. data/lib/assets/stylesheets/wcc/styles/base.css.scss +90 -0
  18. data/lib/assets/stylesheets/wcc/styles/base/all.css.scss +4 -0
  19. data/lib/assets/stylesheets/wcc/styles/base/custom_file_inputs.css.scss +7 -0
  20. data/lib/assets/stylesheets/wcc/styles/base/custom_selects.css.scss +8 -0
  21. data/lib/assets/stylesheets/wcc/styles/base/icons.css.scss +2 -0
  22. data/lib/assets/stylesheets/wcc/styles/snippets/_admin.scss +0 -0
  23. data/lib/assets/stylesheets/wcc/styles/snippets/_alerts.scss +95 -0
  24. data/lib/assets/stylesheets/wcc/styles/snippets/_all.scss +12 -0
  25. data/lib/assets/stylesheets/wcc/styles/snippets/_buttons.scss +126 -0
  26. data/lib/assets/stylesheets/wcc/styles/snippets/_datetimepicker.scss +555 -0
  27. data/lib/assets/stylesheets/wcc/styles/snippets/_elements.scss +174 -0
  28. data/lib/assets/stylesheets/wcc/styles/snippets/_forms.scss +236 -0
  29. data/lib/assets/stylesheets/wcc/styles/snippets/_grid.scss +183 -0
  30. data/lib/assets/stylesheets/wcc/styles/snippets/_labels.scss +117 -0
  31. data/lib/assets/stylesheets/wcc/styles/snippets/_navs.scss +146 -0
  32. data/lib/assets/stylesheets/wcc/styles/snippets/_normalize.scss +99 -0
  33. data/lib/assets/stylesheets/wcc/styles/snippets/_pagination.scss +135 -0
  34. data/lib/assets/stylesheets/wcc/styles/snippets/_selectize.scss +361 -0
  35. data/lib/assets/stylesheets/wcc/styles/snippets/_sidebar_slideout.scss +184 -0
  36. data/lib/assets/stylesheets/wcc/styles/snippets/_tables.scss +268 -0
  37. data/lib/assets/stylesheets/wcc/styles/snippets/_top_nav.scss +278 -0
  38. data/lib/assets/stylesheets/wcc/styles/variables/_colors.scss +28 -0
  39. data/lib/assets/stylesheets/wcc/styles/variables/_mixins.scss +14 -0
  40. data/lib/assets/stylesheets/wcc/styles/variables/_typography.scss +382 -0
  41. data/lib/wcc/styles.rb +16 -0
  42. data/lib/wcc/styles/engine.rb +32 -0
  43. data/lib/wcc/styles/helpers.rb +11 -0
  44. data/lib/wcc/styles/simple_form.rb +102 -0
  45. data/lib/wcc/styles/simple_form/asset_input.rb +46 -0
  46. data/lib/wcc/styles/simple_form/date_picker_input.rb +19 -0
  47. data/lib/wcc/styles/simple_form/historical_date_input.rb +50 -0
  48. data/lib/wcc/styles/simple_form/time_picker_input.rb +32 -0
  49. data/lib/wcc/styles/version.rb +5 -0
  50. metadata +190 -0
@@ -0,0 +1,11 @@
1
+ module WCC::Styles::Helpers
2
+
3
+ def show_field_errors(model, field)
4
+ if model.errors[field].present?
5
+ content_tag(:div, class: "invalid-error") do
6
+ model.errors[field].to_sentence
7
+ end
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,102 @@
1
+ require 'wcc/styles/simple_form/asset_input'
2
+ require 'wcc/styles/simple_form/time_picker_input'
3
+ require 'wcc/styles/simple_form/date_picker_input'
4
+ require 'wcc/styles/simple_form/historical_date_input'
5
+
6
+ SimpleForm::FormBuilder.map_type :date, to: WCC::Styles::SimpleForm::DatePickerInput
7
+ SimpleForm::FormBuilder.map_type :datetime, :time, to: WCC::Styles::SimpleForm::TimePickerInput
8
+
9
+ SimpleForm.setup do |config|
10
+ config.button_class = 'button'
11
+ config.boolean_label_class = nil if config.respond_to?(:boolean_label_class=)
12
+ config.boolean_style = :inline
13
+ config.item_wrapper_tag = :div
14
+ config.label_text = lambda { |label, required, explicit_label| "#{label.to_s.titleize}" }
15
+ config.default_form_class = "simple_form row"
16
+ config.browser_validations = false
17
+
18
+ config.wrappers :watermark,
19
+ tag: 'div',
20
+ class: 'field-group',
21
+ error_class: 'invalid' do |b|
22
+
23
+ b.use :html5
24
+ b.use :min_max
25
+ b.use :maxlength
26
+ b.use :placeholder
27
+
28
+ b.optional :pattern
29
+ b.optional :readonly
30
+
31
+ b.use :label_input
32
+ b.use :error, wrap_with: { tag: 'div', class: 'field-help text-danger' }
33
+ b.use :hint, wrap_with: { tag: 'div', class: 'field-help' }
34
+ end
35
+
36
+ config.wrappers :watermark_radio_buttons,
37
+ tag: 'div',
38
+ class: 'field-group radio-buttons',
39
+ error_class: :invalid do |b|
40
+
41
+ b.use :html5
42
+ b.optional :readonly
43
+
44
+ b.use :label, wrap_with: { tag: 'div', class: 'radio-heading' }
45
+ b.use :input
46
+ b.use :error, wrap_with: { tag: 'div', class: 'field-help text-danger' }
47
+ b.use :hint, wrap_with: { tag: 'div', class: 'field-help' }
48
+ end
49
+
50
+ config.wrappers :watermark_boolean,
51
+ tag: 'div',
52
+ class: 'field-group boolean' do |b|
53
+
54
+ b.use :html5
55
+
56
+ b.wrapper class: 'checkbox', error_class: 'invalid' do |ba|
57
+ ba.use :input
58
+ ba.use :label
59
+ end
60
+ b.use :error, wrap_with: { tag: 'div', class: 'field-help text-danger' }
61
+ b.use :hint, wrap_with: { tag: 'div', class: 'field-help' }
62
+
63
+ end
64
+
65
+ config.wrappers :watermark_check_boxes,
66
+ tag: 'div',
67
+ class: 'field-group checkboxes',
68
+ error_class: 'invalid' do |b|
69
+
70
+ b.use :html5
71
+
72
+ b.use :label, wrap_with: { tag: 'div', class: 'checkbox-heading' }
73
+ b.use :input
74
+ b.use :error, wrap_with: { tag: 'div', class: 'field-help text-danger' }
75
+ b.use :hint, wrap_with: { tag: 'div', class: 'field-help' }
76
+ end
77
+
78
+ config.wrappers :watermark_select,
79
+ tag: 'div',
80
+ class: 'field-group select',
81
+ error_class: 'invalid' do |b|
82
+
83
+ b.use :html5
84
+
85
+ b.use :label
86
+ b.use :input, wrap_with: { tag: 'div', class: 'select-style selectize' }
87
+ b.use :error, wrap_with: { tag: 'div', class: 'field-help text-danger' }
88
+ b.use :hint, wrap_with: { tag: 'div', class: 'field-help' }
89
+ end
90
+
91
+ config.default_wrapper = :watermark
92
+
93
+ config.wrapper_mappings = {
94
+ check_boxes: :watermark_check_boxes,
95
+ radio_buttons: :watermark_radio_buttons,
96
+ select: :watermark_select,
97
+ boolean: :watermark_boolean,
98
+ }
99
+
100
+ config.custom_inputs_namespaces << "WCC::Styles::SimpleForm"
101
+ end
102
+
@@ -0,0 +1,46 @@
1
+ module WCC::Styles::SimpleForm
2
+ class AssetInput < SimpleForm::Inputs::Base
3
+
4
+ def input(wrapper_options=nil)
5
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
6
+ field = object.class.tessa_fields[attribute_name]
7
+
8
+ template.content_tag(
9
+ :div,
10
+ hidden_fields_for(object.public_send(attribute_name)),
11
+ "class" => "tessa-upload dropzone #{"multiple" if field.multiple?}",
12
+ "data-asset-field-prefix" => tessa_field_prefix,
13
+ "data-dropzone-options" => (options[:dropzone] || {}).to_json,
14
+ "data-tessa-params" => (options[:tessa_params] || {}).to_json,
15
+ )
16
+ end
17
+
18
+ private
19
+
20
+ def tessa_field_prefix
21
+ @tessa_field_prefix ||= "#{lookup_model_names.reduce { |str, item| "#{str}[#{item}]" }}[#{attribute_name}]"
22
+ end
23
+
24
+ def hidden_fields_for(assets)
25
+ [*assets].collect do |asset|
26
+ template.hidden_field_tag(
27
+ "#{tessa_field_prefix}[#{asset.id}][action]",
28
+ "add",
29
+ "data-meta" => meta_for_asset(asset),
30
+ "id" => "tessa_asset_action_#{asset.id}"
31
+ )
32
+ end.join.html_safe
33
+ end
34
+
35
+ def meta_for_asset(asset)
36
+ {
37
+ "assetID" => asset.id,
38
+ "name" => asset.meta[:name],
39
+ "size" => asset.meta[:size],
40
+ "mimeType" => asset.meta[:mime_type],
41
+ "url" => asset.private_url,
42
+ }.to_json
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,19 @@
1
+ module WCC::Styles::SimpleForm
2
+ class DatePickerInput < TimePickerInput
3
+
4
+ def input(*)
5
+ options[:picker] = (options[:picker] || {}).merge(
6
+ timepicker: false,
7
+ format: "MM/DD/YYYY",
8
+ )
9
+ super
10
+ end
11
+
12
+ private
13
+
14
+ def picker_format
15
+ :datepicker
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,50 @@
1
+ module WCC::Styles::SimpleForm
2
+ class HistoricalDateInput < SimpleForm::Inputs::Base
3
+
4
+ def input(wrapper_options=nil)
5
+ input_html_classes.unshift('date')
6
+ common_options = {
7
+ prefix: object_name,
8
+ prompt: "",
9
+ }.merge(merge_wrapper_options(input_html_options, wrapper_options))
10
+
11
+ template.content_tag(:div, class: "row") do
12
+ date_select_component(:month, common_options.merge(options[:month_input] || {})) +
13
+ date_select_component(:day, common_options.merge(options[:day_input] || {})) +
14
+ date_select_component(:year, common_options.merge(options[:year_input] || {}))
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def date_select_component(component, options)
21
+ template.content_tag(:div, class: "col4") do
22
+ template.content_tag(:div, class: "select-style") do
23
+ template.concat(
24
+ template.public_send(
25
+ "select_#{component}",
26
+ date,
27
+ options.merge(field_name: "#{attribute_name}(#{component_id(component)})"),
28
+ input_html_options
29
+ )
30
+ )
31
+ end
32
+ end
33
+ end
34
+
35
+ def component_id(component)
36
+ case component
37
+ when :year
38
+ "1i"
39
+ when :month
40
+ "2i"
41
+ when :day
42
+ "3i"
43
+ end
44
+ end
45
+
46
+ def date
47
+ object.public_send(attribute_name)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,32 @@
1
+ module WCC::Styles::SimpleForm
2
+ class TimePickerInput < SimpleForm::Inputs::Base
3
+
4
+ def input(wrapper_options=nil)
5
+ input_html_classes.unshift('date')
6
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
7
+
8
+ template.content_tag(:div) do
9
+ template.concat @builder.hidden_field(attribute_name, merged_input_options)
10
+ template.concat template.text_field_tag(
11
+ "datetime_picker_#{input_class}",
12
+ localize_for_picker(object.public_send(attribute_name)),
13
+ "id" => "datetime_picker_#{input_class}",
14
+ "class" => "date",
15
+ "data-datetimepicker" => "##{input_class}",
16
+ "data-datetimepicker-options" => (options[:picker] || {}).to_json,
17
+ )
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def localize_for_picker(time, format = picker_format)
24
+ time.present? ? l(time, format: format) : nil
25
+ end
26
+
27
+ def picker_format
28
+ :picker
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module WCC
2
+ module Styles
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wcc-styles
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Watermark Community Church
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: coffee-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: compass-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: font-awesome-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails-assets-selectize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails-assets-dropzone
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails-assets-moment
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rails-assets-datetimepicker
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 2.4.5
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 2.4.5
111
+ description: This gem holds a mountable engine of Watermark's base styles
112
+ email:
113
+ - dev@watermark.org
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - README-GEM.md
119
+ - lib/assets/images/wcc/styles/logo-dark.png
120
+ - lib/assets/images/wcc/styles/logo-dark.svg
121
+ - lib/assets/images/wcc/styles/logo-text.png
122
+ - lib/assets/images/wcc/styles/logo.png
123
+ - lib/assets/images/wcc/styles/logo.svg
124
+ - lib/assets/javascripts/wcc/styles/application.js
125
+ - lib/assets/javascripts/wcc/styles/selectize.js
126
+ - lib/assets/javascripts/wcc/styles/tessa.js.coffee
127
+ - lib/assets/javascripts/wcc/styles/wcc.datetimepicker.js
128
+ - lib/assets/stylesheets/wcc/styles/admin/_admin_base.scss
129
+ - lib/assets/stylesheets/wcc/styles/admin/_all.scss
130
+ - lib/assets/stylesheets/wcc/styles/apps/_all.scss
131
+ - lib/assets/stylesheets/wcc/styles/apps/_events.scss
132
+ - lib/assets/stylesheets/wcc/styles/apps/_staff.scss
133
+ - lib/assets/stylesheets/wcc/styles/base.css.scss
134
+ - lib/assets/stylesheets/wcc/styles/base/all.css.scss
135
+ - lib/assets/stylesheets/wcc/styles/base/custom_file_inputs.css.scss
136
+ - lib/assets/stylesheets/wcc/styles/base/custom_selects.css.scss
137
+ - lib/assets/stylesheets/wcc/styles/base/icons.css.scss
138
+ - lib/assets/stylesheets/wcc/styles/snippets/_admin.scss
139
+ - lib/assets/stylesheets/wcc/styles/snippets/_alerts.scss
140
+ - lib/assets/stylesheets/wcc/styles/snippets/_all.scss
141
+ - lib/assets/stylesheets/wcc/styles/snippets/_buttons.scss
142
+ - lib/assets/stylesheets/wcc/styles/snippets/_datetimepicker.scss
143
+ - lib/assets/stylesheets/wcc/styles/snippets/_elements.scss
144
+ - lib/assets/stylesheets/wcc/styles/snippets/_forms.scss
145
+ - lib/assets/stylesheets/wcc/styles/snippets/_grid.scss
146
+ - lib/assets/stylesheets/wcc/styles/snippets/_labels.scss
147
+ - lib/assets/stylesheets/wcc/styles/snippets/_navs.scss
148
+ - lib/assets/stylesheets/wcc/styles/snippets/_normalize.scss
149
+ - lib/assets/stylesheets/wcc/styles/snippets/_pagination.scss
150
+ - lib/assets/stylesheets/wcc/styles/snippets/_selectize.scss
151
+ - lib/assets/stylesheets/wcc/styles/snippets/_sidebar_slideout.scss
152
+ - lib/assets/stylesheets/wcc/styles/snippets/_tables.scss
153
+ - lib/assets/stylesheets/wcc/styles/snippets/_top_nav.scss
154
+ - lib/assets/stylesheets/wcc/styles/variables/_colors.scss
155
+ - lib/assets/stylesheets/wcc/styles/variables/_mixins.scss
156
+ - lib/assets/stylesheets/wcc/styles/variables/_typography.scss
157
+ - lib/wcc/styles.rb
158
+ - lib/wcc/styles/engine.rb
159
+ - lib/wcc/styles/helpers.rb
160
+ - lib/wcc/styles/simple_form.rb
161
+ - lib/wcc/styles/simple_form/asset_input.rb
162
+ - lib/wcc/styles/simple_form/date_picker_input.rb
163
+ - lib/wcc/styles/simple_form/historical_date_input.rb
164
+ - lib/wcc/styles/simple_form/time_picker_input.rb
165
+ - lib/wcc/styles/version.rb
166
+ homepage: https://github.com/watermarkchurch
167
+ licenses:
168
+ - Proprietary
169
+ metadata: {}
170
+ post_install_message:
171
+ rdoc_options: []
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 2.2.5
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: This gem holds a mountable engine of Watermark's base styles
190
+ test_files: []