From a884d5c4d00eab192ea35cada17bc060a84697c9 Mon Sep 17 00:00:00 2001 From: Alex Tharp Date: Mon, 27 Mar 2017 14:42:23 -0500 Subject: [PATCH 1/3] feat: table_widget_data methods --- lib/cortex/snippets/webpage.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cortex/snippets/webpage.rb b/lib/cortex/snippets/webpage.rb index 55a935d..aec548b 100644 --- a/lib/cortex/snippets/webpage.rb +++ b/lib/cortex/snippets/webpage.rb @@ -59,6 +59,14 @@ def dynamic_yield } end + def table_widget_data + JSON.parse(@webpage[:tables_widget_json] || 'null', quirks_mode: true) + end + + def table_widget_data_for(table_name) + table_widget_data&.[](table_name) || [] + end + def snippets @webpage[:snippets] end From 5e9a43850681cd4efefc239dda8123bc3dea00bc Mon Sep 17 00:00:00 2001 From: Alex Tharp Date: Mon, 27 Mar 2017 14:46:53 -0500 Subject: [PATCH 2/3] chore: bump to v1.1.0 --- lib/cortex/snippets/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cortex/snippets/version.rb b/lib/cortex/snippets/version.rb index 454b640..3258a76 100644 --- a/lib/cortex/snippets/version.rb +++ b/lib/cortex/snippets/version.rb @@ -1,5 +1,5 @@ module Cortex module Snippets - VERSION = '1.0.4' + VERSION = '1.1.0' end end From 65feb8ad784c2b10be67ade1985f021b778fe0a6 Mon Sep 17 00:00:00 2001 From: Alex Tharp Date: Mon, 27 Mar 2017 17:26:18 -0500 Subject: [PATCH 3/3] chore: naming + documentation updates --- README.md | 7 ++++--- lib/cortex/snippets/version.rb | 2 +- lib/cortex/snippets/webpage.rb | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 217b87f..1c6f2e3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Or if you're installing from a Gemfile include it as gem 'cortex-snippets-client`, '~> 1.0.4' ``` -And then run +And then run ```ruby bundle install @@ -51,7 +51,7 @@ Use of this gem is generally split into two categories: Snippets and Webpages **Snippets** refers to blocks of markup that are editable in Cortex IPE and, through the use of this gem, persist into the tenant application. This allows the copy changes made in IPE to replace default blocks on the page and your changes to be shown. -**Webpages** refer to the created webpages themselves, which have several bits of relevant metadata including, but not limited to: title, keywords, and indexing information. +**Webpages** refer to the created webpages themselves, which have several bits of relevant metadata including, but not limited to: title, keywords, and indexing information. ### Snippets @@ -125,9 +125,10 @@ This will give you a webpage object from your current Cortex Tenant with all of |noarchive| The noarchive information for the Webpage. Included in `seo_robots`| |noimageindex| The noimageindex information for the Webpage. Included in `seo_robots`| |dynamic_yield| A hash of Dynamic Yield information from the current Webpage.| +|tables_widget_data| A hash containing Tables Widget configuration data.| +|tables_widget_data_for| An array (usually) containing table data for a single section.| |snippets|An array of the associated snippets with the current Webpage.| - 1:
The resulting array from `seo_keywords` can be entered into a single keyword meta tag like so: diff --git a/lib/cortex/snippets/version.rb b/lib/cortex/snippets/version.rb index 3258a76..d878f2b 100644 --- a/lib/cortex/snippets/version.rb +++ b/lib/cortex/snippets/version.rb @@ -1,5 +1,5 @@ module Cortex module Snippets - VERSION = '1.1.0' + VERSION = '1.1.1' end end diff --git a/lib/cortex/snippets/webpage.rb b/lib/cortex/snippets/webpage.rb index aec548b..e6b6389 100644 --- a/lib/cortex/snippets/webpage.rb +++ b/lib/cortex/snippets/webpage.rb @@ -59,12 +59,12 @@ def dynamic_yield } end - def table_widget_data + def tables_widget_data JSON.parse(@webpage[:tables_widget_json] || 'null', quirks_mode: true) end - def table_widget_data_for(table_name) - table_widget_data&.[](table_name) || [] + def tables_widget_data_for(section_name) + tables_widget_data&.[](section_name) || [] end def snippets