changes in kernel for widgets to enable or disable main and column titles.

This commit is contained in:
Harry Bomrah 2014-02-11 18:06:13 +08:00 committed by Saurabh Bhatia
parent 26980ebf33
commit 703a1f416f
4 changed files with 23 additions and 2 deletions

View File

@ -52,6 +52,7 @@ class DefaultWidgetController< OrbitWidgetController
@tag_class = nil @tag_class = nil
@default_widget = @page_part.module_app.get_default_widget @default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image] @widget_image_field = @default_widget["image"] || @default_widget[:image]
case @page_part case @page_part
when Page when Page
@frontend_field_names = @page_part.frontend_field_name @frontend_field_names = @page_part.frontend_field_name
@ -65,7 +66,7 @@ class DefaultWidgetController< OrbitWidgetController
@frontend_field_names = @page_part.widget_field_name @frontend_field_names = @page_part.widget_field_name
@frontend_classes = @page_part.widget_class @frontend_classes = @page_part.widget_class
@frontend_sat_to_links = @page_part.widget_sat_to_link @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 @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) @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 end

View File

@ -2,11 +2,18 @@
<div class="default_widget_type_A"> <div class="default_widget_type_A">
<table class="default_widget_tb" border="0" cellpadding="0" cellspacing="0" > <table class="default_widget_tb" border="0" cellpadding="0" cellspacing="0" >
<thead> <thead>
<% if @default_widget['widget_title_enabled'] %>
<tr>
<%= content_tag(:th,content_tag(:span,@widget_title,:class=>"title"),:colspan=>@frontend_field_names.count) unless @page_part.title_translations.empty?%>
</tr>
<% end %>
<% if @default_widget['column_title_enabled'] %>
<tr> <tr>
<% @frontend_field_names.each_with_index do |field,index|%> <% @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?%> <%= content_tag(:th,content_tag(:span,get_field_header(field),:class=>@frontend_classes[index]))unless field.blank?%>
<% end %> <% end %>
</tr> </tr>
<% end %>
</thead> </thead>
<% @data.each do |row_data| %> <% @data.each do |row_data| %>
<tr> <tr>

View File

@ -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_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 '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 '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"

View File

@ -26,6 +26,8 @@ module OrbitApp
def initialize(name,key,&block) def initialize(name,key,&block)
@widgets = [] @widgets = []
@default_widget = nil @default_widget = nil
@widget_title_enabled = true
@column_title_enabled = false
@categories_query = '' @categories_query = ''
@tags_query = '' @tags_query = ''
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
@ -101,6 +103,8 @@ module OrbitApp
def initialize(&block) def initialize(&block)
@query = nil @query = nil
@widget_title_enabled = true
@column_title_enabled = false
@image = nil @image = nil
@more_link = {} @more_link = {}
@fields = [] @fields = []
@ -122,7 +126,7 @@ module OrbitApp
end end
def to_module_app_format 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 end
def link_field(field_name,setting) def link_field(field_name,setting)
@ -145,6 +149,14 @@ module OrbitApp
@query = var @query = var
end end
def widget_title_enabled(var)
@widget_title_enabled = var
end
def column_title_enabled(var)
@column_title_enabled = var
end
def image(var) def image(var)
@image = var @image = var
end end