Merge branch 'design_team' into ldap

Conflicts:
	vendor/built_in_modules/web_resource/web_resource.json
This commit is contained in:
Christophe Vilayphiou 2012-05-10 00:34:23 +08:00
commit de739d7d20
44 changed files with 628 additions and 237 deletions

View File

@ -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
@ -71,10 +74,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|

View File

@ -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>
<%= t :or_lower %>
<span id="widget_tag">
<%= render 'widget_tags' %>
</span>

View File

@ -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 %>

View File

@ -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' %>")

View File

@ -5,12 +5,12 @@
<%= javascript_include_tag "/static/kernel.js" %> <%= javascript_include_tag "/static/kernel.js" %>
<% end %> <% end %>
<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_sys_call_for_app('module_apps','edit','Announcement') do -%> <%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals','bulletin_category_setting') || active_sys_call_for_app('module_apps','edit','Announcement') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => (active_for_action('bulletin_categorys', 'index') || active_for_action('bulletin_category_setting', 'setting')) %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('module_apps','edit','Announcement') if (is_admin? rescue nil) %> <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('module_apps','edit','Announcement') if (is_admin? rescue nil) %>
@ -19,12 +19,12 @@
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals') do -%> <%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals','news_bulletin_category_setting') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => (active_for_action('news_bulletin_categorys', 'index') || active_for_action('news_bulletin_category_setting', 'setting'))%>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %> <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %> <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %>

View File

@ -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

View File

@ -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

View File

@ -7,9 +7,9 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
@bulletin = Bulletin.find params[:bulletin_id] @bulletin = Bulletin.find params[:bulletin_id]
end end
def approve # def approve
#
end # end
def setting def setting
@bulletin_categorys = BulletinCategory.all @bulletin_categorys = BulletinCategory.all
@ -39,41 +39,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def user_list def user_list
@bulletin_category = BulletinCategory.find params[:category][:id] @bulletin_category = BulletinCategory.find params[:category][:id]
end end
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected protected
def update_setting_by_params def update_setting_by_params
category = BulletinCategory.find params[:category][:id] category = BulletinCategory.find params[:category][:id]

View File

@ -0,0 +1,63 @@
class Panel::Announcement::BackEnd::BulletinCategorySettingController < OrbitBackendController
before_filter :authenticate_user!
before_filter :for_app_manager
include AdminHelper
# layout 'admin'
def preview_and_approve
@bulletin = Bulletin.find params[:bulletin_id]
end
# def approve
#
# end
def setting
@bulletin_categorys = []
@bulletin_categorys << BulletinCategory.find(params[:bulletin_category_id])
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
if params.has_key? :category
@bulletin_category = BulletinCategory.find params[:category][:id]
else
@bulletin_category = @bulletin_categorys.first
end
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
object_auth = update_setting_by_params
if object_auth.save!
flash[:notice] = "Update Done"
else
flash[:notice] = "Update Failed"
end
end
def user_list
@bulletin_category = BulletinCategory.find params[:category][:id]
end
protected
def update_setting_by_params
category = BulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
object_auth = object_auth_ary.first
object_auth.privilege_users = privilege_users
object_auth
end
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -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

View File

@ -10,15 +10,16 @@ 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

View File

@ -2,13 +2,15 @@ module Panel::Announcement::BackEnd::BulletinCategorysHelper
include ActionView::Helpers::UrlHelper include ActionView::Helpers::UrlHelper
def show_submit_permission_link(bulletin_category) def show_anc_cate_permission_link(bulletin_category)
oa = bulletin_category.get_object_auth_by_title('submit') type = 'submit'
oa = bulletin_category.get_object_auth_by_title(type)
if oa.nil? if oa.nil?
bulletin_category.object_auths.new(title: 'submit' ).save bulletin_category.object_auths.new(title: type ).save
oa = bulletin_category.get_object_auth_by_title('submit') oa = bulletin_category.get_object_auth_by_title(type)
end end
link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa) # link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
link_to t('announcement.bulletin.cate_auth'),panel_announcement_back_end_bulletin_category_setting_path(bulletin_category)
end end
end end

View File

@ -0,0 +1,44 @@
<% if bulletin_category -%>
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><%= t("announcement.bulletin.submit_user_list") %></h3>
</div>
<div class="modal-body">
<div class="clear">
<% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
<div class="checkbox clear checked">
<div class='member-avatar'>
<% if user.avatar? %>
<%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
</div>
<% end -%>
<divl>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#bulletin_category-<%=bulletin_category.id%>").on("show", function () {
});
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
});
</script>
</div>
</div>
<% end -%>

View File

@ -0,0 +1,26 @@
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% sys_users = User.all -%>
<% sys_users.each do |sys_user| -%>
<div class="checkblock">
<% sys_user.sub_roles.each do |sr| %>
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
<% end %>
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon">
</div>
<div class='member-avatar'>
<% if sys_user.avatar? %>
<%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
<%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
<%end -%>
</div>
<% end -%>
<% end -%>

View File

@ -0,0 +1,56 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "inc/permission-checkbox" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %>
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
<div class="subnav clear">
<ul class="nav nav-pills filter pull-left">
<li class="accordion-group">
<div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("announcement.bulletin.category") %>
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
<%= search_field_tag 'user_filter' %>
</div>
</li>
</ul>
<%= link_to t("announcement.bulletin.submit_user_list"), panel_announcement_back_end_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
</div>
<%#= label_tag :role, t("admin.roles") %>
<div class="clear">
<%= content_tag :div do -%>
<% form_tag panel_announcement_back_end_approval_setting_path do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
<div class="form-actions form-fixed pagination-right">
<%= submit_tag "Update", :class => 'btn btn-primary' %>
</div>
<% end -%>
<% end -%>
</div>
<script type="text/javascript" charset="utf-8">
var availableTags = [];
$(document).ready(function() {
$(".prevent_enter_submit_form").bind("keypress", function(e) {
if (e.keyCode == 13) {
return false;
}
});
$('#category_id').change(function() {
$.ajax({
type: 'GET',
dataType: "script",
url:$(this).parents("from").attr("href"),
data:$(this).parents("form").serialize()
});
});
});
</script>

View File

@ -0,0 +1,2 @@
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
permissionCheckbox();

View File

@ -0,0 +1 @@
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");

View File

@ -0,0 +1,2 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"

View File

@ -5,7 +5,7 @@
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<%if is_manager? || is_admin? %> <%if is_manager? || is_admin? %>
<li><%= show_submit_permission_link(bulletin_category) %></li> <li><%= show_anc_cate_permission_link(bulletin_category) %></li>
<% end %> <% end %>
<% if is_admin?%> <% if is_admin?%>
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li> <li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>

View File

@ -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'} %>

View File

@ -68,6 +68,7 @@ en:
related_links: Related Links related_links: Related Links
list_announcement: List Announcement list_announcement: List Announcement
bulletin: bulletin:
submit_user_list: Submit User
category: Category category: Category
list_lower: " list" list_lower: " list"
title: Title title: Title

View File

@ -50,6 +50,7 @@ zh_tw:
list_announcement: 公告列表 list_announcement: 公告列表
bulletin: bulletin:
category: 分類 category: 分類
submit_user_list: 張貼人
list_lower: 列表 list_lower: 列表
title: 標題 title: 標題
postdate: 張貼日期 postdate: 張貼日期
@ -173,7 +174,9 @@ zh_tw:
panel: panel:
bulletin_category:
edit: 修改
delete: 刪除
# Chinese (Taiwan) translations for Ruby on Rails # Chinese (Taiwan) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho) # by tsechingho (http://github.com/tsechingho)

View File

@ -21,7 +21,11 @@ Rails.application.routes.draw do
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
end end
resources :bulletin_categorys resources :bulletin_categorys do
match 'submit_setting' => "bulletin_category_setting#setting" ,:as => :setting,:via => :get
match 'submit_setting' => "bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
match 'submit_setting' => "bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
end
resources :bulletin_links, :controller => 'bulletin_links' do resources :bulletin_links, :controller => 'bulletin_links' do
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit

View File

@ -0,0 +1,63 @@
class Panel::News::BackEnd::NewsBulletinCategorySettingController < OrbitBackendController
before_filter :authenticate_user!
before_filter :for_app_manager
include AdminHelper
# layout 'admin'
# def preview_and_approve
# @bulletin = Bulletin.find params[:bulletin_id]
# end
# def approve
#
# end
def setting
@bulletin_categorys = []
@bulletin_categorys << NewsBulletinCategory.find(params[:news_bulletin_category_id])
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
if params.has_key? :category
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
else
@bulletin_category = @bulletin_categorys.first
end
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
object_auth = update_setting_by_params
if object_auth.save!
flash[:notice] = "Update Done"
else
flash[:notice] = "Update Failed"
end
end
def user_list
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
end
protected
def update_setting_by_params
category = NewsBulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
object_auth = object_auth_ary.first
object_auth.privilege_users = privilege_users
object_auth
end
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -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

View File

@ -2,13 +2,16 @@ module Panel::News::BackEnd::NewsBulletinCategorysHelper
include ActionView::Helpers::UrlHelper include ActionView::Helpers::UrlHelper
def show_submit_permission_link(news_bulletin_category) def show_news_cate_permission_link(news_bulletin_category)
oa = news_bulletin_category.get_object_auth_by_title('submit') type = 'submit'
oa = news_bulletin_category.get_object_auth_by_title(type)
if oa.nil? if oa.nil?
news_bulletin_category.object_auths.new(title: 'submit' ).save news_bulletin_category.object_auths.new(title: type ).save
oa = news_bulletin_category.get_object_auth_by_title('submit') oa = news_bulletin_category.get_object_auth_by_title(type)
end end
link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa) # link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
link_to t('announcement.bulletin.cate_auth'),panel_news_back_end_news_bulletin_category_setting_path(news_bulletin_category)
end end
end end

View File

@ -0,0 +1,44 @@
<% if bulletin_category -%>
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><%= t("announcement.bulletin.submit_user_list") %></h3>
</div>
<div class="modal-body">
<div class="clear">
<% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
<div class="checkbox clear checked">
<div class='member-avatar'>
<% if user.avatar? %>
<%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
</div>
<% end -%>
<divl>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#bulletin_category-<%=bulletin_category.id%>").on("show", function () {
});
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
});
</script>
</div>
</div>
<% end -%>

View File

@ -0,0 +1,26 @@
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% sys_users = User.all -%>
<% sys_users.each do |sys_user| -%>
<div class="checkblock">
<% sys_user.sub_roles.each do |sr| %>
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
<% end %>
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon">
</div>
<div class='member-avatar'>
<% if sys_user.avatar? %>
<%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
<%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
<%end -%>
</div>
<% end -%>
<% end -%>

View File

@ -0,0 +1,56 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "inc/permission-checkbox" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %>
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
<div class="subnav clear">
<ul class="nav nav-pills filter pull-left">
<li class="accordion-group">
<div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("announcement.bulletin.category") %>
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
<%= search_field_tag 'user_filter' %>
</div>
</li>
</ul>
<%= link_to t("announcement.bulletin.submit_user_list"), panel_news_back_end_news_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
</div>
<%#= label_tag :role, t("admin.roles") %>
<div class="clear">
<%= content_tag :div do -%>
<% form_tag panel_news_back_end_news_bulletin_category_setting_path do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
<div class="form-actions form-fixed pagination-right">
<%= submit_tag "Update", :class => 'btn btn-primary' %>
</div>
<% end -%>
<% end -%>
</div>
<script type="text/javascript" charset="utf-8">
var availableTags = [];
$(document).ready(function() {
$(".prevent_enter_submit_form").bind("keypress", function(e) {
if (e.keyCode == 13) {
return false;
}
});
$('#category_id').change(function() {
$.ajax({
type: 'GET',
dataType: "script",
url:$(this).parents("from").attr("href"),
data:$(this).parents("form").serialize()
});
});
});
</script>

View File

@ -0,0 +1,2 @@
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
permissionCheckbox();

View File

@ -0,0 +1 @@
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");

View File

@ -0,0 +1,2 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"

View File

@ -5,7 +5,7 @@
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<%if is_manager? || is_admin? %> <%if is_manager? || is_admin? %>
<li><%= show_submit_permission_link(news_bulletin_category) %></li> <li><%= show_news_cate_permission_link(news_bulletin_category) %></li>
<% end %> <% end %>
<% if is_admin?%> <% if is_admin?%>
<li><%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li> <li><%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>

View 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 %>

View File

@ -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'} %>

View File

@ -20,7 +20,11 @@ Rails.application.routes.draw do
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
end end
resources :news_bulletin_categorys resources :news_bulletin_categorys do
match 'submit_setting' => "news_bulletin_category_setting#setting" ,:as => :setting,:via => :get
match 'submit_setting' => "news_bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
match 'submit_setting' => "news_bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
end
resources :news_bulletin_links, :controller => 'news_bulletin_links' do resources :news_bulletin_links, :controller => 'news_bulletin_links' do
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit
@ -39,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"

View File

@ -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
} }

View File

@ -7,7 +7,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

View File

@ -0,0 +1,5 @@
<h3 class="link_title"><%= t("announcement.related_links") %></h3>
<div id='web_links_links'>
<%= render 'web_links' %>
</div>

View File

@ -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'} %>

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -7,7 +7,8 @@
"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"]
"category": ["WebLinkCategory"], "category": ["WebLinkCategory"],
"widgets": ["web_links", "home_list"],
"enable_frontend": true "enable_frontend": true
} }