shipyard-framework 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/shipyard/alert_helper.rb +52 -0
  3. data/app/helpers/shipyard/button_helper.rb +34 -0
  4. data/app/helpers/shipyard/form_helper.rb +16 -0
  5. data/app/helpers/shipyard/icon_helper.rb +49 -0
  6. data/app/helpers/shipyard/layout_helper.rb +31 -0
  7. data/assets/stylesheets/shipyard/components/_alerts.sass +1 -0
  8. data/assets/stylesheets/shipyard/components/_boxes.sass +3 -0
  9. data/assets/stylesheets/shipyard/components/_tooltips.sass +1 -1
  10. data/assets/stylesheets/shipyard/core/_type.sass +4 -1
  11. data/assets/stylesheets/shipyard/utilities/_colors.sass +4 -0
  12. data/assets/stylesheets/shipyard/variables/_colors.scss +72 -9
  13. data/lib/shipyard-framework.rb +2 -0
  14. data/lib/shipyard-framework/jekyll/alert_tag.rb +20 -0
  15. data/lib/shipyard-framework/jekyll/button_tag.rb +2 -2
  16. data/lib/shipyard-framework/rails/railtie.rb +0 -14
  17. data/lib/shipyard-framework/version.rb +1 -1
  18. data/shipyard.gemspec +1 -1
  19. data/styleguide/.gitignore +3 -0
  20. data/styleguide/.nojekyll +0 -0
  21. data/styleguide/.ruby-version +1 -0
  22. data/styleguide/Gemfile +6 -0
  23. data/styleguide/Gemfile.lock +87 -0
  24. data/styleguide/_config.yml +43 -0
  25. data/styleguide/_layouts/application.html +24 -0
  26. data/styleguide/_sass/layout.sass +35 -0
  27. data/styleguide/_sass/views.sass +27 -0
  28. data/styleguide/assets/css/application.sass +8 -0
  29. data/styleguide/components/alerts.html +12 -0
  30. data/styleguide/components/boxes.html +37 -0
  31. data/styleguide/components/buttons.html +67 -0
  32. data/styleguide/components/empty-states.html +12 -0
  33. data/styleguide/components/forms.html +82 -0
  34. data/styleguide/components/grid.html +44 -0
  35. data/styleguide/components/index.html +16 -0
  36. data/styleguide/components/modals.html +15 -0
  37. data/styleguide/components/tooltips.html +19 -0
  38. data/styleguide/index.html +6 -0
  39. data/styleguide/utilities/colors.html +24 -0
  40. data/styleguide/utilities/index.html +16 -0
  41. data/styleguide/utilities/responsive.html +19 -0
  42. data/styleguide/utilities/typography.html +56 -0
  43. metadata +43 -18
  44. data/lib/shipyard-framework/rails/alert_helper.rb +0 -45
  45. data/lib/shipyard-framework/rails/button_helper.rb +0 -36
  46. data/lib/shipyard-framework/rails/form_helper.rb +0 -18
  47. data/lib/shipyard-framework/rails/icon_helper.rb +0 -51
  48. data/lib/shipyard-framework/rails/layout_helpers.rb +0 -33
@@ -1,18 +0,0 @@
1
- module Shipyard
2
- module Rails
3
- module FormHelper
4
- def input_text(name, value=nil, options={})
5
- options[:class] = "input input-text #{options[:class]}"
6
- text_field_tag name, value, options
7
- end
8
-
9
- def input_select_tag(name, choices, container_options={}, select_options={})
10
- container_options[:class] = "input-select-container #{container_options[:class]}"
11
- content_tag :div, container_options do
12
- select_options[:class] = "input input-select #{select_options[:class]}"
13
- select_tag name, choices, select_options
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,51 +0,0 @@
1
- module Shipyard
2
- module Rails
3
- module IconHelper
4
- include ActionView::Context
5
- include ActionView::Helpers::TagHelper
6
-
7
- def icon(name, options={})
8
- if name.is_a? Symbol
9
- svg = Icons.instance.find_by(symbol: name)
10
- svg_use_tag svg, options
11
- else
12
- svg = Icons.instance.find_by(id: name)
13
- svg_tag svg, options
14
- end
15
- end
16
-
17
- private
18
-
19
- def svg_options(svg, options)
20
- options[:class] = svg_classes(svg, options)
21
- options[:viewBox] ||= svg[:view_box]
22
- options[:preserveAspectRatio] ||= 'xMinYMin meet'
23
- options.delete(:prefix)
24
- options
25
- end
26
-
27
- def svg_classes(svg, options)
28
- css_classes = []
29
- css_classes << 'icon'
30
- css_classes << "icon-#{svg[:id]}"
31
- css_classes << 'icon-outline' if svg[:is_outlined] == true
32
- css_classes << "#{options[:prefix]}-icon" if options[:prefix]
33
- css_classes << "#{options[:prefix]}-icon-#{svg[:id]}" if options[:prefix]
34
- css_classes << options[:class]
35
- css_classes.join(' ').strip
36
- end
37
-
38
- def svg_use_tag(svg, options)
39
- content_tag :svg, svg_options(svg, options) do
40
- content_tag :use, nil, 'xlink:href' => Icons.instance.asset_path(svg[:id])
41
- end
42
- end
43
-
44
- def svg_tag(svg, options)
45
- html = svg[:inner_html]
46
- html = html.gsub(/class="([\s\w-]+)"/, "class=\"#{options[:prefix]}-\\1 \\1\"") if options[:prefix]
47
- content_tag :svg, raw(html), svg_options(svg, options)
48
- end
49
- end
50
- end
51
- end
@@ -1,33 +0,0 @@
1
- module Shipyard
2
- module Rails
3
- module LayoutHelpers
4
- def shipyard_css_classes
5
- css_classes = []
6
- css_classes << current_page
7
- css_classes << current_controller
8
- css_classes << "env-#{::Rails.env}"
9
- css_classes.join(' ')
10
- end
11
-
12
- def current_controller
13
- controller.controller_name.dasherize
14
- end
15
-
16
- def current_action
17
- controller.action_name.dasherize
18
- end
19
-
20
- def current_page
21
- "#{current_controller}-#{current_action}"
22
- end
23
-
24
- def current_route
25
- "#{controller.controller_name}##{controller.action_name}"
26
- end
27
-
28
- def current_route_is?(routes)
29
- routes.tr(' ', '').split(',').include? current_route
30
- end
31
- end
32
- end
33
- end