add class to default widget if row data is hot or top
This commit is contained in:
parent
c1316f72a0
commit
aea15fa622
|
@ -3,6 +3,13 @@ module DefaultWidgetHelper
|
||||||
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_top_hot_class(row_data)
|
||||||
|
class_attr = []
|
||||||
|
class_attr << 'data_is_hot' if( row_data.is_hot? rescue false )
|
||||||
|
class_attr << 'data_is_top' if( row_data.is_top? rescue false)
|
||||||
|
return class_attr.join(" ")
|
||||||
|
end
|
||||||
|
|
||||||
def link_to_field(row_data,field, switch, options=nil)
|
def link_to_field(row_data,field, switch, options=nil)
|
||||||
method_ary = @page_part.module_app.widget_fields_link_method
|
method_ary = @page_part.module_app.widget_fields_link_method
|
||||||
field = field.to_sym
|
field = field.to_sym
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<% @data.each do |row_data| %>
|
<% @data.each do |row_data| %>
|
||||||
<tr>
|
<tr class="<%= get_top_hot_class(row_data) %>">
|
||||||
<% @frontend_field_names.each_with_index do |field,index|%>
|
<% @frontend_field_names.each_with_index do |field,index|%>
|
||||||
<%= content_tag(:td,content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]))unless field.blank?%>
|
<%= content_tag(:td,content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]))unless field.blank?%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%= content_tag :div,:class=>@tag_class do%>
|
<%= content_tag :div,:class=>@tag_class do%>
|
||||||
<ul class="default_widget_list">
|
<ul class="default_widget_list">
|
||||||
<% @data.each do |row_data| %>
|
<% @data.each do |row_data| %>
|
||||||
<%= content_tag(:li) do %>
|
<%= content_tag(:li,:class=>get_top_hot_class(row_data)) do %>
|
||||||
<div class="img app-pic">
|
<div class="img app-pic">
|
||||||
<%= image_tag row_data.send(@widget_image_field)%>
|
<%= image_tag row_data.send(@widget_image_field)%>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ul class="default_widget_list">
|
<ul class="default_widget_list">
|
||||||
<% @data.each do |row_data| %>
|
<% @data.each do |row_data| %>
|
||||||
<%= content_tag(:li) do %>
|
<%= content_tag(:li,:class=>get_top_hot_class(row_data)) do %>
|
||||||
<% @frontend_field_names.each_with_index do |field,index|%>
|
<% @frontend_field_names.each_with_index do |field,index|%>
|
||||||
<%= content_tag(:span, link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%>
|
<%= content_tag(:span, link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue