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 454b640..d878f2b 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.1' end end diff --git a/lib/cortex/snippets/webpage.rb b/lib/cortex/snippets/webpage.rb index 55a935d..e6b6389 100644 --- a/lib/cortex/snippets/webpage.rb +++ b/lib/cortex/snippets/webpage.rb @@ -59,6 +59,14 @@ def dynamic_yield } end + def tables_widget_data + JSON.parse(@webpage[:tables_widget_json] || 'null', quirks_mode: true) + end + + def tables_widget_data_for(section_name) + tables_widget_data&.[](section_name) || [] + end + def snippets @webpage[:snippets] end