fix announcement links & files

This commit is contained in:
unknown 2012-03-16 16:49:25 +08:00
commit a755eb184b
84 changed files with 2009 additions and 1672 deletions

View File

@ -1,6 +1,8 @@
source 'http://rubygems.org'
gem 'rails', '>=3.1.0', '<3.2.0'
gem "brakeman"
gem 'bson_ext'
gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
@ -13,6 +15,7 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick'
gem 'mongoid'
gem "mongo_session_store-rails3"
gem 'radius'
gem 'rake'
gem 'ruby-debug19'
@ -20,7 +23,7 @@ gem 'rubyzip'
gem 'sinatra'
gem 'sprockets'
gem 'tinymce-rails'
# gem 'therubyracer'
#gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.

View File

@ -10,48 +10,55 @@ GIT
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.3)
actionpack (= 3.1.3)
actionmailer (3.1.4)
actionpack (= 3.1.4)
mail (~> 2.3.0)
actionpack (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
actionpack (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.5)
rack (~> 1.3.6)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
activemodel (3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
activerecord (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
activesupport (3.1.3)
activeresource (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
arel (2.2.1)
bcrypt-ruby (3.0.1)
arel (2.2.3)
bcrypt-ruby (3.0.1-x86-mingw32)
bson (1.5.2)
bson_ext (1.5.2)
bson (= 1.5.2)
brakeman (1.5.1)
activesupport
erubis (~> 2.6)
haml (~> 3.0)
i18n
ruby2ruby (~> 1.2)
ruport (~> 1.6)
sass (~> 3.0)
bson (1.6.1)
bson_ext (1.6.1)
bson (~> 1.6.1)
builder (3.0.0)
carrierwave (0.5.8)
activesupport (~> 3.0)
carrierwave-mongoid (0.1.3)
carrierwave (>= 0.5.6)
mongoid (~> 2.1)
chronic (0.6.6)
chronic (0.6.7)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@ -59,26 +66,32 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
color (1.4.1)
columnize (0.3.6)
database_cleaner (0.7.1)
delorean (1.2.0)
chronic
devise (1.5.3)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
railties (~> 3.1)
warden (~> 1.1.1)
diff-lcs (1.1.3)
erubis (2.7.0)
exception_notification (2.5.2)
actionmailer (>= 3.0.4)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.5.0)
activesupport
factory_girl_rails (1.6.0)
factory_girl (~> 2.5.0)
factory_girl (2.6.3)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
railties (>= 3.0.0)
fastercsv (1.5.4)
haml (3.1.4)
hike (1.2.1)
hoe (2.16.1)
rake (~> 0.8)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
@ -86,24 +99,30 @@ GEM
json (1.6.5)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
mini_magick (3.4)
subexec (~> 0.2.1)
mongo (1.5.2)
bson (= 1.5.2)
mongoid (2.4.2)
mongo (1.6.1)
bson (~> 1.6.1)
mongo_session_store-rails3 (3.0.5)
actionpack (>= 3.0)
mongo
mongoid (2.4.6)
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
multi_json (1.0.4)
multi_json (1.1.0)
orm_adapter (0.0.6)
pdf-writer (1.1.8)
color (>= 1.4.0)
transaction-simple (~> 1.3)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
@ -113,18 +132,18 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
radius (0.7.1)
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
activerecord (= 3.1.3)
activeresource (= 3.1.3)
activesupport (= 3.1.3)
radius (0.7.3)
rails (3.1.4)
actionmailer (= 3.1.4)
actionpack (= 3.1.4)
activerecord (= 3.1.4)
activeresource (= 3.1.4)
activesupport (= 3.1.4)
bundler (~> 1.0)
railties (= 3.1.3)
railties (3.1.3)
actionpack (= 3.1.3)
activesupport (= 3.1.3)
railties (= 3.1.4)
railties (3.1.4)
actionpack (= 3.1.4)
activesupport (= 3.1.4)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -153,25 +172,33 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.5)
sass (3.1.12)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.6.1)
ruport (1.6.3)
fastercsv
pdf-writer (= 1.1.8)
sass (3.1.15)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sexp_processor (3.1.0)
shoulda-matchers (1.0.0)
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov (0.6.1)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
spork (0.9.0)
spork (0.9.0-x86-mingw32)
win32-process
sprockets (2.0.3)
@ -183,30 +210,32 @@ GEM
tilt (1.3.3)
tinymce-rails (3.4.8)
railties (>= 3.1)
transaction-simple (1.4.0)
hoe (>= 1.1.7)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
uglifier (1.2.2)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.0)
warden (1.1.1)
rack (>= 1.0)
watchr (0.7)
win32-api (1.4.8-x86-mingw32)
win32-process (0.6.5)
windows-pr (>= 1.1.2)
windows-api (0.4.0)
windows-api (0.4.1)
win32-api (>= 1.4.5)
windows-pr (1.2.1)
win32-api (>= 1.4.5)
windows-api (>= 0.3.0)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
brakeman
bson_ext
carrierwave
carrierwave-mongoid
@ -220,6 +249,7 @@ DEPENDENCIES
jquery-rails
kaminari!
mini_magick
mongo_session_store-rails3
mongoid
radius
rails (>= 3.1.0, < 3.2.0)

View File

@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'
PrototypeR4::Application.load_tasks
Orbit::Application.load_tasks

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,104 +1,100 @@
var viewportwidth,
viewportheight;
function resize() {
viewportheight=$(window).height();
viewportwidth=$(window).width();
if(window.navigator.userAgent.indexOf("MSIE")>0){
windH=document.clientHeight;
windW=document.clientWidht;
}
}
$(document).ready(function(){
$(document).on('click', '.language-menu li', function(){
$(this).each(function(i){
$(this).siblings().removeClass('active')
$(this).addClass('active')
})
return false;
});
$(document).on('click', '.orbit-bar-member', function(){
$(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open');
$('.bar-login .dropdown-menu').toggle();
return false;
});
$(document).click(function() {
$('.orbit-bar-member').removeClass("open");
$('.bar-login .dropdown-menu').hide();
});
$(document).on('click', '.bar-login .dropdown-menu', function(e) {
e.stopPropagation();
$('.bar-login .dropdown-menu').show();
});
$('.tip').tooltip({
placement: "left"
});
$(document).on('click', '.privacy', function() {
switch ($(this).val()) {
case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300);
break;
case 'false':
$(this).parents('.controls').children('.select-role').slideDown(300);
break;
}
});
$(document).on('click', '.toggle-tr-edit', function() {
$(this).parents('tr').next('.qe-block').removeClass('hide');
$(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide');
$(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide');
});
$(document).on('click', '.sort-header > .sort', function() {
$.getScript($(this).attr('rel'));
});
/*tinyscrollbar&windows-Size*/
resize();
$('#main-sidebar').css("height", viewportheight-40);
$('#main-sidebar .viewport').css("height", viewportheight-40);
$('.post-title').css("width", viewportwidth-495);
$('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-44)});
/*isotope*/
var $container = $('#isotope');
$container.isotope({
itemSelector : '.item',
layoutMode : 'masonry',
});
});
$(window).resize(function(){
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
});
/*main-table position*/
function mainTablePosition() {
var $height = $('#main-wrap > .subnav').height()
var $table = $('#main-wrap > .table')
//alert ($table.height())
$table.stop().animate({marginTop:$height},500)
//$table.css({marginTop : $height})
}
$(window).scroll(function () {
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
var $winLeft = $(window).scrollLeft()
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
});
var viewportwidth,
viewportheight;
function resize() {
viewportheight=$(window).height();
viewportwidth=$(window).width();
if(window.navigator.userAgent.indexOf("MSIE")>0){
windH=document.clientHeight;
windW=document.clientWidht;
}
}
$(document).ready(function(){
$(document).on('click', '.orbit-bar-member', function(){
$(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open');
$('.bar-login .dropdown-menu').toggle();
return false;
});
$(document).click(function() {
$('.orbit-bar-member').removeClass("open");
$('.bar-login .dropdown-menu').hide();
});
$(document).on('click', '.bar-login .dropdown-menu', function(e) {
e.stopPropagation();
$('.bar-login .dropdown-menu').show();
});
$('.tip').tooltip({
placement: "left"
});
$(document).on('click', '.privacy', function() {
switch ($(this).val()) {
case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300);
break;
case 'false':
$(this).parents('.controls').children('.select-role').slideDown(300);
break;
}
});
$(document).on('click', '.toggle-tr-edit', function() {
$(this).parents('tr').next('.qe-block').removeClass('hide');
$(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide');
$(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide');
});
$(document).on('click', '.sort-header > .sort', function() {
$.getScript($(this).attr('rel'));
});
/*tinyscrollbar&windows-Size*/
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
/*isotope*/
var $container = $('#isotope');
$container.isotope({
itemSelector : '.item',
layoutMode : 'masonry',
});
});
$(window).resize(function(){
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
});
/*main-table position*/
function mainTablePosition() {
var $height = $('#main-wrap > .subnav').height()
var $table = $('#main-wrap > .table')
//alert ($table.height())
$table.stop().animate({marginTop:$height},500)
//$table.css({marginTop : $height})
}
$(window).scroll(function () {
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
var $winLeft = $(window).scrollLeft()
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
});

View File

@ -2642,8 +2642,8 @@ button.btn.small, input[type="submit"].btn.small {
color: #333333;
}
.pagination {
height: 36px;
margin: 18px 0;
height: 36px;
margin: 18px 0;
}
.pagination ul {
display: inline-block;
@ -2663,7 +2663,8 @@ button.btn.small, input[type="submit"].btn.small {
.pagination li {
display: inline;
}
.pagination a {
.pagination .page{
float: left;
padding: 0 14px;
line-height: 34px;
@ -2671,6 +2672,28 @@ button.btn.small, input[type="submit"].btn.small {
border: 1px solid #ddd;
border-left-width: 0;
}
.pagination a {
float: left;
}
.pagination .next{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
.pagination .last{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
.pagination .current{
border-left-width: 1px;
}
.pagination a:hover, .pagination .active a {
background-color: #f5f5f5;
}

View File

@ -1,482 +1,483 @@
html, body{
height: 100%;
margin: 0;
padding: 0;
}
html{
background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent;
background-size: cover;
}
body{
color: #000000;
font-family: Helvetica, '微軟正黑體';
}
#back_banner_link{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) );
background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d');
-moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
-webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
border-top: 1px solid #474a4c;
border-bottom: 1px solid #1d2020;
height: 41px;
width: 100%;
behavior: url(<%= asset_path "PIE.htc" %>);
}
.hmenu{
float: right;
height: 41px;
}
#back_orbit{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) );
background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043');
-webkit-border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
border-radius: 0px 0px 5px 5px;
-moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
-webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
cursor: pointer;
float: left;
height: 43px;
margin-left: 10px;
width: 41px;
behavior: url(<%= asset_path "PIE.htc" %>);
}
#back_orbit span{
text-indent: -9999px;
background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent;
display: block;
height: 43px;
width: 100%;
}
#back_orbit:hover{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) );
background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4');
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
#back_orbit:hover span{
background-position: 0 -44px;
}
#back_orbit:hover #orblist{
display:block;
}
#orblist{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) );
background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF');
-webkit-border-radius: 0px 3px 3px 3px;
-moz-border-radius: 0px 3px 3px 3px;
border-radius: 0px 3px 3px 3px;
-webkit-box-shadow: 0 3px 3px #000000;
-moz-box-shadow: 0 3px 3px #000000;
box-shadow: 0 3px 3px #000000;
display: none;
margin: 0;
padding: 10px;
position: absolute;
top: 43px;
width: 130px;
}
#orblist li{
border-bottom:1px solid #aaa;
list-style:none;
}
.orblink{
color: #333333;
display: block;
font: 12px/100% arial,sans-serif;
padding: 5px;
text-decoration: none;
}
.orblink:hover{
background:#eee;
color:#333;
}
#log_out{
-moz-box-shadow:inset 1px 0px 0px 0px #73777b;
-webkit-box-shadow:inset 1px 0px 0px 0px #73777b;
box-shadow:inset 1px 0px 0px 0px #73777b;
border-right:1px solid #41474c;
border-left:1px solid #41474c;
float:right;
width:41px;
height:41px;
}
#log_out:hover{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) );
background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6');
}
#log_out a{
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent;
display: block;
height: 41px;
text-indent: -9999px;
width: 41px;
}
#log_out a:hover{
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important;
}
.lang{
color: #FFFFFF;
float: right;
font-size: 15px;
line-height: 40px;
margin-right: 10px;
}
.lang a{
color:#fff;
text-decoration:none;
}
.lang a:hover{
text-decoration:underline;
}
#back_content{
height: 100%;
}
#back_footer{
background-color: #101010;
bottom: 0;
color: #FFFFFF;
font-size: 11px;
padding: 10px;
position: fixed;
width: 100%;
left: 0;
box-shadow: 0 -3px 4px #000;
}
.items_setup{
padding:42px 0 0 0;
}
#back_sidebar .items_setup .list li{
padding: 6px 0 7px 5px;
}
#back_sidebar .items_setup .list li a{
display: inline;
font-size: 0.9em;
padding: 0;
}
#back_sidebar .items_setup .list li a span{
background:none;
padding:0;
text-shadow:none;
}
.main {
background: none repeat scroll 0 0 #FFFFFF;
height: 100%;
margin-left: 220px;
padding: 0 40px;
position: relative;
}
.main_list {
padding-top: 70px;
}
.main_list ul {
clear:both;
}
#porfile {
padding-top: 100px;
}
/*add_buttom*/
.button_bar {
float: right;
-moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
-webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) );
background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000');
background-color:#4f4f4f;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
display:inline-block;
padding:0;
margin:10px 0 60px;
}
.button_bar a {
text-decoration:none;
text-shadow:0px -1px 0px #000000;
font-size:12px;
color:#EDEDED;
border-right:1px solid #555;
-moz-box-shadow:1px 0px 0px black;
-webkit-box-shadow:1px 0px 0px black;
box-shadow:1px 0px 0px black;
padding: 6px 10px 4px;
display: inline-block;
float: left;
}
.button_bar a:active {
padding: 7px 10px 3px !important;
text-shadow:0px 1px 0px #000000;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) );
background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f');
}
.button_bar a:last-child {
border-right:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
box-shadow:none;
-moz-border-radius:0px 5px 5px 0px;
-webkit-border-radius:0px 5px 5px 0px;
border-radius:0px 5px 5px 0px;
}
.button_bar a:first-child {
-moz-border-radius:5px 0px 0px 5px;
-webkit-border-radius:5px 0px 0px 5px;
border-radius:5px 0px 0px 5px;
}
.button_bar a.new {
padding: 5px 10px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}
.button_bar a:hover {
color:#FFFFFF;
}
.up {
margin:10px 0;
}
#person {
left: 245px;
position: fixed;
text-align: center;
top: 75px;
width: 140px;
background-color:#FFF;
padding:15px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
}
#file {
display:none;
}
#person img {
}
.user_mail {
border: medium none;
border:1px solid #DDDDDD;
color: #666666;
font-size: 12px;
width: 140px;
}
#person label {
display: block;
margin: 15px 0 0;
}
#person label input {
}
#person label #user_admin {
float:right;
margin: 0;
}
#person label span {
text-align:left;
font-size:11px;
color:#888;
display:block;
}
#person select {
border: 1px solid #DDDDDD;
padding: 0;
width: 140px;
}
#porfile .users{
margin-left: 180px;
}
.roles_block {
background: url(<%= asset_path "75.png" %>) repeat left top;
min-width:710px;
margin-bottom:50px;
position:relative;
padding-bottom: 20px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
}
.roles_block h2 {
color: #FFFFFF;
font-weight: normal;
margin: 0;
padding: 0;
position: absolute;
text-shadow: 0 3px 2px #000000;
top: -30px;
}
.main hr {
height:8px;
border:none;
margin:0;
border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-bottom:1px solid #000;
}
.main2{
padding:70px 0 0;
}
#basic_block hr {
background-color: #666666;
}
#teacher_block hr {
background-color: #0071A9;
}
#student_block hr {
background-color: #AF0045;
}
.info_input {
padding:10px 20px;
}
.info_input table {
color:#fff;
width:100%;
font-size:14px;
}
.info_input table td {
padding:5px 10px 5px 0;
width: 10%;
}
.info_input .list_head {
background:url(<%= asset_path "line.png" %>) left bottom repeat-x;
}
.info_input .list_head td {
}
.info_input .list_item {
color:#AEAEAE;
}
.info_input .add {
display:block;
padding-left:22px;
font-size:12px;
line-height:21px;
height:19px;
background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0;
margin-top: 10px;
color: #DDDDDD;
}
.main table {
width:100%;
}
.main td {
padding-left:20px;
color:#fff;
font-size:14px;
line-height:40px;
}
.main tr.have td{
background: url(<%= asset_path "75.png" %>) repeat left top;
}
.main tr.have td:first-child{
border-radius: 5px 0 0 5px;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
}
.main tr.have td:last-child{
border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
}
.main thead td {
line-height:40px;
font-size:16px;
text-shadow: 0px 1px 1px #3e2914;
}
.main thead td.action {
width:140px;
}
.main tbody td.roles {
background-image: url(<%= asset_path "roles_type.jpg" %>);
background-repeat: repeat-x;
}
.main tbody td.teacher {
background-position: 0 -54px;
}
.main tbody td.student {
background-position: 0 -5px;
}
.main tbody td.action a {
background-image: url(<%= asset_path "icon.png" %>);
display: inline-block;
height: 19px;
margin-right: 10px;
top: 8px;
text-indent: -9999px;
width: 19px;
position: relative;
}
.main tbody td.action a.show {
background-position: left top;
}
.main tbody td.action a.show:hover {
background-position: left -19px;
}
.main tbody td.action a.edit {
background-position: -19px top;
}
.main tbody td.action a.edit:hover {
background-position: -19px -19px;
}
.main tbody td.action a.delete {
background-position: -38px top;
}
.main tbody td.action a.delete:hover {
background-position: -38px -19px;
}
.main tbody td.action a.switch {
background: url(<%= asset_path "switch.png" %>) no-repeat left 3px;
width: 40px;
}
.main tbody tr.disable td.action a.switch {
background-position:left bottom;
}
.main tbody td.action a.delete:hover {
background-position: -38px -19px;
}
.main tbody tr.have {
}
.main tbody tr.disable {
opacity: 0.7;
}
.main tbody tr {
background:none;
height:15px;
}
h1{
margin:0 0 20px;
}
p{
margin:0 0 10px;
}
#back_sidebar .items_setup .list li{
background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top;
border:none;
padding: 0 0 0 5px;
}
#back_sidebar .items_setup .list li a{
line-height:31px;
}
#back_sidebar .items_setup .list li:hover{
background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top;
border:none;
}
#back_sidebar .items_setup ul .list {
html, body{
height: 100%;
margin: 0;
padding: 0;
}
html{
background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent;
background-size: cover;
}
body{
color: #000000;
font-family: Helvetica, '微軟正黑體';
}
#back_banner_link{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) );
background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d');
-moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
-webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7);
border-top: 1px solid #474a4c;
border-bottom: 1px solid #1d2020;
height: 41px;
width: 100%;
behavior: url(<%= asset_path "PIE.htc" %>);
}
.hmenu{
float: right;
height: 41px;
}
#back_orbit{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) );
background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043');
-webkit-border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
border-radius: 0px 0px 5px 5px;
-moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
-webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7);
cursor: pointer;
float: left;
height: 43px;
margin-left: 10px;
width: 41px;
behavior: url(<%= asset_path "PIE.htc" %>);
}
#back_orbit span{
text-indent: -9999px;
background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent;
display: block;
height: 43px;
width: 100%;
}
#back_orbit:hover{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) );
background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4');
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
#back_orbit:hover span{
background-position: 0 -44px;
}
#back_orbit:hover #orblist{
display:block;
}
#orblist{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) );
background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF');
-webkit-border-radius: 0px 3px 3px 3px;
-moz-border-radius: 0px 3px 3px 3px;
border-radius: 0px 3px 3px 3px;
-webkit-box-shadow: 0 3px 3px #000000;
-moz-box-shadow: 0 3px 3px #000000;
box-shadow: 0 3px 3px #000000;
display: none;
margin: 0;
padding: 10px;
position: absolute;
top: 43px;
width: 130px;
}
#orblist li{
border-bottom:1px solid #aaa;
list-style:none;
}
.orblink{
color: #333333;
display: block;
font: 12px/100% arial,sans-serif;
padding: 5px;
text-decoration: none;
}
.orblink:hover{
background:#eee;
color:#333;
}
#log_out{
-moz-box-shadow:inset 1px 0px 0px 0px #73777b;
-webkit-box-shadow:inset 1px 0px 0px 0px #73777b;
box-shadow:inset 1px 0px 0px 0px #73777b;
border-right:1px solid #41474c;
border-left:1px solid #41474c;
float:right;
width:41px;
height:41px;
}
#log_out:hover{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) );
background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6');
}
#log_out a{
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent;
display: block;
height: 41px;
text-indent: -9999px;
width: 41px;
}
#log_out a:hover{
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important;
}
.lang{
color: #FFFFFF;
float: right;
font-size: 15px;
line-height: 40px;
margin-right: 10px;
}
.lang a{
color:#fff;
text-decoration:none;
}
.lang a:hover{
text-decoration:underline;
}
#back_content{
height: 100%;
}
#back_footer{
background-color: #101010;
bottom: 0;
color: #FFFFFF;
display:none;
font-size: 11px;
padding: 10px;
position: fixed;
width: 100%;
left: 0;
box-shadow: 0 -3px 4px #000;
}
.items_setup{
padding:42px 0 0 0;
}
#back_sidebar .items_setup .list li{
padding: 6px 0 7px 5px;
}
#back_sidebar .items_setup .list li a{
display: inline;
font-size: 0.9em;
padding: 0;
}
#back_sidebar .items_setup .list li a span{
background:none;
padding:0;
text-shadow:none;
}
.main {
background: none repeat scroll 0 0 #FFFFFF;
height: 100%;
margin-left: 220px;
padding: 0 40px;
position: relative;
}
.main_list {
padding-top: 70px;
}
.main_list ul {
clear:both;
}
#porfile {
padding-top: 100px;
}
/*add_buttom*/
.button_bar {
float: right;
-moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
-webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) );
background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000');
background-color:#4f4f4f;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
display:inline-block;
padding:0;
margin:10px 0 60px;
}
.button_bar a {
text-decoration:none;
text-shadow:0px -1px 0px #000000;
font-size:12px;
color:#EDEDED;
border-right:1px solid #555;
-moz-box-shadow:1px 0px 0px black;
-webkit-box-shadow:1px 0px 0px black;
box-shadow:1px 0px 0px black;
padding: 6px 10px 4px;
display: inline-block;
float: left;
}
.button_bar a:active {
padding: 7px 10px 3px !important;
text-shadow:0px 1px 0px #000000;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) );
background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f');
}
.button_bar a:last-child {
border-right:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
box-shadow:none;
-moz-border-radius:0px 5px 5px 0px;
-webkit-border-radius:0px 5px 5px 0px;
border-radius:0px 5px 5px 0px;
}
.button_bar a:first-child {
-moz-border-radius:5px 0px 0px 5px;
-webkit-border-radius:5px 0px 0px 5px;
border-radius:5px 0px 0px 5px;
}
.button_bar a.new {
padding: 5px 10px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}
.button_bar a:hover {
color:#FFFFFF;
}
.up {
margin:10px 0;
}
#person {
left: 245px;
position: fixed;
text-align: center;
top: 75px;
width: 140px;
background-color:#FFF;
padding:15px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
}
#file {
display:none;
}
#person img {
}
.user_mail {
border: medium none;
border:1px solid #DDDDDD;
color: #666666;
font-size: 12px;
width: 140px;
}
#person label {
display: block;
margin: 15px 0 0;
}
#person label input {
}
#person label #user_admin {
float:right;
margin: 0;
}
#person label span {
text-align:left;
font-size:11px;
color:#888;
display:block;
}
#person select {
border: 1px solid #DDDDDD;
padding: 0;
width: 140px;
}
#porfile .users{
margin-left: 180px;
}
.roles_block {
background: url(<%= asset_path "75.png" %>) repeat left top;
min-width:710px;
margin-bottom:50px;
position:relative;
padding-bottom: 20px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
}
.roles_block h2 {
color: #FFFFFF;
font-weight: normal;
margin: 0;
padding: 0;
position: absolute;
text-shadow: 0 3px 2px #000000;
top: -30px;
}
.main hr {
height:8px;
border:none;
margin:0;
border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-bottom:1px solid #000;
}
.main2{
padding:70px 0 0;
}
#basic_block hr {
background-color: #666666;
}
#teacher_block hr {
background-color: #0071A9;
}
#student_block hr {
background-color: #AF0045;
}
.info_input {
padding:10px 20px;
}
.info_input table {
color:#fff;
width:100%;
font-size:14px;
}
.info_input table td {
padding:5px 10px 5px 0;
width: 10%;
}
.info_input .list_head {
background:url(<%= asset_path "line.png" %>) left bottom repeat-x;
}
.info_input .list_head td {
}
.info_input .list_item {
color:#AEAEAE;
}
.info_input .add {
display:block;
padding-left:22px;
font-size:12px;
line-height:21px;
height:19px;
background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0;
margin-top: 10px;
color: #DDDDDD;
}
.main table {
width:100%;
}
.main td {
padding-left:20px;
color:#fff;
font-size:14px;
line-height:40px;
}
.main tr.have td{
background: url(<%= asset_path "75.png" %>) repeat left top;
}
.main tr.have td:first-child{
border-radius: 5px 0 0 5px;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
}
.main tr.have td:last-child{
border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
}
.main thead td {
line-height:40px;
font-size:16px;
text-shadow: 0px 1px 1px #3e2914;
}
.main thead td.action {
width:140px;
}
.main tbody td.roles {
background-image: url(<%= asset_path "roles_type.jpg" %>);
background-repeat: repeat-x;
}
.main tbody td.teacher {
background-position: 0 -54px;
}
.main tbody td.student {
background-position: 0 -5px;
}
.main tbody td.action a {
background-image: url(<%= asset_path "icon.png" %>);
display: inline-block;
height: 19px;
margin-right: 10px;
top: 8px;
text-indent: -9999px;
width: 19px;
position: relative;
}
.main tbody td.action a.show {
background-position: left top;
}
.main tbody td.action a.show:hover {
background-position: left -19px;
}
.main tbody td.action a.edit {
background-position: -19px top;
}
.main tbody td.action a.edit:hover {
background-position: -19px -19px;
}
.main tbody td.action a.delete {
background-position: -38px top;
}
.main tbody td.action a.delete:hover {
background-position: -38px -19px;
}
.main tbody td.action a.switch {
background: url(<%= asset_path "switch.png" %>) no-repeat left 3px;
width: 40px;
}
.main tbody tr.disable td.action a.switch {
background-position:left bottom;
}
.main tbody td.action a.delete:hover {
background-position: -38px -19px;
}
.main tbody tr.have {
}
.main tbody tr.disable {
opacity: 0.7;
}
.main tbody tr {
background:none;
height:15px;
}
h1{
margin:0 0 20px;
}
p{
margin:0 0 10px;
}
#back_sidebar .items_setup .list li{
background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top;
border:none;
padding: 0 0 0 5px;
}
#back_sidebar .items_setup .list li a{
line-height:31px;
}
#back_sidebar .items_setup .list li:hover{
background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top;
border:none;
}
#back_sidebar .items_setup ul .list {
}

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,10 @@ class Admin::AppAuthsController < ApplicationController
def create
app_auth = AppAuth.find_or_create_by(module_app_id: params[:module_app_id])
params[:new].each do |item|
auth_all = params[:auth_all] || false
app_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0]
field_value = item[1]
if field_value!=''
@ -66,6 +69,8 @@ class Admin::AppAuthsController < ApplicationController
@module_app = ModuleApp.find(params[:id])
end
def show
@module_app = ModuleApp.find(params[:id])
end
end

View File

@ -21,6 +21,10 @@ class Admin::ModuleAppsController < ApplicationController
@module_app = ModuleApp.find(params[:id])
end
def show
@module_app = ModuleApp.find(params[:id])
end
def update
@module_app = ModuleApp.find(params[:id])
@ -97,7 +101,7 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('admin.app_auth.operation_not_permitted')
redirect_to :action => "edit" # [TODO] maybe need to redirect to some other page
render :nothing => true, :status => 403
end
@ -109,7 +113,7 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('admin.app_auth.operation_not_permitted')
redirect_to :action => "edit" # [TODO] maybe need to redirect to some other page
render :nothing => true, :status => 403
end
end

View File

@ -1,8 +1,12 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
layout "admin"
before_filter :authenticate_user!
before_filter :check_if_user_can_do_object_auth
# before_filter :is_admin? ,:only => :index
def index
# if current_user.admin?
@object_auths = ObjectAuth.all
@ -14,6 +18,7 @@ class Admin::ObjectAuthsController < ApplicationController
def new
obj = eval(params[:type]).find params[:obj_id]
@object_auth=obj.object_auths.build
@object_auth_title_option = eval(params[:type]+"::ObjectAuthTitlesOptions")
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post }
@ -22,13 +27,21 @@ class Admin::ObjectAuthsController < ApplicationController
def create
obj = eval(params[:object_auth][:type]).find params[:object_auth][:obj_id]
@object_auth=obj.object_auths.create :title=> params[:object_auth][:title]
redirect_to edit_admin_object_auth_path(@object_auth)
@object_auth=obj.object_auths.build :title=> params[:object_auth][:title]
if @object_auth.save
redirect_to edit_admin_object_auth_path(@object_auth)
else
flash[:error] = t('admin.object.a_object_must_have_only_one_object_auth_profile_for_each_action')
redirect_to (:back)
end
end
def create_role
object_auth = ObjectAuth.find(params[:id])
params[:new].each do |item|
auth_all = params[:auth_all] || false
object_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0]
field_value = item[1]
if field_value!=''
@ -69,7 +82,11 @@ class Admin::ObjectAuthsController < ApplicationController
def edit
@object_auth = ObjectAuth.find(params[:id])
end
private
def check_if_user_can_do_object_auth
unless check_permission(:manager)
render :nothing => true, :status => 403
end
end
end

View File

@ -0,0 +1,8 @@
class SessionsController < Devise::SessionsController
def create
super
reset_session
end
end

View File

@ -1,3 +0,0 @@
class ObitFrontendController< ObitFrontendComponentController
end

View File

@ -1,3 +0,0 @@
class ObitWidgetController< ObitFrontendComponentController
end

View File

@ -0,0 +1,24 @@
class OrbitBackendController< ApplicationController
before_filter :authenticate_user!
before_filter :setup_vars
# before_filter {|c| c.front_end_available(@app_title)}
before_filter :check_user_can_use,:except => [:public]
include OrbitCoreLib::PermissionUnility
include AdminHelper
layout 'admin'
def setup_vars
@app_title = request.fullpath.split('/')[2]
@module_app = ModuleApp.first(conditions: {:key => @app_title} )
end
private
def check_user_can_use
unless check_permission
redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
end
end
end

View File

@ -1,7 +1,7 @@
class ObitFrontendComponentController< ApplicationController
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout 'module_widget'
layout :false
def setup_vars
@app_title = request.fullpath.split('/')[2]

View File

@ -0,0 +1,3 @@
class OrbitFrontendController< OrbitFrontendComponentController
end

View File

@ -0,0 +1,3 @@
class OrbitWidgetController< OrbitFrontendComponentController
end

View File

@ -30,7 +30,11 @@ class PagesController < ApplicationController
end
def index_from_link
redirect_to "/#{@item.full_name}"
if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
else
redirect_to "/#{@item.full_name}"
end
end
def show_from_link

View File

@ -3,4 +3,9 @@ module Admin::AppAuthHelper
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
end
def if_permitted_to(user,role)
end
end

View File

@ -5,4 +5,17 @@ module AdminHelper
link_to('/' , admin_items_path) + ( @parent_items.map{ |i| link_to(i.name, admin_items_path(:parent_id=>i.id) ) } << @parent_item.name ).join("/").html_safe
end
# Check if the current_user is manager in current module app
def is_manager?
@module_app.is_manager?(current_user) || is_admin?
end
# Check if the current_user is sub manager in current module app
def is_sub_manager?
@module_app.is_sub_manager?(current_user)|| is_admin?
end
def is_admin?
current_user.admin?
end
end

View File

@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth
belongs_to :module_app
end

View File

@ -1,6 +1,7 @@
class ModuleApp
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectTokenUnility
field :key
field :title
@ -14,7 +15,7 @@ class ModuleApp
field :app_pages ,type: Array
field :widgets ,type: Array
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
@ -26,6 +27,14 @@ class ModuleApp
before_save :set_key
def is_manager?(user)
managing_users.include?(user)
end
def is_sub_manager?(user)
sub_managing_users.include?(user) || is_manager?(user)
end
def managing_users
self.managers.collect{ |t| t.user }
end
@ -73,5 +82,6 @@ class ModuleApp
def set_key
self.key = self.title.underscore if self.title
end
end

View File

@ -1,5 +1,6 @@
class ObjectAuth < PrototypeAuth
include OrbitCoreLib::ObjectTokenUnility
validates_uniqueness_of :obj_authable_type,:scope => :title #{ |c| }
belongs_to :obj_authable, polymorphic: true
# > - Something.find_with_auth(query)
# > - or Something.find(query).auth

View File

@ -4,7 +4,6 @@ class PrototypeAuth
# after_save :update_block_list,:update_privilage_list
field :title
field :token
field :all ,type: Boolean,default: false
belongs_to :users
@ -12,11 +11,12 @@ class PrototypeAuth
has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User"
has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User"
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users,:users
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users
def add_role role
add_operation(:roles,role)
@ -68,7 +68,7 @@ class PrototypeAuth
end
end
def auth_users
def auth_users_before_block_list
if self.all?
User.all.entries
else
@ -83,11 +83,10 @@ class PrototypeAuth
end
end
def auth_users_after_block_list
auth_users - self.blocked_users
def auth_users
auth_users_before_block_list - self.blocked_users
end
# protected
end

12
app/models/session.rb Normal file
View File

@ -0,0 +1,12 @@
class Session
include Mongoid::Document
include Mongoid::Timestamps
def self.sweep(time = 1.hour)
if time.is_a?(String)
time = time.split.inject { |count, unit| count.to_i.send(unit) }
end
delete_all "updated_at < '#{time.ago.to_s(:db)}' OR created_at < '#{2.days.ago.to_s(:db)}'"
end
end

View File

@ -0,0 +1 @@
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>

View File

@ -1,3 +1,10 @@
<div id="open_for_all_user">
<h1>All User</h1>
<%= form_tag(submit_url) do %>
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %><br/>
<% end %>
</div>
<div id="user_role_management">
<h1>User Role</h1>
<%= form_tag(submit_url) do %>
@ -10,7 +17,6 @@
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/>
<% end %>
<ul>Roles </ul>
<% unless auth.nil? %>
<% auth.roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %>

View File

@ -1 +0,0 @@
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {}, {:rel => admin_module_apps_path } %>

View File

@ -0,0 +1,37 @@
<br /><br /><br /><br />
<%=@module_app.key %><br />
<%=@module_app.title %><br />
<%=@module_app.version %><br />
<%=@module_app.organization %><br />
<%=@module_app.author %><br />
<%=@module_app.intro %><br />
<%=@module_app.update_info %><br />
<%=@module_app.create_date %><br />
<%=@module_app.enable_frontend%><br />
<%=@module_app.app_pages%><br />
<%=@module_app.widgets%><br />
Mangers:
<ul>
<% @module_app.managers.each do |manager|%>
<li><%= manager.user.name %></li>
<%end%>
</ul>
SubManagers:
<div>
<% @module_app.sub_managers.each do |manager|%>
<%= manager.user.name %>
<%end%>
</div>
<br />
All User?:<%= @module_app.app_auth.all %><br />
Blocked Users:<%= @module_app.app_auth.blocked_users.collect{|t| t.name} %><br />
Privilege Users:<%= @module_app.app_auth.privilege_users.collect{|t| t.name}%><br />
User Roles:<%= @module_app.app_auth.roles.collect{|t| t.key} %><br />
User Sub Roles:<%= @module_app.app_auth.sub_roles.collect{|t| t.key} %><br />
Available users after calculation:
<%= @module_app.app_auth.auth_users.collect{|user| user.name}.join(',') %>

View File

@ -11,4 +11,4 @@
<%= render :partial => "admin/components/user_role_management", :locals => {
:object => @object_auth.auth_obj ,:auth=>@object_auth,:submit_url=>create_role_admin_object_auth_path(@object_auth),:ploy_route_ary=>['remove',:admin,@object_auth] } %>
<%= link_to 'Back to object',eval(@object_auth.obj_authable.class.to_s+"::AfterObjectAuthUrl") %>

View File

@ -12,7 +12,8 @@
<h1><%= t('object_auth.new_object_auth') %></h1>
<%= form_for @object_auth, :url => admin_object_auths_path do |f| %>
<%= f.label :title %>
<%= f.text_field :title, :class => 'text' %>
<%= f.select :title,@object_auth_title_option %>
<%= f.hidden_field :obj_id, :value => params[:obj_id] %>
<%= f.hidden_field :type, :value => params[:type] %>

View File

@ -26,10 +26,10 @@
</ul>
</li>
<% if user_signed_in? %>
<li class="dropdown active clear">
<li class="dropdown active">
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
<!-- <img src="images/menber-pic.png" /> -->
<%= image_tag current_user.avatar.thumb.url, :class => 'member-img' %>
<img class="member-img" src="/assets/menber-pic.png" />
<%#= image_tag current_user.avatar.thumb.url, :class => 'member-img' %>
<span class="member-name"><%= current_user.name %></span>
</a>
<ul class="dropdown-menu account-menu">
@ -45,7 +45,7 @@
<%= t(:desktop) %>
</a>
</li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-out') + t(:logout), destroy_user_session_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-out') + ' ' + t(:logout), destroy_user_session_path %></li>
<li class="divider"></li>
<li>
@ -95,7 +95,7 @@
<% end %>
</ul>
<form class="navbar-search span6" action="">
<input class="search-query span4" type="text" placeholder="Search NCCU">
<input class="search-query span4" type="text" placeholder="<%= t(:search_nccu) %>">
</form>
</div>
</div>

View File

@ -9,6 +9,7 @@
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('tags', 'index') %>
<% end -%>
<% end -%>

View File

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run PrototypeR4::Application
run Orbit::Application

View File

@ -13,12 +13,13 @@ require 'sprockets/railtie'
# or test environments.
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
module PrototypeR4
module Orbit
class Application < Rails::Application
# Add directories for plugins
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
config.paths.app.views << "app/views/devise"
# Settings in config/environments/* take precedence over those specified here.
@ -47,7 +48,7 @@ module PrototypeR4
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :en
config.i18n.default_locale = :zh_tw
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

View File

@ -4,4 +4,4 @@ require 'yaml'
YAML::ENGINE.yamler = 'syck'
# Initialize the rails application
PrototypeR4::Application.initialize!
Orbit::Application.initialize!

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
@ -24,21 +24,21 @@ PrototypeR4::Application.configure do
config.action_dispatch.best_standards_support = :builtin
config.middleware.use ExceptionNotifier,
:email_prefix => "[R4_error]",
:sender_address => %{"notifier" <redmine@rulingcom.com>},
:exception_recipients => %w{chris@rulingcom.com}
# config.middleware.use ExceptionNotifier,
# :email_prefix => "[R4_error]",
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => '587',
:domain => "smtp.gmail.com",
:authentication => "plain",
:user_name => "redmine@rulingcom.com",
:password => "rulingredmine" }
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# :tls => true,
# :enable_starttls_auto => true,
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine" }
end

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
Orbit::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
Orbit::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'

View File

@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# PrototypeR4::Application.config.session_store :active_record_store
Orbit::Application.config.session_store :mongoid_store

View File

@ -32,6 +32,7 @@ en:
password: Password
register: Register
remember_me: Remember me
search_nccu: Search NCCU
show: Show
submit: Submit
sure?: Are you sure?

View File

@ -17,7 +17,7 @@ zh_tw:
edit: 編輯
email: 電子郵件
enable: 啟用
forget_password: 忘記密碼?
forgot_password: 忘記密碼?
help: 協助
hide: 隱藏
homepage: 首頁
@ -25,10 +25,11 @@ zh_tw:
logout: 登出
no_: "No"
nothing:
or_lower:
or_lower:
password: 密碼
register: 註冊
remember_me: 記住我
search_nccu: 搜尋政大
show: 顯示
submit: 送出
sure?: 您肯定嗎?

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.routes.draw do
Orbit::Application.routes.draw do
devise_for :users

View File

@ -31,4 +31,44 @@ module OrbitCoreLib
end
end
module ObjectTokenUnility
def self.included(base)
base.instance_eval("field :s_token")
base.instance_eval("after_create :generate_token")
end
def token
return self.s_token
end
protected
def generate_token
self.s_token = ActiveSupport::SecureRandom.hex(16)
self.save!
end
end
module PermissionUnility
private
def check_permission(type = :use)
permission_grant = current_user.admin?? true : false
module_app = @module_app.nil?? find_module_app_by_token(params[:token]) : @module_app
unless permission_grant
permission_grant = case type
when :use
users_ary = module_app.app_auth.auth_users rescue nil
users_ary = [] if users_ary.nil?
(users_ary.include?(current_user) || module_app.is_manager?(current_user) || module_app.is_sub_manager?(current_user))
when :manager
module_app.is_manager?(current_user)
when :sub_manager
module_app.is_manager?(current_user) || module_app.is_sub_manager?(current_user)
end
end
permission_grant
end
def find_module_app_by_token(token)
ModuleApp.first(conditions: {s_token: token})
end
end
end

View File

@ -100,7 +100,7 @@ module ParserBackEnd
ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }

View File

@ -62,6 +62,7 @@ module ParserFrontEnd
c.define_tag 'stylesheets' do |tag|
res = ''
res << "<link href='/assets/bootstrap.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/style.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' /> " if page.design.default_css
@ -81,7 +82,7 @@ module ParserFrontEnd
res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>"
res << "<script type='text/javascript' src='/assets/event.js'></script>"
page.design.javascripts.each do |js|
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
# res << "<script type='text/javascript' src='#{js.file.url}'></script>"
end
res
end
@ -127,7 +128,7 @@ module ParserFrontEnd
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
ret << "/#{id}" if id
ret << "?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil

22
lib/tasks/anc_tasks.rake Normal file
View File

@ -0,0 +1,22 @@
# encoding: utf-8
namespace :anc do
task :build => :environment do
bulletin_category_1 = BulletinCategory.create(:key => "C1ChrisCheckANDPreivew",:display => "List" )
bulletin_category_1.create_i18n_variable(:en => "ChrisCheckANDPreivew", :zh_tw => 'ChrisCheckANDPreivew')
bulletin_category_2 = BulletinCategory.create(:key => "C2MattCheckANDPreivew",:display => "List" )
bulletin_category_2.create_i18n_variable(:en => "MattCheckANDPreivew", :zh_tw => 'MattCheckANDPreivew')
bulletin_category_3 = BulletinCategory.create(:key => "C3MattCheckChrisPreview",:display => "List" )
bulletin_category_3.create_i18n_variable(:en => "MattCheckChrisPreview", :zh_tw => 'MattCheckChrisPreview')
bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
end
end

View File

@ -125,6 +125,12 @@ namespace :dev do
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
user = User.create( :email => 'manager@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => false, :role_id => r_2.id, :sub_role_ids => [sr_2_1.id ] )
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[0].id, :key => 'first_name', :en => 'Manager', :zh_tw => '管理員' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Chen', :zh_tw => '陳' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
ad_banner = AdBanner.new(:title => 'banner_1',:post_date => Date.today,:context=> "context",:ad_fx=>'zoom',:direct_to_after_click=>true)

View File

@ -5,7 +5,7 @@ namespace :user do
User.all(conditions: {email: /nor/}).destroy_all
username_list = %w{nor1 nor2 nor3 nor4 nor5 nor6 nor7}
userfirstname_list_en = %w{ One Two Thre For Fiv Six Sen }
userfirstname_list_en = %w{ UserOne UserTwo Thre For Fiv Six Sen }
userlastname_list_en = %w{ Aa Bb Cc Dd Ee Ff Gg }
userfirstname_list_ct = %w{ 一一 二二 三三 四四 五五 六六 七七 }

View File

@ -1,5 +1,5 @@
{
"title": "Announcement",
"title": "announcement",
"version": "0.1",
"organization": "Rulingcom",
"author": "RD dep",

View File

@ -1,5 +1,4 @@
class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
layout 'new_admin'
before_filter :authenticate_user!
@ -15,7 +14,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
# @bulletins = Bulletin.search(params[:search], params[:category_id])
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.limit(1).desc("postdate")
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
@bulletin_categories = BulletinCategory.all
respond_to do |format|
@ -137,7 +136,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
# end
respond_to do |format|
if @bulletin.update_attributes(params[:bulletin])
if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) }
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
format.js { render 'toggle_enable' }
@ -177,7 +176,17 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
protected
def get_categorys(id = nil)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end
def get_tags

View File

@ -0,0 +1,76 @@
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
# layout 'admin'
layout 'new_admin'
def setting
@bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id)
first_category = BulletinCategory.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 = @bulletin_categorys.first
end
preload_object_auth = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :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
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -1,4 +1,4 @@
class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def initialize
super
@ -11,13 +11,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
def index
date_now = Time.now
if params[:bulletin_category_id]
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_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)
if params[:category_id]
@bulletins = Bulletin.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)
else
@bulletins = Bulletin.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
get_categorys
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
end
def show

View File

@ -1,4 +1,4 @@
class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
def initialize
super
@ -28,6 +28,7 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins.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_bulletins

View File

@ -4,7 +4,7 @@ class Bulletin
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
@ -19,6 +19,9 @@ class Bulletin
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 :not_checked_reason
field :public, :type => Boolean, :default => true

View File

@ -3,6 +3,10 @@
class BulletinCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
@ -14,4 +18,8 @@ class BulletinCategory
has_many :bulletins
def self.from_id(id)
BulletinCategory.find(id) rescue nil
end
end

View File

@ -14,4 +14,4 @@
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<% end %>
<td><%= bulletin_category.display %></td>
</tr>
</tr>

View File

@ -1,35 +0,0 @@
<% # encoding: utf-8 %>
<div class="field">
<%= f.label :key %><br />
<%= f.text_field :key %>
</div>
<div class="field">
<%= f.label :name %><br />
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :display %> <br />
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
<%= f.radio_button :display, "List" %>List
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
<%= f.radio_button :display, "Picture" %>Picture
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
<div class="actions">
<%= f.submit %>
</div>

View File

@ -1,15 +1,15 @@
<br />
<br />
<br />
<br />
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t('bulletin_category.index'), panel_announcement_back_end_bulletin_categorys_path, :class => 'seclink2' %></li>
</ul>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('bulletin_category.new_announcement_class') %></h1>
<%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>

View File

@ -24,11 +24,12 @@
</ul>
</li>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
</ul>
</div>
</td>
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) rescue ''%></td>
<td><%= bulletin.postdate %></td>
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
<td>
@ -36,7 +37,7 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>
<td><%= User.from_id(bulletin.update_user_id).name %></td>
<td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td>
</tr>
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>

View File

@ -36,4 +36,4 @@
</thead>
<tbody class="sort-holder">
<%= render :partial => 'bulletin', :collection => @bulletins %>
</tbody>
</tbody>

View File

@ -1,6 +1,25 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<div class="field">
<%= label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
<%= f.radio_button :is_checked, true%>
<%= label :is_checked_true, t('announcement.bulletin.fact_check_pass') %>
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true} : {}) %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass') %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
<div class="field">
<%= f.label :image, t('announcement.image') %><br />
<%= f.file_field :image %>
<% if @bulletin.image.file %>
<%= check_box_tag 'bulletin[image_del]' %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
<!--Widget start-->
@ -83,7 +102,7 @@
</div>
<!--Wiget End-->
<!--Post Start-->
@ -194,49 +213,6 @@
</div>
<div class="main-wiget">
<div id="widget-link" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Add a reference link" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
<div class="widget-content">
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-link" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
</td>
</tr>
</tfoot>
<tbody>
<%#= render :partial => 'bulletin_link2', :collection => @bulletin.bulletin_links %>
<% @bulletin.bulletin_links.each_with_index do |bulletin_link2, i| %>
<%= f.fields_for :bulletin_links, bulletin_link2 do |f| %>
<%= render :partial => 'bulletin_link2', :object => bulletin_link2, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
<div id="bulletin_link_qe"><%#= render :partial => "bulletin_link_qe" %></div>
</div>
</div>
<div class="main-wiget">
<div id="widget-file" class="widget-box">
<div class="widget-action clear">

View File

@ -3,11 +3,11 @@
<td colspan="8">
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span>Basic / Picture / Tags / Link / File</legend>
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %>
<%= render :partial => "quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>

View File

@ -4,4 +4,4 @@
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_back %>
<%= link_back %>

View File

@ -2,11 +2,10 @@
<table id="bulettin_sort_list" class="table main-list">
<%= render '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 :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<% end %>
<% end %>

View File

@ -1,6 +1,5 @@
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_back %>
<%= link_back %>

View File

@ -1,10 +1,14 @@
<% # encoding: utf-8 %>
<% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<p id="notice"><%= flash_messages %></p>
<br />
<br />
<ul>
<li>

View File

@ -2,7 +2,11 @@
<%= flash_messages %>
<h1 class="h1"><%= t('announcement.list_announcement') %></h1>
<% if @current_category %>
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
<% else %>
<h1 class="h1"><%= t('announcement.list_announcement') %></h1>
<% end %>
<table class="table table-bordered">
@ -24,6 +28,6 @@
<% end %>
</table>
<%= paginate @bulletins %>
<%= paginate @bulletins, :params => {:inner => 'false'} %>

View File

@ -1,6 +1,6 @@
<% @web_links.each do |web_link| %>
<li>
<a><%= web_link.name[I18n.locale] %></a>
<%= link_to web_link.name[I18n.locale], web_link.url %>
</li>
<% end %>

View File

@ -35,6 +35,12 @@ en:
list_lower: " list"
title: Title
postdate: Postdate
fact_check: Fact Check
fact_check_setting: Fact Check Setting
fact_check_stat: Fact Check Status
fact_check_not_pass: 'Not Pass'
fact_check_not_pass_reason: 'Reason'
fact_check_pass: 'Pass'
# admin:
# action: Action
# add_language: Add language

View File

@ -30,6 +30,13 @@ zh_tw:
list_lower: 列表
title: 標題
postdate: 張貼日期
fact_check: 公告審核
fact_check_setting: 審核設定
fact_check_stat: 審核狀況
fact_check_not_pass: '不通過'
fact_check_pass: '通過'
fact_check_not_pass_reason: '不通過原因'
# admin:
# action: 行動
# add_language: 新增語言

View File

@ -2,6 +2,10 @@ Rails.application.routes.draw do
namespace :panel do
namespace :announcement do
namespace :back_end do
match 'public' => "announcements#public",:as => :public
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index"
resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
@ -10,11 +14,9 @@ Rails.application.routes.draw do
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
end
resources :bulletin_links
resources :tags
end
namespace :front_end do
root :to => "bulletins#index"
resources :bulletins
end
namespace :widget do
@ -25,4 +27,4 @@ Rails.application.routes.draw do
end
end
end
end
end

View File

@ -1,4 +0,0 @@
# desc "Explaining what the task does"
# task :announcement do
# # Task goes here
# end

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::CommentsController < ObitFrontendController
class Panel::NewBlog::FrontEnd::CommentsController < OrbitFrontendController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController
class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController
# GET /posts
# GET /posts.xml
def index

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::Widget::PostsController < ObitWidgetController
class Panel::NewBlog::Widget::PostsController < OrbitWidgetController
# GET /posts
# GET /posts.xml
def index

View File

@ -3,7 +3,7 @@
# # Add a load path for this specific Engine
# # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
# put "ABC"
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"
#
# # initializer "my_engine.add_middleware" do |app|
# # app.middleware.use MyEngine::Middleware
@ -15,4 +15,4 @@ module NewBlog
VERSION = "0.0.1"
MOUDLEAPP_TITLE = "NewBlog"
end
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"

View File

@ -1,4 +1,4 @@
class Panel::PageContent::FrontEnd::PageContextsController < ObitWidgetController
class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetController
def initialize
super

View File

@ -1,4 +1,4 @@
class Panel::WebResource::FrontEnd::WebLinksController < ObitWidgetController
class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
def initialize
super

View File

@ -1,4 +1,4 @@
class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
def initialize
super
@ -14,7 +14,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
# @web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
@web_links = WebLink.widget_datas.page(params[:page]).per(9)
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
# get_categorys
@ -24,7 +24,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
end
def reload_web_links
@web_links = WebLink.widget_datas.page(params[:page]).per(9)
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
end