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:
commit
2b9190a49e
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 |
|
@ -1,6 +1,5 @@
|
|||
var viewportwidth,
|
||||
viewportheight;
|
||||
console.log($(window).height())
|
||||
function resize() {
|
||||
viewportheight=$(window).height();
|
||||
viewportwidth=$(window).width();
|
||||
|
@ -15,9 +14,9 @@ $(document).ready(function(){
|
|||
placement: "left"
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.privacy', function() {
|
||||
|
||||
console.log($(this).val());
|
||||
switch ($(this).val()) {
|
||||
case 'true':
|
||||
$(this).parents('.controls').children('.select-role').slideUp(300);
|
||||
|
@ -53,15 +52,12 @@ $(document).ready(function(){
|
|||
$orbitBar = $('#orbit-bar').height(),
|
||||
$mainSidebar = $('#main-sidebar').width()+5,
|
||||
$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 .viewport').css("height", viewportheight-$orbitBar);
|
||||
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
|
||||
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
|
||||
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
|
||||
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
|
||||
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
|
||||
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
|
||||
$('.detal-list').tinyscrollbar();
|
||||
mainTablePosition();
|
||||
|
@ -82,14 +78,12 @@ $(window).resize(function(){
|
|||
$orbitBar = $('#orbit-bar').height(),
|
||||
$mainSidebar = $('#main-sidebar').width()+5,
|
||||
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
|
||||
console.log(viewportheight);
|
||||
$('#main-sidebar').css("height", viewportheight-$orbitBar);
|
||||
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
|
||||
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
|
||||
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
|
||||
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
|
||||
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
|
||||
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
|
||||
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
|
||||
mainTablePosition();
|
||||
});
|
||||
|
@ -118,5 +112,4 @@ $(window).scroll(function () {
|
|||
$(".table-label").css({left:$winLeft*-1} );
|
||||
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
|
||||
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
|
||||
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
|
||||
$(document).ready(function(){
|
||||
$('.search').tooltip({
|
||||
placement: "bottom"
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.orbit-bar-search', function (){
|
||||
if ($(this).parents('.search').hasClass('visible')){
|
||||
$(this).parents('.search').stop().animate({
|
||||
|
|
|
@ -2701,8 +2701,11 @@ button.btn.small, input[type="submit"].btn.small {
|
|||
.pagination .current{
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.pagination a {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.pagination a:hover, .pagination .active a {
|
||||
background-color: #f5f5f5;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
.pagination .active a {
|
||||
color: #999999;
|
||||
|
|
|
@ -10,22 +10,25 @@
|
|||
}
|
||||
.checkbox{
|
||||
padding: 5px;
|
||||
margin: 5px 5px 10px;
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
color:#777777;
|
||||
text-shadow: 0 1px 0px rgba(255,255,255,.4);
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
height: 30px;
|
||||
position: relative;
|
||||
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% );
|
||||
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);
|
||||
-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);
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;*/
|
||||
}
|
||||
.checkbox .check-icon {
|
||||
display: none;
|
||||
|
@ -40,7 +43,7 @@
|
|||
cursor: pointer;
|
||||
font-family: helvetica;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
line-height: 15px;
|
||||
padding: 0 10px 0 40px;
|
||||
color: #333333;
|
||||
display: inline-block;
|
||||
|
|
|
@ -70,9 +70,8 @@
|
|||
}
|
||||
.main-list .label-td:hover {
|
||||
height: auto;
|
||||
text-align: center;
|
||||
padding: 5px 5px 8px;
|
||||
left: -6px;
|
||||
left: -40px;
|
||||
top: -6px;
|
||||
border: 1px solid 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;
|
||||
-moz-border-radius: 3px;
|
||||
z-index: 5;
|
||||
width: 200px;
|
||||
}
|
||||
.qe-edit-div .table-condensed {
|
||||
background-color: #F2F2F2;
|
||||
|
@ -188,10 +188,16 @@ legend {
|
|||
}
|
||||
.form-fixed {
|
||||
position: fixed;
|
||||
margin-bottom: 0;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
z-index: 2;
|
||||
}
|
||||
.form-fixed .btn {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.paginationFixed {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.paginationFixed .pagination {
|
||||
margin-top: 0 !important;
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
}
|
||||
.login-logo {
|
||||
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;
|
||||
height: 160px;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@
|
|||
margin-right: -20px;
|
||||
}
|
||||
#orbit-bar .search-query {
|
||||
padding: 4px 9px;
|
||||
height: 12px;
|
||||
padding: 7px 9px 5px;
|
||||
height: 10px;
|
||||
margin-top: 3px;
|
||||
border: 1px solid #333333;
|
||||
font-size: 11px;
|
||||
|
@ -119,7 +119,8 @@
|
|||
background-position: -10px -10px;
|
||||
}
|
||||
#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 {
|
||||
background-position: -4px -37px;
|
||||
|
@ -635,6 +636,22 @@
|
|||
.adbanner-action {
|
||||
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-"] {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Admin::AdBannersController < ApplicationController
|
||||
class Admin::AdBannersController < OrbitBackendController
|
||||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :for_app_manager
|
||||
|
||||
def destroy
|
||||
@ad_banner = AdBanner.find(params[:id])
|
||||
|
|
|
@ -2,7 +2,7 @@ class Admin::DashboardsController < ApplicationController
|
|||
|
||||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
# before_filter :is_admin?
|
||||
|
||||
def index
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Admin::DesignsController < ApplicationController
|
||||
class Admin::DesignsController < OrbitBackendController
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
@ -6,6 +6,7 @@ class Admin::DesignsController < ApplicationController
|
|||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :for_admin_only
|
||||
|
||||
def upload_package
|
||||
if !params[:design].nil?
|
||||
|
@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@designs = Design.all.entries
|
||||
@designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -84,6 +85,13 @@ class Admin::DesignsController < ApplicationController
|
|||
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
|
||||
|
||||
def unzip_design(file, zip_name)
|
||||
|
|
|
@ -1,16 +1,48 @@
|
|||
class Admin::SitesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :get_site
|
||||
|
||||
def index
|
||||
@site = Site.first
|
||||
redirect_to :action => :new unless @site
|
||||
# def index
|
||||
# @site = Site.first
|
||||
# # redirect_to :action => :new unless @site
|
||||
# end
|
||||
|
||||
# def new
|
||||
# @site = Site.new
|
||||
# end
|
||||
|
||||
def update
|
||||
@site.update_attributes(params[:site])
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
def new
|
||||
@site = Site.new
|
||||
def site_info
|
||||
|
||||
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
|
||||
|
|
|
@ -39,15 +39,65 @@ class ApplicationController < ActionController::Base
|
|||
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
||||
end
|
||||
|
||||
def auth_failed_in_backend
|
||||
#redirect_to admin_dashboards_url
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
# Check if the current_user 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
|
||||
|
||||
# Render the page
|
||||
def render_page(id = nil)
|
||||
def render_page(param={})
|
||||
if @item
|
||||
render :text => process_page(@item, id), :layout => 'page_layout'
|
||||
render :text => process_page(@item, param[:id], param), :layout => 'page_layout'
|
||||
else
|
||||
render :text => '404 Not Found'
|
||||
end
|
||||
|
@ -78,8 +128,8 @@ class ApplicationController < ActionController::Base
|
|||
# set site if exist or create site
|
||||
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
|
||||
session[:site] = @site.id
|
||||
@site_in_use_locales = @site.in_use_locales
|
||||
@site_valid_locales = @site.valid_locales
|
||||
@site_in_use_locales = site_locales_default_head(@site.in_use_locales)
|
||||
@site_valid_locales = site_locales_default_head(@site.valid_locales)
|
||||
end
|
||||
|
||||
def set_current_item
|
||||
|
@ -114,4 +164,14 @@ class ApplicationController < ActionController::Base
|
|||
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
|
||||
|
|
|
@ -27,9 +27,13 @@ class OrbitBackendController< ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def get_sorted_and_filtered(object_class)
|
||||
def get_sorted_and_filtered(object_class, query=nil)
|
||||
object_class = object_class.classify.constantize
|
||||
if query
|
||||
objects = object_class.all.where(query)
|
||||
else
|
||||
objects = object_class.all
|
||||
end
|
||||
|
||||
if !params[:sort].blank?
|
||||
options = params[:sort_options]
|
||||
|
@ -62,30 +66,23 @@ class OrbitBackendController< ApplicationController
|
|||
case key
|
||||
when 'status'
|
||||
a = Array.new
|
||||
objects.each do |bulletin|
|
||||
objects.each do |object|
|
||||
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
|
||||
a << object if object[v]
|
||||
end
|
||||
end
|
||||
objects = a.uniq
|
||||
when 'categories'
|
||||
a = Array.new
|
||||
objects.each do |bulletin|
|
||||
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
|
||||
objects.each do |object|
|
||||
a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s)
|
||||
end
|
||||
objects = a.uniq
|
||||
when 'tags'
|
||||
a = Array.new
|
||||
objects.each do |bulletin|
|
||||
bulletin.tags.each do |tag|
|
||||
a << bulletin if value.include?(tag.id.to_s)
|
||||
objects.each do |object|
|
||||
object.tags.each do |tag|
|
||||
a << object if value.include?(tag.id.to_s)
|
||||
end
|
||||
end
|
||||
objects = a.uniq
|
||||
|
@ -150,7 +147,7 @@ class OrbitBackendController< ApplicationController
|
|||
|
||||
def get_with_nil(objects, option, sorted_objects)
|
||||
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_tmp = sorted.collect {|a| a[1] }
|
||||
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
|
||||
|
|
|
@ -16,10 +16,10 @@ class PagesController < ApplicationController
|
|||
def show
|
||||
#begin
|
||||
@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
|
||||
when 'Page'
|
||||
render_page(params[:id])
|
||||
render_page(params)
|
||||
when 'Link'
|
||||
redirect_to "http://#{@item[:url]}"
|
||||
end
|
||||
|
@ -40,7 +40,9 @@ class PagesController < ApplicationController
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def load_orbit_bar
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
module Admin::AdImagesHelper
|
||||
|
||||
def active_when_default_locale_eq locale
|
||||
locale.to_sym == I18n.default_locale ? 'active': ''
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -28,12 +28,15 @@ module Admin::ItemHelper
|
|||
end
|
||||
|
||||
def render_children(parent)
|
||||
if children = parent.children
|
||||
children = parent.ordered_children
|
||||
if !children.entries.blank?
|
||||
ret = ''
|
||||
children.each do |child|
|
||||
ret << render_node_and_children(child)
|
||||
end
|
||||
ret
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,12 +2,6 @@ module ApplicationHelper
|
|||
|
||||
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)
|
||||
@site_in_use_locales.include?(locale)? 'green' : 'red'
|
||||
end
|
||||
|
@ -74,6 +68,15 @@ module ApplicationHelper
|
|||
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)
|
||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
|
||||
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
|
||||
end
|
||||
|
||||
def process_page(page, id)
|
||||
parse_page_noko(page, id)
|
||||
def process_page(page, id, params)
|
||||
parse_page_noko(page, id, params)
|
||||
end
|
||||
|
||||
def page_metas(page)
|
||||
tmp_meta = {}
|
||||
metas = ''
|
||||
@site.page_metas.each do |meta|
|
||||
@site.site_metas.each do |meta|
|
||||
name, content = meta.get_name_content
|
||||
metas << "<meta name=#{name} content=#{content} />\n"
|
||||
tmp_meta.merge!(name => content)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
def page_stylesheets(page, edit=nil)
|
||||
|
@ -112,6 +132,7 @@ module ApplicationHelper
|
|||
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
|
||||
end
|
||||
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
|
||||
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
|
||||
|
@ -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.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-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-search.js'></script>\n"
|
||||
end
|
||||
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"
|
||||
|
@ -138,4 +159,8 @@ module ApplicationHelper
|
|||
javascripts
|
||||
end
|
||||
|
||||
def active_when_current_locale_eq(locale)
|
||||
locale.to_sym == I18n.locale ? 'active in': ''
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module OrbitBackendHelper
|
|||
concat (content_tag :th, :class => "span1 strong" do
|
||||
concat check_box_tag :check_all
|
||||
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|
|
||||
concat render_title(title[0], title[1], title[2], title[3])
|
||||
end
|
||||
|
|
|
@ -3,10 +3,10 @@ class Design
|
|||
include Mongoid::Timestamps
|
||||
include ParserLayout
|
||||
|
||||
field :title
|
||||
field :author
|
||||
field :intro
|
||||
field :version
|
||||
field :title, :type => String
|
||||
field :author, :type => String
|
||||
field :intro, :type => String
|
||||
field :version, :type => String
|
||||
|
||||
has_many :pages
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class Item
|
|||
field :full_name, :index => true
|
||||
field :position, :type => Integer
|
||||
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 :name, :exclusion => { :in => LIST[:forbidden_item_names] }
|
||||
|
@ -36,6 +38,21 @@ class Item
|
|||
urls.join("/")
|
||||
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
|
||||
|
||||
def setup_default_value
|
||||
|
|
|
@ -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
|
|
@ -8,4 +8,12 @@ class Meta
|
|||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class Site
|
||||
|
||||
METAS = ['description', 'keywords']
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
|
@ -9,12 +11,17 @@ class Site
|
|||
field :roaming_id
|
||||
field :private_key, :type => Binary
|
||||
field :public_key, :type => Binary
|
||||
field :title_always_on, :type => Boolean, :default => false
|
||||
|
||||
field :school
|
||||
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
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def generate_keys
|
||||
private_key = OpenSSL::PKey::RSA.generate(2048)
|
||||
self.public_key = private_key.public_key.to_s
|
||||
|
@ -31,4 +38,34 @@ class Site
|
|||
res.eql?('local out of date') ? false : true
|
||||
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
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<div class="adbanner-list">
|
||||
<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("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>
|
||||
<ul class="clear">
|
||||
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% content_for :page_specific_css do -%>
|
||||
<%#= stylesheet_link_tag "admin/ad_banner_preview" %>
|
||||
<% 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 "inc/modal-preview" %>
|
||||
<% end -%>
|
||||
|
|
|
@ -130,14 +130,14 @@
|
|||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
<ul class="nav nav-tabs">
|
||||
<% site_valid_locales_default_head.each do |locale|%>
|
||||
<%= content_tag :li,link_to(I18nVariable.from_locale(locale),"##{locale}",:data=>{:toggle => "tab"}),:class=> (active_when_default_locale_eq locale) %>
|
||||
<% @site_valid_locales.each do |locale|%>
|
||||
<%= 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">
|
||||
<%= 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|%>
|
||||
<%= content_tag :div,:class => "tab-pane #{active_when_default_locale_eq locale}",:id=>"#{locale}" do%>
|
||||
<% @site_valid_locales.each do |locale|%>
|
||||
<%= content_tag :div,:class => "tab-pane #{active_when_current_locale_eq locale}",:id=>"#{locale}" do%>
|
||||
<div class="title">
|
||||
<%= f.fields_for :title,@ad_image.title do |f| %>
|
||||
<%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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 %>
|
|
@ -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 %>
|
|
@ -1,52 +1,10 @@
|
|||
<%= flash_messages %>
|
||||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= 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 %>
|
||||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<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>
|
||||
<%= render 'designs' %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<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">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
|
@ -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 %>");
|
|
@ -17,17 +17,17 @@
|
|||
</dd>
|
||||
</dl>
|
||||
<dl id="sub_manager">
|
||||
<dt><%= t("admin.user_role.auth.sub_manager") %></ht>
|
||||
<% @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>
|
||||
<% end %>
|
||||
<dt><%#= t("admin.user_role.auth.sub_manager") %></ht>
|
||||
<%# @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>
|
||||
<%# end %>
|
||||
<dd>
|
||||
<%= 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))%>
|
||||
<%= submit_tag t("admin.user_role.auth.add_sub_manager") %>
|
||||
<% end %>
|
||||
<%#= 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))%>
|
||||
<%#= submit_tag t("admin.user_role.auth.add_sub_manager") %>
|
||||
<%# end %>
|
||||
</dd>
|
||||
</dl>
|
||||
</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] } %>
|
||||
|
||||
|
|
|
@ -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>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
|
||||
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
|
||||
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
|
||||
<%= 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>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
language.html.erb
|
|
@ -0,0 +1 @@
|
|||
mail_setting.html.erb
|
|
@ -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>
|
|
@ -0,0 +1 @@
|
|||
system_info.html.erb
|
|
@ -0,0 +1 @@
|
|||
ui_theme.html.erb
|
|
@ -10,23 +10,23 @@
|
|||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if @user_info_model_i18n_variables.size > 0 %>
|
||||
<% if @info_i18n_variables.size > 0 %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= t('admin.user_info') %>
|
||||
<%#= render :partial => 'action_bar' %>
|
||||
</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>
|
||||
<% end %>
|
||||
|
||||
<% if @user_role_model_i18n_variables.size > 0 %>
|
||||
<% if @role_i18n_variables.size > 0 %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= t('admin.user_role') %>
|
||||
<%#= render :partial => 'action_bar' %>
|
||||
</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>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if @user_info_model_i18n_variables.size > 0 %>
|
||||
<% if @info_i18n_variables.size > 0 %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= t('admin.user_info') %>
|
||||
|
@ -56,7 +56,7 @@
|
|||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if @user_role_model_i18n_variables.size > 0 %>
|
||||
<% if @role_i18n_variables.size > 0 %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= t('admin.user_role') %>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="search clear">
|
||||
<li class="search clear" title="<%= t :search_nccu %>">
|
||||
<a class="orbit-bar-search" href="#">search</a>
|
||||
<form class="navbar-search" action="">
|
||||
<input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>">
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<%#= content_tag :li, :class => active_for_controllers('purchases') do -%>
|
||||
<%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
|
||||
<%# 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 %>
|
||||
<%= 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') %>
|
||||
|
@ -10,7 +13,7 @@
|
|||
<%= 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.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 -%>
|
||||
|
||||
|
@ -24,6 +27,7 @@
|
|||
<%= 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.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 -%>
|
||||
|
@ -43,13 +47,15 @@
|
|||
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
|
||||
<% 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 %>
|
||||
<%#= 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.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') %>
|
||||
<%# 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 %>
|
||||
|
||||
<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%>
|
||||
|
@ -62,6 +68,13 @@
|
|||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
<%= content_tag :li, :class => active_for_controllers(nil) do -%>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %>
|
||||
<%= content_tag :li, :class => active_for_controllers('sites') do -%>
|
||||
<%= 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 -%>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<%= render 'layouts/orbit_bar' %>
|
||||
<nav id="main-sidebar" class="my_scroll">
|
||||
<div id="main-sidebar" class="my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
|
@ -29,7 +29,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div id="main-wrap">
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<meta charset="utf-8">
|
||||
<%= page_title(@item).html_safe %>
|
||||
<%= page_metas(@item).html_safe %>
|
||||
<%= @metas %>
|
||||
<!--[if lt IE 9]>
|
||||
<%= javascript_include_tag "html5" %>
|
||||
<![endif]-->
|
||||
|
|
|
@ -68,6 +68,14 @@ en:
|
|||
traffic: Traffic
|
||||
|
||||
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
|
||||
ad_banner: AD Banner
|
||||
ad:
|
||||
|
@ -90,6 +98,7 @@ en:
|
|||
admin: Admin
|
||||
action: Action
|
||||
all_articles: List
|
||||
always_display_title: Always displayed in the title bar
|
||||
announcement: Announcement
|
||||
asset: Asset
|
||||
assets:
|
||||
|
@ -128,6 +137,7 @@ en:
|
|||
editing_role: Editing user role
|
||||
email: Email
|
||||
enable_language: Enable language
|
||||
enabled_for: Enabled for
|
||||
file_name: Filename
|
||||
file_size: File size
|
||||
format: Format
|
||||
|
@ -138,6 +148,7 @@ en:
|
|||
is_published: Is published
|
||||
item: Item
|
||||
key: Key
|
||||
keywords: Keywords
|
||||
language: Language
|
||||
layout: Layout
|
||||
layout_name: Layout name
|
||||
|
@ -152,6 +163,7 @@ en:
|
|||
list_infos: User information list
|
||||
list_roles: User roles list
|
||||
member: Member
|
||||
menu_enabled_for: Menu enabled for
|
||||
module:
|
||||
authorization: Module Authorization
|
||||
move_down: Move down
|
||||
|
@ -190,7 +202,10 @@ en:
|
|||
setup_translations: Translations setup
|
||||
setup_designs: Designs setup
|
||||
site: Site
|
||||
site_description: Site description
|
||||
site_footer: Site footer
|
||||
site_settings: Site Setting
|
||||
site_title: Site title
|
||||
super_pages: Super pages
|
||||
structure: Structure
|
||||
title: Title
|
||||
|
|
|
@ -8,12 +8,12 @@ zh_tw:
|
|||
back: 回上一步
|
||||
browse: 選擇檔案
|
||||
cancel: 取消
|
||||
create: 創建
|
||||
create: 新增
|
||||
delete: 刪除
|
||||
desktop: 桌面
|
||||
disable: 禁用
|
||||
dots: …
|
||||
downloaded: 已經下載
|
||||
downloaded: 已下載
|
||||
download: 下載
|
||||
edit: 編輯
|
||||
email: 電子郵件
|
||||
|
@ -50,7 +50,7 @@ zh_tw:
|
|||
file_type: 檔案類型
|
||||
hits: 點擊率
|
||||
item: 項目
|
||||
member: 成員
|
||||
member: 會員
|
||||
module: 模組
|
||||
most_visited_page: 熱門頁面
|
||||
quantity: 數量
|
||||
|
@ -65,6 +65,14 @@ zh_tw:
|
|||
traffic: 流量
|
||||
|
||||
admin:
|
||||
access:
|
||||
denied:
|
||||
app:
|
||||
not_sub_manager: 拒絕存取因你不是此應用程式次管理員
|
||||
not_manager: 拒絕存取因你不是此應用程式管理員
|
||||
not_authed_user: 拒絕存取因你不是此應用程式授權使用者
|
||||
not_admin: 拒絕存取因你不是此應用程式次管理員
|
||||
object: 拒絕存取因你不是網站管理者
|
||||
action: 操作
|
||||
ad_banner: 廣告輪播
|
||||
ad:
|
||||
|
@ -84,8 +92,9 @@ zh_tw:
|
|||
add_item: 新增項目
|
||||
add_language: 新增語言
|
||||
add_drop_down_item: +增加Orbit選單
|
||||
admin: 管理
|
||||
admin: 網站管理者
|
||||
all_articles: 列表
|
||||
always_display_title: 永遠顯示於標題列
|
||||
announcement: 公告管理
|
||||
asset: 資產
|
||||
assets:
|
||||
|
@ -97,22 +106,22 @@ zh_tw:
|
|||
author: 作者
|
||||
calendar: 行事曆
|
||||
cant_delete_self: 您不可以刪除自己。
|
||||
cant_revoke_self_admin: 您不可以撤銷自己的管理作用。
|
||||
cant_revoke_self_admin: 您不可以撤銷自己的管理身份。
|
||||
choose_file: 請選擇一個文件...
|
||||
class: 階級
|
||||
content: 內容
|
||||
create_error_link: 創建連接時出錯。
|
||||
create_error_page: 創建頁面時出錯。
|
||||
create_success_home: 首頁已成功創建。
|
||||
create_success_layout: 樣板已成功創建。
|
||||
create_success_link: 連結已成功創建。
|
||||
create_success_page: 頁面已成功創建。
|
||||
create_success_home: 首頁已成功創建。
|
||||
create_success_layout: 佈局已成功創建。
|
||||
create_success_link: 連結已成功創建。
|
||||
create_success_page: 頁面已成功創建。
|
||||
create_success_snippet: 片段已成功創建。
|
||||
create_success_user: 用戶已成功創建。。
|
||||
create_error_link: 新增連接時出錯。
|
||||
create_error_page: 新增頁面時出錯。
|
||||
create_success_home: 首頁已成功新增。
|
||||
create_success_layout: 樣板已成功新增。
|
||||
create_success_link: 連結已成功新增。
|
||||
create_success_page: 頁面已成功新增。
|
||||
create_success_home: 首頁已成功新增。
|
||||
create_success_layout: 佈局已成功新增。
|
||||
create_success_link: 連結已成功新增。
|
||||
create_success_page: 頁面已成功新增。
|
||||
create_success_snippet: 片段已成功新增。
|
||||
create_success_user: 用戶已成功新增。。
|
||||
dashboard: 儀表板
|
||||
data: 資料數據
|
||||
delete_language: 刪除語言
|
||||
|
@ -129,6 +138,7 @@ zh_tw:
|
|||
editing_role: 編輯用戶身份
|
||||
email: Email
|
||||
enable_language: 啟用語言
|
||||
enabled_for: 啟用
|
||||
file_name: 檔名
|
||||
file_size: 檔案大小
|
||||
format: 格式
|
||||
|
@ -138,7 +148,8 @@ zh_tw:
|
|||
intro: 簡介
|
||||
is_published: 被出版
|
||||
item: 網站架構
|
||||
key: 鍵值
|
||||
key: 關鍵
|
||||
keywords: 關鍵字
|
||||
language: 語言
|
||||
layout: 佈局
|
||||
layout_name: 佈局名字
|
||||
|
@ -153,6 +164,7 @@ zh_tw:
|
|||
list_infos: 用戶資料列表
|
||||
list_roles: 用戶身份列表
|
||||
member: 會員
|
||||
menu_enabled_for: 選單啟用
|
||||
module:
|
||||
authorization: 模組授權
|
||||
move_down: 往下移
|
||||
|
@ -186,7 +198,10 @@ zh_tw:
|
|||
purchase: 購買
|
||||
role: 身份
|
||||
roles: 身份
|
||||
site_description: 網站描述
|
||||
site_footer: 網站頁尾
|
||||
site_settings: 基本設定
|
||||
site_title: 網站標題
|
||||
setup_member: 成員設置
|
||||
setup_translations: 語系設定
|
||||
setup_designs: 版型設定
|
||||
|
|
|
@ -25,7 +25,7 @@ Orbit::Application.routes.draw do
|
|||
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
|
||||
collection do
|
||||
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
|
||||
collection do
|
||||
get 'upload_package'
|
||||
post 'delete'
|
||||
post 'upload_package'
|
||||
end
|
||||
member do
|
||||
|
@ -92,7 +93,13 @@ Orbit::Application.routes.draw do
|
|||
get 'add_sub_role'
|
||||
get 'add_attribute_field'
|
||||
end
|
||||
resources :sites
|
||||
resources :sites do
|
||||
get 'site_info'
|
||||
get 'system_info'
|
||||
get 'language'
|
||||
get 'mail_setting'
|
||||
get 'ui_theme'
|
||||
end
|
||||
resources :snippets
|
||||
resources :tags
|
||||
resources :translations
|
||||
|
|
|
@ -28,6 +28,7 @@ module ParserBackEnd
|
|||
parse_menu(body, page, true)
|
||||
public_r_tags = parse_content_edits(body, page, id)
|
||||
parse_images(body, page)
|
||||
parse_footer(body, page, true)
|
||||
|
||||
public_r_tags.each do |tag|
|
||||
send("parse_#{tag}s", body, page,id)
|
||||
|
|
|
@ -1,47 +1,36 @@
|
|||
module ParserCommon
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
def menu_level(page, current, menu, edit = false)
|
||||
res = ''
|
||||
if menu.levels > 0 && current <= menu.levels
|
||||
if current != 0
|
||||
res << "<div class='rc_dm'>"
|
||||
item = rand(100000)
|
||||
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>"
|
||||
if page.children.size > 0
|
||||
res << "<div id='#{item}' class='dm_list #{menu.values['class_#{current}']}'>"
|
||||
res << "<ul class='ini_list'>"
|
||||
if page.ordered_and_visible_children.size > 0
|
||||
res << "<ul class='"
|
||||
res << menu.values["class_#{current}"] rescue nil
|
||||
res << "'>"
|
||||
i = nil
|
||||
i = 1 if menu.values["li_incremental_#{current}"]
|
||||
page.children.each do |child|
|
||||
if menu.values['home'] && current == 1
|
||||
res << menu_li(page, current, menu, i, edit)
|
||||
end
|
||||
page.ordered_and_visible_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
|
||||
res
|
||||
end
|
||||
|
||||
def menu_li(page, current, menu, i, edit)
|
||||
res = "<li class="
|
||||
res << menu.values["li_class_#{current}"]
|
||||
res << menu.values["li_class_#{current}"] rescue nil
|
||||
res << "_#{i}" if i
|
||||
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)
|
||||
else
|
||||
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='nav dm_ctrl'>#{page.i18n_variable[I18n.locale]}</a>"
|
||||
end
|
||||
end unless (page.is_home? rescue nil)
|
||||
res << "</li>"
|
||||
end
|
||||
|
||||
|
@ -103,7 +92,7 @@ module ParserCommon
|
|||
page_menu = body.css('.page_menu').first
|
||||
home = get_homepage
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -114,7 +103,7 @@ module ParserCommon
|
|||
res << "<div class='category_list'>"
|
||||
res << "<h3 class='h3'>#{page.i18n_variable[I18n.locale]}</h3>"
|
||||
res << "<ul class='list'>"
|
||||
page.children.each do |child|
|
||||
page.ordered_and_visible_children.each do |child|
|
||||
res << "<li>"
|
||||
res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>"
|
||||
res << "</li>"
|
||||
|
@ -127,4 +116,14 @@ module ParserCommon
|
|||
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
|
||||
|
|
|
@ -21,11 +21,12 @@ module ParserFrontEnd
|
|||
|
||||
require 'nokogiri'
|
||||
|
||||
def parse_page_noko(page, id = nil)
|
||||
def parse_page_noko(page, id = nil,params)
|
||||
body = Nokogiri::HTML(page.design.layout.body)
|
||||
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_footer(body, page, true)
|
||||
|
||||
public_r_tags.each do |tag|
|
||||
send("parse_#{tag}s", body, page,id)
|
||||
|
@ -35,7 +36,7 @@ module ParserFrontEnd
|
|||
end
|
||||
|
||||
# page_contents
|
||||
def parse_contents(body, page, id)
|
||||
def parse_contents(body, page, id,preview = false)
|
||||
public_r_tags = []
|
||||
body.css('.page_content').each do |content|
|
||||
ret = ''
|
||||
|
@ -46,6 +47,7 @@ module ParserFrontEnd
|
|||
# ret << "&category_id=#{page.category}" if page[:category]
|
||||
ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank?
|
||||
ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank?
|
||||
ret << "&preview=true" if preview.eql?('true')
|
||||
ret << "'></div>"
|
||||
else
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
include AdminHelper
|
||||
# layout 'admin'
|
||||
def preview_and_approve
|
||||
@bulletin = Bulletin.find params[:bulletin_id]
|
||||
end
|
||||
|
||||
def approve
|
||||
|
||||
end
|
||||
|
||||
def setting
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
|
||||
layout 'new_admin'
|
||||
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
def index
|
||||
@bulletin_categorys = BulletinCategory.all
|
||||
|
|
|
@ -3,8 +3,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
layout 'new_admin'
|
||||
|
||||
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
|
||||
# @bulletins = Bulletin.all
|
||||
# @bulletins = Bulletin.desc("postdate desc")
|
||||
|
@ -44,6 +45,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
@bulletin_file = BulletinFile.new
|
||||
@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|
|
||||
format.html # index.html.erb
|
||||
format.js { }
|
||||
|
@ -82,14 +87,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
# @bulletin.bulletin_files.build
|
||||
# @bulletin.bulletin_files.new
|
||||
|
||||
get_categorys
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /bulletins/1/edit
|
||||
def edit
|
||||
|
@ -312,10 +320,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
|
||||
def get_categorys(id = nil)
|
||||
@bulletin_categorys = []
|
||||
@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -324,86 +333,4 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||
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
|
||||
|
|
|
@ -25,10 +25,20 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
end
|
||||
|
||||
def show
|
||||
if params[:preview] == "true"
|
||||
preview_content
|
||||
else
|
||||
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
|
||||
get_categorys
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def preview_content
|
||||
@bulletin = Bulletin.find params[:id]
|
||||
get_categorys
|
||||
render :show
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper
|
|||
|
||||
def show_approval_link(bulletin)
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ class Bulletin
|
|||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
belongs_to :unit_list_for_anc
|
||||
|
||||
# embeds_many :bulletin_links, :cascade_callbacks => true
|
||||
# embeds_many :bulletin_files, :cascade_callbacks => true
|
||||
|
|
|
@ -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
|
|
@ -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 -%>
|
|
@ -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");
|
|
@ -4,10 +4,13 @@
|
|||
<%= bulletin_category.key %>
|
||||
<div class="quick-edit">
|
||||
<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>
|
||||
<% 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>
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="form"><%= render :partial => "form" %></div>
|
||||
<div id="form"><%= render :partial => "form" if is_manager?%></div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<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>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
@ -27,8 +31,11 @@
|
|||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td>
|
||||
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
|
||||
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
|
||||
<% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
|
||||
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
|
@ -43,11 +50,13 @@
|
|||
</li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
<% if show_approval_link(bulletin) %>
|
||||
<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 %>
|
||||
<% 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 %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -105,28 +105,6 @@
|
|||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</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>
|
||||
<% elsif current_user.admin? %>
|
||||
<%= f.hidden_field :is_checked,:value => true%>
|
||||
|
@ -140,12 +118,15 @@
|
|||
<div id="post-body">
|
||||
<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.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<%# @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>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -153,7 +134,7 @@
|
|||
<div class="tab-content">
|
||||
|
||||
<%# @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" : '' %>">
|
||||
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
</table>
|
||||
<% end %>
|
||||
|
||||
<div id="bulletin_pagination" class="paginationFixed">
|
||||
<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 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 id="bulletin_link_qe">
|
||||
|
@ -15,11 +18,9 @@
|
|||
</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 %>
|
||||
<%= javascript_include_tag "bulletin_form" %>
|
||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="info1">
|
||||
<span class="date"><%= @bulletin.postdate %></span>
|
||||
|
|
||||
<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 class="news_image">
|
||||
|
@ -14,58 +14,18 @@
|
|||
<div class="news_paragraph">
|
||||
<%= @bulletin.text[I18n.locale].html_safe %>
|
||||
</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">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35&appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
|
||||
</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 %>
|
||||
|
|
|
@ -59,6 +59,8 @@ en:
|
|||
all_articles: List
|
||||
add_new: Add
|
||||
categories: Categories
|
||||
error:
|
||||
no_avilb_cate_for_posting: You need a category to submit your post,please contact admin
|
||||
sure?: Sure?
|
||||
campus_news: Campus News
|
||||
more: more+
|
||||
|
@ -80,6 +82,7 @@ en:
|
|||
approval_setting_window_title: 'Unit'
|
||||
approval_user_list: 'Approval Users'
|
||||
cate_auth: Category Authorization
|
||||
submit_approval: Submit approval
|
||||
tag_cloud: Tag cloud
|
||||
|
||||
# admin:
|
||||
|
|
|
@ -37,6 +37,8 @@ zh_tw:
|
|||
announcement:
|
||||
add_new: 新增
|
||||
all_articles: 列表
|
||||
error:
|
||||
no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類
|
||||
tags: 標籤
|
||||
categories: 分類
|
||||
status: 狀態
|
||||
|
@ -61,6 +63,7 @@ zh_tw:
|
|||
approval_setting_window_title: '單位'
|
||||
approval_user_list: '審核者'
|
||||
cate_auth: '分類授權'
|
||||
submit_approval: '提交審核'
|
||||
tag_cloud: 標籤雲
|
||||
|
||||
bulletin:
|
||||
|
|
|
@ -7,6 +7,8 @@ Rails.application.routes.draw do
|
|||
match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post
|
||||
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
|
||||
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_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||
member do
|
||||
|
@ -32,7 +34,9 @@ Rails.application.routes.draw do
|
|||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
resources :bulletins
|
||||
resources :bulletins # do
|
||||
# match "preview" => "bulletins#preview_content",:as => :get_preview_content
|
||||
# end
|
||||
end
|
||||
namespace :widget do
|
||||
match "bulletins" => "bulletins#index"
|
||||
|
|
15
vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake
vendored
Normal file
15
vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake
vendored
Normal 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
|
|
@ -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,7 +1,16 @@
|
|||
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
include AdminHelper
|
||||
|
||||
def preview_and_approve
|
||||
@bulletin = NewsBulletin.find params[:bulletin_id]
|
||||
end
|
||||
|
||||
def approve
|
||||
|
||||
end
|
||||
|
||||
def setting
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
if params.has_key?(:category_id)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
|
||||
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
|
||||
def index
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
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
|
||||
# @news_bulletins = NewsBulletin.all
|
||||
|
@ -39,6 +42,10 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
@news_bulletin_link = NewsBulletinLink.new
|
||||
@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
|
||||
@file_url = panel_news_back_end_news_bulletins_path
|
||||
|
||||
|
@ -79,15 +86,17 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
|
||||
# @news_bulletin.news_bulletin_files.build
|
||||
# @news_bulletin.news_bulletin_files.new
|
||||
|
||||
get_categorys
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @news_bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /news_bulletins/1/edit
|
||||
def edit
|
||||
|
@ -311,10 +320,11 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
|
||||
def get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
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
|
||||
|
||||
|
@ -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)
|
||||
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
|
||||
|
|
|
@ -24,10 +24,19 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
|||
end
|
||||
|
||||
def show
|
||||
if params[:preview] == "true"
|
||||
preview_content
|
||||
else
|
||||
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
|
||||
get_categorys
|
||||
end
|
||||
end
|
||||
|
||||
def preview_content
|
||||
@news_bulletins = NewsBulletin.find params[:id]
|
||||
get_categorys
|
||||
render :show
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
14
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
vendored
Normal file
14
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
vendored
Normal 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
|
9
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
vendored
Normal file
9
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
vendored
Normal 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
|
|
@ -33,6 +33,7 @@ class NewsBulletin
|
|||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :news_bulletin_category
|
||||
belongs_to :unit_list_for_anc
|
||||
|
||||
# embeds_many :news_bulletin_links, :cascade_callbacks => true
|
||||
# embeds_many :news_bulletin_files, :cascade_callbacks => true
|
||||
|
|
|
@ -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 -%>
|
|
@ -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");
|
|
@ -4,8 +4,14 @@
|
|||
<%= news_bulletin_category.key %>
|
||||
<div class="quick-edit">
|
||||
<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>
|
||||
<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>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<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>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="form"><%= render :partial => "form" %></div>
|
||||
<div id="form"><%= render :partial => "form" if is_manager? %></div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -105,28 +105,6 @@
|
|||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</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>
|
||||
<% elsif current_user.admin? %>
|
||||
<%= f.hidden_field :is_checked,:value => true%>
|
||||
|
@ -140,12 +118,15 @@
|
|||
<div id="post-body">
|
||||
<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.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">
|
||||
<%# @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>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -153,7 +134,7 @@
|
|||
<div class="tab-content">
|
||||
|
||||
<%# @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" : '' %>">
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<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>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
@ -27,8 +31,11 @@
|
|||
<td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %></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 ''%>
|
||||
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
|
||||
<% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
|
||||
<li><%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
|
@ -43,11 +50,14 @@
|
|||
</li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
<% if (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !news_bulletin.is_expired? %>
|
||||
<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 %>
|
||||
<% 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 %>
|
||||
<% 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>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
</table>
|
||||
<% end %>
|
||||
|
||||
<div id="news_bulletin_pagination">
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= 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 id="news_bulletin_link_qe">
|
||||
|
@ -21,11 +24,9 @@
|
|||
</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 %>
|
||||
<%= javascript_include_tag "news_bulletin_form" %>
|
||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="info1">
|
||||
<span class="date"><%= @news_bulletin.postdate %></span>
|
||||
|
|
||||
<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 class="news_image">
|
||||
|
@ -14,58 +14,18 @@
|
|||
<div class="news_paragraph">
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
</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">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35&appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
|
||||
</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 %>
|
||||
|
|
|
@ -2,7 +2,20 @@
|
|||
|
||||
<% if @news_bulletins and !@news_bulletins.nil? %>
|
||||
<h2 class="topic_title"><%= t('news.campus_news')%></h2>
|
||||
<%= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
|
||||
<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
|
||||
<div class="btn-group topic_note">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<%= t('news.more') %>
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<% @news_bulletin_categorys.each do |category| %>
|
||||
<li>
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="topic_prev">previous page</div>
|
||||
<div class="topic_next">next page</div>
|
||||
<ul id="topic_list">
|
||||
|
|
|
@ -6,6 +6,8 @@ Rails.application.routes.draw do
|
|||
match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting
|
||||
|
||||
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_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||
member do
|
||||
|
@ -31,7 +33,9 @@ Rails.application.routes.draw do
|
|||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
resources :news_bulletins
|
||||
resources :news_bulletins # do
|
||||
# match "preview" => "news_bulletins#preview_content",:as => :get_preview_content
|
||||
# end
|
||||
end
|
||||
namespace :widget do
|
||||
match "news_bulletins" => "news_bulletins#index"
|
||||
|
|
|
@ -5,11 +5,12 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
|
|||
|
||||
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|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @page_contexts }
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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 %>
|
|
@ -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 %>
|
|
@ -1,22 +1,6 @@
|
|||
|
||||
<%= flash_messages %>
|
||||
|
||||
<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>
|
||||
<%= render 'filter' %>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
|
@ -27,13 +11,13 @@
|
|||
<th class="span2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="tbody_page_contexts" class="sort-holder">
|
||||
|
||||
<%= render :partial => 'page_context', :collection => @page_contexts %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @page_contexts %>
|
||||
|
||||
|
||||
<div id="page_context_pagination" class="paginationFixed">
|
||||
<%= paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %>
|
||||
</div>
|
||||
|
|
|
@ -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]} %>");
|
|
@ -123,6 +123,13 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
|
|||
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
|
||||
|
||||
def get_categorys(id = nil)
|
||||
|
|
|
@ -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'],
|
||||
['name', 'name','span3', 'bulletin.title'],
|
||||
['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %>
|
|
@ -1,4 +1,9 @@
|
|||
<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>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<%= 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 %>
|
||||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span3"></th>
|
||||
|
@ -11,7 +13,8 @@
|
|||
<tbody id="tbody_web_links" class="sort-holder">
|
||||
<%= render :partial => 'web_link', :collection => @web_links %>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<div id="web_link_pagination" class="paginationFixed">
|
||||
<%= paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
|
|
|
@ -4,7 +4,11 @@ Rails.application.routes.draw do
|
|||
namespace :web_resource do
|
||||
namespace :back_end do
|
||||
root :to => "web_links#index"
|
||||
resources :web_links
|
||||
resources :web_links do
|
||||
collection do
|
||||
post 'delete'
|
||||
end
|
||||
end
|
||||
resources :web_link_categorys
|
||||
resources :tags
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue