Merge branch 'design_team' into ldap

Conflicts:
	app/controllers/admin/page_parts_controller.rb
	vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb
	vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb
This commit is contained in:
Christophe Vilayphiou 2012-04-30 07:57:20 +08:00
commit 20504b2205
213 changed files with 5216 additions and 780 deletions

View File

@ -11,17 +11,9 @@ $(document).on('click', '.action a.remove_existing_record', function(){
$("tr #" + $(this).prev().attr('value')).hide(); $("tr #" + $(this).prev().attr('value')).hide();
}); });
$('.quick_edit_cancel').live('click', function(){ $(document).on('click', '.quick_edit_cancel', function(){
tr = $(this).attr('rel'); tr = $(this).attr('rel');
$('#' + tr).hide(); $('#' + tr).hide();
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
}); });
$(document).on('click', '.list-remove', function(){
$('#delete_bulletins').submit();
});
$(document).on('click', '#check_all_bulletins', function(){
$('.checkbox_in_list').attr("checked", this.checked);
});

View File

@ -4,7 +4,7 @@
$(document).ready(function() { $(document).ready(function() {
$("a.preview_trigger").click(function(){ $("a.preview_trigger").click(function(){
$(this).after("<span id='show_preview'></span>"); $("#main-wrap").after("<span id='show_preview'></span>");
$.ajax({ $.ajax({
type: 'PUT', type: 'PUT',
url:$(this).attr("href"), url:$(this).attr("href"),

View File

@ -1,4 +1,7 @@
$(document).ready(function() { $(document).ready(function() {
permissionCheckbox();
});
function permissionCheckbox(){
$('.check[checked="checked"]').parents(".checkbox").addClass("checked") $('.check[checked="checked"]').parents(".checkbox").addClass("checked")
$(".checkbox").click(function(){ $(".checkbox").click(function(){
if($(this).children(".check").attr("checked")){ if($(this).children(".check").attr("checked")){
@ -16,4 +19,4 @@ $(document).ready(function() {
placement: 'bottom', placement: 'bottom',
delay: { show: 100, hide: 300 }, delay: { show: 100, hide: 300 },
}); });
}); };

View File

@ -1,5 +1,6 @@
var viewportwidth, var viewportwidth,
viewportheight; viewportheight;
console.log($(window).height())
function resize() { function resize() {
viewportheight=$(window).height(); viewportheight=$(window).height();
viewportwidth=$(window).width(); viewportwidth=$(window).width();
@ -49,14 +50,20 @@ $(document).ready(function(){
resize(); resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18; $subWiget = $('#sub-wiget').width()+18;
$('#main-sidebar').css("height", viewportheight-30); $orbitBar = $('#orbit-bar').height(),
$('#main-sidebar .viewport').css("height", viewportheight-30); $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-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('#main-sidebar').tinyscrollbar(); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
$('.detal-list').tinyscrollbar(); $('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition(); mainTablePosition();
/*isotope*/ /*isotope*/
@ -72,12 +79,18 @@ $(window).resize(function(){
resize(); resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18; $subWiget = $('#sub-wiget').width()+18;
$('#main-sidebar').css("height", viewportheight-30); $orbitBar = $('#orbit-bar').height(),
$('#main-sidebar .viewport').css("height", viewportheight-30); $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-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft) $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#bulletin_pagination').css("width", viewportwidth-$mainSidebar);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
mainTablePosition(); mainTablePosition();
}); });
/*main-table position*/ /*main-table position*/

View File

@ -0,0 +1,7 @@
$(document).on('click', '.list-remove', function(){
$('#delete_all').submit();
});
$(document).on('click', '#check_all', function(){
$('.checkbox_in_list').attr("checked", this.checked);
});

View File

@ -112,6 +112,18 @@ table .span1-3 {
.qe-block .form-horizontal .form-actions { .qe-block .form-horizontal .form-actions {
text-align:right; text-align:right;
} }
.form-actions form {
margin-bottom: 0;
}
.form-actions form input {
margin-bottom: 0;
}
.modal.fade { .modal.fade {
top: -50%; top: -50%;
} }
.form-search button {
margin-bottom: 0;
}
.modal form {
margin-bottom: 0;
}

View File

@ -2,17 +2,10 @@
#isotope { #isotope {
margin-top: 2px; margin-top: 2px;
background-color:#f4f4f4;
} }
.isotope-item { .isotope-item {
z-index: 2; z-index: 2;
} }
.isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
/**** Isotope CSS3 transitions ****/ /**** Isotope CSS3 transitions ****/
.isotope, .isotope,
@ -48,28 +41,27 @@
transition-duration: 0s; transition-duration: 0s;
} }
.w-a { .w-a {
width: 388px; width: 398px;
} }
.w-b { .w-b {
width: 802px; width: 812px;
} }
.h-a { .h-a {
height: 315px; height: 315px;
} }
.h-b { .h-b {
height: 699px; height: 703px;
} }
.item { .item {
margin: 5px 0 15px 15px; margin: 5px 0 15px 15px;
} }
.item h3 { .item h3 {
margin: 5px 0; margin: 20px 0 5px;
} }
.item h3 [class^="icons-"] { .item h3 [class^="icons-"] {
margin: 3px 5px 0 3px; margin: 1px 5px 0 3px;
} }
.item .detail { .item .detail {
padding: 5px;
border: 1px solid rgba(0, 0, 0, 0.1); border: 1px solid rgba(0, 0, 0, 0.1);
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 5px; border-radius: 5px;
@ -77,12 +69,11 @@
-moz-border-radius: 5px; -moz-border-radius: 5px;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
} }
.item .detail .totle { .item .detail .totle {
font-size: 50px; font-size: 50px;
padding:10px 5px 20px 0; padding:10px 5px 30px 0;
margin: 0px; margin: 0;
text-align: right; text-align: right;
border-bottom:1px solid #d9d9d9; border-bottom:1px solid #d9d9d9;
} }
@ -92,20 +83,60 @@
color: #333; color: #333;
padding-left: 5px; padding-left: 5px;
text-align:left; text-align:left;
margin-bottom: -7px;
}
.item .detail .table {
margin-bottom: 0;
} }
.item .detail .table th, .item .detail .table td { .item .detail .table th, .item .detail .table td {
border-top: none; border-top: none;
border-bottom: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;
} }
.item .detail .table tr th {
background-color: #F2F2F2;
border-bottom: 1px solid #AAAAAA;
}
.item .detail .table tr td:first-child { .item .detail .table tr td:first-child {
color: #666;; color: #666;;
} }
.item .detail .table tr td:last-child { .item .detail .table tr td:last-child, .item .detail .table tr th:last-child {
text-align:right; text-align:right;
padding-right: 15px;
} }
.item .h-a .my_scroll .viewport { .item .h-a .my_scroll .viewport {
height: 248px; height: 210px;
} }
.item .h-b .my_scroll .viewport { .item .h-b .my_scroll .viewport {
height: 632px; height: 594px;
}
.item .isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
.item .my_scroll {
position: relative;
}
.item .my_scroll .scrollbar {
right: 3px;
top: 0;
position: absolute;
z-index: 10;
}
.item .my_scroll .track {
background-color: transparent;
}
.detail.noStatistics {
overflow: hidden;
}
.detail.noStatistics.h-a {
height: 315px;
}
.detail.noStatistics.h-a .my_scroll .viewport {
height: 280px;
}
.detail.noStatistics.h-b {
height: 704px;
}
.detail.noStatistics.h-b .my_scroll .viewport {
height: 670px;
} }

View File

@ -22,7 +22,7 @@
.main-list .nav-pills > li > a { .main-list .nav-pills > li > a {
border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;
margin: 2px; margin: 2px;
padding:5px padding:5px;
} }
.main-list tbody .quick-edit { .main-list tbody .quick-edit {
position:relative; position:relative;
@ -54,6 +54,11 @@
position: relative; position: relative;
height: 40px; height: 40px;
} }
.main-list .label-group .label {
margin-bottom: 1px;
display: inline-block;
padding: 0 3px;
}
.main-list .label-td { .main-list .label-td {
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
height: 40px; height: 40px;
@ -99,6 +104,7 @@
.qe-block td { .qe-block td {
height:auto; height:auto;
padding: 0; padding: 0;
/*background-color: #dedede;*/
} }
.qe-block legend { .qe-block legend {
padding-left: 8px; padding-left: 8px;
@ -174,11 +180,18 @@ legend {
.sort-header th a:hover { .sort-header th a:hover {
text-decoration: none; text-decoration: none;
} }
#check_all_bulletins { .list-remove {
position: absolute; position: absolute;
top: 10px; top: 0;
left: 5px; padding-top: 9px !important;
left: 25px;
} }
#sort_headers .list-remove { .form-fixed {
padding: 8px 0 8px 16px !important; position: fixed;
margin-bottom: 0;
bottom: 0;
z-index: 10;
}
.paginationFixed {
margin-bottom: 25px;
} }

View File

@ -243,7 +243,7 @@
padding-right: 4px; padding-right: 4px;
border-right: 1px solid rgba(0,0,0,.2); border-right: 1px solid rgba(0,0,0,.2);
position:fixed; position:fixed;
top: 32px; top: 31px;
z-index: 88; z-index: 88;
} }
#main-sidebar .nav { #main-sidebar .nav {
@ -286,17 +286,18 @@
background-color: #FFF; background-color: #FFF;
margin-left:160px; margin-left:160px;
padding-top: 32px; padding-top: 32px;
padding-bottom: 18px; /*padding-bottom: 18px;*/
position: relative; position: relative;
min-height: 100%; padding-bottom: 45px;
/*min-height: 100%;*/
} }
#main-wrap > .form-actions { /*#main-wrap > .form-actions {
background-color: #FFF; background-color: #FFF;
text-align: center; text-align: center;
padding: 17px 20px 0; padding: 17px 20px 0;
margin: 0; margin: 0;
border-top: none; border-top: none;
} }*/
#main-wrap .subnav { #main-wrap .subnav {
height: auto; height: auto;
min-height: 36px; min-height: 36px;
@ -345,7 +346,7 @@
text-align: right; text-align: right;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
margin-bottom: 0; margin-bottom: -50px;
clear: both; clear: both;
} }
#poststuff form { #poststuff form {
@ -634,9 +635,6 @@
.adbanner-action { .adbanner-action {
margin-bottom: 20px; margin-bottom: 20px;
} }
#bulletin_link_qe form {
margin: 0;
}
[class^="icons-"] { [class^="icons-"] {
display: inline-block; display: inline-block;
width: 16px; width: 16px;
@ -925,5 +923,5 @@
} }
/*21*/ /*21*/
.icons- { .icons- {
background-position: -0px -640px; background-position: -0px -640px
} }

View File

@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController
before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ] before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ]
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ] before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
layout "admin" layout "new_admin"
def index def index
@module_apps = ModuleApp.all.entries @module_apps = ModuleApp.all.entries

View File

@ -1,6 +1,6 @@
class Admin::ObjectAuthsController < ApplicationController class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility include OrbitCoreLib::PermissionUnility
layout "admin" layout "new_admin"
before_filter :force_order before_filter :force_order
# before_filter :is_admin? ,:only => :index # before_filter :is_admin? ,:only => :index

View File

@ -27,8 +27,10 @@ class Admin::PagePartsController < ApplicationController
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil @tag_objects = @r_tag.classify.constantize.all rescue nil
case @module_app.key case @module_app.key
when 'bulletin' when 'announcement'
@categories = BulletinCategory.all @categories = BulletinCategory.all
when 'news'
@categories = NewsBulletinCategory.all
when 'web_resource' when 'web_resource'
@categories = WebLinkCategory.all @categories = WebLinkCategory.all
end end
@ -66,11 +68,13 @@ class Admin::PagePartsController < ApplicationController
@categories =[] @categories =[]
@module_app = ModuleApp.find(params[:id]) @module_app = ModuleApp.find(params[:id])
unless (@module_app.category.nil? rescue true) case @module_app.key
@module_app.category.each do |category| when 'announcement'
@categories << eval(category).all.entries @categories = BulletinCategory.all
end when 'news'
@categories.flatten! @categories = NewsBulletinCategory.all
when 'web_resource'
@categories = WebLinkCategory.all
end end
respond_to do |format| respond_to do |format|

View File

@ -31,7 +31,18 @@ class Admin::PagesController < ApplicationController
@designs = Design.all.entries @designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first @design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app @app_frontend_urls = @item.module_app.app_pages if @item.module_app
@categories = BulletinCategory.all if @item.module_app && @item.module_app.key.eql?('announcement') if @item.module_app
case @item.module_app.key
when 'announcement'
@categories = BulletinCategory.all
when 'news'
@categories = NewsBulletinCategory.all
when 'web_resource'
@categories = WebLinkCategory.all
end
else
@categories = nil
end
end end
def create def create

View File

@ -22,8 +22,139 @@ class OrbitBackendController< ApplicationController
def check_user_can_use def check_user_can_use
unless check_permission unless check_permission
redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) #redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
render :text => '403 Forbidden'
end end
end end
def get_sorted_and_filtered(object_class)
object_class = object_class.classify.constantize
objects = object_class.all
if !params[:sort].blank?
options = params[:sort_options]
options = [options] if !options.class.eql?(Array)
options.each do |option|
if object_class.fields.include?(option)
case object_class.fields[option].type.to_s
when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time'
(objects = objects.order_by(option, params[:direction])) rescue nil
when 'Object'
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
end
elsif object_class.relations.include?(option)
case object_class.relations[option].macro
when :references_one
a = Array.new
objects.each { |object| a << [get_string_value_from_object(object), object] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
objects = sorted.collect {|x| x[1] }
when :references_many, :references_and_referenced_in_many
objects = get_objects_from_self(object_class, objects, option)
when :referenced_in
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
end
end
end
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
objects.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
objects = a.uniq
when 'categories'
a = Array.new
objects.each do |bulletin|
a << bulletin if value.include?(bulletin.bulletin_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)
end
end
objects = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(objects).page(params[:page]).per(10)
end
def get_string_value_from_object(object)
s = object[I18n.locale] rescue nil
s = object.i18n_variable unless s rescue nil
s = object.name unless s rescue nil
s = object.title unless s rescue nil
if s
case s.class.to_s
when "String"
s.downcase
when "I18nVariable"
s[I18n.locale].downcase
else
nil
end
end
end
def get_objects_from_referenced_objects(object_class, objects, option)
referer_ids = objects.distinct(option)
referenced_objects = object_class.find(referer_ids) rescue nil
if referenced_objects
a = Array.new
referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_objects_from_self(object_class, objects, option)
referenced_class = object_class.relations[option].class_name.constantize
referenced_objects = referenced_class.all rescue nil
if referenced_objects
reverse_relation = nil
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
a = Array.new
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
a.compact!
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = Array.new
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
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) }
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)
a.flatten
end
end end

View File

@ -33,9 +33,9 @@ class PagesController < ApplicationController
def index_from_link def index_from_link
if params[:page] if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}" redirect_to "/#{@item.full_name}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
else else
redirect_to "/#{@item.full_name}" redirect_to "/#{@item.full_name}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
end end
end end
@ -51,11 +51,11 @@ class PagesController < ApplicationController
def get_item def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if params[:category_id] # if params[:category_id]
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) # @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
else # else
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
end # end
end end
end end

View File

@ -14,6 +14,7 @@ module Admin::ModuleAppHelper
end end
def get_auth_by(manager_obj) def get_auth_by(manager_obj)
"-AuthBy: " +( manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name) showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
t("admin.user_role.auth.auth_by",:user_display_name => showing_name)
end end
end end

View File

@ -87,26 +87,6 @@ module ApplicationHelper
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end end
def sortable(column)
direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
{:sort => column, :direction => direction}
end
def is_sort_active?(name)
res = ''
res << ' select' if params[:sort].eql?(name)
res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc')
res
end
def is_sort?(name)
' web-symbol' if params[:sort].eql?(name)
end
def is_filter_active?(type, id)
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
def process_page(page, id) def process_page(page, id)
parse_page_noko(page, id) parse_page_noko(page, id)
end end

View File

@ -0,0 +1,45 @@
module OrbitBackendHelper
def sortable(column)
direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
{:sort => column, :direction => direction}
end
def is_sort_active?(name)
res = ''
res << ' select' if params[:sort].eql?(name)
res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc')
res
end
def is_sort?(name)
' web-symbol' if params[:sort].eql?(name)
end
def is_filter_active?(type, id)
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
def render_sort_bar(delete_all, *titles)
content_tag :table, :class => "table main-list" do
content_tag :thead do
content_tag :tr, :class => "sort-header" do
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
titles.each do |title|
concat render_title(title[0], title[1], title[2], title[3])
end
end
end
end
end
def render_title(title, fields, span, translation)
content_tag :th, :class => "sort #{span} #{is_sort_active?(title)}" do
link_to (t(translation) + content_tag(:b, nil, :class => is_sort?(title))).html_safe, url_for({:filter => @filter}.merge(sortable(title).merge(:sort_options => fields))), :class => 'js_history'
end
end
end

View File

@ -1,5 +1,5 @@
<div id="new-a-banner" class="modal fade in tab-pane <%= 'active' if @active.nil? %>"> <div id="new-a-banner" class="modal fade <%= 'active' if @active.nil? %>">
<%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %> <%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
<div class="modal-header"> <div class="modal-header">
@ -28,25 +28,11 @@
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
</div> </div>
</div> </div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary',:remote=>true %> <%= f.submit t('submit'), :class=>'btn btn-primary',:remote=>true %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a> <a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div> </div>
<% end %> <% end %>
</div> </div>
<script type="text/javascript" charset="utf-8">
$('#new_ad_banner_tab_but').on('shown', function (e) {
$('#new-a-banner').modal({show: true});
});
$('#new-a-banner').on('hidden', function (e) {
$('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active");
$('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active");
$('.tab-pane').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active");
});
</script>

View File

@ -8,17 +8,17 @@
<div id="post-body-content" class="clear"> <div id="post-body-content" class="clear">
<ul class="nav nav-tabs"> <ul id="banner_tab" class="nav nav-tabs">
<% @ad_banners.each do |ab| %> <% @ad_banners.each do |ab| %>
<%= content_tag :li,link_to(ab.title,"##{ab.title.dehumanize}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %> <%= content_tag :li,link_to(ab.title,"##{ab.title.dehumanize}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
<% end -%> <% end -%>
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %> <%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"modal"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<%= render :partial => 'ad_banner_tab',:collection => @ad_banners %> <%= render :partial => 'ad_banner_tab',:collection => @ad_banners %>
<%= render :partial => "modal_ad_banner_form"%>
</div> </div>
<%= render :partial => "modal_ad_banner_form"%>
</div> </div>

View File

@ -1,21 +1,21 @@
<div id="open_for_all_user"> <div id="open_for_all_user">
<h1>All User</h1> <h1><%= t("admin.user_role.auth.all_member") %></h1>
<%= form_tag(submit_url) do %> <%= form_tag(submit_url) do %>
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %><br/> <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("admin.user_role.auth.all_member") %><br/>
<% end %> <% end %>
</div> </div>
<div id="user_role_management"> <div id="user_role_management">
<h1>User Role</h1> <h1><%= t("admin.user_role.auth.user") %></h1>
<%= form_tag(submit_url) do %> <%= form_tag(submit_url) do %>
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add Role' %><br/> <%= submit_tag t("admin.user_role.auth.by_role") %><br/>
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %> <%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add SubRole' %><br/> <%= submit_tag t("admin.user_role.auth.by_sub_role") %><br/>
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %> <%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add PrivilegeList' %><br/> <%= submit_tag t("admin.user_role.auth.add_to_privilege_list") %><br/>
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> <%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/> <%= submit_tag t("admin.user_role.auth.add_to_block_list") %><br/>
<% end %> <% end %>
<% unless auth.nil? %> <% unless auth.nil? %>
<% auth.roles.each do |role| %> <% auth.roles.each do |role| %>

View File

@ -1,197 +1,16 @@
<div id="isotope"> <div id="isotope">
<div class="item element"> <div class="item element">
<h3><i class="icons-member"></i><a href="">Member</a></h3> <h3><i class="icons-content"></i><a href=""><%= t(:content) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span>Quantity</span>9,517</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td>2,304</td>
</tr>
<tr>
<td>Master</td>
<td>783</td>
</tr>
<tr>
<td>Doctor</td>
<td>45</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-content"></i><a href="">Content</a></h3>
<div class="detail w-a h-a">
<p class="totle"><span>Quantity</span>9,517</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td>2,304</td>
</tr>
<tr>
<td>Master</td>
<td>783</td>
</tr>
<tr>
<td>Doctor</td>
<td>45</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-asset"></i><a href="">Asset</a></h3>
<div class="detail w-a h-a">
<p class="totle"><span>Quantity</span>9,517</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td>2,304</td>
</tr>
<tr>
<td>Master</td>
<td>783</td>
</tr>
<tr>
<td>Doctor</td>
<td>45</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href="">Traffic</a></h3>
<div class="detail w-a h-b"> <div class="detail w-a h-b">
<p class="totle"><span>Quantity</span>9,517</p> <p class="totle"><span><%= t(:all_content) %></span>9,517</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:module) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
<div class="track"> <div class="track">
@ -205,128 +24,44 @@
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody>
<tr> <tr>
<td>University</td> <td>公告</td>
<td>2,304</td> <td class="span2">2,304</td>
</tr> </tr>
<tr> <tr>
<td>Master</td> <td>新聞</td>
<td>783</td> <td class="span2">783</td>
</tr> </tr>
<tr> <tr>
<td>Doctor</td> <td>連結</td>
<td>45</td> <td class="span2">45</td>
</tr> </tr>
<tr> <tr>
<td>Staff</td> <td>連結</td>
<td>62</td> <td class="span2">62</td>
</tr> </tr>
<tr> <tr>
<td>Teacher</td> <td>連結</td>
<td>52</td> <td class="span2">52</td>
</tr> </tr>
<tr> <tr>
<td>Professor</td> <td>新聞</td>
<td>20</td> <td class="span2">20</td>
</tr> </tr>
<tr> <tr>
<td>Assistant Professor</td> <td>公告</td>
<td>41</td> <td class="span2">41</td>
</tr> </tr>
<tr> <tr>
<td>Substitute teacher</td> <td>公告</td>
<td>37</td> <td class="span2">37</td>
</tr> </tr>
<tr> <tr>
<td>Lecturer</td> <td>公告</td>
<td>41</td> <td class="span2">41</td>
</tr> </tr>
<tr> <tr>
<td>Part-time teacher</td> <td>公告</td>
<td>20</td> <td class="span2">20</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -336,72 +71,17 @@
</div> </div>
</div> </div>
<div class="item element"> <div class="item element">
<h3><i class="icons-"></i><a href="">Site info</a></h3> <h3><i class="icons-member"></i><a href=""><%= t(:member) %></a></h3>
<div class="detail w-b h-a">
<p class="totle"><span>Quantity</span>9,517</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td>2,304</td>
</tr>
<tr>
<td>Master</td>
<td>783</td>
</tr>
<tr>
<td>Doctor</td>
<td>45</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href="">Connection</a></h3>
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"><span>Quantity</span>9,517</p> <p class="totle"><span><%= t(:all_member) %></span>2,217</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:role) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll"> <div class="detal-list my_scroll">
<div class="scrollbar"> <div class="scrollbar">
<div class="track"> <div class="track">
@ -461,4 +141,450 @@
</div> </div>
</div> </div>
</div> </div>
<div class="item element">
<h3><i class="icons-asset"></i><a href=""><%= t(:file) %></a></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_file) %></span>3,422</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:file_type) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Word</td>
<td>304</td>
</tr>
<tr>
<td>PDF</td>
<td>783</td>
</tr>
<tr>
<td>PowerPoint</td>
<td>45</td>
</tr>
<tr>
<td>Excel</td>
<td>62</td>
</tr>
<tr>
<td>Jpeg</td>
<td>52</td>
</tr>
<tr>
<td>Gif</td>
<td>20</td>
</tr>
<tr>
<td>Png</td>
<td>41</td>
</tr>
<tr>
<td>Avi</td>
<td>37</td>
</tr>
<tr>
<td>Txt</td>
<td>41</td>
</tr>
<tr>
<td>Zip</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:referral_in_links) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:statistics) %></span>517</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:site_name) %></th>
<th class="span2"><%= t(:statistics) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Ruling</td>
<td class="span2">36</td>
</tr>
<tr>
<td>Yahoo</td>
<td class="span2">31</td>
</tr>
<tr>
<td>Google</td>
<td class="span2">3,187</td>
</tr>
<tr>
<td>facebook</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:most_visited_page) %></a></h3>
<div class="detail noStatistics w-b h-a">
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:title) %></th>
<th class="span2"><%= t(:module) %></th>
<th class="span2"><%= t(:hits) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Title1</td>
<td class="span2">公告</td>
<td class="span2">2,549</td>
</tr>
<tr>
<td>Title2</td>
<td class="span2">頁面</td>
<td class="span2">1,022</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
<td class="span2">928</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
<td class="span2">904</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
<td class="span2">867</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
<td class="span2">830</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
<td class="span2">749</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
<td class="span2">702</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
<td class="span2">639</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
<td class="span2">549</td>
</tr>
<tr>
<td>Title1</td>
<td class="span2">公告</td>
<td class="span2">2,549</td>
</tr>
<tr>
<td>Title2</td>
<td class="span2">頁面</td>
<td class="span2">1,022</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
<td class="span2">928</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
<td class="span2">904</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
<td class="span2">867</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
<td class="span2">830</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
<td class="span2">749</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
<td class="span2">702</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
<td class="span2">639</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
<td class="span2">549</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:traffic) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:total_visitors) %></span>438,913</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:item) %></th>
<th class="span2"><%= t(:data) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Visitors Today</td>
<td>2,304</td>
</tr>
<tr>
<td>Visitors This Month</td>
<td>783</td>
</tr>
<tr>
<td>Visitor This Tear</td>
<td>45</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:site_info) %></a></h3>
<div class="detail noStatistics w-b h-a">
<!--<p class="totle"><span><%= t(:statistics) %></span>9,517</p>-->
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:item) %></th>
<th class="span6"><%= t(:content) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Title:</td>
<td class="span6">National Chengchi University</td>
</tr>
<tr>
<td>Description:</td>
<td class="span6">......</td>
</tr>
<tr>
<td>Keywords</td>
<td class="span6">.....</td>
</tr>
<tr>
<td>Online Date:</td>
<td class="span6">2012/04/30</td>
</tr>
<tr>
<td>WedID:</td>
<td class="span6">nccu</td>
</tr>
<tr>
<td>Softwave Version:</td>
<td class="span6">R4 beta</td>
</tr>
<tr>
<td>Warranty:</td>
<td class="span6">Valid</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:recent_update) %></a></h3>
<div class="detail noStatistics w-a h-a">
<!--<p class="totle"><span><%= t(:statistics) %></span>9,517</p>-->
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:title) %></th>
<th class="span2"><%= t(:module) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Title1</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title2</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div> </div>

View File

@ -1,24 +1,41 @@
<%= flash_messages %> <%= 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="span1 strong">
<input type="checkbox">
<a href class="list-remove"><i class="icon-trash"></i></a>
</th>
<th class="span7"><%= t('admin.title') %></th>
<th class="span2"><%= t('admin.author') %></th>
<th class="span2"><%= t('admin.intro') %></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1 strong"> <th class="span1 strong"></th>
<input type="checkbox"> <th class="span7"></th>
<a href class="list-remove"><i class="icon-trash"></i></a> <th class="span2"></th>
</th> <th class="span2"></th>
<th class="span7 select"><%= t('admin.title') %></th>
<th class="span1-2"><%= t('admin.author') %></th>
<th class="span1-2"><%= t('admin.intro') %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @designs.each do |design| %> <% @designs.each do |design| %>
<tr> <tr class="with_action">
<td><input type="checkbox"></td> <td><input type="checkbox"></td>
<td> <td>
<%= design.title %> <%= design.title %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills hide">
<li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li> <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> <li class="dropdown"><%= link_to t(:delete), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li>
</ul> </ul>
@ -30,6 +47,6 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<div class="form-actions"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
</div> </div>

View File

@ -1,37 +1,30 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<% end %> <% end %>
<!-- Remove if CSS done--> <h3><%= @module_app.title%></h3>
<br />
<br />
<br />
<!-- Remove if CSS done-->
<h3><%= @module_app.title %></h3>
<div id="manager_management"> <div id="manager_management">
<h1>Manager</h1>
<dl id="manager"> <dl id="manager">
<dt>Manager</ht> <dt><%= t("admin.user_role.auth.manager") %></ht>
<% @module_app.managers.each do |manager| %> <% @module_app.managers.each do |manager| %>
<dd><%= manager.user.name %> <%= get_auth_by(manager) %> <%= link_to '[X]',remove_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:manager) && manager.user != current_user %> </dd> <dd><%= manager.user.name %> <%= get_auth_by(manager) %> <%= link_to '[X]',remove_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:manager) && manager.user != current_user %> </dd>
<% end %> <% end %>
<dd>Add: <dd>
<%= form_tag(assign_manager_admin_module_app_path) do %> <%= form_tag(assign_manager_admin_module_app_path) do %>
<%= collection_select(:manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:manager))%> <%= collection_select(:manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:manager))%>
<%= submit_tag 'Add Manager' %> <%= submit_tag t("admin.user_role.auth.add_manager") %>
<% end %> <% end %>
</dd> </dd>
</dl> </dl>
<dl id="sub_manager"> <dl id="sub_manager">
<dt>Sub Manager</ht> <dt><%= t("admin.user_role.auth.sub_manager") %></ht>
<% @module_app.sub_managers.each do |manager| %> <% @module_app.sub_managers.each do |manager| %>
<dd><%= manager.user.name %> -AuthBy:<%= manager.rule_creator.name %> <%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd> <dd><%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
<% end %> <% end %>
<dd>Add: <dd>
<%= form_tag(assign_sub_manager_admin_module_app_path) do %> <%= form_tag(assign_sub_manager_admin_module_app_path) do %>
<%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%> <%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%>
<%= submit_tag 'Add Sub Manager' %> <%= submit_tag t("admin.user_role.auth.add_sub_manager") %>
<% end %> <% end %>
</dd> </dd>
</dl> </dl>

View File

@ -1,11 +1,6 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<% end %> <% end %>
<!-- Remove if CSS done-->
<br />
<br />
<br />
<!-- Remove if CSS done-->
<h3><%= @object_auth.title %></h3> <h3><%= @object_auth.title %></h3>
<%= render :partial => "admin/components/user_role_management", :locals => { <%= render :partial => "admin/components/user_role_management", :locals => {

View File

@ -1 +1 @@
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil) if @categories && @categories.size > 0 %> <%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %>

View File

@ -27,7 +27,7 @@
<%= t('admin.module_app') %> <%= t('admin.module_app') %>
<%= render :partial => "app_selector", :locals => { :f => f } %> <%= render :partial => "app_selector", :locals => { :f => f } %>
<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span> <span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span>
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> </span> <span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span>
</p> </p>
<p> <p>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= f.label :is_published, "#{t('admin.is_published')} ?" %>

View File

@ -1,4 +1,4 @@
<div class="subnav"> <!--<div class="subnav">
<ul class="nav nav-pills filter"> <ul class="nav nav-pills filter">
<li class="accordion-group"> <li class="accordion-group">
<form class="form-search"> <form class="form-search">
@ -8,9 +8,10 @@
</li> </li>
</ul> </ul>
</div> </div>
-->
<div id='tags' class="clear"> <div id='tags' class="clear">
<%= render :partial => 'tag', :collection => @tags %> <%= render :partial => 'tag', :collection => @tags %>
</div> </div>
<div class="form-actions"> <div class="form-actions form-fixed pagination-right">
<%= render 'add' %> <%= render 'add' %>
</div> </div>

View File

@ -5,11 +5,11 @@
<%= flash_messages %> <%= flash_messages %>
<div id="container" class="sign-in"> <div id="container" class="sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
<% end%>
<%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %> <%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %>
<div class="content"> <div class="content">
<% flash.each do |key, msg| %>
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
<% end%>
<p class="alert hide">You need to sign in or sign up before continuing.</p> <p class="alert hide">You need to sign in or sign up before continuing.</p>
<div class="main"> <div class="main">
<div class="control-group clear"> <div class="control-group clear">

View File

@ -2,7 +2,7 @@
<%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
<%# end -%> <%# end -%>
<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') do -%> <%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys','module_apps', 'approvals') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
@ -10,6 +10,20 @@
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_action('module_apps', 'edit') if (is_admin? rescue nil) %>
<% end -%>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
<%= content_tag :li, link_to(t('news.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
<%= content_tag :li, link_to(t('news.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
<%= content_tag :li, link_to(t('news.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('news.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('news.news_bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<% end -%> <% end -%>
<% end -%> <% end -%>
@ -20,9 +34,9 @@
<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> <%= content_tag :li, :class => active_for_controllers('page_contexts') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%> <%#= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %> <%#= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %>
<% end -%> <%# end -%>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('designs') do -%> <%= content_tag :li, :class => active_for_controllers('designs') do -%>
@ -31,11 +45,11 @@
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%> <%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%> <%#= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%>
<%= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<% end %> <%# end %>
<% end %> <% end %>
<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%> <%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%>

View File

@ -44,6 +44,29 @@ en:
view: View view: View
yes_: "Yes" yes_: "Yes"
all_content: All Content
all_file: All File
all_member: All Member
content: Content
data: Data
file: File
file_type: File Type
hits: Hits
item: Item
member: Member
module: Module
most_visited_page: Most Visited Page
quantity: Quantity
recent_update: Recent Update
referral_in_links: Referral in Links
role: Role
site_info: Site Info
site_name: Site Name
statistics: Statistics
title: Title
total_visitors: Total Visitors
traffic: Traffic
admin: admin:
action: Action action: Action
ad_banner: AD Banner ad_banner: AD Banner
@ -129,6 +152,8 @@ en:
list_infos: User information list list_infos: User information list
list_roles: User roles list list_roles: User roles list
member: Member member: Member
module:
authorization: Module Authorization
move_down: Move down move_down: Move down
move_up: Move up move_up: Move up
multilingual: Multilingual multilingual: Multilingual
@ -183,6 +208,20 @@ en:
upload_design: Upload design upload_design: Upload design
url: URL url: URL
user: User user: User
user_role:
auth:
all_member: All Member
manager: Manager
sub_mamanger: SubManager
by_role: By Role
by_sub_role: By SubRole
block_list: Block List
privilege_list: Privilege List
add_manager: Add Manager
add_sub_manager: Add SubManager
add_to_block_list: Add to block List
add_to_privilege_list: Add to privilege List
auth_by: -AuthBy %{user_display_name}
info: User information info: User information
panel: User panel panel: User panel
role: User role role: User role

View File

@ -41,6 +41,29 @@ zh_tw:
view: 檢視 view: 檢視
yes_: "Yes" yes_: "Yes"
all_content: 全部內容有:
all_file: 全部檔案有:
all_member: 成員總數:
content: 內容
data: 數據
file: 檔案
file_type: 檔案類型
hits: 點擊率
item: 項目
member: 成員
module: 模組
most_visited_page: 熱門頁面
quantity: 數量
recent_update: 近期更新
referral_in_links: 外部推薦連結
role: 角色
site_info: 網站資訊
site_name: 網站名稱
statistics: 統計
title: 標題
total_visitors: 造訪次數:
traffic: 流量
admin: admin:
action: 操作 action: 操作
ad_banner: 廣告輪播 ad_banner: 廣告輪播
@ -103,7 +126,7 @@ zh_tw:
editing_page: 編輯頁面 editing_page: 編輯頁面
editing_snippet: 編輯片段 editing_snippet: 編輯片段
editing_info: 編輯用戶資料 editing_info: 編輯用戶資料
editing_role: 編輯用戶角色 editing_role: 編輯用戶身份
email: Email email: Email
enable_language: 啟用語言 enable_language: 啟用語言
file_name: 檔名 file_name: 檔名
@ -128,8 +151,10 @@ zh_tw:
list_snippets: 斷片列表 list_snippets: 斷片列表
list_users: 使用列表 list_users: 使用列表
list_infos: 用戶資料列表 list_infos: 用戶資料列表
list_roles: 用戶角色列表 list_roles: 用戶身份列表
member: 會員 member: 會員
module:
authorization: 模組授權
move_down: 往下移 move_down: 往下移
move_up: 往上移 move_up: 往上移
multilingual: 多種語言 multilingual: 多種語言
@ -150,7 +175,7 @@ zh_tw:
new_snippet: 新增片段 new_snippet: 新增片段
new_user: 新增使用 new_user: 新增使用
new_info: 新增用戶資料 new_info: 新增用戶資料
new_role: 新增用戶角色 new_role: 新增用戶身份
non_multilingual: 非多種語言 non_multilingual: 非多種語言
options: 選項 options: 選項
orig_upload_file: 原上傳檔名 orig_upload_file: 原上傳檔名
@ -158,8 +183,8 @@ zh_tw:
position: 位置 position: 位置
published?: 發布? published?: 發布?
purchase: 購買 purchase: 購買
role: 角色 role: 身份
roles: 角色 roles: 身份
site_settings: 基本設定 site_settings: 基本設定
setup_member: 成員設置 setup_member: 成員設置
setup_translations: 語系設定 setup_translations: 語系設定
@ -184,9 +209,23 @@ zh_tw:
upload_design: 上傳設計 upload_design: 上傳設計
url: URL url: URL
user: 用戶 user: 用戶
user_role:
auth:
all_member: 所有會員
manager: 管理員
sub_manager: 次管理員
by_role: 根據身份
by_sub_role: 根據次身份
block_list: 封鎖名單
add_manager: 增加到管理員
add_sub_manager: 增加到次管理員
add_to_block_list: 封鎖名單
add_to_privilege_list: 特許名單
auth_by: -由%{user_display_name}授權
user: 使用會員
info: 用戶資料 info: 用戶資料
panel: 用戶面板 panel: 用戶面板
role: 用戶角色 role: 用戶身份
panel: panel:

View File

@ -19,6 +19,10 @@ module OrbitCoreLib
end end
def get_object_auth_by_title(title)
self.object_auths.where({title: title }).first
end
def authed_users(title=nil) def authed_users(title=nil)
users = [] users = []
users = case title users = case title
@ -33,7 +37,7 @@ module OrbitCoreLib
[] []
end end
else else
self.object_auths.where(title: title).first.auth_users rescue [] get_object_auth_by_title(title).auth_users rescue []
end end
users users
end end

View File

@ -43,7 +43,9 @@ module ParserFrontEnd
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}" ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
ret << "/#{id}" if id ret << "/#{id}" if id
ret << "?inner=true&page_id=#{page.id}" ret << "?inner=true&page_id=#{page.id}"
ret << "&category_id=#{page.category}" if page[:category] # ret << "&category_id=#{page.category}" if page[:category]
ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank?
ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank?
ret << "'></div>" ret << "'></div>"
else else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
@ -51,8 +53,15 @@ module ParserFrontEnd
when 'text' when 'text'
ret << part.i18n_variable[I18n.locale] rescue '' ret << part.i18n_variable[I18n.locale] rescue ''
when 'module_widget' when 'module_widget'
if part[:category] # if part[:category]
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>" # ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
# else
# ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
# end
if !params[:category_id].blank?
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{params[:category_id]}'></div>"
elsif !params[:tag_id].blank?
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{params[:tag_id]}'></div>"
else else
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>" ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
end end

View File

@ -5,19 +5,13 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def setting def setting
@bulletin_categorys = BulletinCategory.all @bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id) @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
first_category = BulletinCategory.find params[:category_id] if params.has_key? :category
if params[:commit] == 'Update' @bulletin_category = BulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
preload_object_auth = preload_object_auth_ary.first
preload_object_auth.privilege_users = privilege_users
preload_object_auth.save!
end
else else
first_category = @bulletin_categorys.first @bulletin_category = @bulletin_categorys.first
end end
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check') preload_object_auth = @bulletin_category.object_auths.where(title: 'fact_check').empty?? (@bulletin_category.object_auths.create! :title=> 'fact_check') : @bulletin_category.object_auths.where(title: 'fact_check')
@users_array = preload_object_auth.first.privilege_users rescue [] @users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format| respond_to do |format|
format.html format.html
@ -26,7 +20,16 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
end end
def update_setting def update_setting
object_auth = update_setting_by_params
if object_auth.save!
flash[:notice] = "Update Done"
else
flash[:notice] = "Update Failed"
end
end
def user_list
@bulletin_category = BulletinCategory.find params[:category][:id]
end end
# def index # def index
# get_categorys(params[:bulletin_category_id]) # get_categorys(params[:bulletin_category_id])
@ -64,6 +67,15 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
# #
# end # end
protected protected
def update_setting_by_params
category = BulletinCategory.find params[:category][:id]
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
object_auth_ary = category.object_auths.where(title: 'fact_check') || (category.object_auths.create :title=> 'fact_check')
object_auth = object_auth_ary.first
object_auth.privilege_users = privilege_users
object_auth
end
def get_categorys(id = nil) def get_categorys(id = nil)
@bulletin_categorys = [] @bulletin_categorys = []
if(is_manager? || is_admin?) if(is_manager? || is_admin?)

View File

@ -32,7 +32,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletins = Bulletin.search(params[:search], params[:category_id]) # @bulletins = Bulletin.search(params[:search], params[:category_id])
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
# @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin") : Bulletin.all.page(params[:page]).per(10)
@bulletin_categories = BulletinCategory.all @bulletin_categories = BulletinCategory.all
@bulletin_link = BulletinLink.new @bulletin_link = BulletinLink.new
@ -301,7 +304,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
if params[:to_delete] if params[:to_delete]
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
end end
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort]) redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end end

View File

@ -11,8 +11,10 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def index def index
date_now = Time.now date_now = Time.now
if params[:category_id] if !params[:category_id].blank?
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
elsif !params[:tag_id].blank?
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else else
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end end

View File

@ -13,8 +13,10 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
# deadline # deadline
# @bulletin_categorys = BulletinCategory.first; # @bulletin_categorys = BulletinCategory.first;
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9) # @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
if params[:category_id] if !params[:category_id].blank?
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9) @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
elsif !params[:tag_id].blank?
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.widget_datas.limit(9) rescue nil
else else
@bulletins = Bulletin.can_display.widget_datas.limit(9) @bulletins = Bulletin.can_display.widget_datas.limit(9)
end end
@ -41,6 +43,11 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
end end
def bulletins_side_bar
@tags = AnnouncementTag.all
get_categorys
end
protected protected

View File

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

View File

@ -0,0 +1,9 @@
module Panel::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_bulletin and by_user
end
end

View File

@ -14,7 +14,7 @@ class Bulletin
field :deadline , :type => Date field :deadline , :type => Date
# field :url # field :url
field :create_user_id field :create_user_id
field :update_user_id field :update_user_id, :class_name => "User"
field :is_top, :type => Boolean, :default => false field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false field :is_hot, :type => Boolean, :default => false

View File

@ -0,0 +1,11 @@
class AnnouncementTag < Tag
has_and_belongs_to_many :bulletins
def get_visible_bulletins(sort = :name)
date_now = Time.now
self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
end
end

View File

@ -1,15 +0,0 @@
<h1><%= bulletin_category.key %></h1>
<table>
<tr>
<th><%= t('bulletin.status') %></th>
<th><%= t('bulletin.category') %></th>
<th><%= t('bulletin.title') %></th>
<th><%= t('bulletin.postdate') %></th>
<th><%= t('bulletin.deadline') %></th>
<th><%= t('bulletin.action') %></th>
</tr>
<% bulletin_category.bulletins.each do |post| %>
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:approval_allow=>true} %>
<% end %>
</table>

View File

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

View File

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

View File

@ -1,50 +0,0 @@
<%= render 'panel/announcement/back_end/bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/announcement/back_end/bulletins/bulletins' %>
</table>
<div class="form-actions">
<%= 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 :secondary do %>
<%#= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<fieldset><legend><%= t('bulletin.search') %></legend>
<%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
<%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
Category <%#= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</fieldset>
<br />
<br />
<h1><%= t('bulletin.list_announcement') %></h1>
<div id="check_block">
<h1>Check Please</h1>
<%#= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
-->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
<%# <br />顯示方式是設定在前台頁面時,資訊所呈現的樣式 %> <%# <br />顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
</div> </div>
<div class="form-actions"> <div class="form-actions pagination-right">
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <%= f.submit t('submit'), :class=>'btn btn-primary' %>
</div> </div>

View File

@ -1,12 +1,30 @@
<%= flash_messages %> <%= 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="span2"><%= t('bulletin_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th class="span2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table id="bulletin_categorys" class="table main-list"> <table id="bulletin_categorys" class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1-2"><%= t('bulletin_category.key') %></th> <th class="span2"></th>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th> <th class="span2"></th>
<% end %> <% end %>
</tr> </tr>
</thead> </thead>

View File

@ -43,7 +43,7 @@
</li> </li>
<%#= debugger %> <%#= debugger %>
<%#= a=1 %> <%#= a=1 %>
<% if (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !bulletin.is_expired? %> <% 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 %> <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 %>
<% end %> <% end %>

View File

@ -31,3 +31,7 @@
</div> </div>
</div> </div>
</div> </div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

@ -1,6 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox"> <div class="accordion-inner" data-toggle="buttons-checkbox">
<% @bulletin_categories.each do |category| -%> <% @bulletin_categories.each do |category| -%>
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> <%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
<% end -%> <% end -%>
</div> </div>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %> <%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>

View File

@ -1,9 +1,9 @@
<div class="accordion-inner" data-toggle="buttons-checkbox"> <div class="accordion-inner" data-toggle="buttons-checkbox">
<%= link_to t(:top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %> <%= link_to t(:top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %> <%= link_to t(:hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %> <%= link_to t(:hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %>
<%= link_to t(:pending), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_pending'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_pending')}" %> <%= link_to t(:pending), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_pending'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_pending')}" %>
<%= link_to t(:passed), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %> <%= link_to t(:passed), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %>
<%= link_to t(:rejected), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_rejected'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_rejected')}" %> <%= link_to t(:rejected), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_rejected'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_rejected')}" %>
</div> </div>
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %> <%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>

View File

@ -1,6 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox"> <div class="accordion-inner" data-toggle="buttons-checkbox">
<% @tags.each do |tag| -%> <% @tags.each do |tag| -%>
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %> <%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%> <% end -%>
</div> </div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %> <%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>

View File

@ -292,7 +292,6 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %> <%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
<script> <script>
$('#add_bulletin_link a.add').live('click', function(){ $('#add_bulletin_link a.add').live('click', function(){

View File

@ -1,31 +1,7 @@
<table class="table main-list"> <%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
<thead> ['category', 'bulletin_category', 'span1-2', 'bulletin.category'],
<tr class="sort-header"> ['title', 'title','span7', 'bulletin.title'],
<th class="span1 strong"> ['start_date', 'postdate', 'span1-2', 'bulletin.start_date'],
<input id="check_all_bulletins" type="checkbox"> ['end_date', 'deadline', 'span1-2', 'bulletin.end_date'],
<a href='#' class="list-remove"><i class="icon-trash"></i></a> ['tags', 'tags', 'span1-2', 'bulletin.tags'],
</th> ['last_modified', 'update_user_id','span1-3', 'bulletin.last_modified']).html_safe %>
<th class="sort span1-2 <%= is_sort_active?('status') %>">
<%= link_to (t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('category') %>">
<%= link_to (t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %>
</th>
<th class="sort span7 <%= is_sort_active?('title') %>">
<%= link_to (t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
<%= link_to (t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
<%= link_to (t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
<%= link_to (t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %>
</th>
<th class="sort span1-3 <%= is_sort_active?('update_user_id') %>">
<%= link_to (t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %>
</th>
</tr>
</thead>
</table>

View File

@ -1,12 +1,12 @@
<%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil), :html => {:id => 'delete_bulletins'}, :remote => true do %> <%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
<%= render 'filter' %> <%= render 'filter' %>
<table id="bulettin_sort_list" class="table main-list"> <table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %> <%= render 'bulletins' %>
</table> </table>
<% end %> <% end %>
<div id="bulletin_pagination"> <div id="bulletin_pagination" class="paginationFixed">
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= 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"> <div id="bulletin_link_qe">
@ -15,13 +15,7 @@
</div> </div>
</div> </div>
<div id="bulletin_file_qe"> <div class="form-actions form-fixed pagination-right">
<div id="modal-file" class="modal fade">
<%= render :partial => "bulletin_file_qe" %>
</div>
</div>
<div class="form-actions">
<%= 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' %> <%= 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> </div>

View File

@ -1,7 +1,7 @@
$("#collapse-status").html("<%= j render 'filter_status' %>"); $("#collapse-status").html("<%= j render 'filter_status' %>");
$("#collapse-category").html("<%= j render 'filter_categories' %>"); $("#collapse-category").html("<%= j render 'filter_categories' %>");
$("#collapse-tags").html("<%= j render 'filter_tags' %>"); $("#collapse-tags").html("<%= j render 'filter_tags' %>");
$("#delete_bulletins").attr("action", "<%= delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter) %>"); $("#delete_all").attr("action", "<%= delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
$("#sort_headers").html("<%= j render 'sort_headers' %>"); $("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_bulletins").html("<%= j render :partial => 'bulletin', :collection => @bulletins %>"); $("#tbody_bulletins").html("<%= j render :partial => 'bulletin', :collection => @bulletins %>");
$("#bulletin_pagination").html("<%= j paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); $("#bulletin_pagination").html("<%= j paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -0,0 +1,25 @@
<!-- <div class="search"> <input type="text" onfocus="this.value='';this.searchClickFlag=true;" onblur="if(this.value==''){this.value='公告搜尋';this.searchClickFlag=false;}" value="公告搜尋" id="q" class="search_key" name="q"/> <input type="submit" name="sa" id="sa" class="sa" value="." /> </div> -->
<div class="category_list">
<h3 class="h3"><%= t('announcement.categories') %></h3>
<ul class="list">
<% @bulletin_categorys.each do |category| %>
<li>
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
</li>
<% end %>
</ul>
</div>
<div class="tag_cloud">
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
<ul class="cloud">
<% @tags.each do |tag| %>
<li class="hot<%#=rand(4) + 1%>">
<%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id) %>
</li>
<% end %>
</ul>
</div>
<!-- <div class="clear"></div> -->
<!-- <div class="rss_feed">
<a href="" class="rssimg"> Rss feed </a>
</div> -->

View File

@ -58,6 +58,7 @@ en:
announcement: announcement:
all_articles: List all_articles: List
add_new: Add add_new: Add
categories: Categories
sure?: Sure? sure?: Sure?
campus_news: Campus News campus_news: Campus News
more: more+ more: more+
@ -77,6 +78,9 @@ en:
approval_pending: 'Pending' approval_pending: 'Pending'
approval_pass: 'Pass' approval_pass: 'Pass'
approval_setting_window_title: 'Unit' approval_setting_window_title: 'Unit'
approval_user_list: 'Approval Users'
cate_auth: Category Authorization
tag_cloud: Tag cloud
# admin: # admin:
# action: Action # action: Action

View File

@ -59,6 +59,9 @@ zh_tw:
approval_pass: '通過' approval_pass: '通過'
approval_not_pass_reason: '不通過原因' approval_not_pass_reason: '不通過原因'
approval_setting_window_title: '單位' approval_setting_window_title: '單位'
approval_user_list: '審核者'
cate_auth: '分類授權'
tag_cloud: 標籤雲
bulletin: bulletin:
last_modified: 最後修改於 last_modified: 最後修改於

View File

@ -3,9 +3,9 @@ Rails.application.routes.draw do
namespace :announcement do namespace :announcement do
namespace :back_end do namespace :back_end do
match 'public' => "announcements#public",:as => :public match 'public' => "announcements#public",:as => :public
match 'approval_setting' => "approvals#setting" ,:as => :approval_setting match 'approval_setting' => "approvals#setting" ,:as => :approval_setting,:via => :get
match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting 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 resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
@ -39,6 +39,7 @@ Rails.application.routes.draw do
match "bulletins_and_web_links" => "bulletins#bulletins_and_web_links" match "bulletins_and_web_links" => "bulletins#bulletins_and_web_links"
match "reload_bulletins" => "bulletins#reload_bulletins" match "reload_bulletins" => "bulletins#reload_bulletins"
match "reload_web_links" => "bulletins#reload_web_links" match "reload_web_links" => "bulletins#reload_web_links"
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
end end
end end
end end

View File

@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/

17
vendor/built_in_modules/news/Gemfile vendored Normal file
View File

@ -0,0 +1,17 @@
source "http://rubygems.org"
# Declare your gem's dependencies in news.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

View File

@ -0,0 +1,20 @@
Copyright 2011 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,3 @@
= News
This project rocks and uses MIT-LICENSE.

39
vendor/built_in_modules/news/Rakefile vendored Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'News'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task :default => :test

View File

@ -0,0 +1,9 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require news_link

View File

@ -0,0 +1,45 @@
$(document).ready(function(){
var topic1="0px";
var topic2="-948px";
var topic3="-1896px";
var topic_page=1;
$(".topic_prev").addClass("topic_prev_first");
$(document).on("click", ".topic_prev", function() {
if (topic_page !=1){
topic_page-=1;
}else{
}
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
$(".topic_prev").removeClass("topic_prev_first");
$(".topic_next").removeClass("topic_next_last");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_prev").removeClass("topic_next_last");
}
});
$(document).on("click", ".topic_next", function() {
if (topic_page >=1 && topic_page <=2){
topic_page+=1;
}else{
}
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
$(".topic_prev").removeClass("topic_prev_first");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_next").addClass("topic_next_last");
}
});
});

View File

View File

@ -0,0 +1,23 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
# Set I18n.locale
def set_locale
# update session if passed
session[:locale] = params[:locale] if params[:locale]
# set locale based on session or default
begin
# check if locale is valid for non site pages
if !VALID_LOCALES.include?(session[:locale])
I18n.locale = I18n.default_locale
else
I18n.locale = session[:locale]
end
rescue
I18n.locale = I18n.default_locale
end
end
end

View File

@ -0,0 +1,41 @@
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
def setting
@news_bulletin_categorys = NewsBulletinCategory.all
if params.has_key?(:category_id)
first_category = NewsBulletinCategory.find params[:category_id]
if params[:commit] == 'Update'
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
preload_object_auth = preload_object_auth_ary.first
preload_object_auth.privilege_users = privilege_users
preload_object_auth.save!
end
else
first_category = @news_bulletin_categorys.first
end
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
end
protected
def get_categorys(id = nil)
@news_bulletin_categorys = []
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')
end
end
end

View File

@ -0,0 +1,118 @@
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
def index
@news_bulletin_categorys = NewsBulletinCategory.all
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
@url = panel_news_back_end_news_bulletin_categorys_path
respond_to do |format|
format.html # index.html.erb
# format.xml { render :xml => @news_bulletins }
format.js
end
end
# GET /news_bulletins/1
# GET /news_bulletins/1.xml
def show
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
# format.xml { render :xml => @news_bulletin_category }
format.js
end
end
# GET /news_bulletins/new
# GET /news_bulletins/new.xml
def new
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
respond_to do |format|
format.html # new.html.erb
# format.xml { render :xml => @news_bulletin_category }
format.js
end
end
def quick_edit
# debugger
@news_bulletin_category = NewsBulletinCategory.find(params[:news_bulletin_category_id])
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
respond_to do |format|
format.js
end
end
# GET /news_bulletins/1/edit
def edit
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
@i18n_variable = @news_bulletin_category.i18n_variable
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
respond_to do |format|
format.html
format.js
end
end
# POST /news_bulletins
# POST /news_bulletins.xml
def create
@news_bulletin_category = NewsBulletinCategory.new(params[:news_bulletin_category])
respond_to do |format|
if @news_bulletin_category.save
# format.html { redirect_to @news_bulletin_category, notice: 'Entry was successfully created.' }
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news.create_news_bulletin_category_success')) }
# format.xml { render :xml => @news_bulletin_category, :status => :created, :location => @news_bulletin_category }
format.js
else
format.html { render :action => "new" }
# format.xml { render :xml => @news_bulletin_category.errors, :status => :unprocessable_entity }
format.js { render action: "new" }
end
end
end
# PUT /news_bulletins/1
# PUT /news_bulletins/1.xml
def update
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
respond_to do |format|
if @news_bulletin_category.update_attributes(params[:news_bulletin_category])
# format.html { redirect_to(panel_news_back_end_news_bulletin_category_url(@news_bulletin_category), :notice => t('news_bulletin_category.update_news_bulletin_category_success')) }
# format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news_bulletin_category.update_news_bulletin_category_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
# format.xml { render :xml => @news_bulletin_category.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /news_bulletins/1
# DELETE /news_bulletins/1.xml
def destroy
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
@news_bulletin_category.destroy
respond_to do |format|
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url) }
# format.xml { head :ok }
format.js
end
end
end

View File

@ -0,0 +1,48 @@
class Panel::News::BackEnd::NewsBulletinFilesController < ApplicationController
layout 'new_admin'
def index
@news_bulletin_files = NewsBulletinFile.all
respond_to do |format|
format.html # index.html.erb
# format.xml { render :xml => @news_bulletins }
format.js
end
end
# POST /news_bulletins
# POST /news_bulletins.xml
def create
@news_bulletin_file = NewsBulletinFile.new(params[:news_bulletin_file])
respond_to do |format|
if @news_bulletin_file.save
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
# PUT /news_bulletins/1
# PUT /news_bulletins/1.xml
def update
@news_bulletin_file = NewsBulletinFile.find(params[:id])
respond_to do |format|
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
end

View File

@ -0,0 +1,49 @@
class Panel::News::BackEnd::NewsBulletinLinksController < ApplicationController
layout 'new_admin'
def index
@news_bulletin_links = NewsBulletinLink.all
respond_to do |format|
format.html # index.html.erb
# format.xml { render :xml => @news_bulletins }
format.js
end
end
# POST /news_bulletins
# POST /news_bulletins.xml
def create
@news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link])
# @news_bulletin_link.news_bulletin_id = params[:news_bulletin_link][:news_bulletin_id]
respond_to do |format|
if @news_bulletin_link.save
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
# PUT /news_bulletins/1
# PUT /news_bulletins/1.xml
def update
@news_bulletin_link = NewsBulletinLink.find(params[:id])
respond_to do |format|
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
end

View File

@ -0,0 +1,408 @@
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
before_filter :authenticate_user!
before_filter :is_admin?
def index
# @news_bulletins = NewsBulletin.all
# @news_bulletins = NewsBulletin.desc("postdate desc")
get_categorys(params[:news_bulletin_category_id])
get_tags
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
# @news_bulletins = NewsBulletin.where("news_bulletin_category_id" => params[:news_bulletin_category_id]).desc("postdate") if params[:news_bulletin_category_id]
# @news_bulletins = NewsBulletin.search(params[:search], params[:category_id])
# @news_bulletins = NewsBulletin.all.order_by([params[:sort], params[:direction]])
# @news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_news_bulletins : NewsBulletin.all.page(params[:page]).per(10)
@news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("news_bulletin") : NewsBulletin.all.page(params[:page]).per(10)
@news_bulletin_categories = NewsBulletinCategory.all
@news_bulletin_link = NewsBulletinLink.new
@link_url = panel_news_back_end_news_bulletins_path
@news_bulletin_file = NewsBulletinFile.new
@file_url = panel_news_back_end_news_bulletins_path
respond_to do |format|
format.html # index.html.erb
format.js { }
format.xml { render :xml => @news_bulletins }
end
end
# GET /news_bulletins/1
# GET /news_bulletins/1.xml
def show
@news_bulletin = NewsBulletin.find(params[:id])
get_tags
# get_categorys
# @news_bulletin_categorys = NewsBulletinCategory.where("_id" => params[:id])
# if params[:id]
# @news_bulletins = NewsBulletin.where("news_bulletin_category_id" => params[:id])
# else
# @news_bulletins = NewsBulletin.desc("postdate desc")
# end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @news_bulletin }
end
end
# GET /news_bulletins/new
# GET /news_bulletins/new.xml
def new
@news_bulletin = NewsBulletin.new
@link_url = panel_news_back_end_news_bulletins_path
# @news_bulletin.news_bulletin_files.build
# @news_bulletin.news_bulletin_files.new
get_categorys
get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @news_bulletin }
end
end
# GET /news_bulletins/1/edit
def edit
@news_bulletin = NewsBulletin.find(params[:id])
if !current_user.admin? && (@news_bulletin.is_rejected? || @news_bulletin.is_checked?)
redirect_to :action => :index
else
# @summary_variable = @news_bulletin.summary_variable
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin)
get_categorys
get_tags
end
end
# POST /news_bulletins
# POST /news_bulletins.xml
def create
if params[:news_bulletin_link]
@news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link])
respond_to do |format|
if @news_bulletin_link.save
format.js { render 'create_news_bulletin_link' }
end
end
elsif params[:news_bulletin_file]
@news_bulletin_file = NewsBulletinFile.new(params[:news_bulletin_file])
respond_to do |format|
if @news_bulletin_file.save
format.js { render 'create_news_bulletin_file' }
end
end
else
@news_bulletin = NewsBulletin.new(params[:news_bulletin])
@news_bulletin.create_user_id = current_user.id
@news_bulletin.update_user_id = current_user.id
respond_to do |format|
if @news_bulletin.save
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news.create_news_bulletin_success')) }
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.create_news_bulletin_success')) }
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
format.js
else
format.html { render :action => "new" }
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
end
end
end
end
def link_quick_add
# debugger
@news_bulletin_link = NewsBulletinLink.new
@link_url = panel_news_back_end_news_bulletins_path
@news_bulletin_link.news_bulletin_id = params[:news_bulletin_id]
respond_to do |format|
format.js
end
end
def link_quick_edit
# debugger
@news_bulletin_link = NewsBulletinLink.find(params[:news_bulletin_id])
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin_link)
# @news_bulletin = NewsBulletin.find(params[:news_bulletin_id])
# @link_url = panel_news_back_end_news_bulletin_path(@news_bulletin)
respond_to do |format|
format.js
end
end
def file_quick_add
# debugger
@news_bulletin_file = NewsBulletinFile.new
@file_url = panel_news_back_end_news_bulletins_path
@news_bulletin_file.news_bulletin_id = params[:news_bulletin_id]
respond_to do |format|
format.js
end
end
def file_quick_edit
# debugger
@news_bulletin_file = NewsBulletinFile.find(params[:news_bulletin_id])
@file_url = panel_news_back_end_news_bulletin_path(@news_bulletin_file)
respond_to do |format|
format.js
end
end
# PUT /news_bulletins/1
# PUT /news_bulletins/1.xml
def update
if params[:news_bulletin_link]
@news_bulletin_link = NewsBulletinLink.find(params[:id])
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin_link)
respond_to do |format|
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js { render 'update_news_bulletin_link' }
end
end
elsif params[:news_bulletin_file]
@news_bulletin_file = NewsBulletinFile.find(params[:id])
@file_url = panel_news_back_end_news_bulletin_path(@news_bulletin_file)
respond_to do |format|
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
format.js { render 'update_news_bulletin_file' }
end
end
else
@news_bulletin = NewsBulletin.find(params[:id])
@news_bulletin.update_user_id = current_user.id
# @news_bulletin.image.clear if params[:news_bulletin][:image_del] == '1'
# if params[:news_bulletin][:image_del] == '1'
# @news_bulletin.remove_image!
# @news_bulletin.image_del = nil
# params[:news_bulletin][:image_del] = nil
# end
respond_to do |format|
if @news_bulletin.update_attributes(params[:news_bulletin])
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.update_news_bulletin_success')) }
format.js { render 'toggle_enable' }
format.xml { head :ok }
else
get_tags
get_categorys
format.html { render :action => "edit" }
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
end
end
end
end
# DELETE /news_bulletins/1
# DELETE /news_bulletins/1.xml
def destroy
@news_bulletin = NewsBulletin.find(params[:id])
# @news_bulletin.news_bulletin_files.destroy
@news_bulletin.destroy
respond_to do |format|
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
# format.xml { head :ok }
format.js
end
end
# def top_edit
# NewsBulletin.where(id: params[:id]).update_all( is_top: true )
# respond_to do |format|
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
# format.xml { head :ok }
# end
# end
def load_quick_edit
@news_bulletin = NewsBulletin.find(params[:id])
@type = params[:type]
@news_bulletin_categories = NewsBulletinCategory.all
get_tags
end
def delete
if params[:to_delete]
news_bulletins = NewsBulletin.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to panel_news_back_end_news_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
def get_categorys(id = nil)
@news_bulletin_categorys = []
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')
end
end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'news'})
@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

View File

@ -0,0 +1,8 @@
class Panel::News::BackEnd::TagsController < Admin::TagsController
def initialize
super
@app_title = 'news'
end
end

View File

@ -0,0 +1,38 @@
class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
def initialize
super
@app_title = 'news'
end
# GET /news_bulletins
# GET /news_bulletins.xml
def index
date_now = Time.now
if !params[:category_id].blank?
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
elsif !params[:tag_id].blank?
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else
@news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end
get_categorys
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
end
def show
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
get_categorys
end
protected
def get_categorys
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
end
end

View File

@ -0,0 +1,58 @@
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
def initialize
super
@app_title = 'news'
end
# GET /news_bulletins
# GET /news_bulletins.xml
def index
# deadline
# @news_bulletin_categorys = NewsBulletinCategory.first;
# @news_bulletins = NewsBulletin.widget_datas(@news_bulletin_categorys.id).limit(9)
if !params[:category_id].blank?
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
elsif !params[:tag_id].blank?
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil
else
@news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
end
get_categorys
end
def news_bulletins_and_web_links
@tags = NewsTag.all
@selected_tag = NewsTag.find(params[:id]) rescue @tags[0]
@news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
render :layout => 'module_widget'
end
def reload_news_bulletins
@selected_tag = NewsTag.find(params[:tag_id])
@news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil
end
def reload_web_links
@selected_tag = NewsTag.find(params[:tag_id])
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
end
def news_bulletins_side_bar
@tags = NewsTag.all
get_categorys
end
protected
def get_categorys
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
end
end

View File

View File

View File

View File

@ -0,0 +1,182 @@
# encoding: utf-8
class NewsBulletin
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :tags, :class_name => "NewsTag"
field :postdate , :type => Date
field :deadline , :type => Date
# field :url
field :create_user_id
field :update_user_id, :class_name => "User"
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
field :is_hidden, :type => Boolean, :default => false
field :is_checked, :type => Boolean, :default => false
field :is_pending, :type => Boolean, :default => true
field :is_rejected, :type => Boolean, :default => false
field :not_checked_reason
field :public, :type => Boolean, :default => true
scope :can_display,where(is_checked: true)
mount_uploader :image, ImageUploader
belongs_to :news_bulletin_category
# embeds_many :news_bulletin_links, :cascade_callbacks => true
# embeds_many :news_bulletin_files, :cascade_callbacks => true
has_many :news_bulletin_links, :autosave => true, :dependent => :destroy
has_many :news_bulletin_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :news_bulletin_files, :allow_destroy => true
accepts_nested_attributes_for :news_bulletin_links, :allow_destroy => true
validates_presence_of :title
before_save :set_key, :update_status
after_save :save_news_bulletin_links
after_save :save_news_bulletin_files
def self.search( search = nil, category_id = nil )
if category_id.to_s.size > 0 and search.to_s.size > 0
key = /#{search}/
find(:all, :conditions => {title: key, news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
elsif category_id.to_s.size > 0 and search.to_s.size < 1
find(:all, :conditions => {news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
elsif search.to_s.size > 0 and category_id.to_s.size < 1
key = /#{search}/
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
else
find(:all).desc( :is_top, :postdate)
end
end
def self.widget_datas( category_id = nil )
date_now = Time.now
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
if category_id.to_s.size > 0
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
else
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
end
end
def is_expired?
Date.today > self.deadline ? true : false rescue false
#some dates might sat as nil so rescue false
end
def is_top?
self.is_top
end
def is_hot?
self.is_hot
end
def is_hidden?
self.is_hidden
end
def is_checked?
self.is_checked
end
def is_pending?
self.is_pending
end
def is_rejected?
self.is_rejected
end
def save_news_bulletin_links
self.news_bulletin_links.each do |t|
if t.should_destroy
t.destroy
end
end
end
def save_news_bulletin_files
self.news_bulletin_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
def title
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def subtitle
@subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def text
@text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def self.filter(news_bulletins)
news_bulletins.each do |news_bulletin|
p "#{news_bulletin.id}/#{news_bulletin.is_top}/#{news_bulletin.is_hot}/#{news_bulletin.is_hidden}"
end
return nil
end
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
protected
def set_key
if title.new_record?
title.key = 'title'
end
if subtitle.new_record?
subtitle.key = 'subtitle'
end
if text.new_record?
text.key = 'text'
end
end
def update_status
if !self.is_pending && !self.is_checked
self.is_pending = false
self.is_rejected = true
self.is_checked = false
elsif self.is_checked
self.is_pending = false
self.is_rejected = false
self.is_checked = true
end
end
end

View File

@ -0,0 +1,25 @@
# encoding: utf-8
class NewsBulletinCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/news/back_end/news_bulletin_categorys'
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
field :key
field :display
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
has_many :news_bulletins
def self.from_id(id)
NewsBulletinCategory.find(id) rescue nil
end
end

View File

@ -0,0 +1,40 @@
class NewsBulletinFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
# field :filetitle
# field :description
has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
# field :to_save, :type => Boolean
field :should_destroy, :type => Boolean
belongs_to :news_bulletin
# embedded_in :news_bulletin
before_save :set_key
def filetitle
@filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def description
@description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
protected
def set_key
if filetitle.new_record?
filetitle.key = 'filetitle'
end
if description.new_record?
description.key = 'description'
end
end
end

View File

@ -0,0 +1,15 @@
class NewsBulletinLink
include Mongoid::Document
include Mongoid::Timestamps
field :url
# field :name
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
field :should_destroy, :type => Boolean
# embedded_in :news_bulletin
belongs_to :news_bulletin
end

View File

@ -0,0 +1,11 @@
class NewsTag < Tag
has_and_belongs_to_many :news_bulletins
def get_visible_news_bulletins(sort = :name)
date_now = Time.now
self.news_bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
end
end

View File

View File

@ -11,14 +11,14 @@
<%= javascript_include_tag "inc/search" %> <%= javascript_include_tag "inc/search" %>
>>>>>>> 291d5e3a03ba7da62ceb5e3b18012f0c9198dfba >>>>>>> 291d5e3a03ba7da62ceb5e3b18012f0c9198dfba
<% end %> <% end %>
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> <%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true) %> <%= form_tag('', :remote => true) %>
<div class="subnav"> <div class="subnav">
<ul class="nav nav-pills filter"> <ul class="nav nav-pills filter">
<li class="accordion-group"> <li class="accordion-group">
<div class="form-search" style="margin: 5px 10px;"> <div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("announcement.bulletin.category") %> <%= label_tag :category, t("news.news_bulletin.category") %>
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %> <%= select_tag "category_id", options_from_collection_for_select(@news_bulletin_categorys, "id", "key") %>
<%= search_field_tag 'user_filter' %> <%= search_field_tag 'user_filter' %>
</div> </div>
</li> </li>

View File

@ -0,0 +1,15 @@
<h1><%= news_bulletin_category.key %></h1>
<table>
<tr>
<th><%= t('news_bulletin.status') %></th>
<th><%= t('news_bulletin.category') %></th>
<th><%= t('news_bulletin.title') %></th>
<th><%= t('news_bulletin.postdate') %></th>
<th><%= t('news_bulletin.deadline') %></th>
<th><%= t('news_bulletin.action') %></th>
</tr>
<% news_bulletin_category.news_bulletins.each do |post| %>
<%= render :partial => 'panel/news/back_end/news_bulletins/news_bulletins', :locals => {:post => post,:approval_allow=>true} %>
<% end %>
</table>

View File

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

View File

@ -0,0 +1,50 @@
<%= render 'panel/news/back_end/news_bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/news/back_end/news_bulletins/news_bulletins' %>
</table>
<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 :secondary do %>
<%#= render :partial => '/panel/news/back_end/news_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<fieldset><legend><%= t('news_bulletin.search') %></legend>
<%= form_for :news_bulletin, :action => 'search', :method => 'get', :url => panel_news_back_end_news_bulletins_path do |f| %>
<%#= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('news_bulletin.select') }%>
Category <%#= select_tag "category_id", options_for_select(@news_bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('news_bulletin.select') %>
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</fieldset>
<br />
<br />
<h1><%= t('news_bulletin.list_news') %></h1>
<div id="check_block">
<h1>Check Please</h1>
<%#= render :partial => "list_table", :collection => @news_bulletin_categorys_check,:as => :news_bulletin_category%>
</div>
<br />
-->

View File

@ -0,0 +1,40 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "inc/permission-checkbox" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %>
<% end %>
<%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true) %>
<div class="subnav">
<ul class="nav nav-pills filter">
<li class="accordion-group">
<div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("news.news_bulletin.category") %>
<%= select_tag "category_id", options_from_collection_for_select(@news_bulletin_categorys, "id", "key") %>
<%= search_field_tag 'user_filter' %>
</div>
</li>
</ul>
</div>
<%#= label_tag :role, t("admin.roles") %>
<div class="clear">
<%= content_tag :div do -%>
<% form_tag :action => "update_setting" do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
<div class="form-actions pagination-centered">
<%= submit_tag "Update", :class => 'btn' %>
</div>
<% end -%>
<% end -%>
</div>
<script type="text/javascript" charset="utf-8">
var availableTags = [];
$(function() {
$('#category_id').change(function() {
$(this).parents('form').submit();
});
</script>

View File

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

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