From bfe8d8edbde590b2212115ca61376344c7c566bf Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 14:16:54 -0600 Subject: [PATCH 1/4] Add Popup Cell to new, faked ContentItemFiledType --- app/cells/plugins/core/content_item/popup.haml | 2 ++ app/cells/plugins/core/content_item_cell.rb | 15 +++++++++++++++ app/models/content_item_field_type.rb | 11 +++++++++++ 3 files changed, 28 insertions(+) create mode 100644 app/cells/plugins/core/content_item/popup.haml create mode 100644 app/cells/plugins/core/content_item_cell.rb create mode 100644 app/models/content_item_field_type.rb diff --git a/app/cells/plugins/core/content_item/popup.haml b/app/cells/plugins/core/content_item/popup.haml new file mode 100644 index 0000000..187210b --- /dev/null +++ b/app/cells/plugins/core/content_item/popup.haml @@ -0,0 +1,2 @@ +%button{ class: "popup--open mdl-button mdl-js-button mdl-button--raised mdl-button--success mdl-js-ripple-effect" } + = render_button_name diff --git a/app/cells/plugins/core/content_item_cell.rb b/app/cells/plugins/core/content_item_cell.rb new file mode 100644 index 0000000..9a5e900 --- /dev/null +++ b/app/cells/plugins/core/content_item_cell.rb @@ -0,0 +1,15 @@ +module Plugins + module Core + class ContentItemCell < Plugins::Core::Cell + def popup + render + end + + private + + def render_field_name + "Insert #{field.name}" + end + end + end +end diff --git a/app/models/content_item_field_type.rb b/app/models/content_item_field_type.rb new file mode 100644 index 0000000..be0bb33 --- /dev/null +++ b/app/models/content_item_field_type.rb @@ -0,0 +1,11 @@ +class ContentItemFieldType < FieldType + def mapping + { name: mapping_field_name, type: :string, analyzer: :snowball } + end + + private + + def mapping_field_name + "#{field_name.parameterize('_')}_content_item" + end +end From 053f991c0526e1e8e1f49201e8bf910bee2a3ea1 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 15:00:37 -0600 Subject: [PATCH 2/4] Add full width button and styles for popup button --- app/assets/stylesheets/application.scss | 29 +++++++++++++++++++ .../plugins/core/content_item/popup.haml | 15 ++++++++-- app/cells/plugins/core/content_item_cell.rb | 4 +-- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 app/assets/stylesheets/application.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 0000000..97d5f97 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,29 @@ +.content_item_button { + border: 1px solid #BBB; + margin-top: 10px; + margin-bottom: 10px; + width: 100%; + background-color: white; + color: #747D8E; + + &:active { + background-color: #DDD; + } +} + +.text-center { + text-align: center; +} + +.logo { + font-size: 56px; +} + +.button_content { + padding-top: 30px; + padding-bottom: 20px; +} + +.content_item_button-text { + font-size: 12px; +} diff --git a/app/cells/plugins/core/content_item/popup.haml b/app/cells/plugins/core/content_item/popup.haml index 187210b..331a2ee 100644 --- a/app/cells/plugins/core/content_item/popup.haml +++ b/app/cells/plugins/core/content_item/popup.haml @@ -1,2 +1,13 @@ -%button{ class: "popup--open mdl-button mdl-js-button mdl-button--raised mdl-button--success mdl-js-ripple-effect" } - = render_button_name += render_label +%br +%button.content_item_button.text-center + .button_content + %i{ class: "material-icons icon" } + cloud_upload + %br + %span.content_item_button-text + Click to add a + = field.name + from the media library +%small + Recommended size: 1452px x 530px with a live area of 930px x 530px diff --git a/app/cells/plugins/core/content_item_cell.rb b/app/cells/plugins/core/content_item_cell.rb index 9a5e900..a247ca6 100644 --- a/app/cells/plugins/core/content_item_cell.rb +++ b/app/cells/plugins/core/content_item_cell.rb @@ -7,8 +7,8 @@ def popup private - def render_field_name - "Insert #{field.name}" + def render_label + "Add #{field.name}" end end end From 889b620a1260f9b4412293812017c1f07e69f7cc Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 15:08:22 -0600 Subject: [PATCH 3/4] Add popup--open class to popup --- app/cells/plugins/core/content_item/popup.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cells/plugins/core/content_item/popup.haml b/app/cells/plugins/core/content_item/popup.haml index 331a2ee..b808b22 100644 --- a/app/cells/plugins/core/content_item/popup.haml +++ b/app/cells/plugins/core/content_item/popup.haml @@ -1,6 +1,6 @@ = render_label %br -%button.content_item_button.text-center +%button.content_item_button.text-center.popup--open .button_content %i{ class: "material-icons icon" } cloud_upload From dfeb1f610c74d3783a351a3dbc4e95370d797335 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 15:10:26 -0600 Subject: [PATCH 4/4] Remove Stylesheet - unnecessary for now --- app/assets/stylesheets/application.scss | 29 ------------------------- 1 file changed, 29 deletions(-) delete mode 100644 app/assets/stylesheets/application.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss deleted file mode 100644 index 97d5f97..0000000 --- a/app/assets/stylesheets/application.scss +++ /dev/null @@ -1,29 +0,0 @@ -.content_item_button { - border: 1px solid #BBB; - margin-top: 10px; - margin-bottom: 10px; - width: 100%; - background-color: white; - color: #747D8E; - - &:active { - background-color: #DDD; - } -} - -.text-center { - text-align: center; -} - -.logo { - font-size: 56px; -} - -.button_content { - padding-top: 30px; - padding-bottom: 20px; -} - -.content_item_button-text { - font-size: 12px; -}