Add list widgets for announcement, news and links with categories and tags
This commit is contained in:
parent
9a6b66c57d
commit
13587306bc
|
@ -22,17 +22,20 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@part = PagePart.find(params[:id])
|
@part = PagePart.find(params[:id])
|
||||||
@module_apps = ModuleApp.all(:conditions => {:enable_frontend => true})
|
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
|
||||||
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
||||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
case @module_app.key
|
case @module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
@tags = AnnouncementTag.all
|
||||||
when 'news'
|
when 'news'
|
||||||
@categories = NewsBulletinCategory.all
|
@categories = NewsBulletinCategory.all
|
||||||
|
@tags = NewsTag.all
|
||||||
when 'web_resource'
|
when 'web_resource'
|
||||||
@categories = WebLinkCategory.all
|
@categories = WebLinkCategory.all
|
||||||
|
@tags = WebResourceTag.all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,10 +72,13 @@ class Admin::PagePartsController < ApplicationController
|
||||||
case @module_app.key
|
case @module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
@tags = AnnouncementTag.all
|
||||||
when 'news'
|
when 'news'
|
||||||
@categories = NewsBulletinCategory.all
|
@categories = NewsBulletinCategory.all
|
||||||
|
@tags = NewsTag.all
|
||||||
when 'web_resource'
|
when 'web_resource'
|
||||||
@categories = WebLinkCategory.all
|
@categories = WebLinkCategory.all
|
||||||
|
@tags = WebResourceTag.all
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
:
|
||||||
|
|
||||||
<span id="widget_category">
|
<span id="widget_category">
|
||||||
<%= render 'widget_categories' %>
|
<%= render 'widget_categories' %>
|
||||||
</span>
|
</span>
|
||||||
|
or
|
||||||
|
<span id="widget_tag">
|
||||||
|
<%= render 'widget_tags' %>
|
||||||
|
</span>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %>
|
|
@ -1,2 +1,3 @@
|
||||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
||||||
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
||||||
|
$('#widget_tag').html("<%= j render 'widget_tags' %>")
|
|
@ -46,6 +46,7 @@ module ParserBackEnd
|
||||||
if (content["main"] == "true" && !page.module_app.nil?)
|
if (content["main"] == "true" && !page.module_app.nil?)
|
||||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
|
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
|
||||||
ret << "&category_id=#{page.category}" if page[:category]
|
ret << "&category_id=#{page.category}" if page[:category]
|
||||||
|
ret << "&tag_id=#{page.tag}" if page[:tag]
|
||||||
ret << "'></div>"
|
ret << "'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||||
|
@ -57,8 +58,10 @@ module ParserBackEnd
|
||||||
when 'text'
|
when 'text'
|
||||||
ret << part.i18n_variable[I18n.locale] rescue ''
|
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||||
when 'module_widget'
|
when 'module_widget'
|
||||||
if part[:category]
|
if !part[:category].blank?
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?category_id=#{part[:category]}'></div>"
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?category_id=#{part[:category]}}'></div>"
|
||||||
|
elsif !part[:tag].blank?
|
||||||
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{part[:tag]}'></div>"
|
||||||
else
|
else
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}'></div>"
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}'></div>"
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,10 +61,10 @@ module ParserFrontEnd
|
||||||
# else
|
# else
|
||||||
# ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
# ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
||||||
# end
|
# end
|
||||||
if !params[:category_id].blank?
|
if !part[:category].blank?
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{params[:category_id]}'></div>"
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
|
||||||
elsif !params[:tag_id].blank?
|
elsif !part[:tag].blank?
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{params[:tag_id]}'></div>"
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{part[:tag]}'></div>"
|
||||||
else
|
else
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,17 +13,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
if !params[:category_id].blank?
|
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]).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]).per(10)
|
||||||
|
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
tmp = AnnouncementTag.find(params[:tag_id]) rescue nil
|
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||||
tmp = AnnouncementTag.where(key: params[:tag_id])[0] unless tmp
|
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
@bulletins = tmp.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]).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]).per(10)
|
||||||
else
|
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]).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]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
|
||||||
|
|
||||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -10,18 +10,19 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
# deadline
|
date_now = Time.now
|
||||||
# @bulletin_categorys = BulletinCategory.first;
|
|
||||||
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
|
|
||||||
if !params[:category_id].blank?
|
if !params[:category_id].blank?
|
||||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
@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]).per(10)
|
||||||
|
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.widget_datas.limit(9) rescue nil
|
@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]).per(10)
|
||||||
else
|
else
|
||||||
@bulletins = Bulletin.can_display.widget_datas.limit(9)
|
@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]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,29 @@
|
||||||
<% # encoding: utf-8 %>
|
<% if @current_category %>
|
||||||
|
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
|
||||||
<% if @bulletins and !@bulletins.nil? %>
|
<% elsif @tag %>
|
||||||
<h2 class="topic_title"><%= t('announcement.campus_news')%></h2>
|
<h1 class="h1"><%= @tag[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
|
||||||
<%= link_to t('announcement.more'),panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
|
<% else %>
|
||||||
<div class="topic_prev">previous page</div>
|
<h1 class="h1"><%= t('announcement.list_announcement') %></h1>
|
||||||
<div class="topic_next">next page</div>
|
|
||||||
<ul id="topic_list">
|
|
||||||
<% @bulletins.each do |post| %>
|
|
||||||
<li>
|
|
||||||
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
|
|
||||||
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %></h3>
|
|
||||||
<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<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] %></td>
|
||||||
|
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||||
|
</td>
|
||||||
|
<td><%= post.postdate %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= paginate @bulletins, :params => {:inner => 'false'} %>
|
|
@ -9,20 +9,18 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||||
# GET /news_bulletins.xml
|
# GET /news_bulletins.xml
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
date_now = Time.now
|
||||||
# deadline
|
|
||||||
# @news_bulletin_categorys = NewsBulletinCategory.first;
|
|
||||||
# @news_bulletins = NewsBulletin.widget_datas(@news_bulletin_categorys.id).limit(9)
|
|
||||||
if !params[:category_id].blank?
|
if !params[:category_id].blank?
|
||||||
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
@news_bulletins = NewsBulletin.can_display.where(:news_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]).per(10)
|
||||||
|
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
|
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
||||||
|
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
|
@news_bulletins = @tag.news_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]).per(10) rescue nil
|
||||||
else
|
else
|
||||||
@news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
|
@news_bulletins = NewsBulletin.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]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def news_bulletins_and_web_links
|
def news_bulletins_and_web_links
|
||||||
|
@ -48,6 +46,18 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||||
get_categorys
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def home_banner
|
||||||
|
if !params[:category_id].blank?
|
||||||
|
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||||
|
elsif !params[:tag_id].blank?
|
||||||
|
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
|
||||||
|
else
|
||||||
|
@news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
|
||||||
|
end
|
||||||
|
get_categorys
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
28
vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
vendored
Normal file
28
vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<% if @news_bulletins and !@news_bulletins.nil? %>
|
||||||
|
<h2 class="topic_title"><%= t('news.campus_news')%></h2>
|
||||||
|
<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
|
||||||
|
<div class="btn-group topic_note">
|
||||||
|
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||||
|
<%= t('news.more') %>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<% @news_bulletin_categorys.each do |category| %>
|
||||||
|
<li>
|
||||||
|
<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="topic_prev">previous page</div>
|
||||||
|
<div class="topic_next">next page</div>
|
||||||
|
<ul id="topic_list">
|
||||||
|
<% @news_bulletins.each do |post| %>
|
||||||
|
<li>
|
||||||
|
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
|
||||||
|
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
|
||||||
|
<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
|
@ -1,33 +1,33 @@
|
||||||
<% # encoding: utf-8 %>
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
<% if @news_bulletins and !@news_bulletins.nil? %>
|
<%= flash_messages %>
|
||||||
<h2 class="topic_title"><%= t('news.campus_news')%></h2>
|
|
||||||
<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
|
|
||||||
<div class="btn-group topic_note">
|
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
|
||||||
<%= t('news.more') %>
|
|
||||||
<span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<% @news_bulletin_categorys.each do |category| %>
|
|
||||||
<li>
|
|
||||||
<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="topic_prev">previous page</div>
|
|
||||||
<div class="topic_next">next page</div>
|
|
||||||
<ul id="topic_list">
|
|
||||||
<% @news_bulletins.each do |post| %>
|
|
||||||
<li>
|
|
||||||
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
|
|
||||||
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
|
|
||||||
<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
<% if @current_category %>
|
||||||
|
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %></h1>
|
||||||
|
<% elsif @tag %>
|
||||||
|
<h1 class="h1"><%= @tag[I18n.locale] + t('news.news_bulletin.list_lower') %></h1>
|
||||||
|
<% else %>
|
||||||
|
<h1 class="h1"><%= t('news.list_news') %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th class="span2"><%= t('news.news_bulletin.image') %></th>
|
||||||
|
<th><%= t('news.news_bulletin.title') %></th>
|
||||||
|
<th class="span2 pagination-right"><%= t('news.news_bulletin.postdate') %></th>
|
||||||
|
</tr>
|
||||||
|
<% @news_bulletins.each do |post| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= image_tag post.image %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||||
|
<%= post.subtitle[I18n.locale].html_safe %>
|
||||||
|
</td>
|
||||||
|
<td><%= post.postdate %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= paginate @news_bulletins, :params => {:inner => 'false'} %>
|
||||||
|
|
|
@ -43,6 +43,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
match "news_bulletins" => "news_bulletins#index"
|
match "news_bulletins" => "news_bulletins#index"
|
||||||
|
match "home_banner" => "news_bulletins#home_banner"
|
||||||
match "news_bulletins_and_web_links" => "news_bulletins#news_bulletins_and_web_links"
|
match "news_bulletins_and_web_links" => "news_bulletins#news_bulletins_and_web_links"
|
||||||
match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins"
|
match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins"
|
||||||
match "reload_web_links" => "news_bulletins#reload_web_links"
|
match "reload_web_links" => "news_bulletins#reload_web_links"
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
"update_info": "Some info",
|
"update_info": "Some info",
|
||||||
"create_date": "11-11-2011",
|
"create_date": "11-11-2011",
|
||||||
"app_pages": ["news_bulletins"],
|
"app_pages": ["news_bulletins"],
|
||||||
"widgets": ["news_bulletins", "news_bulletins_and_web_links"],
|
"widgets": ["news_bulletins", "news_bulletins_and_web_links", "home_banner"],
|
||||||
"enable_frontend": true
|
"enable_frontend": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,23 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
|
||||||
# GET /web_links
|
# GET /web_links
|
||||||
# GET /web_links.xml
|
# GET /web_links.xml
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
if !params[:category_id].blank?
|
||||||
|
@web_links = WebLink.where(:web_link_category => params[:category_id]).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||||
|
@current_category = WebLinkCategory.from_id(params[:category_id]) rescue nil
|
||||||
|
elsif !params[:tag_id].blank?
|
||||||
|
@tag = WebResourceTag.find(params[:tag_id]) rescue nil
|
||||||
|
@tag = WebResourceTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
|
@web_links = @tag.web_links.desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||||
|
else
|
||||||
|
@web_links = WebLink.all.desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def home_list
|
||||||
|
|
||||||
# deadline
|
# deadline
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h3 class="link_title"><%= t("announcement.related_links") %></h3>
|
||||||
|
|
||||||
|
<div id='web_links_links'>
|
||||||
|
<%= render 'web_links' %>
|
||||||
|
</div>
|
|
@ -1,5 +1,26 @@
|
||||||
<h3 class="link_title"><%= t("announcement.related_links") %></h3>
|
<% if @current_category %>
|
||||||
|
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + " " + t('web_resource.list_lower') %></h1>
|
||||||
|
<% elsif @tag %>
|
||||||
|
<h1 class="h1"><%= @tag[I18n.locale] + " " + t('web_resource.list_lower') %></h1>
|
||||||
|
<% else %>
|
||||||
|
<h1 class="h1"><%= t('web_resource.list_link') %></h1>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div id='web_links_links'>
|
<table class="table table-bordered">
|
||||||
<%= render 'web_links' %>
|
<tbody>
|
||||||
</div>
|
<tr>
|
||||||
|
<th><%= t('web_resource.category') %></th>
|
||||||
|
<th><%= t('web_resource.name') %></th>
|
||||||
|
</tr>
|
||||||
|
<% @web_links.each do |post| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%= paginate @web_links, :params => {:inner => 'false'} %>
|
||||||
|
|
|
@ -26,6 +26,12 @@ en:
|
||||||
announcement:
|
announcement:
|
||||||
sure?: Sure?
|
sure?: Sure?
|
||||||
|
|
||||||
|
|
||||||
|
web_resource:
|
||||||
|
list_lower: list
|
||||||
|
list_link: Links list
|
||||||
|
|
||||||
|
|
||||||
# admin:
|
# admin:
|
||||||
# action: Action
|
# action: Action
|
||||||
# add_language: Add language
|
# add_language: Add language
|
||||||
|
|
|
@ -18,102 +18,9 @@ zh_tw:
|
||||||
update: 更新
|
update: 更新
|
||||||
yes_: "Yes"
|
yes_: "Yes"
|
||||||
|
|
||||||
admin:
|
web_resource:
|
||||||
action: 行動
|
list_lower: 列表
|
||||||
add_language: 新增語言
|
list_link: 鏈接列表
|
||||||
admin: 管理
|
|
||||||
action: 行動
|
|
||||||
announcement: 公告
|
|
||||||
asset: 資產
|
|
||||||
attributes: 屬性
|
|
||||||
cant_delete_self: 您不可以刪除自己。
|
|
||||||
cant_revoke_self_admin: 您不可以撤銷自己的管理作用。
|
|
||||||
class: 階級
|
|
||||||
content: 內容
|
|
||||||
create_error_link: 創建連接時出錯。
|
|
||||||
create_error_page: 創建頁面時出錯。
|
|
||||||
create_success_home: 首頁已成功創建。
|
|
||||||
create_success_layout: 樣板已成功創建。
|
|
||||||
create_success_link: 連結已成功創建。
|
|
||||||
create_success_page: 頁面已成功創建。
|
|
||||||
create_success_snippet: 片段已成功創建
|
|
||||||
create_success_user: 用戶已成功創建。。
|
|
||||||
data: 數據
|
|
||||||
delete_language: 刪除語言
|
|
||||||
description: 描述
|
|
||||||
disable_language: 禁用語言
|
|
||||||
editing_home: 編輯首頁
|
|
||||||
editing_layout: 編輯樣板
|
|
||||||
editing_link: 編輯連結
|
|
||||||
editing_page: 編輯頁面
|
|
||||||
editing_snippet: 編輯片段
|
|
||||||
editing_user_info: 編輯用戶資料
|
|
||||||
editing_user_role: 編輯用戶角色
|
|
||||||
email: Email
|
|
||||||
enable_language: 啟用語言
|
|
||||||
file_name: 檔名
|
|
||||||
file_size: 檔案大小
|
|
||||||
format: 格式
|
|
||||||
home: 首頁
|
|
||||||
id: ID
|
|
||||||
info: 資料
|
|
||||||
is_published: 被出版
|
|
||||||
item: 項目
|
|
||||||
key: 關鍵
|
|
||||||
language: 語言
|
|
||||||
layout: 佈局
|
|
||||||
layout_name: 佈局名字
|
|
||||||
list_assets: 資產清單
|
|
||||||
list_items: 項目清單
|
|
||||||
list_layouts: 佈局清單
|
|
||||||
list_snippets: 斷片清單
|
|
||||||
list_users: 使用清單
|
|
||||||
list_user_infos: 用戶資料清單
|
|
||||||
list_user_roles: 用戶角色清單
|
|
||||||
member: 會員
|
|
||||||
move_down: 往下移
|
|
||||||
move_up: 往上移
|
|
||||||
multilingual: 多種語言
|
|
||||||
my_avatar: 我的頭像
|
|
||||||
no_home_page: 您沒有首頁
|
|
||||||
no_layout: 您沒有佈局
|
|
||||||
name: 名稱
|
|
||||||
new_asset: 新增資產
|
|
||||||
new_component: 新增元件
|
|
||||||
new_home: 新增首頁
|
|
||||||
new_layout: 新增樣板
|
|
||||||
new_link: 新增連結
|
|
||||||
new_page: 新增頁面
|
|
||||||
new_snippet: 新增片段
|
|
||||||
new_user: 新增使用
|
|
||||||
new_user_info: 新增用戶資料
|
|
||||||
new_user_role: 新增用戶角色
|
|
||||||
non_multilingual: 非多種語言
|
|
||||||
options: 選項
|
|
||||||
orig_upload_file: 原上傳檔名
|
|
||||||
position: 位置
|
|
||||||
published?: 發布?
|
|
||||||
role: 角色
|
|
||||||
roles: 角色。
|
|
||||||
title: 標題
|
|
||||||
translation: 翻譯
|
|
||||||
type: 類型
|
|
||||||
update_error_link: 更新鏈接時出現錯誤。
|
|
||||||
update_error_page: 更新頁面時出現錯誤。
|
|
||||||
update_success_content: 內容已成功更新。
|
|
||||||
update_success_home: 首頁已成功更新。
|
|
||||||
update_success_layout: 樣板已成功更新。
|
|
||||||
update_success_link: 連結已成功更新。
|
|
||||||
update_success_page: 頁面已成功更新。
|
|
||||||
update_success_snippet: 片段已成功更新。
|
|
||||||
update_success_user: 用戶已成功更新
|
|
||||||
url: URL
|
|
||||||
user: 用戶
|
|
||||||
user_info: 用戶資料
|
|
||||||
user_panel: 用戶面板
|
|
||||||
user_role: 用戶角色
|
|
||||||
|
|
||||||
panel:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
match "web_links" => "web_links#index"
|
match "web_links" => "web_links#index"
|
||||||
|
match "home_list" => "web_links#home_list"
|
||||||
match "reload_web_links" => "web_links#reload_web_links"
|
match "reload_web_links" => "web_links#reload_web_links"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
"update_info": "Some info",
|
"update_info": "Some info",
|
||||||
"create_date": "11-11-2011",
|
"create_date": "11-11-2011",
|
||||||
"app_pages": ["web_links"],
|
"app_pages": ["web_links"],
|
||||||
"widgets": ["web_links"],
|
"widgets": ["web_links", "home_list"],
|
||||||
"enable_frontend": true
|
"enable_frontend": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue