From b7fa61ce018a150670167154f03fd0fc45adc8a8 Mon Sep 17 00:00:00 2001 From: david rosenbloom Date: Thu, 29 May 2014 16:54:25 -0400 Subject: [PATCH 1/2] Template for list widget. --- app/views/chameleon/widgets/list.xml.erb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/views/chameleon/widgets/list.xml.erb diff --git a/app/views/chameleon/widgets/list.xml.erb b/app/views/chameleon/widgets/list.xml.erb new file mode 100644 index 0000000..9c901dd --- /dev/null +++ b/app/views/chameleon/widgets/list.xml.erb @@ -0,0 +1,16 @@ + + + <% @data.each do |entry| %> + + + + <text><![CDATA[<%=raw entry[:text] %>]]></text> + <highlight><%=entry[:highlight] %></highlight> + + ]]> + + <% end %> + From 7756e083d45efc802f6c6291e609a28a1eff35ee Mon Sep 17 00:00:00 2001 From: david rosenbloom Date: Fri, 13 Jun 2014 15:51:41 -0400 Subject: [PATCH 2/2] Added sample List widget in /doc dir. --- doc/list_sample.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/list_sample.rb diff --git a/doc/list_sample.rb b/doc/list_sample.rb new file mode 100644 index 0000000..96dac50 --- /dev/null +++ b/doc/list_sample.rb @@ -0,0 +1,18 @@ +widget :somethings do + #key some_key + type "list" + a = [] + data do + Somethings.scope_of_interest.each do |s| + a << { + :name => s.suitable_field_for_name + :color => 'red', # or whichever + :text => s.suitable_field_for_text, + :highlight => true, # or not + :description => s.suitable_field_for_description + } + end + a + end +end +