widget & frontend field
This commit is contained in:
1 parent
c0cac812c5
commit
d5c55c9697
19 files changed
+604
-100
No files matched your search
+13
-3
@@ -9,17 +9,27 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
# GET /bulletins.xml
|
||||
|
||||
def index
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
if @item.frontend_data_count
|
||||
@page_num = @item.frontend_data_count
|
||||
else
|
||||
@page_num = 10
|
||||
end
|
||||
|
||||
@frontend_style = @item.frontend_style
|
||||
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10)
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10)
|
||||
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10)
|
||||
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -12,8 +12,6 @@ class Bulletin
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_and_belongs_to_many :tags, :class_name => "AnnouncementTag"
|
||||
|
||||
field :title2, localize: true
|
||||
|
||||
field :postdate , :type => DateTime
|
||||
field :deadline , :type => DateTime
|
||||
|
||||
Vendored
+1
-7
@@ -146,13 +146,7 @@
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.label :title2 %>
|
||||
<%= f.fields_for :title2_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@bulletin.title2_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
|
||||
vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
Vendored
+242
-16
@@ -8,26 +8,252 @@
|
||||
<h1 class="h1"><%= t('announcement.announcement') %></h1>
|
||||
<% end %>
|
||||
|
||||
<% if !@item.frontend_field.blank? %>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th><%= t('announcement.bulletin.category') %></th>
|
||||
<th><%= t('announcement.bulletin.title') %></th>
|
||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||
</tr>
|
||||
<% if @frontend_style == '1' %>
|
||||
|
||||
<div class="news news1">
|
||||
<table class="newstb" border="0" cellpadding="0" cellspacing="0" >
|
||||
<thead>
|
||||
<tr>
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<th><span class="<%= ff[1] %>"><%= t("announcement.bulletin.#{ff[0]}") if !ff[0].blank? %></span></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<% @bulletins.each do |post| %>
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<tr class="<%= cycle('odd', '')%>">
|
||||
<td>
|
||||
<span class="<%= ff[1] %>">
|
||||
<% if ff[1] == 'title' %>
|
||||
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<% elsif ff[1] == 'date' %>
|
||||
<%= display_date(post.send(ff[0])) %>
|
||||
<% elsif ff[1] == 'category' %>
|
||||
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif ff[1] == 'img' %>
|
||||
<div class="newsimg app-pic"><%= image_tag(post.image.url) %></div>
|
||||
<% elsif ff[1] == 'text' %>
|
||||
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||
<% elsif ff[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 ff[1] == 'link' %>
|
||||
<% elsif ff[1] == 'file' %>
|
||||
<% elsif ff[1] == 'tag' %>
|
||||
<% elsif ff[1] == 'viewcount' %>
|
||||
<%= dislpay_view_count(post) %>
|
||||
<% elsif ff[1] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% elsif @frontend_style == '2' %>
|
||||
|
||||
<div class="news news2">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="newsimg app-pic"><%= image_tag(post.image.url) %></div>
|
||||
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<span class="<%= ff[1] %>">
|
||||
<% if ff[1] == 'title' %>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<% elsif ff[1] == 'date' %>
|
||||
<%= display_date(post.send(ff[0])) %>
|
||||
<% elsif ff[1] == 'category' %>
|
||||
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif ff[1] == 'text' %>
|
||||
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||
<% elsif ff[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 ff[1] == 'link' %>
|
||||
<% elsif ff[1] == 'file' %>
|
||||
<% elsif ff[1] == 'tag' %>
|
||||
<% elsif ff[1] == 'viewcount' %>
|
||||
<%= dislpay_view_count(post) %>
|
||||
<% elsif ff[1] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% elsif @frontend_style == '3' %>
|
||||
|
||||
<div class="news news3">
|
||||
<ul class="newslist">
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="newsimg app-pic"><%= image_tag(post.image.url) %></div>
|
||||
<div class="wrap">
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<span class="<%= ff[1] %>">
|
||||
<% if ff[1] == 'title' %>
|
||||
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<% elsif ff[1] == 'date' %>
|
||||
<%= display_date(post.send(ff[0])) %>
|
||||
<% elsif ff[1] == 'category' %>
|
||||
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif ff[1] == 'text' %>
|
||||
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||
<% elsif ff[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 ff[1] == 'link' %>
|
||||
<% elsif ff[1] == 'file' %>
|
||||
<% elsif ff[1] == 'tag' %>
|
||||
<% elsif ff[1] == 'viewcount' %>
|
||||
<%= dislpay_view_count(post) %>
|
||||
<% elsif ff[1] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<% elsif @frontend_style == '4' %>
|
||||
|
||||
<div class="news news4">
|
||||
<ul class="newslist">
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="newsimg app-pic"><%= image_tag(post.image.url) %></div>
|
||||
<div class="wrap">
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<span class="<%= ff[1] %>">
|
||||
<% if ff[1] == 'title' %>
|
||||
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<% elsif ff[1] == 'date' %>
|
||||
<%= display_date(post.send(ff[0])) %>
|
||||
<% elsif ff[1] == 'category' %>
|
||||
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif ff[1] == 'text' %>
|
||||
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||
<% elsif ff[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 ff[1] == 'link' %>
|
||||
<% elsif ff[1] == 'file' %>
|
||||
<% elsif ff[1] == 'tag' %>
|
||||
<% elsif ff[1] == 'viewcount' %>
|
||||
<%= dislpay_view_count(post) %>
|
||||
<% elsif ff[1] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<% elsif @frontend_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', '')%>">
|
||||
<% @item.frontend_field.each do |ff| %>
|
||||
<span class="<%= ff[1] %>">
|
||||
<% if ff[1] == 'title' %>
|
||||
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<% elsif ff[1] == 'date' %>
|
||||
<%= display_date(post.send(ff[0])) %>
|
||||
<% elsif ff[1] == 'category' %>
|
||||
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif ff[1] == 'text' %>
|
||||
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||
<% elsif ff[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 ff[1] == 'link' %>
|
||||
<% elsif ff[1] == 'file' %>
|
||||
<% elsif ff[1] == 'tag' %>
|
||||
<% elsif ff[1] == 'viewcount' %>
|
||||
<%= dislpay_view_count(post) %>
|
||||
<% elsif ff[1] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||
</td>
|
||||
<td><%= display_date_time(post.postdate) %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
<% else %>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th><%= t('announcement.bulletin.category') %></th>
|
||||
<th><%= t('announcement.bulletin.title') %></th>
|
||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||
</tr>
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||
</td>
|
||||
<td><%= display_date_time(post.postdate) %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>
|
||||
|
||||
Vendored
+221
-54
@@ -3,41 +3,56 @@
|
||||
<h1 class="h1"><%= @title %></h1>
|
||||
<% end %>
|
||||
|
||||
<% if !@widget_fields.blank? %>
|
||||
|
||||
<% if @widget_style == '1' %>
|
||||
|
||||
<p> ========== 1 ========== </p>
|
||||
|
||||
<div class="news news1">
|
||||
<ul class="newslist">
|
||||
|
||||
<% @bulletins.each_with_index do |post, i| %>
|
||||
|
||||
<li <%= ( (i+1) % 2 ) == 0 ? "class='odd'" : '' %> >
|
||||
<table class="newstb" border="0" cellpadding="0" cellspacing="0" >
|
||||
<thead>
|
||||
<tr>
|
||||
<% @widget_fields.each do |wf| %>
|
||||
|
||||
<% if wf == 'title' %>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% elsif wf == 'date' %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<% elsif wf == '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 == 'subtitle' %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
<% elsif wf == 'image' %>
|
||||
<div class="newsimg app-pic"><%#= image_tag(post.image.url, :size => "90x90") if post.image.file %><%= image_tag(post.image.url) %></div>
|
||||
<% end %>
|
||||
|
||||
<th><span class="<%= wf[1] %>"><%= t("announcement.bulletin.#{wf[0]}") if !wf[0].blank? %></span></th>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<% @bulletins.each do |post| %>
|
||||
<% @widget_fields.each do |wf| %>
|
||||
<tr class="<%= cycle('odd', '')%>">
|
||||
<td>
|
||||
<span class="<%= wf[1] %>">
|
||||
<% if wf[1] == 'title' %>
|
||||
<%= link_to post.send("#{wf[0]}")[I18n.locale], 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]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif wf[1] == 'img' %>
|
||||
<div class="newsimg 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]}")[I18n.locale].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] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<% if !@category_id.blank? %>
|
||||
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||
@@ -46,41 +61,95 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<% elsif @widget_style == '2' %>
|
||||
|
||||
<p> ========== 2 ========== </p>
|
||||
|
||||
<div class="news news2">
|
||||
<div class="newsimg app-pic"><%= image_tag(@bulletins.first.image.url) %></div>
|
||||
<ul class="newslist">
|
||||
|
||||
<% @bulletins.each_with_index do |post, i| %>
|
||||
|
||||
<li <%= ( (i+1) % 2 ) == 0 ? "class='odd'" : '' %> >
|
||||
<% @widget_fields.each do |wf| %>
|
||||
<% @bulletins.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="newsimg app-pic"><%= image_tag(post.image.url) %></div>
|
||||
|
||||
<% if wf == 'title' %>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% elsif wf == 'date' %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<% elsif wf == '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 == 'subtitle' %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
<% @widget_fields.each do |wf| %>
|
||||
<span class="<%= wf[1] %>">
|
||||
<% if wf[1] == 'title' %>
|
||||
<%= link_to post.send("#{wf[0]}")[I18n.locale], 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]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif wf[1] == 'text' %>
|
||||
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{wf[0]}")[I18n.locale].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] == 'host' %>
|
||||
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
<% 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="newsimg 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]}")[I18n.locale], 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]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif wf[1] == 'text' %>
|
||||
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{wf[0]}")[I18n.locale].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] == 'host' %>
|
||||
<%= 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 %>
|
||||
@@ -88,5 +157,103 @@
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '4' %>
|
||||
|
||||
<div class="news news4">
|
||||
<ul class="newslist">
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="newsimg 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]}")[I18n.locale], 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]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif wf[1] == 'text' %>
|
||||
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{wf[0]}")[I18n.locale].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] == 'host' %>
|
||||
<%= 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]}")[I18n.locale], 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]}").i18n_variable[I18n.locale] rescue nil %>
|
||||
<% elsif wf[1] == 'text' %>
|
||||
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||
<%= post.send("#{wf[0]}")[I18n.locale].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] == 'host' %>
|
||||
<%= 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 %>
|
||||
+1
-1
@@ -39,7 +39,7 @@ Rails.application.routes.draw do
|
||||
# end
|
||||
end
|
||||
namespace :widget do
|
||||
match "index" => "bulletins#index"
|
||||
match "bulletins" => "bulletins#index"
|
||||
match "bulletins_and_web_links" => "bulletins#bulletins_and_web_links"
|
||||
match "reload_bulletins" => "bulletins#reload_bulletins"
|
||||
match "reload_web_links" => "bulletins#reload_web_links"
|
||||
|
||||
Reference in new issue
Block a user