voom-presenters 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +4 -1
  4. data/app/demo/components/badges.pom +2 -1
  5. data/app/demo/components/buttons.pom +13 -1
  6. data/app/demo/components/cards.pom +1 -3
  7. data/app/demo/components/chips.pom +1 -2
  8. data/app/demo/components/date_fields.pom +1 -1
  9. data/app/demo/components/datetime_fields.pom +1 -1
  10. data/app/demo/components/dialogs.pom +1 -2
  11. data/app/demo/components/drawers.pom +1 -0
  12. data/app/demo/components/expansion_panels.pom +2 -3
  13. data/app/demo/components/fabs-mini.pom +1 -2
  14. data/app/demo/components/fabs.pom +1 -1
  15. data/app/demo/components/forms.pom +1 -0
  16. data/app/demo/components/headers.pom +4 -5
  17. data/app/demo/components/hidden_fields.pom +1 -3
  18. data/app/demo/components/icons.pom +1 -1
  19. data/app/demo/components/layouts.pom +1 -1
  20. data/app/demo/components/lists.pom +1 -2
  21. data/app/demo/components/menus.pom +1 -1
  22. data/app/demo/components/selects.pom +1 -2
  23. data/app/demo/components/snackbar.pom +1 -0
  24. data/app/demo/components/tables.pom +1 -2
  25. data/app/demo/components/text_areas.pom +1 -2
  26. data/app/demo/components/text_fields.pom +1 -2
  27. data/app/demo/components/time_fields.pom +1 -1
  28. data/app/demo/components/toggles.pom +1 -2
  29. data/app/demo/components/tooltips.pom +2 -3
  30. data/app/demo/components.pom +1 -1
  31. data/app/demo/nav/top_nav.pom +1 -1
  32. data/app/demo/styles.pom +3 -0
  33. data/lib/voom/presenters/dsl/components/button.rb +5 -0
  34. data/lib/voom/presenters/dsl/components/content.rb +2 -0
  35. data/lib/voom/presenters/dsl/components/dialog.rb +2 -0
  36. data/lib/voom/presenters/dsl/components/header.rb +13 -24
  37. data/lib/voom/presenters/dsl/components/menu.rb +17 -1
  38. data/lib/voom/presenters/dsl/components/mixins/typography.rb +4 -0
  39. data/lib/voom/presenters/dsl/components/typography.rb +7 -0
  40. data/lib/voom/presenters/helpers/rails.rb +1 -1
  41. data/lib/voom/presenters/version.rb +1 -1
  42. data/public/bundle.css +24 -7
  43. data/public/bundle.js +6 -4
  44. data/views/mdc/assets/js/components/menus.js +3 -1
  45. data/views/mdc/assets/scss/components/button.scss +16 -0
  46. data/views/mdc/assets/scss/theme.scss +10 -7
  47. data/views/mdc/body/header.erb +12 -12
  48. data/views/mdc/components/button.erb +9 -0
  49. data/views/mdc/components/buttons/button.erb +4 -2
  50. data/views/mdc/components/buttons/fab.erb +0 -6
  51. data/views/mdc/components/buttons/icon.erb +0 -7
  52. data/views/mdc/components/buttons/image.erb +19 -0
  53. data/views/mdc/components/list/menu.erb +1 -1
  54. data/views/mdc/components/menu.erb +13 -1
  55. data/views/mdc/components/page_title.erb +4 -0
  56. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae9fe537c82c38d72bd3c5b1b8b4039fa1eda4acb8e239d99606fae2e863b54a
4
- data.tar.gz: 5bf2378799b7c857993bb311d6c011620fcfc91d57279c11c8294485af6a6842
3
+ metadata.gz: 4fbf304ea2a5077bc2472395b6ae56094648cd48e3717c6f5288c878d85e7612
4
+ data.tar.gz: 78e06a167d4b8570f2ea3ef6a01f4ed439fcb053c4630c6f1aa274399c1c8c44
5
5
  SHA512:
6
- metadata.gz: cca44edbb9a96d37245af4f362df6229d19646f0631616abcb0800958259e72c991c5c35a0702cc68bb04dd04518253c94f27ce29a08ef2328f3eac6d65b0f0f
7
- data.tar.gz: 3b17dae8e2bf6111c0e015c93749e1ffa855f90579dcbd8a98f7ced7c07c9a455fdc5a5f01387753cb77983980db6d6e3d952baf4df25d380ff4c563e5f4f703
6
+ metadata.gz: 7466d802080d7eb70b9e6f56435a089460c719de4421485c76ff3161d8757355c813d47b708ab13f0be01042c59d0d0ca35577c4243cbac2f11df8bb4c4a06fe
7
+ data.tar.gz: 8a6186fe67c01cf091969fec6468a1d727cd467e4f0cf798c8a730c20c2aeebc73c971873f1ca1f1d5c3befb5427557dd9bd75dee3dc366d5c0c86ecf18027ba
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ ruby `cat .ruby-version`
3
4
  # Specify your gem's dependencies in voom-console.gemspec
4
5
  gemspec
5
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- voom-presenters (0.1.7)
4
+ voom-presenters (0.1.8)
5
5
  dry-configurable (> 0.1, <= 7.0)
6
6
  dry-container (~> 0.6)
7
7
  dry-inflector (~> 0.1)
@@ -111,5 +111,8 @@ DEPENDENCIES
111
111
  watir-rspec
112
112
  webdrivers (~> 3.0)
113
113
 
114
+ RUBY VERSION
115
+ ruby 2.5.0p0
116
+
114
117
  BUNDLED WITH
115
118
  1.16.1
@@ -5,8 +5,9 @@ Voom::Presenters.define(:badges) do
5
5
 
6
6
  attach :top_nav
7
7
  attach :component_drawer
8
+ page_title 'Badges'
8
9
  indented_grid do
9
- display 'Badges'
10
+
10
11
 
11
12
  headline 'Number'
12
13
  badge 1, icon: :account_box
@@ -4,9 +4,10 @@ Voom::Presenters.define(:buttons) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Buttons'
7
8
 
8
9
  indented_grid do
9
- display 'Buttons'
10
+
10
11
 
11
12
  # Raised buttons
12
13
  headline 'Raised Button'
@@ -46,6 +47,17 @@ Voom::Presenters.define(:buttons) do
46
47
  subheading 'with text'
47
48
  button "I'm happy", icon: :mood
48
49
 
50
+ headline 'Image button'
51
+ button type: :image do
52
+ image 'http://geotix.com/application/files/3514/5564/7308/MyNorthTicketsLogo.png'
53
+ end
54
+
55
+ subheading 'with icon'
56
+ button type: :image do
57
+ image 'http://geotix.com/application/files/3514/5564/7308/MyNorthTicketsLogo.png'
58
+ icon :link
59
+ end
60
+
49
61
  attach :code, file: __FILE__
50
62
  end
51
63
  end
@@ -4,11 +4,9 @@ Voom::Presenters.define(:cards) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
-
7
+ page_title 'Cards'
8
8
 
9
9
  indented_grid do
10
- display 'Cards'
11
-
12
10
  headline 'Wide'
13
11
  card width: '512px' do
14
12
  media do
@@ -4,10 +4,9 @@ Voom::Presenters.define(:chips) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Chips'
7
8
 
8
9
  indented_grid do
9
- heading 'Chips'
10
-
11
10
  chip 'Chip 1'
12
11
  chip 'Chip 1', color: :primary
13
12
  chip 'Chip 2', color: :secondary
@@ -4,9 +4,9 @@ Voom::Presenters.define(:date_fields) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Date Fields'
7
8
 
8
9
  indented_grid do
9
- display 'Date Fields'
10
10
  body <<~DOC
11
11
  A date separates user display format from the value format.
12
12
 
@@ -4,9 +4,9 @@ Voom::Presenters.define(:datetime_fields) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Date Time'
7
8
 
8
9
  indented_grid do
9
- display 'Date Time'
10
10
  body <<~DOC
11
11
  A date time separates user display format from the value format.
12
12
 
@@ -4,10 +4,9 @@ Voom::Presenters.define(:dialogs) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Dialogs'
7
8
 
8
9
  indented_grid do
9
- display 'Dialogs'
10
-
11
10
  button 'Show Dialog' do
12
11
  event :click do
13
12
  dialog :hold_on
@@ -3,6 +3,7 @@ require_relative '../helpers/indented_grid'
3
3
  Voom::Presenters.define(:drawers) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
+ page_title 'Drawers'
6
7
 
7
8
  drawer do
8
9
  menu do
@@ -4,10 +4,9 @@ Voom::Presenters.define(:expansion_panels) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
-
8
- indented_grid do
9
- display 'Expansion Panels'
7
+ page_title 'Expansion Panels'
10
8
 
9
+ indented_grid do
11
10
  expansion_panel do
12
11
  text 'Personal data'
13
12
  secondary_text 'Type your name and age'
@@ -4,10 +4,9 @@ Voom::Presenters.define(:fabs_mini) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Float Action Button'
7
8
 
8
9
  indented_grid do
9
- display 'Float Action Button'
10
-
11
10
  # Mini Floating action buttons
12
11
  headline 'Mini FAB'
13
12
  body '*Mini size: Only used to create visual continuity with other screen elements*'
@@ -4,9 +4,9 @@ Voom::Presenters.define(:fabs) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Floating Action Button'
7
8
 
8
9
  indented_grid do
9
- display 'Floating Action Button'
10
10
 
11
11
  headline 'FAB'
12
12
  button icon: :add, type: :fab, color: :primary
@@ -4,6 +4,7 @@ Voom::Presenters.define(:forms) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Forms'
7
8
 
8
9
  grid do
9
10
  column 1
@@ -8,11 +8,7 @@ Voom::Presenters.define(:headers) do
8
8
 
9
9
 
10
10
  header 'Presenters Demo' do
11
- page_title 'Page about headers' do
12
- icon :subtitles
13
- end
14
-
15
- menu do
11
+ nav do
16
12
  item 'About (Header)' do
17
13
  event :click do
18
14
  loads :index
@@ -32,6 +28,9 @@ Voom::Presenters.define(:headers) do
32
28
  end
33
29
  end
34
30
  end
31
+ page_title 'Page about headers' do
32
+ icon :subtitles
33
+ end
35
34
 
36
35
 
37
36
  indented_grid do
@@ -5,10 +5,8 @@ Voom::Presenters.define(:hidden_fields) do
5
5
 
6
6
  attach :top_nav
7
7
  attach :component_drawer
8
-
8
+ page_title 'Hidden'
9
9
  indented_grid do
10
- headline 'Hidden'
11
-
12
10
  form do
13
11
  hidden_field name: :idoit_id do
14
12
  value 'do it!'
@@ -1,6 +1,7 @@
1
1
  Voom::Presenters.define(:icons) do
2
2
  attach :top_nav
3
3
  attach :component_drawer
4
+ page_title 'Icons'
4
5
 
5
6
  helpers do
6
7
  def small_card(&block)
@@ -13,7 +14,6 @@ Voom::Presenters.define(:icons) do
13
14
  grid do
14
15
  column 1
15
16
  column 10 do
16
- display 'Icons'
17
17
  body 'An icon is commonly used on a menu, button, chip, list or card. They can be used standalone as well.'
18
18
 
19
19
  headline 'Plain'
@@ -5,9 +5,9 @@ Voom::Presenters.define(:layouts) do
5
5
 
6
6
  attach :top_nav
7
7
  attach :component_drawer
8
+ page_title 'Layouts'
8
9
 
9
10
  indented_grid do
10
- display 'Layouts'
11
11
 
12
12
  display 'Grid'
13
13
 
@@ -4,7 +4,7 @@ Voom::Presenters.define(:lists) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
-
7
+ page_title 'Lists'
8
8
  helpers do
9
9
  def actors
10
10
  [OpenStruct.new(name: "<strong>Bryan Cranston</strong>", episodes: 62, body: 'Bryan Cranston played the role of Walter in Breaking Bad. He is also known for playing Hal in Malcom in the Middle.'),
@@ -15,7 +15,6 @@ Voom::Presenters.define(:lists) do
15
15
  end
16
16
 
17
17
  indented_grid do
18
- display 'Lists'
19
18
 
20
19
  headline 'Simple'
21
20
  list do
@@ -4,9 +4,9 @@ Voom::Presenters.define(:menus) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Menus'
7
8
 
8
9
  indented_grid do
9
- display 'Menus'
10
10
 
11
11
  grid do
12
12
  column 1
@@ -4,10 +4,9 @@ Voom::Presenters.define(:selects) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Select Fields'
7
8
 
8
9
  indented_grid do
9
- display 'Select Fields'
10
-
11
10
  form do
12
11
  select do
13
12
  label 'Text...'
@@ -4,6 +4,7 @@ Voom::Presenters.define(:snackbar) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Snackbar'
7
8
 
8
9
  indented_grid do
9
10
  title 'On Page'
@@ -4,6 +4,7 @@ Voom::Presenters.define(:tables) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Tables'
7
8
 
8
9
  helpers do
9
10
  def items
@@ -16,8 +17,6 @@ Voom::Presenters.define(:tables) do
16
17
  end
17
18
 
18
19
  indented_grid do
19
- display 'Tables'
20
-
21
20
  table selectable: true do
22
21
  header do
23
22
  column 'Material'
@@ -4,10 +4,9 @@ Voom::Presenters.define(:text_areas) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Text Areas'
7
8
 
8
9
  indented_grid do
9
- display 'Text Areas'
10
-
11
10
  headline 'Multiple line'
12
11
 
13
12
  text_area name: :notes, rows: 3 do
@@ -4,10 +4,9 @@ Voom::Presenters.define(:text_fields) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Text Fields'
7
8
 
8
9
  indented_grid do
9
- display 'Text Fields'
10
-
11
10
  headline 'Text'
12
11
 
13
12
  text_field name: :text do
@@ -4,9 +4,9 @@ Voom::Presenters.define(:time_fields) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Time Field'
7
8
 
8
9
  indented_grid do
9
- display 'Time Field'
10
10
  body <<~DOC
11
11
  A time field separates user display format from the value format.
12
12
 
@@ -4,10 +4,9 @@ Voom::Presenters.define(:toggles) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
+ page_title 'Toggles'
7
8
 
8
9
  indented_grid do
9
- display 'Toggles'
10
-
11
10
  headline 'CHECKBOX'
12
11
  checkbox
13
12
  checkbox checked: true
@@ -4,10 +4,9 @@ Voom::Presenters.define(:tooltips) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
6
  attach :component_drawer
7
-
7
+ page_title 'Tooltips'
8
+
8
9
  indented_grid do
9
- display 'Tooltips'
10
-
11
10
  headline 'Avatars'
12
11
  subheading 'Cards'
13
12
  card do
@@ -4,9 +4,9 @@ Voom::Presenters.define('components') do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach 'top_nav'
6
6
  attach 'component_drawer'
7
+ page_title 'Components'
7
8
 
8
9
  indented_grid do
9
- display 'Components'
10
10
  grid do
11
11
  column 12 do
12
12
  icon 'fa-hand-point-left', position: :left
@@ -4,7 +4,7 @@ Voom::Presenters.define('top_nav') do
4
4
  end
5
5
 
6
6
  header 'Presenters Demo' do
7
- menu do
7
+ nav do
8
8
  item 'About' do
9
9
  event :click do
10
10
  loads :index
data/app/demo/styles.pom CHANGED
@@ -3,6 +3,9 @@ require_relative 'helpers/indented_grid'
3
3
  Voom::Presenters.define(:styles) do
4
4
  helpers Demo::Helpers::IndentedGrid
5
5
  attach :top_nav
6
+ page_title 'Page Title' do
7
+ icon :settings
8
+ end
6
9
 
7
10
  indented_grid do
8
11
  display 'Styles'
@@ -33,6 +33,11 @@ module Voom
33
33
 
34
34
  end
35
35
 
36
+ def image(image=nil, **attribs, &block)
37
+ return @image if locked?
38
+ @image = Components::Image.new(parent: self, image: image, context: context, **attribs, &block)
39
+ end
40
+
36
41
  def menu(**attributes, &block)
37
42
  return @menu if locked?
38
43
  @menu = Components::Menu.new(parent: self, position: menu_position, context: context, **attributes, &block)
@@ -6,6 +6,7 @@ require_relative 'mixins/text_fields'
6
6
  require_relative 'mixins/selects'
7
7
  require_relative 'mixins/snackbars'
8
8
  require_relative 'mixins/date_time_fields'
9
+ require_relative 'mixins/images'
9
10
 
10
11
  module Voom
11
12
  module Presenters
@@ -18,6 +19,7 @@ module Voom
18
19
  include Mixins::DateTimeFields
19
20
  include Mixins::Selects
20
21
  include Mixins::Snackbars
22
+ include Mixins::Images
21
23
 
22
24
  attr_reader :hidden, :components, :shows_errors
23
25
 
@@ -1,4 +1,5 @@
1
1
  require_relative 'mixins/common'
2
+ require_relative 'mixins/attaches'
2
3
 
3
4
  module Voom
4
5
  module Presenters
@@ -6,6 +7,7 @@ module Voom
6
7
  module Components
7
8
  class Dialog < Base
8
9
  include Mixins::Common
10
+ include Mixins::Attaches
9
11
  attr_accessor :width, :height, :buttons, :components, :shows_errors
10
12
 
11
13
  def initialize(**attribs_, &block)
@@ -14,41 +14,30 @@ module Voom
14
14
  expand!
15
15
  end
16
16
 
17
+ def button(icon=nil, **attributes, &block)
18
+ return @button if locked?
19
+ @button = Components::Button.new(icon: icon, position:[:top, :right], parent: self, context: context, **attributes, &block)
20
+ end
21
+
17
22
  def menu(**attribs, &block)
18
23
  return @menu if locked?
19
- @menu = Menu.new(parent: self,
24
+ @menu = Components::Menu.new(parent: self,
20
25
  context: context,
21
26
  **attribs, &block)
22
27
  end
23
28
 
29
+ def nav(**attribs, &block)
30
+ return @nav if locked?
31
+ @nav = Components::Menu.new(parent: self,
32
+ context: context,
33
+ **attribs, &block)
34
+ end
35
+
24
36
  def title(*text, **attribs, &block)
25
37
  return @title if locked?
26
38
  @title = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
27
39
  end
28
40
 
29
- def page_title(*text, **attribs, &block)
30
- return @page_title if locked?
31
- @page_title = PageTitle.new(parent: self, text: text, context: context, **attribs, &block)
32
- end
33
-
34
- class PageTitle < Base
35
-
36
- attr_accessor :text
37
-
38
- def initialize(**attribs_, &block)
39
- super(type: :page_title, **attribs_, &block)
40
- @text = attribs.delete(:text)
41
- expand!
42
- end
43
-
44
- def icon(icon=nil, **attribs, &block)
45
- return @icon if locked?
46
- @icon = Icon.new(parent: self, icon: icon,
47
- context: context,
48
- **attribs, &block)
49
- end
50
- end
51
-
52
41
  end
53
42
  end
54
43
  end
@@ -1,18 +1,21 @@
1
1
  require_relative 'mixins/event'
2
2
  require_relative 'mixins/tooltips'
3
+ require_relative 'mixins/attaches'
4
+ require_relative 'mixins/buttons'
3
5
 
4
6
  module Voom
5
7
  module Presenters
6
8
  module DSL
7
9
  module Components
8
10
  class Menu < Base
9
- attr_accessor :items, :title, :position, :color, :open
11
+ attr_accessor :items, :title, :position, :placement, :color, :open
10
12
 
11
13
  def initialize(title=nil, **attribs_, &block)
12
14
  super(type: :menu, **attribs_, &block)
13
15
  @title = title
14
16
  @items = []
15
17
  @position = attribs.delete(:position) || :left
18
+ @placement = attribs.delete(:placement) || :default
16
19
  @color = attribs.delete(:color)
17
20
  @open = attributes.delete(:open){false}
18
21
  expand!
@@ -31,6 +34,13 @@ module Voom
31
34
  **attribs, &block)
32
35
  end
33
36
 
37
+ def label(**attribs, &block)
38
+ return @label if locked?
39
+ @label = Label.new(parent: self,
40
+ context: context,
41
+ **attribs, &block)
42
+ end
43
+
34
44
  private
35
45
 
36
46
  class Item < EventBase
@@ -54,6 +64,12 @@ module Voom
54
64
  end
55
65
  end
56
66
 
67
+ class Label < Item
68
+ def initialize(**attribs, &block)
69
+ super(type: :label, **attribs, &block)
70
+ end
71
+ end
72
+
57
73
  class Divider < Base
58
74
  def initialize(**attribs, &block)
59
75
  super(type: :divider, **attribs, &block)
@@ -21,6 +21,10 @@ module Voom
21
21
  self << Components::Typography.new(parent: self, type: :title, text: text, context: context, **attributes, &block)
22
22
  end
23
23
 
24
+ def page_title(*text, **attributes, &block)
25
+ self << Components::Typography.new(parent: self, type: :page_title, text: text, context: context, level: 1, **attributes, &block)
26
+ end
27
+
24
28
  def subheading(*text, **attributes, &block)
25
29
  self << Components::Typography.new(parent: self, type: :subheading, text: text, context: context, **attributes, &block)
26
30
  end
@@ -18,6 +18,13 @@ module Voom
18
18
  @position = Array(attribs.delete(:position)).compact
19
19
  expand!
20
20
  end
21
+
22
+ def icon(icon=nil, **attribs, &block)
23
+ return @icon if locked?
24
+ @icon = Components::Icon.new(parent: self, icon: icon,
25
+ context: context,
26
+ **attribs, &block)
27
+ end
21
28
  end
22
29
  end
23
30
  end
@@ -16,7 +16,7 @@ if defined?(Rails)
16
16
  def presenters_path(presenter, **params)
17
17
  path = voom_presenters_web_client_app_path(params)
18
18
  if path.include?('?')
19
- path = path.sub('?', "/#{presenter}?")
19
+ path = path.sub('?', "#{presenter}?")
20
20
  else
21
21
  path = "#{path}/" unless path.end_with?('/')
22
22
  # replace last / with the presenter
@@ -1,5 +1,5 @@
1
1
  module Voom
2
2
  module Presenters
3
- VERSION = '0.1.8'.freeze
3
+ VERSION = '0.1.9'.freeze
4
4
  end
5
5
  end
data/public/bundle.css CHANGED
@@ -5942,13 +5942,16 @@ iframe.heightSet {
5942
5942
  color: #839098; }
5943
5943
  .mdl-layout__header .mdl-layout__drawer-button {
5944
5944
  background-color: #37424a; }
5945
- .mdl-layout__header h1 {
5946
- padding-left: 24px;
5947
- color: #71818c;
5948
- font-size: 30px; }
5949
- .mdl-layout__header h1 i {
5950
- font-size: 30px;
5951
- vertical-align: middle; }
5945
+
5946
+ h1.v-page-title {
5947
+ background-color: #EBF0F4;
5948
+ color: #71818c;
5949
+ margin: 0px;
5950
+ padding: 24px;
5951
+ font-size: 30px; }
5952
+ h1.v-page-title i {
5953
+ font-size: 30px;
5954
+ vertical-align: middle; }
5952
5955
 
5953
5956
  .mdl-layout__drawer {
5954
5957
  background-color: #37424a;
@@ -6565,6 +6568,20 @@ iframe.heightSet {
6565
6568
  font-size: .8125rem;
6566
6569
  line-height: 32px; }
6567
6570
 
6571
+ .v-button-image {
6572
+ width: 150px;
6573
+ height: 45px;
6574
+ background-color: #fff !important;
6575
+ background-size: 75%;
6576
+ background-repeat: no-repeat;
6577
+ background-position-x: 18%;
6578
+ background-position-y: center;
6579
+ border-radius: 10px; }
6580
+ .v-button-image > i {
6581
+ position: absolute;
6582
+ margin-right: 0 !important;
6583
+ color: #263138; }
6584
+
6568
6585
  .mdc-button.v-secondary-filled-button:not(:disabled) {
6569
6586
  background-color: #E58D36; }
6570
6587
 
data/public/bundle.js CHANGED
@@ -3796,14 +3796,14 @@ function getNormalizedEventCoords(ev, pageOffset, clientRect) {
3796
3796
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3797
3797
 
3798
3798
  "use strict";
3799
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MDCMenu; });
3799
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MDCMenu; });
3800
3800
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(91);
3801
3801
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(92);
3802
3802
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation__ = __webpack_require__(93);
3803
3803
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constants__ = __webpack_require__(38);
3804
3804
  /* unused harmony reexport MDCMenuFoundation */
3805
3805
  /* unused harmony reexport AnchorMargin */
3806
- /* unused harmony reexport Corner */
3806
+ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_3__constants__["a"]; });
3807
3807
  /* unused harmony reexport CornerBit */
3808
3808
  /**
3809
3809
  * @license
@@ -15766,8 +15766,10 @@ const numbers = {
15766
15766
 
15767
15767
  function createMenuHandler(menu, element) {
15768
15768
  return function () {
15769
- var offset = parseInt(element.dataset.rightOffset);
15769
+ let offset = parseInt(element.dataset.rightOffset);
15770
+ let placement = element.dataset.placement === 'contextual' ? __WEBPACK_IMPORTED_MODULE_0__material_menu__["a" /* Corner */].TOP_LEFT : __WEBPACK_IMPORTED_MODULE_0__material_menu__["a" /* Corner */].BOTTOM_LEFT;
15770
15771
  menu.setAnchorMargin({ left: offset });
15772
+ menu.setAnchorCorner(placement);
15771
15773
  menu.open = !menu.open;
15772
15774
  };
15773
15775
  }
@@ -15780,7 +15782,7 @@ function initMenus() {
15780
15782
  for (var i = 0; i < components.length; i++) {
15781
15783
  var component = components[i];
15782
15784
  if (!component.mdcComponent) {
15783
- component.mdcComponent = new __WEBPACK_IMPORTED_MODULE_0__material_menu__["a" /* MDCMenu */](component);
15785
+ component.mdcComponent = new __WEBPACK_IMPORTED_MODULE_0__material_menu__["b" /* MDCMenu */](component);
15784
15786
  var anchor = component.closest('.mdc-menu-anchor');
15785
15787
  if (anchor) {
15786
15788
  var menulink = anchor.querySelector('.v-menu-click');
@@ -4,8 +4,10 @@ import {Corner} from '@material/menu';
4
4
 
5
5
  function createMenuHandler(menu, element) {
6
6
  return function () {
7
- var offset = parseInt(element.dataset.rightOffset);
7
+ let offset = parseInt(element.dataset.rightOffset);
8
+ let placement = element.dataset.placement === 'contextual' ? Corner.TOP_LEFT : Corner.BOTTOM_LEFT
8
9
  menu.setAnchorMargin({left: offset});
10
+ menu.setAnchorCorner(placement);
9
11
  menu.open = !menu.open;
10
12
  };
11
13
  }
@@ -1,5 +1,21 @@
1
1
  @import "@material/button/mdc-button";
2
2
 
3
+ .v-button-image {
4
+ width: 150px;
5
+ height: 45px;
6
+ background-color: $mdc-theme-background !important;
7
+ background-size: 75%;
8
+ background-repeat: no-repeat;
9
+ background-position-x: 18%;
10
+ background-position-y: center;
11
+ border-radius: 10px;
12
+ > i {
13
+ position: absolute;
14
+ margin-right: 0 !important;
15
+ color: $v-header-background;
16
+ }
17
+ }
18
+
3
19
  .mdc-button.v-secondary-filled-button {
4
20
  @include mdc-button-filled-accessible($mdc-theme-secondary);
5
21
  }
@@ -21,14 +21,17 @@ $v-title-background: #EBF0F4;
21
21
  .mdl-layout__drawer-button {
22
22
  background-color: $v-drawer-background;
23
23
  }
24
- h1 {
25
- padding-left: 24px;
26
- color: $v-drawer-color;
24
+ }
25
+
26
+ h1.v-page-title {
27
+ background-color: $v-title-background;
28
+ color: $v-drawer-color;
29
+ margin: 0px;
30
+ padding: 24px;
31
+ font-size: 30px;
32
+ i {
27
33
  font-size: 30px;
28
- i {
29
- font-size: 30px;
30
- vertical-align: middle;
31
- }
34
+ vertical-align: middle;
32
35
  }
33
36
  }
34
37
 
@@ -8,24 +8,24 @@
8
8
  <%= expand_text(header.title&.text) %>
9
9
  </span>
10
10
  <div class="mdl-layout-spacer"></div>
11
- <% if header.menu %>
11
+ <% if header.nav %>
12
12
  <nav class="mdl-navigation">
13
- <% header.menu.items.each do |item| %>
14
- <a class="mdl-navigation__link"
15
- id="<%= item.id %>"
16
- href="javascript:void(0)"
17
- <%= erb :"components/event", :locals => {events: item.events, parent_id: item.event_parent_id} %>>
13
+ <% header.nav.items.each do |item| %>
14
+ <a class="mdl-navigation__link"
15
+ id="<%= item.id %>"
16
+ href="javascript:void(0)"
17
+ <%= erb :"components/event", :locals => {events: item.events, parent_id: item.event_parent_id} %>>
18
18
  <%= erb :"components/icon", :locals => {comp: item.icon, class_name: nil} %>
19
19
  <%= item.text %>
20
20
  </a>
21
21
  <% end %>
22
22
  </nav>
23
23
  <% end %>
24
+ <% if header.button %>
25
+ <%= erb :"components/button", :locals => {comp: header.button, parent_id: header.id} %>
26
+ <% end %>
27
+ <% if header.menu %>
28
+ <%= erb :"components/menu", :locals => {comp: header.menu, parent_id: header.id} %>
29
+ <% end %>
24
30
  </div>
25
- <% if header.page_title&.text || header.page_title&.icon%>
26
- <h1>
27
- <%= erb :"components/icon", :locals => {comp: header.page_title.icon, class_name: nil} if header.page_title&.icon%>
28
- <%= expand_text(header.page_title.text) if header.page_title&.text %>
29
- </h1>
30
- <% end %>
31
31
  </header>
@@ -4,14 +4,23 @@
4
4
  position_classes = comp.position.map {|p| "v-button-position-#{p}"}.join(' ')
5
5
  class_name= "#{class_name} #{position_classes}"
6
6
  %>
7
+ <% if comp.menu %>
8
+ <div class="mdc-menu-anchor" %>
9
+ <% end %>
7
10
  <% case comp.button_type.to_sym
8
11
  when :fab %>
9
12
  <%= erb :"components/buttons/fab", :locals => {:comp => comp, class_name: class_name} %>
10
13
  <% when :icon %>
11
14
  <%= erb :"components/buttons/icon", :locals => {:comp => comp, class_name: class_name} %>
15
+ <% when :image %>
16
+ <%= erb :"components/buttons/image", :locals => {:comp => comp, class_name: class_name} %>
12
17
  <% else %>
13
18
  <%= erb :"components/buttons/button", :locals => {:comp => comp, class_name: class_name} %>
14
19
  <% end %>
20
+ <% if comp.menu %>
21
+ </div>
22
+ <% end %>
15
23
  <% end %>
16
24
 
17
25
 
26
+
@@ -2,6 +2,7 @@
2
2
  position_classes = comp.position.map {|p| "v-button-position-#{p}"}.join(' ')
3
3
  text_align = comp.position.select {|p| eq(p, :left)}.any? && eq(comp.button_type, :flat)%>
4
4
 
5
+
5
6
  <button
6
7
  id="<%= comp.id %>"
7
8
  class="mdc-button v-js-ripple-button <%=class_name%>
@@ -10,11 +11,12 @@ class="mdc-button v-js-ripple-button <%=class_name%>
10
11
  <%= 'v-secondary-text-button' if eq(comp.button_type, :flat) && eq(comp.color, :secondary) %>
11
12
  <%= position_classes %>
12
13
  <%= "v-button-text-align-left" if text_align %>
13
- <%= 'mdc-menu-anchor v-menu-click' if comp.menu%>"
14
+ <%= 'v-menu-click' if comp.menu%>"
14
15
  <%= 'disabled' if comp.disabled %>
15
16
  <%= erb :"components/event", :locals => {events: comp.events, parent_id: comp.event_parent_id} unless comp.disabled %>>
16
17
  <%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-button__icon'} %>
18
+ <%= erb :"components/image", :locals => {comp: comp.image} %>
17
19
  <%= comp.text %>
18
- <%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>
19
20
  </button>
20
21
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
22
+ <%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>
@@ -2,9 +2,6 @@
2
2
  position_classes = comp.position.map {|p| "v-button-fab-position-#{p}"}.join(' ')
3
3
  %>
4
4
 
5
- <% if comp.menu %>
6
- <div class="mdc-menu-anchor" %>
7
- <% end %>
8
5
  <button id="<%= comp.id %>"
9
6
  class="mdc-fab material-icons v-fab--absolute v-js-ripple-button <%= class_name %> <%= position_classes %>
10
7
  <%= 'mdc-fab--mini' if eq(comp.size, :small) %>"
@@ -17,6 +14,3 @@
17
14
  </button>
18
15
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
19
16
  <%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>
20
- <% if comp.menu %>
21
- </div>
22
- <% end %>
@@ -2,9 +2,6 @@
2
2
  position_classes = comp.position.map {|p| "v-button-icon-position-#{p}"}.join(' ')
3
3
  %>
4
4
 
5
- <% if comp.menu %>
6
- <div class="mdc-menu-anchor" %>
7
- <% end %>
8
5
  <button id="<%= comp.id %>"
9
6
  class="mdl-button mdl-js-button mdl-button--icon <%=class_name%> <%= position_classes %>
10
7
  <%= 'mdl-button--colored' if eq(comp.color, :primary) %>
@@ -18,7 +15,3 @@
18
15
  </button>
19
16
  <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
20
17
  <%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>
21
-
22
- <% if comp.menu %>
23
- </div>
24
- <% end %>
@@ -0,0 +1,19 @@
1
+ <% class_name = '' unless local_variables.include? :class_name
2
+ position_classes = comp.position.map {|p| "v-button-position-#{p}"}.join(' ') %>
3
+
4
+
5
+ <button
6
+ id="<%= comp.id %>"
7
+ class="mdc-button v-js-ripple-button v-button-image <%=class_name%>
8
+ <%= 'mdc-button--raised' if eq(comp.button_type, :raised) %>
9
+ <%= 'v-secondary-filled-button' if eq(comp.button_type, :raised) && eq(comp.color, :secondary) %>
10
+ <%= 'v-secondary-text-button' if eq(comp.button_type, :flat) && eq(comp.color, :secondary) %>
11
+ <%= position_classes %>
12
+ <%= 'v-menu-click' if comp.menu%>"
13
+ style="background-image: url(<%= comp.image.url %>);"
14
+ <%= 'disabled' if comp.disabled %>
15
+ <%= erb :"components/event", :locals => {events: comp.events, parent_id: comp.event_parent_id} unless comp.disabled %>>
16
+ <%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-button__icon', position: [:right, :center]} %>
17
+ </button>
18
+ <%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %>
19
+ <%= erb :"components/menu", :locals => {comp: comp.menu, parent_id: comp.id} %>
@@ -1,4 +1,4 @@
1
- <div id="<%= comp.id %>" class="mdc-menu v-menu" style="position: absolute;" tabindex="-1">
1
+ <div id="<%= comp.id %>" class="mdc-menu v-menu" data-placement="contextual" style="position: absolute;" tabindex="-1">
2
2
  <ul class="mdc-menu__items mdc-list" role="menu" aria-hidden="true">
3
3
  <% comp.items.each do |item| %>
4
4
  <% unless eq(item.type, :divider) %>
@@ -1,8 +1,16 @@
1
1
  <% if comp %>
2
+ <% if comp.label %>
3
+ <div class="mdc-menu-anchor">
4
+ <span class="v-menu-click">
5
+ <%= expand_text(comp.label.text) %>
6
+ <%= erb(:"components/icon", locals: {comp: comp.label.icon}) %>
7
+ </span>
8
+ <% end %>
2
9
  <div id="<%= comp.id %>"
3
10
  class="mdc-menu v-menu
4
11
  <%='mdc-menu--open' if comp.open %>"
5
12
  style="position: absolute;" tabindex="-1"
13
+ data-placement="<%= comp.placement %>"
6
14
  <%= "data-right-offset=9999" if eq(comp.position, :right) %>>
7
15
  <ul class="mdc-menu__items mdc-list" role="menu" aria-hidden="true">
8
16
  <% comp.items.each do |item| %>
@@ -15,9 +23,10 @@
15
23
  href="javascript:void(0)"
16
24
  <%= erb :"components/event", :locals => {events: item.events, parent_id: item.event_parent_id} %>>
17
25
  <% end %>
18
- <%= item.text %>
26
+ <%= expand_text(item.text) %>
19
27
  <% unless item.disabled %>
20
28
  </a>
29
+ <%= erb(:"components/icon", locals: {comp: item.icon, position: [:right, :center]}) %>
21
30
  <% end %>
22
31
  </li>
23
32
  <% else %>
@@ -26,4 +35,7 @@
26
35
  <% end %>
27
36
  </ul>
28
37
  </div>
38
+ <% if comp.label %>
39
+ </div>
40
+ <% end %>
29
41
  <% end %>
@@ -0,0 +1,4 @@
1
+ <h1 class="v-page-title">
2
+ <%= erb :"components/icon", :locals => {comp: comp.icon} %>
3
+ <%= expand_text(comp.text) %>
4
+ </h1>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voom-presenters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Edens
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-13 00:00:00.000000000 Z
11
+ date: 2018-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ice_nine
@@ -488,6 +488,7 @@ files:
488
488
  - views/mdc/components/buttons/button.erb
489
489
  - views/mdc/components/buttons/fab.erb
490
490
  - views/mdc/components/buttons/icon.erb
491
+ - views/mdc/components/buttons/image.erb
491
492
  - views/mdc/components/card.erb
492
493
  - views/mdc/components/checkbox.erb
493
494
  - views/mdc/components/chip.erb
@@ -524,6 +525,7 @@ files:
524
525
  - views/mdc/components/list/separator.erb
525
526
  - views/mdc/components/menu.erb
526
527
  - views/mdc/components/modal.erb
528
+ - views/mdc/components/page_title.erb
527
529
  - views/mdc/components/radio_button.erb
528
530
  - views/mdc/components/render.erb
529
531
  - views/mdc/components/select.erb