Merge branch 'design_team' into ldap

Conflicts:
	config/locales/zh_tw.yml
	vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb
This commit is contained in:
Christophe Vilayphiou 2012-05-08 11:40:38 +08:00
commit 2b9190a49e
101 changed files with 1269 additions and 689 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,6 +1,5 @@
var viewportwidth, var viewportwidth,
viewportheight; viewportheight;
console.log($(window).height())
function resize() { function resize() {
viewportheight=$(window).height(); viewportheight=$(window).height();
viewportwidth=$(window).width(); viewportwidth=$(window).width();
@ -15,9 +14,9 @@ $(document).ready(function(){
placement: "left" placement: "left"
}); });
$(document).on('click', '.privacy', function() { $(document).on('click', '.privacy', function() {
console.log($(this).val());
switch ($(this).val()) { switch ($(this).val()) {
case 'true': case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300); $(this).parents('.controls').children('.select-role').slideUp(300);
@ -53,15 +52,12 @@ $(document).ready(function(){
$orbitBar = $('#orbit-bar').height(), $orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5, $mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
console.log($orbitBar);
console.log("ready"+$(window).height());
$('#main-sidebar').css("height", viewportheight-$orbitBar); $('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
$('.detal-list').tinyscrollbar(); $('.detal-list').tinyscrollbar();
mainTablePosition(); mainTablePosition();
@ -82,14 +78,12 @@ $(window).resize(function(){
$orbitBar = $('#orbit-bar').height(), $orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5, $mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
console.log(viewportheight);
$('#main-sidebar').css("height", viewportheight-$orbitBar); $('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
mainTablePosition(); mainTablePosition();
}); });
@ -118,5 +112,4 @@ $(window).scroll(function () {
$(".table-label").css({left:$winLeft*-1} ); $(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} ); //$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} ); //$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
}); });

View File

@ -1,3 +1,9 @@
$(document).ready(function(){
$('.search').tooltip({
placement: "bottom"
});
});
$(document).on('click', '.orbit-bar-search', function (){ $(document).on('click', '.orbit-bar-search', function (){
if ($(this).parents('.search').hasClass('visible')){ if ($(this).parents('.search').hasClass('visible')){
$(this).parents('.search').stop().animate({ $(this).parents('.search').stop().animate({

View File

@ -4,4 +4,4 @@ $(document).ready(function() {
$('body').prepend($(this).html()); $('body').prepend($(this).html());
$(this).remove(); $(this).remove();
}); });
}); });

View File

@ -2701,8 +2701,11 @@ button.btn.small, input[type="submit"].btn.small {
.pagination .current{ .pagination .current{
border-left-width: 1px; border-left-width: 1px;
} }
.pagination a {
background-color: #FFFFFF;
}
.pagination a:hover, .pagination .active a { .pagination a:hover, .pagination .active a {
background-color: #f5f5f5; background-color: #e8e8e8;
} }
.pagination .active a { .pagination .active a {
color: #999999; color: #999999;

View File

@ -10,22 +10,25 @@
} }
.checkbox{ .checkbox{
padding: 5px; padding: 5px;
margin: 5px 5px 10px; margin: 0;
display: inline-block; display: inline-block;
color:#777777; color:#777777;
text-shadow: 0 1px 0px rgba(255,255,255,.4); text-shadow: 0 1px 0px rgba(255,255,255,.4);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
height: 30px; height: 30px;
position: relative; position: relative;
cursor: pointer; cursor: pointer;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); border-style: solid;
border-width: 0px 1px 1px 0;
border-color: #dfdfdf;
/*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;*/
} }
.checkbox .check-icon { .checkbox .check-icon {
display: none; display: none;
@ -40,7 +43,7 @@
cursor: pointer; cursor: pointer;
font-family: helvetica; font-family: helvetica;
font-size: 12px; font-size: 12px;
line-height: 30px; line-height: 15px;
padding: 0 10px 0 40px; padding: 0 10px 0 40px;
color: #333333; color: #333333;
display: inline-block; display: inline-block;

View File

@ -70,9 +70,8 @@
} }
.main-list .label-td:hover { .main-list .label-td:hover {
height: auto; height: auto;
text-align: center;
padding: 5px 5px 8px; padding: 5px 5px 8px;
left: -6px; left: -40px;
top: -6px; top: -6px;
border: 1px solid rgba(0, 0, 0, 0.2); border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0px 5px 10px rgba(0,0,0,0.2); box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
@ -82,6 +81,7 @@
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
z-index: 5; z-index: 5;
width: 200px;
} }
.qe-edit-div .table-condensed { .qe-edit-div .table-condensed {
background-color: #F2F2F2; background-color: #F2F2F2;
@ -188,10 +188,16 @@ legend {
} }
.form-fixed { .form-fixed {
position: fixed; position: fixed;
margin-bottom: 0; margin: 0;
padding: 10px;
bottom: 0; bottom: 0;
z-index: 10; z-index: 2;
}
.form-fixed .btn {
margin-top: 4px;
} }
.paginationFixed { .paginationFixed {
margin-bottom: 25px; }
.paginationFixed .pagination {
margin-top: 0 !important;
} }

View File

@ -10,7 +10,7 @@
} }
.login-logo { .login-logo {
text-indent: -9999px; text-indent: -9999px;
background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px;
padding-top: 40px; padding-top: 40px;
height: 160px; height: 160px;
} }
@ -61,8 +61,8 @@
margin-right: -20px; margin-right: -20px;
} }
#orbit-bar .search-query { #orbit-bar .search-query {
padding: 4px 9px; padding: 7px 9px 5px;
height: 12px; height: 10px;
margin-top: 3px; margin-top: 3px;
border: 1px solid #333333; border: 1px solid #333333;
font-size: 11px; font-size: 11px;
@ -119,7 +119,8 @@
background-position: -10px -10px; background-position: -10px -10px;
} }
#orbit-bar .nav > li > a.orbit-bar-desktop { #orbit-bar .nav > li > a.orbit-bar-desktop {
background-position: -106px -9px; background-position: -73px -42px;
width: 48px;
} }
#orbit-bar .nav > li > a.orbit-bar-member { #orbit-bar .nav > li > a.orbit-bar-member {
background-position: -4px -37px; background-position: -4px -37px;
@ -635,6 +636,22 @@
.adbanner-action { .adbanner-action {
margin-bottom: 20px; margin-bottom: 20px;
} }
.textarea-height-s {
resize: none;
max-height: 150px;
}
.textarea-height-m {
resize: none;
max-height: 250px;
}
.textarea-height-l {
resize: none;
max-height: 350px;
}
.textarea-height-xl {
resize: none;
max-height: 500px;
}
[class^="icons-"] { [class^="icons-"] {
display: inline-block; display: inline-block;
width: 16px; width: 16px;

View File

@ -1,7 +1,7 @@
class Admin::AdBannersController < ApplicationController class Admin::AdBannersController < OrbitBackendController
layout "new_admin" layout "new_admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :for_app_manager
def destroy def destroy
@ad_banner = AdBanner.find(params[:id]) @ad_banner = AdBanner.find(params[:id])

View File

@ -2,7 +2,7 @@ class Admin::DashboardsController < ApplicationController
layout "new_admin" layout "new_admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? # before_filter :is_admin?
def index def index
end end

View File

@ -1,11 +1,12 @@
class Admin::DesignsController < ApplicationController class Admin::DesignsController < OrbitBackendController
require "net/http" require "net/http"
require "uri" require "uri"
require 'zip/zip' require 'zip/zip'
layout "new_admin" layout "new_admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?
before_filter :for_admin_only
def upload_package def upload_package
if !params[:design].nil? if !params[:design].nil?
@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController
end end
def index def index
@designs = Design.all.entries @designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all
end end
def new def new
@ -83,6 +84,13 @@ class Admin::DesignsController < ApplicationController
render :action => 'new' render :action => 'new'
end end
end end
def delete
if params[:to_delete]
designs = Design.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected protected

View File

@ -1,16 +1,48 @@
class Admin::SitesController < ApplicationController class Admin::SitesController < ApplicationController
layout "admin" layout "new_admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?
before_filter :get_site
def index # def index
@site = Site.first # @site = Site.first
redirect_to :action => :new unless @site # # redirect_to :action => :new unless @site
# end
# def new
# @site = Site.new
# end
def update
@site.update_attributes(params[:site])
redirect_to :back
end end
def new def site_info
@site = Site.new
end
def system_info
end
def language
end
def mail_setting
end
def ui_theme
end
private
def get_site
@site ||= Site.first
end end
end end

View File

@ -39,15 +39,65 @@ class ApplicationController < ActionController::Base
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil @parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
end end
def auth_failed_in_backend
#redirect_to admin_dashboards_url
redirect_to root_path
end
# Check if the current_user is admin # Check if the current_user is admin
def is_admin? def is_admin?
redirect_to root_url unless current_user.admin? current_user.admin? ? true : auth_failed_in_backend
end
def is_manager?
@module_app.managing_users.include?(current_user) || is_admin?
end
def for_admin_only
if is_admin?
true
else
flash[:error] = t("admin.access.denied.not_admin")
auth_failed_in_backend
end
end
def for_app_manager
if is_manager?
true
else
flash[:error] = t("admin.access.denied.app.not_manager")
auth_failed_in_backend
end
end
def for_app_sub_manager
if (@module_app.sub_managing_users.include?(current_user) || is_manager?)
true
else
flash[:error] = t("admin.access.denied.app.not_sub_manager")
auth_failed_in_backend
end
end
def for_app_user
if (@module_app.app_auth.auth_users.include?(current_user) || for_app_sub_manager )
true
else
flash[:error] = t("admin.access.denied.app.not_authed_user")
auth_failed_in_backend
end
end
def check_object_premission(obj,title)
flash[:error] = t("admin.access.denied.object")
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_user) || is_manager? || is_admin? )
end end
# Render the page # Render the page
def render_page(id = nil) def render_page(param={})
if @item if @item
render :text => process_page(@item, id), :layout => 'page_layout' render :text => process_page(@item, param[:id], param), :layout => 'page_layout'
else else
render :text => '404 Not Found' render :text => '404 Not Found'
end end
@ -78,8 +128,8 @@ class ApplicationController < ActionController::Base
# set site if exist or create site # set site if exist or create site
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []}) @site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
session[:site] = @site.id session[:site] = @site.id
@site_in_use_locales = @site.in_use_locales @site_in_use_locales = site_locales_default_head(@site.in_use_locales)
@site_valid_locales = @site.valid_locales @site_valid_locales = site_locales_default_head(@site.valid_locales)
end end
def set_current_item def set_current_item
@ -114,4 +164,14 @@ class ApplicationController < ActionController::Base
end end
end end
def site_locales_default_head(locales)
if locales[0].eql? I18n.locale.to_s
locales
else
a = Array.new(locales)
shift_out = a.delete(I18n.locale.to_s)
[shift_out] + a
end
end
end end

View File

@ -27,9 +27,13 @@ class OrbitBackendController< ApplicationController
end end
end end
def get_sorted_and_filtered(object_class) def get_sorted_and_filtered(object_class, query=nil)
object_class = object_class.classify.constantize object_class = object_class.classify.constantize
objects = object_class.all if query
objects = object_class.all.where(query)
else
objects = object_class.all
end
if !params[:sort].blank? if !params[:sort].blank?
options = params[:sort_options] options = params[:sort_options]
@ -62,30 +66,23 @@ class OrbitBackendController< ApplicationController
case key case key
when 'status' when 'status'
a = Array.new a = Array.new
objects.each do |bulletin| objects.each do |object|
value.each do |v| value.each do |v|
case v a << object if object[v]
when 'pending'
a << bulletin if bulletin.is_checked.nil?
when 'rejected'
a << bulletin if bulletin.is_checked.eql?(false)
else
a << bulletin if bulletin[v]
end
end end
end end
objects = a.uniq objects = a.uniq
when 'categories' when 'categories'
a = Array.new a = Array.new
objects.each do |bulletin| objects.each do |object|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s) a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s)
end end
objects = a.uniq objects = a.uniq
when 'tags' when 'tags'
a = Array.new a = Array.new
objects.each do |bulletin| objects.each do |object|
bulletin.tags.each do |tag| object.tags.each do |tag|
a << bulletin if value.include?(tag.id.to_s) a << object if value.include?(tag.id.to_s)
end end
end end
objects = a.uniq objects = a.uniq
@ -150,7 +147,7 @@ class OrbitBackendController< ApplicationController
def get_with_nil(objects, option, sorted_objects) def get_with_nil(objects, option, sorted_objects)
tmp = Array.new tmp = Array.new
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).count == 0) } objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_tmp = sorted.collect {|a| a[1] } sorted_tmp = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp) a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)

View File

@ -16,10 +16,10 @@ class PagesController < ApplicationController
def show def show
#begin #begin
@item = Item.first(:conditions => {:full_name => params[:page_name]}) @item = Item.first(:conditions => {:full_name => params[:page_name]})
if @item && @item.is_published if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
case @item._type case @item._type
when 'Page' when 'Page'
render_page(params[:id]) render_page(params)
when 'Link' when 'Link'
redirect_to "http://#{@item[:url]}" redirect_to "http://#{@item[:url]}"
end end
@ -40,7 +40,9 @@ class PagesController < ApplicationController
end end
def show_from_link def show_from_link
redirect_to "/#{@item.full_name}?id=#{params[:id]}" # debugger
# a=1
redirect_to "/#{@item.full_name}?id=#{params[:id]}&preview=#{params[:preview]}"
end end
def load_orbit_bar def load_orbit_bar

View File

@ -1,7 +1,3 @@
module Admin::AdImagesHelper module Admin::AdImagesHelper
def active_when_default_locale_eq locale
locale.to_sym == I18n.default_locale ? 'active': ''
end
end end

View File

@ -28,12 +28,15 @@ module Admin::ItemHelper
end end
def render_children(parent) def render_children(parent)
if children = parent.children children = parent.ordered_children
if !children.entries.blank?
ret = '' ret = ''
children.each do |child| children.each do |child|
ret << render_node_and_children(child) ret << render_node_and_children(child)
end end
ret ret
else
''
end end
end end

View File

@ -2,12 +2,6 @@ module ApplicationHelper
FLASH_NOTICE_KEYS = [:error, :notice, :warning] FLASH_NOTICE_KEYS = [:error, :notice, :warning]
def site_valid_locales_default_head
index = @site_valid_locales.rindex I18n.default_locale.to_s
shift_out = @site_valid_locales.shift(index)
@site_valid_locales += shift_out
end
def colorize_in_use_locale(locale) def colorize_in_use_locale(locale)
@site_in_use_locales.include?(locale)? 'green' : 'red' @site_in_use_locales.include?(locale)? 'green' : 'red'
end end
@ -74,6 +68,15 @@ module ApplicationHelper
end end
end end
def active_sys_call_for_app(controller_name,action_name,app_title)
unless active_for_action(controller_name,action_name).nil?
app = ModuleApp.find params[:id]
app.title == app_title ? 'active' : nil
else
nil
end
end
def active_for_controllers(*controller_names) def active_for_controllers(*controller_names)
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil (controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
end end
@ -87,21 +90,38 @@ module ApplicationHelper
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end end
def process_page(page, id) def process_page(page, id, params)
parse_page_noko(page, id) parse_page_noko(page, id, params)
end end
def page_metas(page) def page_metas(page)
tmp_meta = {}
metas = '' metas = ''
@site.page_metas.each do |meta| @site.site_metas.each do |meta|
name, content = meta.get_name_content name, content = meta.get_name_content
metas << "<meta name=#{name} content=#{content} />\n" tmp_meta.merge!(name => content)
end rescue nil end rescue nil
return metas page.page_metas.each do |meta|
name, content = meta.get_name_content
tmp_meta.merge!(name => content)
end rescue nil
tmp_meta.each_pair{|name, content|
metas << "<meta name='#{name}' content='#{content}' />\n"
} if !tmp_meta.blank?
metas
end end
def page_title(page) def page_title(page)
"<title>#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}</title>\n" res = "<title>"
page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]
if page.is_home? && @site.title
res << @site.title[I18n.locale]
elsif @site.title && @site.title_always_on
res << @site.title[I18n.locale] + ' - ' + page_title
else
res << page_title
end
res << "</title>\n"
end end
def page_stylesheets(page, edit=nil) def page_stylesheets(page, edit=nil)
@ -112,6 +132,7 @@ module ApplicationHelper
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
# stylesheets << "<link href='/assets/menu.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
theme = page.design.themes.detect{ |d| d.id == page.theme_id } theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
@ -126,8 +147,8 @@ module ApplicationHelper
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
end end
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n" javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n" javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
@ -138,4 +159,8 @@ module ApplicationHelper
javascripts javascripts
end end
def active_when_current_locale_eq(locale)
locale.to_sym == I18n.locale ? 'active in': ''
end
end end

View File

@ -25,9 +25,9 @@ module OrbitBackendHelper
content_tag :thead do content_tag :thead do
content_tag :tr, :class => "sort-header" do content_tag :tr, :class => "sort-header" do
concat (content_tag :th, :class => "span1 strong" do concat (content_tag :th, :class => "span1 strong" do
concat check_box_tag :check_all concat check_box_tag :check_all
concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove" concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
end) if delete_all end) if (delete_all && (is_admin? || (is_manager? rescue nil)))
titles.each do |title| titles.each do |title|
concat render_title(title[0], title[1], title[2], title[3]) concat render_title(title[0], title[1], title[2], title[3])
end end

View File

@ -3,10 +3,10 @@ class Design
include Mongoid::Timestamps include Mongoid::Timestamps
include ParserLayout include ParserLayout
field :title field :title, :type => String
field :author field :author, :type => String
field :intro field :intro, :type => String
field :version field :version, :type => String
has_many :pages has_many :pages

View File

@ -7,6 +7,8 @@ class Item
field :full_name, :index => true field :full_name, :index => true
field :position, :type => Integer field :position, :type => Integer
field :is_published, :type => Boolean, :default => false, :index => true field :is_published, :type => Boolean, :default => false, :index => true
field :enabled_for, :type => Array, :default => nil
field :menu_enabled_for, :type => Array, :default => nil
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } validates :name, :exclusion => { :in => LIST[:forbidden_item_names] }
@ -35,6 +37,21 @@ class Item
urls = ancestors.map{ |a| a.name } << self.name urls = ancestors.map{ |a| a.name } << self.name
urls.join("/") urls.join("/")
end end
def ordered_children
self.children.asc(:position)
end
def ordered_and_visible_children
objects = ordered_children
a = []
if objects
objects.each do |object|
a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for.include?(I18n.locale.to_s)
end
end
a
end
protected protected

View File

@ -1,15 +0,0 @@
class Meta
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :value, :default => nil
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
def get_name_content
[self.key, self.value ? self.value : self.i18n_variable[I18n.locale]]
end
end

View File

@ -7,5 +7,13 @@ class Meta
field :value, :default => nil field :value, :default => nil
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
def get_name_content
[self.key, get_content]
end
def get_content
self.value ? self.value : self.i18n_variable[I18n.locale]
end
end end

View File

@ -1,5 +1,7 @@
class Site class Site
METAS = ['description', 'keywords']
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
@ -9,12 +11,17 @@ class Site
field :roaming_id field :roaming_id
field :private_key, :type => Binary field :private_key, :type => Binary
field :public_key, :type => Binary field :public_key, :type => Binary
field :title_always_on, :type => Boolean, :default => false
field :school field :school
field :department field :department
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_many :site_metas, :autosave => true, :dependent => :destroy has_many :site_metas, :autosave => true, :dependent => :destroy
before_save :set_key
def generate_keys def generate_keys
private_key = OpenSSL::PKey::RSA.generate(2048) private_key = OpenSSL::PKey::RSA.generate(2048)
self.public_key = private_key.public_key.to_s self.public_key = private_key.public_key.to_s
@ -30,5 +37,35 @@ class Site
res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil
res.eql?('local out of date') ? false : true res.eql?('local out of date') ? false : true
end end
def title
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def footer
@footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
METAS.each do |meta|
define_method meta do
fetch_meta = self.site_metas.where(key: meta).limit(1)
fetch_meta.blank? ? nil : fetch_meta[0].i18n_variable
end
define_method "#{meta}=" do |values|
if a = self.send(meta)
a.update_attributes(values)
else
a = self.site_metas.build(key: meta)
a.build_i18n_variable(values)
end
end
end
protected
def set_key
title.key = 'title' if title && (title.key.blank? rescue true)
footer.key = 'footer' if footer && (footer.key.blank? rescue true)
end
end end

View File

@ -15,7 +15,7 @@
<div class="adbanner-list"> <div class="adbanner-list">
<div class="adbanner-action"> <div class="adbanner-action">
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%> <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%>
</div> </div>
<ul class="clear"> <ul class="clear">
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>

View File

@ -1,7 +1,7 @@
<% content_for :page_specific_css do -%> <% content_for :page_specific_css do -%>
<%#= stylesheet_link_tag "admin/ad_banner_preview" %> <%#= stylesheet_link_tag "admin/ad_banner_preview" %>
<% end -%> <% end -%>
<% content_for :page_specific_css do -%> <% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %> <%= javascript_include_tag "inc/modal-preview" %>
<% end -%> <% end -%>

View File

@ -130,14 +130,14 @@
<div id="post-body"> <div id="post-body">
<div id="post-body-content" class="clear"> <div id="post-body-content" class="clear">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<% site_valid_locales_default_head.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :li,link_to(I18nVariable.from_locale(locale),"##{locale}",:data=>{:toggle => "tab"}),:class=> (active_when_default_locale_eq locale) %> <%= content_tag :li,link_to(I18nVariable.from_locale(locale),"##{locale}",:data=>{:toggle => "tab"}),:class=> (active_when_current_locale_eq locale) %>
<% end %> <% end %>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title",params[:ad_banner_id]) , :class=>"input-medium", %> <%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title",params[:ad_banner_id]) , :class=>"input-medium", %>
<% site_valid_locales_default_head.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div,:class => "tab-pane #{active_when_default_locale_eq locale}",:id=>"#{locale}" do%> <%= content_tag :div,:class => "tab-pane #{active_when_current_locale_eq locale}",:id=>"#{locale}" do%>
<div class="title"> <div class="title">
<%= f.fields_for :title,@ad_image.title do |f| %> <%= f.fields_for :title,@ad_image.title do |f| %>
<%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%> <%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%>

View File

@ -0,0 +1,14 @@
<tr class="with_action">
<td><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td>
<td>
<%= design.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li>
<li class="dropdown"><%= link_to t(:delete), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li>
</ul>
</div>
</td>
<td><%= design.author %></td>
<td><%= design.intro %></td>
</tr>

View File

@ -0,0 +1,12 @@
<thead>
<tr>
<th class="span1 strong"></th>
<th class="span7"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody>
<tbody id="tbody_designs" class="sort-holder">
<%= render :partial => 'design', :collection => @designs %>
</tbody>

View File

@ -0,0 +1,11 @@
<div id='filter' class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,3 @@
<%= render_sort_bar(true, ['title', 'title','span7', 'admin.title'],
['author', 'author', 'span2', 'admin.author'],
['intro', 'intro', 'span2', 'admin.intro']).html_safe %>

View File

@ -1,52 +1,10 @@
<%= flash_messages %> <%= form_for :news_bulletins, :url => delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
<div id="filter" class="subnav"> <%= render 'filter' %>
<div class="filters"> <table class="table main-list">
<div id="sort_headers" class="table-label"> <%= render 'designs' %>
<table class="table main-list"> </table>
<thead> <% end %>
<tr>
<th class="span1 strong">
<input type="checkbox">
<a href class="list-remove"><i class="icon-trash"></i></a>
</th>
<th class="span7"><%= t('admin.title') %></th>
<th class="span2"><%= t('admin.author') %></th>
<th class="span2"><%= t('admin.intro') %></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table class="table main-list">
<thead>
<tr>
<th class="span1 strong"></th>
<th class="span7"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody>
<% @designs.each do |design| %>
<tr class="with_action">
<td><input type="checkbox"></td>
<td>
<%= design.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li>
<li class="dropdown"><%= link_to t(:delete), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li>
</ul>
</div>
</td>
<td><%= design.author %></td>
<td><%= design.intro %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
</div> </div>

View File

@ -0,0 +1,3 @@
$("#delete_all").attr("action", "<%= delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) %>");
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_designs").html("<%= j render :partial => 'design', :collection => @designs %>");

View File

@ -17,17 +17,17 @@
</dd> </dd>
</dl> </dl>
<dl id="sub_manager"> <dl id="sub_manager">
<dt><%= t("admin.user_role.auth.sub_manager") %></ht> <dt><%#= t("admin.user_role.auth.sub_manager") %></ht>
<% @module_app.sub_managers.each do |manager| %> <%# @module_app.sub_managers.each do |manager| %>
<dd><%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd> <dd><%#= manager.user.name %> <%#= get_auth_by(manager) %><%#= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
<% end %> <%# end %>
<dd> <dd>
<%= form_tag(assign_sub_manager_admin_module_app_path) do %> <%#= form_tag(assign_sub_manager_admin_module_app_path) do %>
<%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%> <%#= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%>
<%= submit_tag t("admin.user_role.auth.add_sub_manager") %> <%#= submit_tag t("admin.user_role.auth.add_sub_manager") %>
<% end %> <%# end %>
</dd> </dd>
</dl> </dl>
</div> </div>
<%= render :partial => "admin/components/user_role_management", :locals => { :object => @module_app ,:auth=> @module_app.app_auth ,:submit_url=> admin_module_app_app_auths_path(@module_app),:ploy_route_ary=>['remove',:admin,@module_app,@module_app.app_auth] } %> <%#= render :partial => "admin/components/user_role_management", :locals => { :object => @module_app ,:auth=> @module_app.app_auth ,:submit_url=> admin_module_app_app_auths_path(@module_app),:ploy_route_ary=>['remove',:admin,@module_app,@module_app.app_auth] } %>

View File

@ -30,7 +30,23 @@
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span> <span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span>
</p> </p>
<p> <p>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= f.label :is_published, "#{t('admin.is_published')} ?" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No <%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<p>
<%= f.label :menu_enabled_for, "#{t('admin.menu_enabled_for')}:" %>
<% @site_valid_locales.each do |valid_locale| %>
<%= check_box_tag 'page[menu_enabled_for][]', valid_locale, (@item.menu_enabled_for.nil? ? true : @item.menu_enabled_for.include?(valid_locale)) %>
<%= I18nVariable.from_locale(valid_locale) %>
<% end %>
<%= hidden_field_tag 'page[menu_enabled_for][]', '' %>
</p>
<p>
<%= f.label :enabled_for, "#{t('admin.enabled_for')}:" %>
<% @site_valid_locales.each do |valid_locale| %>
<%= check_box_tag 'page[enabled_for][]', valid_locale, (@item.enabled_for.nil? ? true : @item.enabled_for.include?(valid_locale)) %>
<%= I18nVariable.from_locale(valid_locale) %>
<% end %>
<%= hidden_field_tag 'page[enabled_for][]', '' %>
</p> </p>

View File

@ -0,0 +1 @@
language.html.erb

View File

@ -0,0 +1 @@
mail_setting.html.erb

View File

@ -0,0 +1,68 @@
<div id="poststuff">
<%= form_for @site, :url => admin_site_path(@site), :html => {:class => "clear"} do |f| %>
<div id="post-body">
<div id="post-body-content" class="clear">
<ul class="nav nav-tabs">
<% @site_valid_locales.each do |locale|%>
<%#= raise @site_valid_locales.inspect %>
<%= content_tag :li, link_to(I18nVariable.from_locale(locale), ".#{locale}", :data => {:toggle => "tab"}), :class => (active_when_current_locale_eq locale) %>
<% end %>
</ul>
<div class="tab-content form-horizontal">
<div class="control-group">
<label class="control-label"><%= t 'admin.site_title' %></label>
<div class="controls">
<%= f.check_box :title_always_on %> <%= t 'admin.always_display_title' %>
</div>
</div>
<% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<div class="control-group">
<div class="controls">
<%= f.fields_for :title, @site.title do |f| %>
<%= f.text_field locale, :class => "input-xxlarge" %>
<% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<% end %>
<% end %>
<% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<div class="control-group">
<label class="control-label"><%= t 'admin.keywords' %></label>
<div class="controls">
<%= f.fields_for :keywords, @site.keywords do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.site_description' %></label>
<div class="controls">
<%= f.fields_for :description, @site.description do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.site_footer' %></label>
<div class="controls">
<%= f.fields_for :footer, @site.footer do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<div class="form-actions">
<%= f.submit t("submit"), :class => "btn btn-primary" %>
<%= f.submit t("cancel"), :class => "btn ", :type => 'reset' %>
</div>
<% end %>
</div>

View File

@ -0,0 +1 @@
system_info.html.erb

View File

@ -0,0 +1 @@
ui_theme.html.erb

View File

@ -10,23 +10,23 @@
</fieldset> </fieldset>
<% end %> <% end %>
<% if @user_info_model_i18n_variables.size > 0 %> <% if @info_i18n_variables.size > 0 %>
<fieldset> <fieldset>
<legend> <legend>
<%= t('admin.user_info') %> <%= t('admin.user_info') %>
<%#= render :partial => 'action_bar' %> <%#= render :partial => 'action_bar' %>
</legend> </legend>
<div><%= render :partial => 'edit_user_attribute_model', :collection => @user_info_model_i18n_variables %></div> <div><%= render :partial => 'edit_user_attribute_model', :collection => @info_i18n_variables %></div>
</fieldset> </fieldset>
<% end %> <% end %>
<% if @user_role_model_i18n_variables.size > 0 %> <% if @role_i18n_variables.size > 0 %>
<fieldset> <fieldset>
<legend> <legend>
<%= t('admin.user_role') %> <%= t('admin.user_role') %>
<%#= render :partial => 'action_bar' %> <%#= render :partial => 'action_bar' %>
</legend> </legend>
<div><%= render :partial => 'edit_user_attribute_model', :collection => @user_role_model_i18n_variables %></div> <div><%= render :partial => 'edit_user_attribute_model', :collection => @role_i18n_variables %></div>
</fieldset> </fieldset>
<% end %> <% end %>

View File

@ -46,7 +46,7 @@
</fieldset> </fieldset>
<% end %> <% end %>
<% if @user_info_model_i18n_variables.size > 0 %> <% if @info_i18n_variables.size > 0 %>
<fieldset> <fieldset>
<legend> <legend>
<%= t('admin.user_info') %> <%= t('admin.user_info') %>
@ -56,7 +56,7 @@
</fieldset> </fieldset>
<% end %> <% end %>
<% if @user_role_model_i18n_variables.size > 0 %> <% if @role_i18n_variables.size > 0 %>
<fieldset> <fieldset>
<legend> <legend>
<%= t('admin.user_role') %> <%= t('admin.user_role') %>

View File

@ -27,7 +27,7 @@
</ul> </ul>
</li> </li>
<li class="search clear"> <li class="search clear" title="<%= t :search_nccu %>">
<a class="orbit-bar-search" href="#">search</a> <a class="orbit-bar-search" href="#">search</a>
<form class="navbar-search" action=""> <form class="navbar-search" action="">
<input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>"> <input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>">

View File

@ -1,16 +1,19 @@
<%#= content_tag :li, :class => active_for_controllers('purchases') do -%> <%#= content_tag :li, :class => active_for_controllers('purchases') do -%>
<%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
<%# end -%> <%# end -%>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "/static/kernel.js" %>
<% end %>
<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys','module_apps', 'approvals') do -%> <%= 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 -%>
<%= 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') %>
<%= 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_for_action('module_apps', 'edit') 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) %>
<% end -%> <% end -%>
@ -18,12 +21,13 @@
<%= 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') 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') %>
<%= 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.news_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.news_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) %>
<% end -%> <% end -%>
<% end -%> <% end -%>
@ -43,18 +47,20 @@
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %> <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%> <%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') || active_sys_call_for_app('module_apps','edit','ad_banners') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
<%#= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%>
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<%# end %> <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "ad_banners"}))), :class => active_sys_call_for_app('module_apps','edit','ad_banners') if (is_admin? rescue nil) %>
<% end -%>
<% end %> <% end %>
<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%> <%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_links', 'index') %> <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_links', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_links', 'new') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_links', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
@ -62,6 +68,13 @@
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers('sites') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %> <%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), admin_site_site_info_path(@site) %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('sites')) do -%>
<%= content_tag :li, link_to(t('admin.site_info'), admin_site_site_info_path(@site)), :class => active_for_action('sites', 'site_info') %>
<%= content_tag :li, link_to(t('admin.system_info'), admin_site_system_info_path(@site)), :class => active_for_action('sites', 'system_info') %>
<%= content_tag :li, link_to(t('admin.language'), admin_site_language_path(@site)), :class => active_for_action('sites', 'language') %>
<%= content_tag :li, link_to(t('admin.mail_setting'), admin_site_mail_setting_path(@site)), :class => active_for_action('sites', 'mail_setting') %>
<%= content_tag :li, link_to(t('admin.ui_theme'), admin_site_ui_theme_path(@site)), :class => active_for_action('sites', 'ui_theme') %>
<% end -%>
<% end -%> <% end -%>

View File

@ -14,7 +14,7 @@
</head> </head>
<body> <body>
<%= render 'layouts/orbit_bar' %> <%= render 'layouts/orbit_bar' %>
<nav id="main-sidebar" class="my_scroll"> <div id="main-sidebar" class="my_scroll">
<div class="scrollbar"> <div class="scrollbar">
<div class="track"> <div class="track">
<div class="thumb"> <div class="thumb">
@ -29,7 +29,7 @@
</ul> </ul>
</div> </div>
</div> </div>
</nav> </div>
<div id="main-wrap"> <div id="main-wrap">
<%= yield %> <%= yield %>
</div> </div>

View File

@ -4,7 +4,6 @@
<meta charset="utf-8"> <meta charset="utf-8">
<%= page_title(@item).html_safe %> <%= page_title(@item).html_safe %>
<%= page_metas(@item).html_safe %> <%= page_metas(@item).html_safe %>
<%= @metas %>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<%= javascript_include_tag "html5" %> <%= javascript_include_tag "html5" %>
<![endif]--> <![endif]-->

View File

@ -68,6 +68,14 @@ en:
traffic: Traffic traffic: Traffic
admin: admin:
access:
denied:
app:
not_sub_manager: Access Denied for you are not SubManager for this app
not_manager: Access Denied for you are not SubManager for this app
not_authed_user: Access Denied for you are not User for this app
not_admin: Access Denied for you are not Admin
object: "Access Denied for you don't have permission for this object"
action: Action action: Action
ad_banner: AD Banner ad_banner: AD Banner
ad: ad:
@ -90,6 +98,7 @@ en:
admin: Admin admin: Admin
action: Action action: Action
all_articles: List all_articles: List
always_display_title: Always displayed in the title bar
announcement: Announcement announcement: Announcement
asset: Asset asset: Asset
assets: assets:
@ -128,6 +137,7 @@ en:
editing_role: Editing user role editing_role: Editing user role
email: Email email: Email
enable_language: Enable language enable_language: Enable language
enabled_for: Enabled for
file_name: Filename file_name: Filename
file_size: File size file_size: File size
format: Format format: Format
@ -138,6 +148,7 @@ en:
is_published: Is published is_published: Is published
item: Item item: Item
key: Key key: Key
keywords: Keywords
language: Language language: Language
layout: Layout layout: Layout
layout_name: Layout name layout_name: Layout name
@ -152,6 +163,7 @@ en:
list_infos: User information list list_infos: User information list
list_roles: User roles list list_roles: User roles list
member: Member member: Member
menu_enabled_for: Menu enabled for
module: module:
authorization: Module Authorization authorization: Module Authorization
move_down: Move down move_down: Move down
@ -190,7 +202,10 @@ en:
setup_translations: Translations setup setup_translations: Translations setup
setup_designs: Designs setup setup_designs: Designs setup
site: Site site: Site
site_description: Site description
site_footer: Site footer
site_settings: Site Setting site_settings: Site Setting
site_title: Site title
super_pages: Super pages super_pages: Super pages
structure: Structure structure: Structure
title: Title title: Title

View File

@ -8,12 +8,12 @@ zh_tw:
back: 回上一步 back: 回上一步
browse: 選擇檔案 browse: 選擇檔案
cancel: 取消 cancel: 取消
create: 創建 create: 新增
delete: 刪除 delete: 刪除
desktop: 桌面 desktop: 桌面
disable: 禁用 disable: 禁用
dots: dots:
downloaded: 下載 downloaded: 下載
download: 下載 download: 下載
edit: 編輯 edit: 編輯
email: 電子郵件 email: 電子郵件
@ -50,7 +50,7 @@ zh_tw:
file_type: 檔案類型 file_type: 檔案類型
hits: 點擊率 hits: 點擊率
item: 項目 item: 項目
member: member:
module: 模組 module: 模組
most_visited_page: 熱門頁面 most_visited_page: 熱門頁面
quantity: 數量 quantity: 數量
@ -65,6 +65,14 @@ zh_tw:
traffic: 流量 traffic: 流量
admin: admin:
access:
denied:
app:
not_sub_manager: 拒絕存取因你不是此應用程式次管理員
not_manager: 拒絕存取因你不是此應用程式管理員
not_authed_user: 拒絕存取因你不是此應用程式授權使用者
not_admin: 拒絕存取因你不是此應用程式次管理員
object: 拒絕存取因你不是網站管理者
action: 操作 action: 操作
ad_banner: 廣告輪播 ad_banner: 廣告輪播
ad: ad:
@ -84,8 +92,9 @@ zh_tw:
add_item: 新增項目 add_item: 新增項目
add_language: 新增語言 add_language: 新增語言
add_drop_down_item: 增加Orbit選單 add_drop_down_item: 增加Orbit選單
admin: 管理 admin: 網站管理
all_articles: 列表 all_articles: 列表
always_display_title: 永遠顯示於標題列
announcement: 公告管理 announcement: 公告管理
asset: 資產 asset: 資產
assets: assets:
@ -97,22 +106,22 @@ zh_tw:
author: 作者 author: 作者
calendar: 行事曆 calendar: 行事曆
cant_delete_self: 您不可以刪除自己。 cant_delete_self: 您不可以刪除自己。
cant_revoke_self_admin: 您不可以撤銷自己的管理作用 cant_revoke_self_admin: 您不可以撤銷自己的管理身份
choose_file: 請選擇一個文件... choose_file: 請選擇一個文件...
class: 階級 class: 階級
content: 內容 content: 內容
create_error_link: 創建連接時出錯。 create_error_link: 新增連接時出錯。
create_error_page: 創建頁面時出錯。 create_error_page: 新增頁面時出錯。
create_success_home: 首頁已成功創建 create_success_home: 首頁已成功新增
create_success_layout: 樣板已成功創建 create_success_layout: 樣板已成功新增
create_success_link: 連結已成功創建 create_success_link: 連結已成功新增
create_success_page: 頁面已成功創建 create_success_page: 頁面已成功新增
create_success_home: 首頁已成功創建 create_success_home: 首頁已成功新增
create_success_layout: 佈局已成功創建 create_success_layout: 佈局已成功新增
create_success_link: 連結已成功創建 create_success_link: 連結已成功新增
create_success_page: 頁面已成功創建 create_success_page: 頁面已成功新增
create_success_snippet: 片段已成功創建 create_success_snippet: 片段已成功新增
create_success_user: 用戶已成功創建。。 create_success_user: 用戶已成功新增。。
dashboard: 儀表板 dashboard: 儀表板
data: 資料數據 data: 資料數據
delete_language: 刪除語言 delete_language: 刪除語言
@ -129,6 +138,7 @@ zh_tw:
editing_role: 編輯用戶身份 editing_role: 編輯用戶身份
email: Email email: Email
enable_language: 啟用語言 enable_language: 啟用語言
enabled_for: 啟用
file_name: 檔名 file_name: 檔名
file_size: 檔案大小 file_size: 檔案大小
format: 格式 format: 格式
@ -138,7 +148,8 @@ zh_tw:
intro: 簡介 intro: 簡介
is_published: 被出版 is_published: 被出版
item: 網站架構 item: 網站架構
key: 鍵值 key: 關鍵
keywords: 關鍵字
language: 語言 language: 語言
layout: 佈局 layout: 佈局
layout_name: 佈局名字 layout_name: 佈局名字
@ -153,6 +164,7 @@ zh_tw:
list_infos: 用戶資料列表 list_infos: 用戶資料列表
list_roles: 用戶身份列表 list_roles: 用戶身份列表
member: 會員 member: 會員
menu_enabled_for: 選單啟用
module: module:
authorization: 模組授權 authorization: 模組授權
move_down: 往下移 move_down: 往下移
@ -186,7 +198,10 @@ zh_tw:
purchase: 購買 purchase: 購買
role: 身份 role: 身份
roles: 身份 roles: 身份
site_description: 網站描述
site_footer: 網站頁尾
site_settings: 基本設定 site_settings: 基本設定
site_title: 網站標題
setup_member: 成員設置 setup_member: 成員設置
setup_translations: 語系設定 setup_translations: 語系設定
setup_designs: 版型設定 setup_designs: 版型設定

View File

@ -25,7 +25,7 @@ Orbit::Application.routes.draw do
end end
match 'ad_banner/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put match 'ad_banners/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put
resources :ad_banners do resources :ad_banners do
collection do collection do
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
@ -37,6 +37,7 @@ Orbit::Application.routes.draw do
resources :designs do resources :designs do
collection do collection do
get 'upload_package' get 'upload_package'
post 'delete'
post 'upload_package' post 'upload_package'
end end
member do member do
@ -92,7 +93,13 @@ Orbit::Application.routes.draw do
get 'add_sub_role' get 'add_sub_role'
get 'add_attribute_field' get 'add_attribute_field'
end end
resources :sites resources :sites do
get 'site_info'
get 'system_info'
get 'language'
get 'mail_setting'
get 'ui_theme'
end
resources :snippets resources :snippets
resources :tags resources :tags
resources :translations resources :translations

View File

@ -28,6 +28,7 @@ module ParserBackEnd
parse_menu(body, page, true) parse_menu(body, page, true)
public_r_tags = parse_content_edits(body, page, id) public_r_tags = parse_content_edits(body, page, id)
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page,id)

View File

@ -1,47 +1,36 @@
module ParserCommon module ParserCommon
include ActionView::Helpers::TagHelper
def menu_level(page, current, menu, edit = false) def menu_level(page, current, menu, edit = false)
res = '' res = ''
if menu.levels > 0 && current <= menu.levels if page.ordered_and_visible_children.size > 0
if current != 0 res << "<ul class='"
res << "<div class='rc_dm'>" res << menu.values["class_#{current}"] rescue nil
item = rand(100000) res << "'>"
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl' rel='#{item}'>#{page.i18n_variable[I18n.locale]}<span class='down'></span></a>" i = nil
if page.children.size > 0 i = 1 if menu.values["li_incremental_#{current}"]
res << "<div id='#{item}' class='dm_list #{menu.values['class_#{current}']}'>" if menu.values['home'] && current == 1
res << "<ul class='ini_list'>" res << menu_li(page, current, menu, i, edit)
i = nil
i = 1 if menu.values["li_incremental_#{current}"]
page.children.each do |child|
res << menu_li(child, current, menu, i, edit)
i += 1 if i
end
res << "</ul>"
res << "</div>"
end
res << "</div>"
else
res << '<ul>'
res << "<li>" + "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl'>#{page.i18n_variable[I18n.locale]}</a>" + "</li>"
page.children.each do |child|
res << "<li>" + menu_level(child, current + 1, menu, edit) + "</li>"
end
res << '</ul>'
end end
page.ordered_and_visible_children.each do |child|
res << menu_li(child, current, menu, i, edit)
i += 1 if i
end
res << "</ul>"
end end
res res
end end
def menu_li(page, current, menu, i, edit) def menu_li(page, current, menu, i, edit)
res = "<li class=" res = "<li class="
res << menu.values["li_class_#{current}"] res << menu.values["li_class_#{current}"] rescue nil
res << "_#{i}" if i res << "_#{i}" if i
res << ">" res << ">"
if page.children.size > 0 res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}'><span>#{page.i18n_variable[I18n.locale]}</span></a>"
if page.ordered_and_visible_children.size > 0 && current <= menu.levels
res << "<span class='dot'></span>"
res << menu_level(page, current + 1, menu, edit) res << menu_level(page, current + 1, menu, edit)
else end unless (page.is_home? rescue nil)
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='nav dm_ctrl'>#{page.i18n_variable[I18n.locale]}</a>"
end
res << "</li>" res << "</li>"
end end
@ -103,7 +92,7 @@ module ParserCommon
page_menu = body.css('.page_menu').first page_menu = body.css('.page_menu').first
home = get_homepage home = get_homepage
menu = page.design.layout.menu menu = page.design.layout.menu
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 0, menu, edit)) fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 1, menu, edit))
page_menu.swap(fragment) page_menu.swap(fragment)
end end
@ -114,7 +103,7 @@ module ParserCommon
res << "<div class='category_list'>" res << "<div class='category_list'>"
res << "<h3 class='h3'>#{page.i18n_variable[I18n.locale]}</h3>" res << "<h3 class='h3'>#{page.i18n_variable[I18n.locale]}</h3>"
res << "<ul class='list'>" res << "<ul class='list'>"
page.children.each do |child| page.ordered_and_visible_children.each do |child|
res << "<li>" res << "<li>"
res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>" res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>"
res << "</li>" res << "</li>"
@ -127,4 +116,14 @@ module ParserCommon
end end
end end
# page_menu
def parse_footer(body, page, edit=nil)
page_footer = body.css('.page_footer').first
res = "<div, id='footer', class='footer'>"
res << @site.footer[I18n.locale]
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_footer.swap(fragment) rescue nil
end
end end

View File

@ -21,11 +21,12 @@ module ParserFrontEnd
require 'nokogiri' require 'nokogiri'
def parse_page_noko(page, id = nil) def parse_page_noko(page, id = nil,params)
body = Nokogiri::HTML(page.design.layout.body) body = Nokogiri::HTML(page.design.layout.body)
parse_menu(body, page) parse_menu(body, page)
public_r_tags = parse_contents(body, page, id) public_r_tags = parse_contents(body, page, id,params[:preview])
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page,id)
@ -35,7 +36,7 @@ module ParserFrontEnd
end end
# page_contents # page_contents
def parse_contents(body, page, id) def parse_contents(body, page, id,preview = false)
public_r_tags = [] public_r_tags = []
body.css('.page_content').each do |content| body.css('.page_content').each do |content|
ret = '' ret = ''
@ -46,6 +47,7 @@ module ParserFrontEnd
# ret << "&category_id=#{page.category}" if page[:category] # ret << "&category_id=#{page.category}" if page[:category]
ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank? ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank?
ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank? ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank?
ret << "&preview=true" if preview.eql?('true')
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

View File

@ -1,7 +1,15 @@
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin?
include AdminHelper include AdminHelper
# layout 'admin' # layout 'admin'
def preview_and_approve
@bulletin = Bulletin.find params[:bulletin_id]
end
def approve
end
def setting def setting
@bulletin_categorys = BulletinCategory.all @bulletin_categorys = BulletinCategory.all

View File

@ -1,5 +1,6 @@
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
layout 'new_admin'
before_filter :for_app_manager,:except => [:index]
def index def index
@bulletin_categorys = BulletinCategory.all @bulletin_categorys = BulletinCategory.all

View File

@ -3,8 +3,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
layout 'new_admin' layout 'new_admin'
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? # before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
def index def index
# @bulletins = Bulletin.all # @bulletins = Bulletin.all
# @bulletins = Bulletin.desc("postdate desc") # @bulletins = Bulletin.desc("postdate desc")
@ -44,6 +45,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin_file = BulletinFile.new @bulletin_file = BulletinFile.new
@file_url = panel_announcement_back_end_bulletins_path @file_url = panel_announcement_back_end_bulletins_path
@bulletins.delete_if{ |bulletin|
bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id)
}
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js { } format.js { }
@ -81,14 +86,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletin.bulletin_files.build # @bulletin.bulletin_files.build
# @bulletin.bulletin_files.new # @bulletin.bulletin_files.new
get_categorys
get_tags
respond_to do |format| if get_categorys.empty?
format.html # new.html.erb flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
format.xml { render :xml => @bulletin } redirect_to :action => :index
end else
get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @bulletin }
end
end
end end
# GET /bulletins/1/edit # GET /bulletins/1/edit
@ -312,10 +320,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def get_categorys(id = nil) def get_categorys(id = nil)
@bulletin_categorys = [] @bulletin_categorys = []
@unit_list_for_anc = UnitListForAnc.all
if(is_manager? || is_admin?) if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager? elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit')
end end
end end
@ -323,87 +332,5 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end end
def get_sorted_and_filtered_bulletins
bulletins = Bulletin.all
case params[:sort]
when 'postdate', 'deadline'
bulletins = bulletins.order_by([params[:sort], params[:direction]])
when 'category'
category_ids = bulletins.distinct(:bulletin_category_id)
categories = BulletinCategory.find(category_ids) rescue nil
if categories
h = Hash.new
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
bulletins = sorted_categorys.flatten!
end
when 'title'
h = Array.new
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
bulletins = sorted.collect {|a| a[1] }
when 'status'
bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction])
when 'update_user_id'
user_ids = bulletins.distinct(:update_user_id)
users = User.find(user_ids) rescue nil
if users
h = Array.new
users.each { |user| h << [user.name, user.id] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
bulletins = sorted_users.flatten
end
when 'tags'
a = Array.new
AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins }
a.flatten!
a.uniq!
tmp = Array.new
bulletins.where(:tag_ids => []).each { |bulletin| tmp << [bulletin.title[I18n.locale].downcase, bulletin] }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
bulletins = a.flatten
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
bulletins.each do |bulletin|
value.each do |v|
case v
when 'pending'
a << bulletin if bulletin.is_checked.nil?
when 'rejected'
a << bulletin if bulletin.is_checked.eql?(false)
else
a << bulletin if bulletin[v]
end
end
end
bulletins = a.uniq
when 'categories'
a = Array.new
bulletins.each do |bulletin|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
end
bulletins = a.uniq
when 'tags'
a = Array.new
bulletins.each do |bulletin|
bulletin.tags.each do |tag|
a << bulletin if value.include?(tag.id.to_s)
end
end
bulletins = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(bulletins).page(params[:page]).per(10)
end
end end

View File

@ -25,10 +25,20 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end end
def show def show
@bulletin = Bulletin.can_display.where(_id: params[:id]).first if params[:preview] == "true"
get_categorys preview_content
else
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
get_categorys
end
end end
def preview_content
@bulletin = Bulletin.find params[:id]
get_categorys
render :show
end
protected protected

View File

@ -2,7 +2,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper
def show_approval_link(bulletin) def show_approval_link(bulletin)
by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?) by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?)
by_user = bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? by_user = (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?)
by_bulletin and by_user by_bulletin and by_user
end end

View File

@ -33,6 +33,7 @@ class Bulletin
mount_uploader :image, ImageUploader mount_uploader :image, ImageUploader
belongs_to :bulletin_category belongs_to :bulletin_category
belongs_to :unit_list_for_anc
# embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_links, :cascade_callbacks => true
# embeds_many :bulletin_files, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true

View File

@ -0,0 +1,12 @@
class UnitListForAnc
include Mongoid::Document
include Mongoid::Timestamps
field :order
field :ut_code
field :up_ut_code
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true
end

View File

@ -0,0 +1,69 @@
<% if bulletin -%>
<div class="modal hide fade in banner-preview" id="bulletin-<%=bulletin.id%>">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><%= t("modal.preview") %></h3>
</div>
<div class="modal-body">
<p class="bulletin_slideshow">
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id ,:preview=>true) %> style="width:1024px;height:300px" >
</iframe>
<%# preview_block_ad_images_helper(bulletin).each do |ad_image| -%>
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || bulletin.context || " ")) %>
<%# end -%>
</p>
</div>
<div class="modal-footer">
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'clear'} do |f| %>
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.approval_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.approval_not_pass') %>
<% end -%>
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
<%= f.submit t('announcement.bulletin.submit_approval'),:class=>"btn"%>
<% end %>
<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-<%#=bulletin.title.dehumanize%>").on("show", function () {
// $("#bulletin-<%#=bulletin.title.dehumanize%>").find(".bulletin_slideshow").cycle({delay: -1000, fx: "<%#= bulletin.ad_fx.nil?? "fade": bulletin.ad_fx %>", timeoutFn: getTimeout });
// });
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
$("iframe").load(function(){
// Get the body element
var frameBody = $("iframe").contents().find("body");
// Get all links inside the BODY tag
$('a', frameBody).click(function(e){
//Disable all default actions
e.preventDefault();
});
$('input', frameBody).attr("disabled", true);
});
});
</script>
</div>
</div>
<% end -%>

View File

@ -0,0 +1,5 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:bulletin => @bulletin})) %>");
var start_modal_with_id = "bulletin-<%=@bulletin.id%>";
$("#"+start_modal_with_id).css("width","1050px");
$("#"+start_modal_with_id).css("height","768px");
$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px");

View File

@ -4,10 +4,13 @@
<%= bulletin_category.key %> <%= bulletin_category.key %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li> <%if is_manager? || is_admin? %>
<li><%= show_submit_permission_link(bulletin_category) %></li> <li><%= show_submit_permission_link(bulletin_category) %></li>
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li> <% end %>
<% 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.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<% end %>
</ul> </ul>
</div> </div>

View File

@ -35,7 +35,7 @@
</tbody> </tbody>
</table> </table>
<div id="form"><%= render :partial => "form" %></div> <div id="form"><%= render :partial => "form" if is_manager?%></div>

View File

@ -1,5 +1,9 @@
<tr id="<%= dom_id bulletin %>" class="with_action"> <tr id="<%= dom_id bulletin %>" class="with_action">
<td><%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %></td> <td>
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td> <td>
<div class="label-group"> <div class="label-group">
<div class="label-td"> <div class="label-td">
@ -27,27 +31,32 @@
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
<td> <td>
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %> <% if (bulletin.create_user_id == current_user.id) || is_manager? %>
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
<li class="dropdown"> <% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a> <li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
<ul class="dropdown-menu" id="menu1"> <li class="dropdown">
<li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li> <a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
<li><%= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li> <ul class="dropdown-menu" id="menu1">
<li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li> <li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li>
<li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li> <li><%= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
<li><%= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li> <li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
</ul> <li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
</li> <li><%= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
<%#= debugger %> </ul>
<%#= a=1 %> </li>
<% if show_approval_link(bulletin) %> <%#= debugger %>
<li><%= link_to t('announcement.bulletin.approval'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %> <%#= a=1 %>
<% end %>
<% end %>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<% end -%>
<% if show_approval_link(bulletin) %>
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %> <% end %>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -105,28 +105,6 @@
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a> <a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
</div> </div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
<div class="widget-content">
<% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
<div class="controls">
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.approval_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.approval_not_pass') %>
<% end -%>
<div class="select-role">
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
</div>
<% end %>
</div>
</div> </div>
<% elsif current_user.admin? %> <% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%> <%= f.hidden_field :is_checked,:value => true%>
@ -139,13 +117,16 @@
<div id="post-body"> <div id="post-body">
<div id="post-body-content" class="clear"> <div id="post-body-content" class="clear">
<%= f.label :unit_list_for_anc%>
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<%= f.label :category %> <%= f.label :category %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<%# @site_valid_locales.each_with_index do |locale, i| %> <%# @site_valid_locales.each_with_index do |locale, i| %>
<% site_valid_locales_default_head.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> <li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %> <% end %>
</ul> </ul>
@ -153,7 +134,7 @@
<div class="tab-content"> <div class="tab-content">
<%# @site_valid_locales.each_with_index do |locale, i| %> <%# @site_valid_locales.each_with_index do |locale, i| %>
<% site_valid_locales_default_head.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">

View File

@ -5,8 +5,11 @@
</table> </table>
<% end %> <% end %>
<div id="bulletin_pagination" class="paginationFixed"> <div class="form-actions form-fixed pagination-right">
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %>
<div id="bulletin_pagination" class="paginationFixed">
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
</div>
</div> </div>
<div id="bulletin_link_qe"> <div id="bulletin_link_qe">
@ -14,12 +17,10 @@
<%= render :partial => "bulletin_link_qe" %> <%= render :partial => "bulletin_link_qe" %>
</div> </div>
</div> </div>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %> <%= javascript_include_tag "bulletin_form" %>
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %> <% end %>

View File

@ -4,7 +4,7 @@
<div class="info1"> <div class="info1">
<span class="date"><%= @bulletin.postdate %></span> <span class="date"><%= @bulletin.postdate %></span>
&nbsp;|&nbsp; &nbsp;|&nbsp;
<a href="" class="unit"><%= User.find(@bulletin.create_user_id).name %></a> <a href="" class="unit"><%= @bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a>
</div> </div>
</div> </div>
<div class="news_image"> <div class="news_image">
@ -14,58 +14,18 @@
<div class="news_paragraph"> <div class="news_paragraph">
<%= @bulletin.text[I18n.locale].html_safe %> <%= @bulletin.text[I18n.locale].html_safe %>
</div> </div>
<b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
<div class="fb"> <div class="fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe> <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
</div> </div>
<!--
<p id="notice"><%= flash_messages %></p>
<ul>
<li>
<b><%= t('announcement.category') %></b>
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %>
</li>
<li>
<b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %>
</li>
<li>
<b><%= t('announcement.title') %></b>
<%= @bulletin.title[I18n.locale] %>
</li>
<li>
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
</li>
<li>
<b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('announcement.text') %></b>
<%= @bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
<b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</li>
<li>
<b><%= t('announcement.張貼者') %></b>
<%= User.find(@bulletin.create_user_id).name %>
</li>
<li>
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
</li>
-->
<%#= link_back %>

View File

@ -59,6 +59,8 @@ en:
all_articles: List all_articles: List
add_new: Add add_new: Add
categories: Categories categories: Categories
error:
no_avilb_cate_for_posting: You need a category to submit your post,please contact admin
sure?: Sure? sure?: Sure?
campus_news: Campus News campus_news: Campus News
more: more+ more: more+
@ -80,8 +82,9 @@ en:
approval_setting_window_title: 'Unit' approval_setting_window_title: 'Unit'
approval_user_list: 'Approval Users' approval_user_list: 'Approval Users'
cate_auth: Category Authorization cate_auth: Category Authorization
submit_approval: Submit approval
tag_cloud: Tag cloud tag_cloud: Tag cloud
# admin: # admin:
# action: Action # action: Action
# add_language: Add language # add_language: Add language

View File

@ -37,6 +37,8 @@ zh_tw:
announcement: announcement:
add_new: 新增 add_new: 新增
all_articles: 列表 all_articles: 列表
error:
no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類
tags: 標籤 tags: 標籤
categories: 分類 categories: 分類
status: 狀態 status: 狀態
@ -61,6 +63,7 @@ zh_tw:
approval_setting_window_title: '單位' approval_setting_window_title: '單位'
approval_user_list: '審核者' approval_user_list: '審核者'
cate_auth: '分類授權' cate_auth: '分類授權'
submit_approval: '提交審核'
tag_cloud: 標籤雲 tag_cloud: 標籤雲
bulletin: bulletin:

View File

@ -7,6 +7,8 @@ Rails.application.routes.draw do
match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
resources :bulletins do resources :bulletins do
match "approve/:bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put
match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
member do member do
@ -32,7 +34,9 @@ Rails.application.routes.draw do
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do
resources :bulletins resources :bulletins # do
# match "preview" => "bulletins#preview_content",:as => :get_preview_content
# end
end end
namespace :widget do namespace :widget do
match "bulletins" => "bulletins#index" match "bulletins" => "bulletins#index"

View File

@ -0,0 +1,15 @@
# encoding: utf-8
namespace :nccu_data do
desc "load nccu data from csv"
task :setup_ut_list => :environment do
require 'csv'
CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row|
new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now)
new_unit.build_title :en => row[4], :zh_tw => row[3]
new_unit.save
end
end
end

View File

@ -0,0 +1,186 @@
order,ut_code,up_tu_code,ut_zh_tw,ut_en
0100,H00,H00,校長室,Office of the President
0110,H01,H01,副校長室一,Office of the Vice President
0110,H03,H03,副校長室二,Office of the Vice President
0200,100,100,文學院,College of Liberal Arts
0210,101,100,中文系,Dept. of Chinese Literature
0220,103,100,歷史系,Dept. of History
0230,104,100,哲學系,Dept. of Philosophy
0240,155,100,圖檔所,"Graduate Institute of Library, Informati"
0250,156,100,宗教所,Graduate Institute of Religious Studies
0260,158,100,台史所,Graduate Institute of Taiwan History
0270,159,100,台文所,Graduate Institute of Taiwan Literatu
0280,161,100,華文碩,Master's Program in Teaching Chinese as
0290,160,100,華文博,Doctor's Program in Teaching Chinese as
0294,913,100,圖資專班,E-learning Master Program of Library and
0300,700,700,理學院,College of Science
0310,701,700,應數系,Dept. of Mathematical Sciences
0320,702,700,心理系,Dept. of Psychology
0330,703,700,資科系,Dept. of Computer Science
0340,754,700,神科所,The Graduate Institute of Neuroscience
0350,755,700,應物所,Graduate Institute of Applied Physics
0600,200,200,社科院,College of Social Sciences
0605,202,200,政治系,Dept. of Political Science
0610,204,200,社會系,Dept. of Sociology
0615,205,200,財政系,Dept. of Public Finance
0620,206,200,公行系,Dept. of Public Administration
0625,207,200,地政系,Dept. of Land Economics
0630,208,200,經濟系,Dept. of Economics
0635,209,200,民族系,Dept. of Ethnology
0640,261,200,國發所,GIDS
0645,262,200,勞工所,Graduate Institute of Labor Research
0650,264,200,社工所,Graduate Institute of Social Work
0652,265,200,亞太博,International Doctor Program in Asia-Pac
0700,600,600,法學院,College of Law
0710,601,600,法律系,Dept. of Law
0720,652,600,法科所,The Institute of Law and Inter-disciplin
0800,300,300,商學院,College of Commerce
0801,301,300,國貿系,Dept. of International Business
0803,302,300,金融系,Dept. of Money and Banking
0805,303,300,會計系,Dept. of Accounting
0807,304,300,統計系,Dept. of Statistics
0809,305,300,企管系,Dept. of Business Administration
0811,306,300,資管系,Dept. of Management Information System
0813,307,300,財管系,Dept. of Finance
0815,308,300,風管系,Dept. of Risk Management and Insurance
0817,359,300,科管所,Graduate Institute of Technology and Inn
0819,361,300,智財所,Graduate Institute of Intellectual Prope
0821,362,300,管理碩士學程,Advanced Master of Business Administrati
0823,380,300,商管碩,Advanced Master of Business Administrati
1100,500,500,外語學院,College of Foreign Languages
1110,501,500,英文系,Dept. of English
1120,502,500,阿文系,Dept. of Arabic Language and Literature
1130,504,500,斯拉夫文系,Dept. of Slavic Languages and Literature
1140,506,500,日文系,Dept. of Japanese
1150,507,500,韓文系,Dept. of Korean Language and Cultur
1160,508,500,土文系,Dept. of Turkish Language and Cultu
1170,555,500,語言所,Graduate Institute of Linguistics
1180,509,500,歐洲語文學程,Undergraduate Program in European Langua
1190,5T1,500,外文中心,Foreign Languages Center
1200,400,400,傳播學院,College of Communication
1210,401,400,新聞系,Dept. of Journalism
1220,402,400,廣告系,Dept. of Advertising
1230,403,400,廣電系,Dept. of Radio and Television
1240,461,400,國傳英語碩士學位學程,International Master's Program in Intern
1250,404,400,傳播學程,College of Communication Undergraduate D
1260,462,400,數位內容學程,DCT
1270,781,700,數位內容與科技學士學位學程,數位內容與科技學士學位學程
1280,4A1,400,實習廣播電台,NCCU Community Radio Station
1300,800,800,國際事務學院,College of International Affairs
1310,203,800,外交系,Dept. of Diplomacy
1320,260,800,東亞所,Graduate Institute of East Asian Studies
1330,263,800,俄研所,Graduate Institute of Russian Studies
1340,861,800,日碩研,Master Program in Japan Studies
1346,862,800,國際研究英語碩士學位學程(籌備處),International Master's Program in Intern
1600,900,900,教育學院,College of Education
1610,102,900,教育系,Dept. of Education
1620,157,900,幼教所,Graduate Institute of Early Childhood Ed
1630,171,900,教政所,Graduate Institute of Educational Admini
1640,1T3,900,師培中心,Institute of Teacher Education
1652,172,900,輔諮碩學程,MPCG
1660,1T1,900,教研中心,The Teacher In-Service Education Center
1700,L00,L00,國關中心,The Institute of International Relations
1710,L01,L00,國關第一所,First Division
1720,L02,L00,國關第二所,Second Division
1730,L03,L00,國關第三所,Third Division
1740,L04,L00,國關第四所,Fourth Division
1750,L05,L00,國關合交組,The Institute of International Relations
1760,L06,L00,國關編譯組,The Institute of International Relations
1770,L07,L00,國關圖資組,The Institute of International Relations
1780,L08,L00,國關秘書組,The Institute of International Relations
1800,S00,S00,選研中心,Election Study Center
1900,Z01,Z01,第三部門研究中心,Center for the Third Sector
1910,Z02,Z02,創新創造力研究中心,CCIS
1920,Z03,Z03,中國大陸研究中心,Center for China Studies
1930,Z04,Z04,台灣研究中心,TSC
1940,Z08,Z08,心腦學中心,"Reseach Center for Mind, Brain and Learn"
1950,Z10,Z10,原民中心,Center for Aboriginal Studies
1960,Z09,Z09,人文中心,Humanities Center
2000,T00,T00,教務處,Office of Academic Affairs
2010,T01,T00,教務處註冊組,Registration Section
2020,T02,T00,教務處課務組,Instruction Resources Section
2030,T03,T00,教務處綜合業務組,Admission Section
2040,T04,T00,教務處通識教育中心,Center of General Education
2100,M00,M00,學務處,Office of Student Affairs
2110,M01,M00,學務處生僑組,Life Guidance and Overseas Chinese Stude
2120,M02,M00,學務處課外組,Student Activities Section
2130,M03,M00,學務處住宿組,Student Housing Service Section
2150,M11,M00,學務處藝文中心,Art and Culture Center
2155,M14,M00,學務處身心健康中心,Physical and Mental Health Center
2160,M13,M00,學務處職涯中心,Center of Career Development
2170,D00,M00,學務處軍訓室,Military Education Office
2200,G00,G00,總務處,Office of General Affairs
2210,G01,G00,總務處文書組,Document and postal section
2220,G02,G00,總務處事務組,General Management Section
2230,G05,G00,總務處出納組,Cashier Section
2240,G04,G00,總務處營繕組,Construction and Maintenance Section
2250,G03,G00,總務處財產組,Property Management SEction
2260,G06,G00,總務處環保組,Environmental Protection Section
2270,G08,G00,總務處規劃組,Campus Planning & Devel opment Section
2280,G07,G00,總務處駐警隊,Campus Security National Chengchi Unive
2300,R00,R00,研發處,Office of Research and Development
2310,R01,R00,研發處企畫組,Planning Section
2320,R02,R00,研發處學術推展組,Academic Development Section
2330,R03,R00,研發處學評組,Academic Evaluation Section
2400,Z05,Z05,國合處,Office of International Cooperation
2410,Z06,Z05,國合處合作交流組,CES
2420,Z07,Z05,國合處教育組,IES
2430,Z14,Z05,國合處發展策劃組,DPS
2500,Q00,Q00,秘書處,Secretariat
2510,Q01,Q00,秘書處第一組,First Section
2520,Q02,Q00,秘書處第二組,Second Section
2530,Q03,Q00,秘書處第三組,Third Section
2600,K00,K00,圖書館,Libraries
2610,K06,K00,圖書館資訊組,System Information Section
2620,K07,K00,圖書館採編組,Acquisition & Cataloging Section
2630,K08,K00,圖書館典閱組,Circulation Section
2640,K09,K00,圖書館推廣服務組,Reference Services Section
2650,K10,K00,圖書館數位典藏組,Digital Preservation Section
2660,K11,K00,圖書館行政組,Administration Section
2670,K12,K00,圖書館圖書分館,Branch Libraries
2700,B00,B00,體育室,Physical Education Office
2710,B01,B00,體育教學組,Physical Education Office
2720,B02,B00,體育活動組,Sport activities section
2800,P00,P00,人事室,Personnel Office
2810,P01,P00,人一組,First Section
2820,P02,P00,人二組,Second Section
2830,P03,P00,人三組,Third Section
2840,P04,P00,人四組,Fourth Section
2900,A00,A00,會計室,Accounting Office
2910,A01,A00,會計室第一組,Budgeting Section
2920,A02,A00,會計室第二組,Accounting Section
2930,A03,A00,會計室第三組,Auditing Section
3000,I00,I00,公企中心,Public and Business Administration Educa
3010,I01,I00,公企諮詢組,Research and Consultation Section
3020,I02,I00,公企職訓組,Training Section
3030,I03,I00,公企語訓組,Language Training Section
3040,I04,I00,公企總務組,General Affairs Section
3050,I05,I00,公企中心圖資組,Library Resource Section
3100,O00,O00,公教中心,Civil Service Education Center
3110,O01,O00,公教教務組,Civil Service Education Center
3120,O02,O00,公教輔導組,Civil Service Education Center
3130,O03,O00,公教行政組,Civil Service Education Center
3200,J00,J00,社資中心,Social Sciences Information Center
3210,J03,J00,社資資料組,Reference Services Section
3220,J04,J00,社資研發組,Section of Research & Development
3300,C00,C00,電算中心,Computer Center
3310,C01,C00,電算教研組,Teaching and Research Section
3320,C02,C00,電算系統組,Application System Section
3330,C03,C00,電算行政組,Administration and Counseling Section
3340,C04,C00,電算網路組,Networking and Development Section
3400,T05,T05,教學發展中心,Center for Teaching and Learning Develop
3410,T06,T05,教發教學組,Teaching and Learning Division
3420,T07,T05,教發數位組,E-Learning Division
3430,T08,T05,教發規劃組,Planning and Research Division
3500,162,162,華語文中心,Chinese Language Center
3600,Z11,Z11,育成中心,Innovation Incubation Center
3700,V00,V00,附設實小,The Experimental Elementary School
3700,V01,V00,附設實小教務處,Office of Academic Affairs
3700,V02,V00,附設實小學務處,Office of Student Affairs
3700,V03,V00,附設實小輔導室,The Experimental Elementary School
3700,V04,V00,附設實小總務處,Office of General Affairs
3700,V06,V00,附設實小研究處,The Experimental Elementary School
3710,V05,V00,附設實小幼稚園,The Experimental Elementary School
3800,W00,W00,附中,The Affiliated High School
3900,Z13,Z13,政大書院辦公室,Chengchi College Project Office
4000,Z12,Z12,頂大辦公室,Office of NCCU Top University Program
1 order ut_code up_tu_code ut_zh_tw ut_en
2 0100 H00 H00 校長室 Office of the President
3 0110 H01 H01 副校長室一 Office of the Vice President
4 0110 H03 H03 副校長室二 Office of the Vice President
5 0200 100 100 文學院 College of Liberal Arts
6 0210 101 100 中文系 Dept. of Chinese Literature
7 0220 103 100 歷史系 Dept. of History
8 0230 104 100 哲學系 Dept. of Philosophy
9 0240 155 100 圖檔所 Graduate Institute of Library, Informati
10 0250 156 100 宗教所 Graduate Institute of Religious Studies
11 0260 158 100 台史所 Graduate Institute of Taiwan History
12 0270 159 100 台文所 Graduate Institute of Taiwan Literatu
13 0280 161 100 華文碩 Master's Program in Teaching Chinese as
14 0290 160 100 華文博 Doctor's Program in Teaching Chinese as
15 0294 913 100 圖資專班 E-learning Master Program of Library and
16 0300 700 700 理學院 College of Science
17 0310 701 700 應數系 Dept. of Mathematical Sciences
18 0320 702 700 心理系 Dept. of Psychology
19 0330 703 700 資科系 Dept. of Computer Science
20 0340 754 700 神科所 The Graduate Institute of Neuroscience
21 0350 755 700 應物所 Graduate Institute of Applied Physics
22 0600 200 200 社科院 College of Social Sciences
23 0605 202 200 政治系 Dept. of Political Science
24 0610 204 200 社會系 Dept. of Sociology
25 0615 205 200 財政系 Dept. of Public Finance
26 0620 206 200 公行系 Dept. of Public Administration
27 0625 207 200 地政系 Dept. of Land Economics
28 0630 208 200 經濟系 Dept. of Economics
29 0635 209 200 民族系 Dept. of Ethnology
30 0640 261 200 國發所 GIDS
31 0645 262 200 勞工所 Graduate Institute of Labor Research
32 0650 264 200 社工所 Graduate Institute of Social Work
33 0652 265 200 亞太博 International Doctor Program in Asia-Pac
34 0700 600 600 法學院 College of Law
35 0710 601 600 法律系 Dept. of Law
36 0720 652 600 法科所 The Institute of Law and Inter-disciplin
37 0800 300 300 商學院 College of Commerce
38 0801 301 300 國貿系 Dept. of International Business
39 0803 302 300 金融系 Dept. of Money and Banking
40 0805 303 300 會計系 Dept. of Accounting
41 0807 304 300 統計系 Dept. of Statistics
42 0809 305 300 企管系 Dept. of Business Administration
43 0811 306 300 資管系 Dept. of Management Information System
44 0813 307 300 財管系 Dept. of Finance
45 0815 308 300 風管系 Dept. of Risk Management and Insurance
46 0817 359 300 科管所 Graduate Institute of Technology and Inn
47 0819 361 300 智財所 Graduate Institute of Intellectual Prope
48 0821 362 300 管理碩士學程 Advanced Master of Business Administrati
49 0823 380 300 商管碩 Advanced Master of Business Administrati
50 1100 500 500 外語學院 College of Foreign Languages
51 1110 501 500 英文系 Dept. of English
52 1120 502 500 阿文系 Dept. of Arabic Language and Literature
53 1130 504 500 斯拉夫文系 Dept. of Slavic Languages and Literature
54 1140 506 500 日文系 Dept. of Japanese
55 1150 507 500 韓文系 Dept. of Korean Language and Cultur
56 1160 508 500 土文系 Dept. of Turkish Language and Cultu
57 1170 555 500 語言所 Graduate Institute of Linguistics
58 1180 509 500 歐洲語文學程 Undergraduate Program in European Langua
59 1190 5T1 500 外文中心 Foreign Languages Center
60 1200 400 400 傳播學院 College of Communication
61 1210 401 400 新聞系 Dept. of Journalism
62 1220 402 400 廣告系 Dept. of Advertising
63 1230 403 400 廣電系 Dept. of Radio and Television
64 1240 461 400 國傳英語碩士學位學程 International Master's Program in Intern
65 1250 404 400 傳播學程 College of Communication Undergraduate D
66 1260 462 400 數位內容學程 DCT
67 1270 781 700 數位內容與科技學士學位學程 數位內容與科技學士學位學程
68 1280 4A1 400 實習廣播電台 NCCU Community Radio Station
69 1300 800 800 國際事務學院 College of International Affairs
70 1310 203 800 外交系 Dept. of Diplomacy
71 1320 260 800 東亞所 Graduate Institute of East Asian Studies
72 1330 263 800 俄研所 Graduate Institute of Russian Studies
73 1340 861 800 日碩研 Master Program in Japan Studies
74 1346 862 800 國際研究英語碩士學位學程(籌備處) International Master's Program in Intern
75 1600 900 900 教育學院 College of Education
76 1610 102 900 教育系 Dept. of Education
77 1620 157 900 幼教所 Graduate Institute of Early Childhood Ed
78 1630 171 900 教政所 Graduate Institute of Educational Admini
79 1640 1T3 900 師培中心 Institute of Teacher Education
80 1652 172 900 輔諮碩學程 MPCG
81 1660 1T1 900 教研中心 The Teacher In-Service Education Center
82 1700 L00 L00 國關中心 The Institute of International Relations
83 1710 L01 L00 國關第一所 First Division
84 1720 L02 L00 國關第二所 Second Division
85 1730 L03 L00 國關第三所 Third Division
86 1740 L04 L00 國關第四所 Fourth Division
87 1750 L05 L00 國關合交組 The Institute of International Relations
88 1760 L06 L00 國關編譯組 The Institute of International Relations
89 1770 L07 L00 國關圖資組 The Institute of International Relations
90 1780 L08 L00 國關秘書組 The Institute of International Relations
91 1800 S00 S00 選研中心 Election Study Center
92 1900 Z01 Z01 第三部門研究中心 Center for the Third Sector
93 1910 Z02 Z02 創新創造力研究中心 CCIS
94 1920 Z03 Z03 中國大陸研究中心 Center for China Studies
95 1930 Z04 Z04 台灣研究中心 TSC
96 1940 Z08 Z08 心腦學中心 Reseach Center for Mind, Brain and Learn
97 1950 Z10 Z10 原民中心 Center for Aboriginal Studies
98 1960 Z09 Z09 人文中心 Humanities Center
99 2000 T00 T00 教務處 Office of Academic Affairs
100 2010 T01 T00 教務處註冊組 Registration Section
101 2020 T02 T00 教務處課務組 Instruction Resources Section
102 2030 T03 T00 教務處綜合業務組 Admission Section
103 2040 T04 T00 教務處通識教育中心 Center of General Education
104 2100 M00 M00 學務處 Office of Student Affairs
105 2110 M01 M00 學務處生僑組 Life Guidance and Overseas Chinese Stude
106 2120 M02 M00 學務處課外組 Student Activities Section
107 2130 M03 M00 學務處住宿組 Student Housing Service Section
108 2150 M11 M00 學務處藝文中心 Art and Culture Center
109 2155 M14 M00 學務處身心健康中心 Physical and Mental Health Center
110 2160 M13 M00 學務處職涯中心 Center of Career Development
111 2170 D00 M00 學務處軍訓室 Military Education Office
112 2200 G00 G00 總務處 Office of General Affairs
113 2210 G01 G00 總務處文書組 Document and postal section
114 2220 G02 G00 總務處事務組 General Management Section
115 2230 G05 G00 總務處出納組 Cashier Section
116 2240 G04 G00 總務處營繕組 Construction and Maintenance Section
117 2250 G03 G00 總務處財產組 Property Management SEction
118 2260 G06 G00 總務處環保組 Environmental Protection Section
119 2270 G08 G00 總務處規劃組 Campus Planning & Devel opment Section
120 2280 G07 G00 總務處駐警隊 Campus Security National Chengchi Unive
121 2300 R00 R00 研發處 Office of Research and Development
122 2310 R01 R00 研發處企畫組 Planning Section
123 2320 R02 R00 研發處學術推展組 Academic Development Section
124 2330 R03 R00 研發處學評組 Academic Evaluation Section
125 2400 Z05 Z05 國合處 Office of International Cooperation
126 2410 Z06 Z05 國合處合作交流組 CES
127 2420 Z07 Z05 國合處教育組 IES
128 2430 Z14 Z05 國合處發展策劃組 DPS
129 2500 Q00 Q00 秘書處 Secretariat
130 2510 Q01 Q00 秘書處第一組 First Section
131 2520 Q02 Q00 秘書處第二組 Second Section
132 2530 Q03 Q00 秘書處第三組 Third Section
133 2600 K00 K00 圖書館 Libraries
134 2610 K06 K00 圖書館資訊組 System Information Section
135 2620 K07 K00 圖書館採編組 Acquisition & Cataloging Section
136 2630 K08 K00 圖書館典閱組 Circulation Section
137 2640 K09 K00 圖書館推廣服務組 Reference Services Section
138 2650 K10 K00 圖書館數位典藏組 Digital Preservation Section
139 2660 K11 K00 圖書館行政組 Administration Section
140 2670 K12 K00 圖書館圖書分館 Branch Libraries
141 2700 B00 B00 體育室 Physical Education Office
142 2710 B01 B00 體育教學組 Physical Education Office
143 2720 B02 B00 體育活動組 Sport activities section
144 2800 P00 P00 人事室 Personnel Office
145 2810 P01 P00 人一組 First Section
146 2820 P02 P00 人二組 Second Section
147 2830 P03 P00 人三組 Third Section
148 2840 P04 P00 人四組 Fourth Section
149 2900 A00 A00 會計室 Accounting Office
150 2910 A01 A00 會計室第一組 Budgeting Section
151 2920 A02 A00 會計室第二組 Accounting Section
152 2930 A03 A00 會計室第三組 Auditing Section
153 3000 I00 I00 公企中心 Public and Business Administration Educa
154 3010 I01 I00 公企諮詢組 Research and Consultation Section
155 3020 I02 I00 公企職訓組 Training Section
156 3030 I03 I00 公企語訓組 Language Training Section
157 3040 I04 I00 公企總務組 General Affairs Section
158 3050 I05 I00 公企中心圖資組 Library Resource Section
159 3100 O00 O00 公教中心 Civil Service Education Center
160 3110 O01 O00 公教教務組 Civil Service Education Center
161 3120 O02 O00 公教輔導組 Civil Service Education Center
162 3130 O03 O00 公教行政組 Civil Service Education Center
163 3200 J00 J00 社資中心 Social Sciences Information Center
164 3210 J03 J00 社資資料組 Reference Services Section
165 3220 J04 J00 社資研發組 Section of Research & Development
166 3300 C00 C00 電算中心 Computer Center
167 3310 C01 C00 電算教研組 Teaching and Research Section
168 3320 C02 C00 電算系統組 Application System Section
169 3330 C03 C00 電算行政組 Administration and Counseling Section
170 3340 C04 C00 電算網路組 Networking and Development Section
171 3400 T05 T05 教學發展中心 Center for Teaching and Learning Develop
172 3410 T06 T05 教發教學組 Teaching and Learning Division
173 3420 T07 T05 教發數位組 E-Learning Division
174 3430 T08 T05 教發規劃組 Planning and Research Division
175 3500 162 162 華語文中心 Chinese Language Center
176 3600 Z11 Z11 育成中心 Innovation Incubation Center
177 3700 V00 V00 附設實小 The Experimental Elementary School
178 3700 V01 V00 附設實小教務處 Office of Academic Affairs
179 3700 V02 V00 附設實小學務處 Office of Student Affairs
180 3700 V03 V00 附設實小輔導室 The Experimental Elementary School
181 3700 V04 V00 附設實小總務處 Office of General Affairs
182 3700 V06 V00 附設實小研究處 The Experimental Elementary School
183 3710 V05 V00 附設實小幼稚園 The Experimental Elementary School
184 3800 W00 W00 附中 The Affiliated High School
185 3900 Z13 Z13 政大書院辦公室 Chengchi College Project Office
186 4000 Z12 Z12 頂大辦公室 Office of NCCU Top University Program

View File

@ -1,7 +1,16 @@
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin?
include AdminHelper include AdminHelper
def preview_and_approve
@bulletin = NewsBulletin.find params[:bulletin_id]
end
def approve
end
def setting def setting
@news_bulletin_categorys = NewsBulletinCategory.all @news_bulletin_categorys = NewsBulletinCategory.all
if params.has_key?(:category_id) if params.has_key?(:category_id)

View File

@ -1,5 +1,8 @@
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
def index def index
@news_bulletin_categorys = NewsBulletinCategory.all @news_bulletin_categorys = NewsBulletinCategory.all
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List') @news_bulletin_category = NewsBulletinCategory.new(:display => 'List')

View File

@ -1,7 +1,10 @@
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin?
# before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins]
def index def index
# @news_bulletins = NewsBulletin.all # @news_bulletins = NewsBulletin.all
@ -39,6 +42,10 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
@news_bulletin_link = NewsBulletinLink.new @news_bulletin_link = NewsBulletinLink.new
@link_url = panel_news_back_end_news_bulletins_path @link_url = panel_news_back_end_news_bulletins_path
@news_bulletins.delete_if{ |news_bulletin|
news_bulletin.is_pending == true && (!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || news_bulletin.create_user_id!=current_user.id)
}
@news_bulletin_file = NewsBulletinFile.new @news_bulletin_file = NewsBulletinFile.new
@file_url = panel_news_back_end_news_bulletins_path @file_url = panel_news_back_end_news_bulletins_path
@ -75,17 +82,19 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
def new def new
@news_bulletin = NewsBulletin.new @news_bulletin = NewsBulletin.new
@link_url = panel_news_back_end_news_bulletins_path @link_url = panel_news_back_end_news_bulletins_path
# @news_bulletin.news_bulletin_files.build # @news_bulletin.news_bulletin_files.build
# @news_bulletin.news_bulletin_files.new # @news_bulletin.news_bulletin_files.new
if get_categorys.empty?
get_categorys flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
get_tags redirect_to :action => :index
else
respond_to do |format| get_tags
format.html # new.html.erb respond_to do |format|
format.xml { render :xml => @news_bulletin } format.html # new.html.erb
format.xml { render :xml => @news_bulletin }
end
end end
end end
@ -311,10 +320,11 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
def get_categorys(id = nil) def get_categorys(id = nil)
@news_bulletin_categorys = [] @news_bulletin_categorys = []
@unit_list_for_anc = UnitListForAnc.all
if(is_manager? || is_admin?) if(is_manager? || is_admin?)
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true)) @news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
elsif is_sub_manager? elsif is_sub_manager?
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new') @news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit')
end end
end end
@ -323,86 +333,4 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end end
def get_sorted_and_filtered_news_bulletins
news_bulletins = NewsBulletin.all
case params[:sort]
when 'postdate', 'deadline'
news_bulletins = news_bulletins.order_by([params[:sort], params[:direction]])
when 'category'
category_ids = news_bulletins.distinct(:news_bulletin_category_id)
categories = NewsBulletinCategory.find(category_ids) rescue nil
if categories
h = Hash.new
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_categorys = sorted.collect {|a| news_bulletins.where(:news_bulletin_category_id => a[1]).entries }
news_bulletins = sorted_categorys.flatten!
end
when 'title'
h = Array.new
news_bulletins.each { |news_bulletin| h << [news_bulletin.title[I18n.locale].downcase, news_bulletin] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
news_bulletins = sorted.collect {|a| a[1] }
when 'status'
news_bulletins = news_bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction])
when 'update_user_id'
user_ids = news_bulletins.distinct(:update_user_id)
users = User.find(user_ids) rescue nil
if users
h = Array.new
users.each { |user| h << [user.name, user.id] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_users = sorted.collect {|a| news_bulletins.where(:update_user_id => a[1]).entries }
news_bulletins = sorted_users.flatten
end
when 'tags'
a = Array.new
NewsTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.news_bulletins }
a.flatten!
a.uniq!
tmp = Array.new
news_bulletins.where(:tag_ids => []).each { |news_bulletin| tmp << [news_bulletin.title[I18n.locale].downcase, news_bulletin] }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
news_bulletins = a.flatten
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
news_bulletins.each do |news_bulletin|
value.each do |v|
case v
when 'pending'
a << news_bulletin if news_bulletin.is_checked.nil?
when 'rejected'
a << news_bulletin if news_bulletin.is_checked.eql?(false)
else
a << news_bulletin if news_bulletin[v]
end
end
end
news_bulletins = a.uniq
when 'categories'
a = Array.new
news_bulletins.each do |news_bulletin|
a << news_bulletin if value.include?(news_bulletin.news_bulletin_category.id.to_s)
end
news_bulletins = a.uniq
when 'tags'
a = Array.new
news_bulletins.each do |news_bulletin|
news_bulletin.tags.each do |tag|
a << news_bulletin if value.include?(tag.id.to_s)
end
end
news_bulletins = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(news_bulletins).page(params[:page]).per(10)
end
end end

View File

@ -24,10 +24,19 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
end end
def show def show
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first if params[:preview] == "true"
get_categorys preview_content
else
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
get_categorys
end
end end
def preview_content
@news_bulletins = NewsBulletin.find params[:id]
get_categorys
render :show
end
protected protected

View File

@ -0,0 +1,14 @@
module Panel::News::BackEnd::NewsBulletinCategorysHelper
include ActionView::Helpers::UrlHelper
def show_submit_permission_link(news_bulletin_category)
oa = news_bulletin_category.get_object_auth_by_title('submit')
if oa.nil?
news_bulletin_category.object_auths.new(title: 'submit' ).save
oa = news_bulletin_category.get_object_auth_by_title('submit')
end
link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
end
end

View File

@ -0,0 +1,9 @@
module Panel::News::BackEnd::NewsBulletinsHelper
def news_show_approval_link(news_bulletin)
by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?)
by_user = news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?
by_news_bulletin and by_user
end
end

View File

@ -33,6 +33,7 @@ class NewsBulletin
mount_uploader :image, ImageUploader mount_uploader :image, ImageUploader
belongs_to :news_bulletin_category belongs_to :news_bulletin_category
belongs_to :unit_list_for_anc
# embeds_many :news_bulletin_links, :cascade_callbacks => true # embeds_many :news_bulletin_links, :cascade_callbacks => true
# embeds_many :news_bulletin_files, :cascade_callbacks => true # embeds_many :news_bulletin_files, :cascade_callbacks => true

View File

@ -0,0 +1,69 @@
<% if news_bulletin -%>
<div class="modal hide fade in banner-preview" id="news_bulletin-<%=news_bulletin.id%>">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><%= t("modal.preview") %></h3>
</div>
<div class="modal-body">
<p class="news_bulletin_slideshow">
<iframe src=<%= panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id ,:preview=>true) %> style="width:1024px;height:300px" >
</iframe>
<%# preview_block_ad_images_helper(news_bulletin).each do |ad_image| -%>
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => news_bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || news_bulletin.context || " ")) %>
<%# end -%>
</p>
</div>
<div class="modal-footer">
<%= form_for news_bulletin, :url => panel_news_back_end_news_bulletin_path(news_bulletin), :html => {:class => 'clear'} do |f| %>
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.approval_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.approval_not_pass') %>
<% end -%>
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
<%= f.submit t('announcement.bulletin.submit_approval'),:class=>"btn"%>
<% end %>
<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() {
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").on("show", function () {
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").find(".news_bulletin_slideshow").cycle({delay: -1000, fx: "<%#= news_bulletin.ad_fx.nil?? "fade": news_bulletin.ad_fx %>", timeoutFn: getTimeout });
// });
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
$("iframe").load(function(){
// Get the body element
var frameBody = $("iframe").contents().find("body");
// Get all links inside the BODY tag
$('a', frameBody).click(function(e){
//Disable all default actions
e.preventDefault();
});
$('input', frameBody).attr("disabled", true);
});
});
</script>
</div>
</div>
<% end -%>

View File

@ -0,0 +1,5 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:news_bulletin => @news_bulletin})) %>");
var start_modal_with_id = "news_bulletin-<%=@news_bulletin.id%>";
$("#"+start_modal_with_id).css("width","1050px");
$("#"+start_modal_with_id).css("height","768px");
$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px");

View File

@ -4,8 +4,14 @@
<%= news_bulletin_category.key %> <%= news_bulletin_category.key %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<li><%= link_to t('news_bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li> <%if is_manager? || is_admin? %>
<li><%= link_to t('news_bulletin_category.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li> <li><%= show_submit_permission_link(news_bulletin_category) %></li>
<% end %>
<% 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.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<% end %>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -17,7 +17,7 @@
</tbody> </tbody>
</table> </table>
<div id="form"><%= render :partial => "form" %></div> <div id="form"><%= render :partial => "form" if is_manager? %></div>

View File

@ -105,28 +105,6 @@
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a> <a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
</div> </div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
<div class="widget-content">
<% if is_manager? || @news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
<div class="controls">
<%= f.label :approval_stat, t('news.news_bulletin.approval_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('news.news_bulletin.approval_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
<%= t('news.news_bulletin.approval_not_pass') %>
<% end -%>
<div class="select-role">
<%= label :is_checked_false, t('news.news_bulletin.approval_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
</div>
<% end %>
</div>
</div> </div>
<% elsif current_user.admin? %> <% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%> <%= f.hidden_field :is_checked,:value => true%>
@ -139,13 +117,16 @@
<div id="post-body"> <div id="post-body">
<div id="post-body-content" class="clear"> <div id="post-body-content" class="clear">
<%= f.label :unit_list_for_anc%>
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<%= f.label :category %> <%= f.label :category %>
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<%# @site_valid_locales.each_with_index do |locale, i| %> <%# @site_valid_locales.each_with_index do |locale, i| %>
<% site_valid_locales_default_head.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> <li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %> <% end %>
</ul> </ul>
@ -153,7 +134,7 @@
<div class="tab-content"> <div class="tab-content">
<%# @site_valid_locales.each_with_index do |locale, i| %> <%# @site_valid_locales.each_with_index do |locale, i| %>
<% site_valid_locales_default_head.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">

View File

@ -1,5 +1,9 @@
<tr id="<%= dom_id news_bulletin %>" class="with_action"> <tr id="<%= dom_id news_bulletin %>" class="with_action">
<td><%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %></td> <td>
<% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td> <td>
<div class="label-group"> <div class="label-group">
<div class="label-td"> <div class="label-td">
@ -27,27 +31,33 @@
<td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %></td>
<td> <td>
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%> <%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %> <% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
<li><%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li>
<li class="dropdown"> <% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a> <li><%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li>
<ul class="dropdown-menu" id="menu1"> <li class="dropdown">
<li><%= link_to t(:basic), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'basic'), :remote => true %></li> <a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
<li><%= link_to t(:picture), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'picture'), :remote => true %></li> <ul class="dropdown-menu" id="menu1">
<li><%= link_to t(:tags), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'tags'), :remote => true %></li> <li><%= link_to t(:basic), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'basic'), :remote => true %></li>
<li><%= link_to t(:link), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'links'), :remote => true %></li> <li><%= link_to t(:picture), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'picture'), :remote => true %></li>
<li><%= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li> <li><%= link_to t(:tags), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'tags'), :remote => true %></li>
</ul> <li><%= link_to t(:link), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'links'), :remote => true %></li>
</li> <li><%= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li>
<%#= debugger %> </ul>
<%#= a=1 %> </li>
<% if (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !news_bulletin.is_expired? %> <%#= debugger %>
<li><%= link_to t('news.news_bulletin.approval'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %> <%#= a=1 %>
<% end %>
<% end %>
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
<% end %> <% end %>
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li> <% if news_show_approval_link(news_bulletin) %>
<li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -5,8 +5,11 @@
</table> </table>
<% end %> <% end %>
<div id="news_bulletin_pagination"> <div class="form-actions form-fixed pagination-right">
<%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
<div id="news_bulletin_pagination" class="paginationFixed">
<%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
</div>
</div> </div>
<div id="news_bulletin_link_qe"> <div id="news_bulletin_link_qe">
@ -20,12 +23,10 @@
<%= render :partial => "news_bulletin_file_qe" %> <%= render :partial => "news_bulletin_file_qe" %>
</div> </div>
</div> </div>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
</div>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "news_bulletin_form" %> <%= javascript_include_tag "news_bulletin_form" %>
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %> <% end %>

View File

@ -4,7 +4,7 @@
<div class="info1"> <div class="info1">
<span class="date"><%= @news_bulletin.postdate %></span> <span class="date"><%= @news_bulletin.postdate %></span>
&nbsp;|&nbsp; &nbsp;|&nbsp;
<a href="" class="unit"><%= User.find(@news_bulletin.create_user_id).name %></a> <a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a>
</div> </div>
</div> </div>
<div class="news_image"> <div class="news_image">
@ -14,58 +14,18 @@
<div class="news_paragraph"> <div class="news_paragraph">
<%= @news_bulletin.text[I18n.locale].html_safe %> <%= @news_bulletin.text[I18n.locale].html_safe %>
</div> </div>
<b><%= t('announcement.link') %></b>
<% @news_bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @news_bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
<div class="fb"> <div class="fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe> <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
</div> </div>
<!--
<p id="notice"><%= flash_messages %></p>
<ul>
<li>
<b><%= t('news.category') %></b>
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %>
</li>
<li>
<b><%= t('news.postdate') %></b>
<%= @news_bulletin.postdate %>
</li>
<li>
<b><%= t('news.title') %></b>
<%= @news_bulletin.title[I18n.locale] %>
</li>
<li>
<%#= image_tag(@news_bulletin.image.url, :size => "320x240") if @news_bulletin.image.file %>
<%= link_to image_tag(@news_bulletin.image.url, :size => "320x240"), @news_bulletin.image.url, {:target => '_blank', :title => @news_bulletin.image_identifier} if @news_bulletin.image.file %>
</li>
<li>
<b><%= t('news.subtitle') %></b>
<%= @news_bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('news.text') %></b>
<%= @news_bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
<b><%= t('news.link') %></b>
<% @news_bulletin.news_bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('news.file') %></b>
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</li>
<li>
<b><%= t('news.張貼者') %></b>
<%= User.find(@news_bulletin.create_user_id).name %>
</li>
<li>
<b><%= t('news.最後修改時間') %></b>
<%= @news_bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
</li>
-->
<%#= link_back %>

View File

@ -2,7 +2,20 @@
<% if @news_bulletins and !@news_bulletins.nil? %> <% if @news_bulletins and !@news_bulletins.nil? %>
<h2 class="topic_title"><%= t('news.campus_news')%></h2> <h2 class="topic_title"><%= t('news.campus_news')%></h2>
<%= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> <%#= 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_prev">previous page</div>
<div class="topic_next">next page</div> <div class="topic_next">next page</div>
<ul id="topic_list"> <ul id="topic_list">

View File

@ -6,6 +6,8 @@ Rails.application.routes.draw do
match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting
resources :news_bulletins do resources :news_bulletins do
match "approve/:news_bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put
match "approve/:news_bulletin_id" => "approvals#approve",:as => :approve,:via => :post
match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit
member do member do
@ -31,7 +33,9 @@ Rails.application.routes.draw do
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do
resources :news_bulletins resources :news_bulletins # do
# match "preview" => "news_bulletins#preview_content",:as => :get_preview_content
# end
end end
namespace :widget do namespace :widget do
match "news_bulletins" => "news_bulletins#index" match "news_bulletins" => "news_bulletins#index"

View File

@ -5,11 +5,12 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
def index def index
@page_contexts = PageContext.where(:archived => false).desc(:updated_at).page(params[:page]).per(10) @page_contexts = params[:sort] ? get_sorted_and_filtered("page_contexts", {:archived => false}) : PageContext.where(:archived => false).page(params[:page]).per(10)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.xml { render :xml => @page_contexts } format.xml { render :xml => @page_contexts }
format.js {}
end end
end end

View File

@ -0,0 +1,11 @@
<div id='filter' class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -0,0 +1,4 @@
<%= render_sort_bar(false, ['name', 'page','span7', 'page_context.name'],
['version', 'version', 'span2', 'page_context.version'],
['update_time', 'updated_at', 'span2', 'page_context.update_time'],
['last_modified', 'update_user_id', 'span2', 'page_context.last_modified']).html_safe %>

View File

@ -1,22 +1,6 @@
<%= flash_messages %> <%= flash_messages %>
<%= render 'filter' %>
<div id="filter" class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<table class="table main-list">
<thead>
<tr>
<th class="span7"><%= t('page_context.name') %></th>
<th class="span2"><%= t('page_context.version') %></th>
<th class="span2"><%= t('page_context.update_time') %></th>
<th class="span2"><%= t('page_context.last_modified') %></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
@ -27,13 +11,13 @@
<th class="span2"></th> <th class="span2"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody id="tbody_page_contexts" class="sort-holder">
<%= render :partial => 'page_context', :collection => @page_contexts %> <%= render :partial => 'page_context', :collection => @page_contexts %>
</tbody> </tbody>
</table> </table>
<%= paginate @page_contexts %> <div id="page_context_pagination" class="paginationFixed">
<%= paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %>
</div>

View File

@ -0,0 +1,3 @@
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_page_contexts").html("<%= j render :partial => 'page_context', :collection => @page_contexts %>");
$("#page_context_pagination").html("<%= j paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %>");

View File

@ -122,6 +122,13 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
format.js format.js
end end
end end
def delete
if params[:to_delete]
web_links = WebLink.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to panel_web_resource_back_end_web_links_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected protected

View File

@ -1,4 +1,4 @@
<%= render_sort_bar(false, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'], <%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'],
['category', 'bulletin_category', 'span2', 'bulletin.category'], ['category', 'bulletin_category', 'span2', 'bulletin.category'],
['name', 'name','span3', 'bulletin.title'], ['name', 'name','span3', 'bulletin.title'],
['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %> ['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %>

View File

@ -1,4 +1,9 @@
<tr id="<%= dom_id web_link %>" class="with_action"> <tr id="<%= dom_id web_link %>" class="with_action">
<td>
<% if (web_link.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', web_link.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td> <td>
<div class="label-group"> <div class="label-group">
<div class="label-td"> <div class="label-td">

View File

@ -1,17 +1,20 @@
<%= render 'filter' %> <%= form_for :news_bulletins, :url => delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
<table class="table main-list"> <%= render 'filter' %>
<thead> <table class="table main-list">
<tr> <thead>
<th class="span1"></th> <tr>
<th class="span2"></th> <th class="span1"></th>
<th class="span3"></th> <th class="span1"></th>
<th class="span2"></th> <th class="span2"></th>
</tr> <th class="span3"></th>
</thead> <th class="span2"></th>
<tbody id="tbody_web_links" class="sort-holder"> </tr>
<%= render :partial => 'web_link', :collection => @web_links %> </thead>
</tbody> <tbody id="tbody_web_links" class="sort-holder">
</table> <%= render :partial => 'web_link', :collection => @web_links %>
</tbody>
</table>
<% end %>
<div id="web_link_pagination" class="paginationFixed"> <div id="web_link_pagination" class="paginationFixed">
<%= paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>

Some files were not shown because too many files have changed in this diff Show More