From 9bc9587a1e28274a7ec32de66ffb99f0604b882e Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 14:22:14 -0600 Subject: [PATCH 1/5] Add Featured Image to Rake Task Seeder --- lib/tasks/employer/blog.rake | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/tasks/employer/blog.rake b/lib/tasks/employer/blog.rake index ac1463723..58ed77132 100644 --- a/lib/tasks/employer/blog.rake +++ b/lib/tasks/employer/blog.rake @@ -85,6 +85,7 @@ namespace :employer do blog.fields.new(name: 'Categories', field_type: 'tree_field_type', metadata: {allowed_values: category_tree}, validations: {maximum: 2, minimum: 1}) blog.fields.new(name: 'Research', field_type: 'tree_field_type', metadata: {allowed_values: research_tree}, validations: {minimum: 1}) blog.fields.new(name: 'Persona', field_type: 'tree_field_type', metadata: {allowed_values: persona_tree}) + blog.fields.new(name: 'Featured Image', field_type: 'content_item_field_type', render_method: 'popup') puts "Saving Employer Blog..." blog.save @@ -137,9 +138,6 @@ namespace :employer do { "id": blog.fields.find_by_name('Tags').id }, - # { - # "id": blog.fields.find_by_name('Expiration Date').id - # }, { "id": blog.fields.find_by_name('Publish Date').id } @@ -196,6 +194,23 @@ namespace :employer do } ] }, + { + "name": "Add Featured Image", + "heading": "..", + "description": "Add an image to feature with this Blog Post.", + "columns": [ + { + "heading": "Image (Optional Heading)", + "grid_width": 12, + "elements": [ + { + "id": blog.fields.find_by_name('Featured Image').id, + "render_method": "popup" + } + ] + } + ] + }, { "name": "Search", "heading": "How can others find your post..", From 890f9872d0d4b417c56dc080759b7479b533bd35 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 15:14:16 -0600 Subject: [PATCH 2/5] Make JS modifications to properly trigger popup button --- app/assets/javascripts/media_popups.js | 5 ++++ app/assets/stylesheets/components/dialog.scss | 30 +++++++++++++++++++ app/cells/wizard/field/show.haml | 3 ++ lib/tasks/employer/blog.rake | 2 +- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/media_popups.js b/app/assets/javascripts/media_popups.js index d8331552f..99a3289ae 100644 --- a/app/assets/javascripts/media_popups.js +++ b/app/assets/javascripts/media_popups.js @@ -42,3 +42,8 @@ window.setModals = function () { window.onload = function(){ window.setModals() } + +$(".popup--open").on("click", function(ev){ + ev.preventDefault(); + window.MODALS.featured.open(); +}) diff --git a/app/assets/stylesheets/components/dialog.scss b/app/assets/stylesheets/components/dialog.scss index f83fc47f3..be818b535 100644 --- a/app/assets/stylesheets/components/dialog.scss +++ b/app/assets/stylesheets/components/dialog.scss @@ -43,3 +43,33 @@ .mdl-dialog__content { padding: 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; +} diff --git a/app/cells/wizard/field/show.haml b/app/cells/wizard/field/show.haml index f158c96bd..2e280b96b 100644 --- a/app/cells/wizard/field/show.haml +++ b/app/cells/wizard/field/show.haml @@ -22,3 +22,6 @@ - if field_item.field.field_type_instance.class == AssetFieldType = cell(Plugins::Core::AssetCell, field_item, form: field_item_form, input_options: input, label_options: label).(:input) + + - if field_item.field.field_type_instance.class == ContentItemFieldType + = cell(Plugins::Core::ContentItemCell, field_item, form: field_item_form).(:popup) diff --git a/lib/tasks/employer/blog.rake b/lib/tasks/employer/blog.rake index 58ed77132..0e25a891e 100644 --- a/lib/tasks/employer/blog.rake +++ b/lib/tasks/employer/blog.rake @@ -85,7 +85,7 @@ namespace :employer do blog.fields.new(name: 'Categories', field_type: 'tree_field_type', metadata: {allowed_values: category_tree}, validations: {maximum: 2, minimum: 1}) blog.fields.new(name: 'Research', field_type: 'tree_field_type', metadata: {allowed_values: research_tree}, validations: {minimum: 1}) blog.fields.new(name: 'Persona', field_type: 'tree_field_type', metadata: {allowed_values: persona_tree}) - blog.fields.new(name: 'Featured Image', field_type: 'content_item_field_type', render_method: 'popup') + blog.fields.new(name: 'Featured Image', field_type: 'content_item_field_type') puts "Saving Employer Blog..." blog.save From 41b4683707978f2fa0a8f6479dae10840a012685 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Wed, 14 Dec 2016 15:31:53 -0600 Subject: [PATCH 3/5] Change cursor to pointer on hover --- Gemfile | 2 +- Gemfile.lock | 24 ++++++++++++------- app/assets/stylesheets/components/dialog.scss | 4 ++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index e95874fa3..547cd4084 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'rails', '~> 5.0.0' # Cortex-specific gem 'cortex-exceptions', '= 0.0.4' -gem 'cortex-plugins-core', '= 0.4.6' +gem 'cortex-plugins-core', git: 'https://github.com/cortex-cms/cortex-plugins-core.git', branch: 'topic/COR-526-Popup-Button' # API gem 'grape', '~> 0.17' diff --git a/Gemfile.lock b/Gemfile.lock index d4428fbef..c3ba06e12 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,19 @@ GIT awesome_nested_set (3.1.2) activerecord (>= 4.0.0, < 5.1) +GIT + remote: https://github.com/cortex-cms/cortex-plugins-core.git + revision: 889b620a1260f9b4412293812017c1f07e69f7cc + branch: topic/COR-526-Popup-Button + specs: + cortex-plugins-core (0.4.6) + cells (~> 4.1) + cells-haml (~> 0.0.10) + cells-rails (~> 0.0.6) + ckeditor (~> 4.2.0) + mimemagic (~> 0.3.2) + rails (>= 4) + GIT remote: https://github.com/samstickland/cells.git revision: e5634e25b472d41913030eb82463b015f429f2ca @@ -127,7 +140,7 @@ GEM childprocess (0.5.9) ffi (~> 1.0, >= 1.0.11) choice (0.2.0) - ckeditor (4.2.0) + ckeditor (4.2.1) cocaine orm_adapter (~> 0.5.0) climate_control (0.0.3) @@ -143,13 +156,6 @@ GEM concurrent-ruby (1.0.2) connection_pool (2.2.0) cortex-exceptions (0.0.4) - cortex-plugins-core (0.4.6) - cells (~> 4.1) - cells-haml (~> 0.0.10) - cells-rails (~> 0.0.6) - ckeditor (~> 4.2.0) - mimemagic (~> 0.3.2) - rails (>= 4) database_cleaner (1.5.3) debug_inspector (0.0.2) descendants_tracker (0.0.4) @@ -710,7 +716,7 @@ DEPENDENCIES cells-rails (~> 0.0.6) codeclimate-test-reporter (~> 0.6) cortex-exceptions (= 0.0.4) - cortex-plugins-core (= 0.4.6) + cortex-plugins-core! database_cleaner (~> 1.5) devise (~> 4.2.0) doorkeeper (~> 4.2) diff --git a/app/assets/stylesheets/components/dialog.scss b/app/assets/stylesheets/components/dialog.scss index be818b535..9a838b042 100644 --- a/app/assets/stylesheets/components/dialog.scss +++ b/app/assets/stylesheets/components/dialog.scss @@ -55,6 +55,10 @@ &:active { background-color: #DDD; } + + &:hover { + cursor: pointer; + } } .text-center { From 3e4e7d44161caaeb500a9079e223f544df2b88d7 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Thu, 15 Dec 2016 09:32:19 -0600 Subject: [PATCH 4/5] Add PR fixes to styles --- app/assets/stylesheets/components/dialog.scss | 21 +++++++------------ lib/tasks/employer/blog.rake | 1 - 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/components/dialog.scss b/app/assets/stylesheets/components/dialog.scss index 9a838b042..2876df614 100644 --- a/app/assets/stylesheets/components/dialog.scss +++ b/app/assets/stylesheets/components/dialog.scss @@ -1,6 +1,6 @@ .dialog-div { position: fixed; - background: #fff; + background: $color-white; } .dialog-backdrop { @@ -37,7 +37,7 @@ bottom: 0; right: 0; left: 0; - background: white; + background: $color-white; } .mdl-dialog__content { @@ -45,15 +45,16 @@ } .content_item_button { - border: 1px solid #BBB; + border: 1px solid $color-grey; margin-top: 10px; margin-bottom: 10px; width: 100%; - background-color: white; - color: #747D8E; + background-color: $color-white; + color: $color-anchor-blue-light; + text-align: center; &:active { - background-color: #DDD; + background-color: $color-grey-lightest; } &:hover { @@ -61,14 +62,6 @@ } } -.text-center { - text-align: center; -} - -.logo { - font-size: 56px; -} - .button_content { padding-top: 30px; padding-bottom: 20px; diff --git a/lib/tasks/employer/blog.rake b/lib/tasks/employer/blog.rake index 0e25a891e..866978e91 100644 --- a/lib/tasks/employer/blog.rake +++ b/lib/tasks/employer/blog.rake @@ -196,7 +196,6 @@ namespace :employer do }, { "name": "Add Featured Image", - "heading": "..", "description": "Add an image to feature with this Blog Post.", "columns": [ { From d2c85b4f29fbf4b034de46ad1ce4acc26ed0cd49 Mon Sep 17 00:00:00 2001 From: ElliottAYoung Date: Thu, 15 Dec 2016 14:00:48 -0600 Subject: [PATCH 5/5] Gem and Styling fixes per Arelia --- Gemfile | 2 +- app/assets/stylesheets/components/dialog.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 547cd4084..e95874fa3 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'rails', '~> 5.0.0' # Cortex-specific gem 'cortex-exceptions', '= 0.0.4' -gem 'cortex-plugins-core', git: 'https://github.com/cortex-cms/cortex-plugins-core.git', branch: 'topic/COR-526-Popup-Button' +gem 'cortex-plugins-core', '= 0.4.6' # API gem 'grape', '~> 0.17' diff --git a/app/assets/stylesheets/components/dialog.scss b/app/assets/stylesheets/components/dialog.scss index 2876df614..42be5874f 100644 --- a/app/assets/stylesheets/components/dialog.scss +++ b/app/assets/stylesheets/components/dialog.scss @@ -68,5 +68,5 @@ } .content_item_button-text { - font-size: 12px; + @extend .text-style-7; }