From eb1480032277186acfd4edde44fff67cd7e27ceb Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 11 Feb 2014 18:06:13 +0800 Subject: [PATCH] changes in kernel for widgets to enable or disable main and column titles. --- app/controllers/default_widget_controller.rb | 3 ++- app/views/default_widget/_typeA.html.erb | 7 +++++++ built_in_extensions.rb | 1 + lib/orbit_app/module/widget.rb | 14 +++++++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index 60a252e..1f9e1d9 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -52,6 +52,7 @@ class DefaultWidgetController< OrbitWidgetController @tag_class = nil @default_widget = @page_part.module_app.get_default_widget @widget_image_field = @default_widget["image"] || @default_widget[:image] + case @page_part when Page @frontend_field_names = @page_part.frontend_field_name @@ -65,7 +66,7 @@ class DefaultWidgetController< OrbitWidgetController @frontend_field_names = @page_part.widget_field_name @frontend_classes = @page_part.widget_class @frontend_sat_to_links = @page_part.widget_sat_to_link - + @widget_title = @page_part.title_translations[I18n.locale.to_s] @fields = @page_part.widget_field @data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3) end diff --git a/app/views/default_widget/_typeA.html.erb b/app/views/default_widget/_typeA.html.erb index d419554..ea07601 100644 --- a/app/views/default_widget/_typeA.html.erb +++ b/app/views/default_widget/_typeA.html.erb @@ -2,11 +2,18 @@
+ <% if @default_widget['widget_title_enabled'] %> + + <%= content_tag(:th,content_tag(:span,@widget_title,:class=>"title"),:colspan=>@frontend_field_names.count) unless @page_part.title_translations.empty?%> + + <% end %> + <% if @default_widget['column_title_enabled'] %> <% @frontend_field_names.each_with_index do |field,index|%> <%= content_tag(:th,content_tag(:span,get_field_header(field),:class=>@frontend_classes[index]))unless field.blank?%> <% end %> + <% end %> <% @data.each do |row_data| %> diff --git a/built_in_extensions.rb b/built_in_extensions.rb index a235a14..c5289a2 100644 --- a/built_in_extensions.rb +++ b/built_in_extensions.rb @@ -15,3 +15,4 @@ gem 'personal_patent', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit- gem 'personal_project', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-personalproject.git' gem 'personal_research', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-personalresearch.git' gem 'web_resource', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-webresource.git' +gem 'faq', '0.0.1', :path => "/Users/H4RRY/github/modules/orbit-faq" \ No newline at end of file diff --git a/lib/orbit_app/module/widget.rb b/lib/orbit_app/module/widget.rb index 9976c9f..1ca4cac 100644 --- a/lib/orbit_app/module/widget.rb +++ b/lib/orbit_app/module/widget.rb @@ -26,6 +26,8 @@ module OrbitApp def initialize(name,key,&block) @widgets = [] @default_widget = nil + @widget_title_enabled = true + @column_title_enabled = false @categories_query = '' @tags_query = '' block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? @@ -101,6 +103,8 @@ module OrbitApp def initialize(&block) @query = nil + @widget_title_enabled = true + @column_title_enabled = false @image = nil @more_link = {} @fields = [] @@ -122,7 +126,7 @@ module OrbitApp end def to_module_app_format - {"query"=>@query,"image"=>@image,"more_link"=>@more_link,"enabled_styles"=>@enabled_styles} rescue nil + {"query"=>@query,"image"=>@image,"more_link"=>@more_link,"enabled_styles"=>@enabled_styles,"widget_title_enabled"=>@widget_title_enabled, "column_title_enabled"=>@column_title_enabled} rescue nil end def link_field(field_name,setting) @@ -145,6 +149,14 @@ module OrbitApp @query = var end + def widget_title_enabled(var) + @widget_title_enabled = var + end + + def column_title_enabled(var) + @column_title_enabled = var + end + def image(var) @image = var end