Skip to content

Commit bb92ff2

Browse files
authored
Merge pull request #30 from cortex-cms/topic/EM-1417/Create-Chart-Widget
topic/EM-1417: Add Methods for Charts Widget Data Access
2 parents 92d8733 + 3c982ac commit bb92ff2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/cortex/snippets/webpage.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ def tables_widget_data_for(section_name)
6767
tables_widget_data&.[](section_name) || []
6868
end
6969

70+
def charts_widget_data
71+
JSON.parse(@webpage[:charts_widget_json] || 'null', quirks_mode: true)
72+
end
73+
74+
def charts_widget_data_for(section_name)
75+
charts_widget_data&.[](section_name) || {}
76+
end
77+
7078
def snippets
7179
@webpage[:snippets]
7280
end

0 commit comments

Comments
 (0)