change bulletin object to bulletin title

This commit is contained in:
Rueshyna 2013-01-04 10:50:08 +08:00
parent a0868a05ac
commit 3e8b029c5f
4 changed files with 24 additions and 22 deletions

View File

@ -14,8 +14,6 @@ class DefaultWidgetController< OrbitWidgetController
@data = eval(@default_widget[:query]).limit(data_limit).includes(@widget_image_field) @data = eval(@default_widget[:query]).limit(data_limit).includes(@widget_image_field)
@fields = @page_part.widget_field @fields = @page_part.widget_field
# binding.pry
case params[:type] case params[:type]
when "typeA" when "typeA"
@tag_class = 'defulat_widget_typeA' @tag_class = 'defulat_widget_typeA'
@ -28,8 +26,6 @@ class DefaultWidgetController< OrbitWidgetController
render "typeC" render "typeC"
end end
# {"inner"=>"true", # {"inner"=>"true",
# "category_id"=>"false", # "category_id"=>"false",
# "tag_id"=>"", # "tag_id"=>"",
@ -41,5 +37,4 @@ class DefaultWidgetController< OrbitWidgetController
# "action"=>"default_widget", # "action"=>"default_widget",
# "type"=>"typeA"} # "type"=>"typeA"}
end end
end end

View File

@ -11,7 +11,11 @@
<% @data.each do |row_data| %> <% @data.each do |row_data| %>
<tr> <tr>
<% @fields.each do |field|%> <% @fields.each do |field|%>
<td><%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%></td> <% if field[0] == "bulletin_category"%>
<td><%= content_tag(:span,row_data.send(field[0]).title,:class=>field[1])%></td>
<% else %>
<td><%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%></td>
<% end %>
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>

View File

@ -1,22 +1,21 @@
<%= content_tag :div,:class=>@tag_class do%> <%= content_tag :div,:class=>@tag_class do%>
<ul class="defulat_widget_list"> <ul class="defulat_widget_list">
<% @data.each do |row_data| %> <% @data.each do |row_data| %>
<%= content_tag(:li) do %> <%= content_tag(:li) 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>
<div class="wrap"> <div class="wrap">
<% @fields.each do |field|%> <% @fields.each do |field|%>
<% if field[0] == "bulletin_category"%>
<%= content_tag(:span,row_data.send(field[0]).title,:class=>field[1])%>
<% else %>
<%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%> <%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%>
<% end %> <% end %>
</div> <% end %>
</div>
<% end %> <% end %>
<% end %> <% end %>
</ul> </ul>
<div class="more">more</div> <div class="more">more</div>
<% end %> <% end %>

View File

@ -2,14 +2,18 @@
<div class="img app-pic"> <div class="img app-pic">
<%= image_tag @data.first.send(@widget_image_field)%> <%= image_tag @data.first.send(@widget_image_field)%>
</div> </div>
<ul class="defulat_widget_list"> <ul class="defulat_widget_list">
<% @data.each do |row_data| %> <% @data.each do |row_data| %>
<%= content_tag(:li) do %> <%= content_tag(:li) do %>
<% @fields.each do |field|%> <% @fields.each do |field|%>
<% if field[0] == "bulletin_category"%>
<%= content_tag(:span,row_data.send(field[0]).title,:class=>field[1])%>
<% else %>
<%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%> <%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
</ul> <% end %>
<div class="more">more</div> </ul>
<% end %> <div class="more">more</div>
<% end %>