orbit-announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb

253 lines
8.5 KiB
Plaintext

<% # encoding: utf-8 %>
<% if @title %>
<h2 class="h2"><%= @title %></h2>
<% end %>
<% if !@widget_fields.blank? %>
<% if @widget_style == '1' %>
<div class="default_widget_typeA">
<table class="default_widget_tb" border="0" cellpadding="0" cellspacing="0" >
<thead>
<tr>
<% @widget_fields.each do |wf| %>
<th><span class="<%= wf[1] %>"><%= t("announcement.default_widget.#{wf[0]}") if !wf[0].blank? %></span></th>
<% end %>
</tr>
</thead>
<% @posts.each do |post| %>
<tr class="<%= cycle('odd', '')%>">
<% @widget_fields.each do |wf| %>
<td>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("category_id")) %>
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'img' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %>
<% if post.is_top? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% end %>
<% elsif wf[1] == 'link' %>
<% elsif wf[1] == 'file' %>
<% elsif wf[1] == 'tag' %>
<% elsif wf[1] == 'viewcount' %>
<%= dislpay_view_count(post) %>
<% elsif wf[1] == 'poster' %>
<%= User.from_id(post.update_user_id).name rescue ''%>
<% end %>
</span>
</td>
<% end %>
</tr>
<% end %>
</table>
<div class="more"><%= link_to t('announcement.more'), panel_announcement_front_end_bulletins_path() %></div>
</div>
<% elsif @widget_style == '2' %>
<div class="default_widget_list">
<ul class="newslist">
<% @posts.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic" style="width:50px; height:50px;"><%= image_tag(post.image.url) %></div>
<% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("category_id")) %>
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %>
<% if post.is_top? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% end %>
<% elsif wf[1] == 'link' %>
<% elsif wf[1] == 'file' %>
<% elsif wf[1] == 'tag' %>
<% elsif wf[1] == 'viewcount' %>
<%= dislpay_view_count(post) %>
<% elsif wf[1] == 'poster' %>
<%= User.from_id(post.update_user_id).name rescue ''%>
<% end %>
</span>
<% end %>
</li>
<% end %>
</ul>
<% if !@category_id.blank? %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
<% else %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
<% end %>
</div>
<% elsif @widget_style == '3' %>
<div class="news news3">
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
<div class="wrap">
<% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %>
<% if post.is_top? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% end %>
<% elsif wf[1] == 'link' %>
<% elsif wf[1] == 'file' %>
<% elsif wf[1] == 'tag' %>
<% elsif wf[1] == 'viewcount' %>
<%= dislpay_view_count(post) %>
<% elsif wf[1] == 'poster' %>
<%= User.from_id(post.update_user_id).name rescue ''%>
<% end %>
</span>
<% end %>
</div>
</li>
<% end %>
</ul>
<% if !@category_id.blank? %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
<% else %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
<% end %>
</div>
<% elsif @widget_style == '4' %>
<div class="news news4">
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
<div class="wrap">
<% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %>
<% if post.is_top? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% end %>
<% elsif wf[1] == 'link' %>
<% elsif wf[1] == 'file' %>
<% elsif wf[1] == 'tag' %>
<% elsif wf[1] == 'viewcount' %>
<%= dislpay_view_count(post) %>
<% elsif wf[1] == 'poster' %>
<%= User.from_id(post.update_user_id).name rescue ''%>
<% end %>
</span>
<% end %>
</div>
</li>
<% end %>
</ul>
<% if !@category_id.blank? %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
<% else %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
<% end %>
</div>
<% elsif @widget_style == '5' %>
<div class="news news5">
<div class="img app-pic"><%= image_tag(@bulletins.first.image.url) %></div>
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
<% elsif wf[1] == 'status' %>
<% if post.is_top? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% end %>
<% elsif wf[1] == 'link' %>
<% elsif wf[1] == 'file' %>
<% elsif wf[1] == 'tag' %>
<% elsif wf[1] == 'viewcount' %>
<%= dislpay_view_count(post) %>
<% elsif wf[1] == 'poster' %>
<%= User.from_id(post.update_user_id).name rescue ''%>
<% end %>
</span>
<% end %>
</li>
<% end %>
</ul>
<% if !@category_id.blank? %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
<% else %>
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
<% end %>
</div>
<% end %>
<% end %>