Merge branch 'design_team' of https://github.com/Rulingcom/orbit into announcement_fact_check

This commit is contained in:
Matt Fu 2012-03-16 15:50:43 +08:00
commit 50a9f66269
63 changed files with 1411 additions and 1007 deletions

View File

@ -1,6 +1,8 @@
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails', '>=3.1.0', '<3.2.0' gem 'rails', '>=3.1.0', '<3.2.0'
gem "brakeman"
gem 'bson_ext' gem 'bson_ext'
gem 'carrierwave' gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
@ -13,6 +15,7 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick' gem 'mini_magick'
gem 'mongoid' gem 'mongoid'
gem "mongo_session_store-rails3"
gem 'radius' gem 'radius'
gem 'rake' gem 'rake'
gem 'ruby-debug19' gem 'ruby-debug19'

View File

@ -42,6 +42,14 @@ GEM
arel (2.2.1) arel (2.2.1)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32) bcrypt-ruby (3.0.1-x86-mingw32)
brakeman (1.5.0)
activesupport
erubis (~> 2.6)
haml (~> 3.0)
i18n
ruby2ruby (~> 1.2)
ruport (~> 1.6)
sass (~> 3.0)
bson (1.5.2) bson (1.5.2)
bson_ext (1.5.2) bson_ext (1.5.2)
bson (= 1.5.2) bson (= 1.5.2)
@ -59,6 +67,7 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.2.0) coffee-script-source (1.2.0)
color (1.4.1)
columnize (0.3.6) columnize (0.3.6)
database_cleaner (0.7.1) database_cleaner (0.7.1)
delorean (1.2.0) delorean (1.2.0)
@ -78,7 +87,11 @@ GEM
factory_girl_rails (1.6.0) factory_girl_rails (1.6.0)
factory_girl (~> 2.5.0) factory_girl (~> 2.5.0)
railties (>= 3.0.0) railties (>= 3.0.0)
fastercsv (1.5.4)
haml (3.1.4)
hike (1.2.1) hike (1.2.1)
hoe (2.15.0)
rake (~> 0.8)
i18n (0.6.0) i18n (0.6.0)
jquery-rails (1.0.19) jquery-rails (1.0.19)
railties (~> 3.0) railties (~> 3.0)
@ -96,12 +109,18 @@ GEM
subexec (~> 0.2.1) subexec (~> 0.2.1)
mongo (1.5.2) mongo (1.5.2)
bson (= 1.5.2) bson (= 1.5.2)
mongo_session_store-rails3 (3.0.5)
actionpack (>= 3.0)
mongo
mongoid (2.4.2) mongoid (2.4.2)
activemodel (~> 3.1) activemodel (~> 3.1)
mongo (~> 1.3) mongo (~> 1.3)
tzinfo (~> 0.3.22) tzinfo (~> 0.3.22)
multi_json (1.0.4) multi_json (1.0.4)
orm_adapter (0.0.6) orm_adapter (0.0.6)
pdf-writer (1.1.8)
color (>= 1.4.0)
transaction-simple (~> 1.3)
polyglot (0.3.3) polyglot (0.3.3)
rack (1.3.6) rack (1.3.6)
rack-cache (1.1) rack-cache (1.1)
@ -154,15 +173,24 @@ GEM
columnize (>= 0.3.1) columnize (>= 0.3.1)
linecache19 (>= 0.5.11) linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19) ruby-debug-base19 (>= 0.11.19)
ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5) ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2) archive-tar-minitar (>= 0.5.2)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.5) rubyzip (0.9.5)
ruport (1.6.3)
fastercsv
pdf-writer (= 1.1.8)
sass (3.1.12) sass (3.1.12)
sass-rails (3.1.5) sass-rails (3.1.5)
actionpack (~> 3.1.0) actionpack (~> 3.1.0)
railties (~> 3.1.0) railties (~> 3.1.0)
sass (~> 3.1.10) sass (~> 3.1.10)
tilt (~> 1.3.2) tilt (~> 1.3.2)
sexp_processor (3.1.0)
shoulda-matchers (1.0.0) shoulda-matchers (1.0.0)
simplecov (0.5.4) simplecov (0.5.4)
multi_json (~> 1.0.3) multi_json (~> 1.0.3)
@ -186,6 +214,8 @@ GEM
tilt (1.3.3) tilt (1.3.3)
tinymce-rails (3.4.8) tinymce-rails (3.4.8)
railties (>= 3.1) railties (>= 3.1)
transaction-simple (1.4.0)
hoe (>= 1.1.7)
treetop (1.4.10) treetop (1.4.10)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
@ -210,6 +240,7 @@ PLATFORMS
x86-mingw32 x86-mingw32
DEPENDENCIES DEPENDENCIES
brakeman
bson_ext bson_ext
carrierwave carrierwave
carrierwave-mongoid carrierwave-mongoid
@ -223,6 +254,7 @@ DEPENDENCIES
jquery-rails jquery-rails
kaminari! kaminari!
mini_magick mini_magick
mongo_session_store-rails3
mongoid mongoid
radius radius
rails (>= 3.1.0, < 3.2.0) 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/dsl_definition'
require 'rake' require 'rake'
PrototypeR4::Application.load_tasks Orbit::Application.load_tasks

View File

@ -1,4 +1,4 @@
$('.bulletin_urls_block a.delete').live('click', function(){ $('.bulletin_links_block a.delete').live('click', function(){
$(this).parents('.list_item').remove(); $(this).parents('.list_item').remove();
}); });
@ -9,4 +9,5 @@ $('.bulletin_files_block a.delete').live('click', function(){
$('.action a.remove_existing_record').live('click', function(){ $('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1); $(this).next('.should_destroy').attr('value', 1);
$("#bulletin_" + $(this).prev().attr('value')).hide(); $("#bulletin_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
}); });

View File

@ -52,12 +52,15 @@ $(document).ready(function(){
/*tinyscrollbar&windows-Size*/ /*tinyscrollbar&windows-Size*/
resize(); resize();
$('#main-sidebar').css("height", viewportheight-40); var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar .viewport').css("height", viewportheight-40); $('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495); $('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar(); $('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar(); $('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-44)}); $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
/*isotope*/ /*isotope*/
var $container = $('#isotope'); var $container = $('#isotope');

View File

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

View File

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

View File

@ -1,3 +1,3 @@
class ObitWidgetController< OrbitFrontendComponentController class OrbitWidgetController< OrbitFrontendComponentController
end 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

@ -17,16 +17,25 @@
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) 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 :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 -%>
<%= content_tag :li, :class => active_for_controllers('designs') do -%> <%= content_tag :li, :class => active_for_controllers('designs') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %> <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<% end -%>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%>

View File

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__) 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. # or test environments.
Bundler.require *Rails.groups(:assets) if defined?(Bundler) Bundler.require *Rails.groups(:assets) if defined?(Bundler)
module PrototypeR4 module Orbit
class Application < Rails::Application class Application < Rails::Application
# Add directories for plugins # Add directories for plugins
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules) config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_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. # Settings in config/environments/* take precedence over those specified here.

View File

@ -4,4 +4,4 @@ require 'yaml'
YAML::ENGINE.yamler = 'syck' YAML::ENGINE.yamler = 'syck'
# Initialize the rails application # 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 # Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on

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 # Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps. # 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 # Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's # 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! # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random, # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks. # 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! # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random, # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks. # 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. # Be sure to restart your server when you modify this file.
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session' Orbit::Application.config.session_store :mongoid_store
# 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

View File

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

View File

@ -8,6 +8,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletins = Bulletin.all # @bulletins = Bulletin.all
# @bulletins = Bulletin.desc("postdate desc") # @bulletins = Bulletin.desc("postdate desc")
get_categorys(params[:bulletin_category_id]) get_categorys(params[:bulletin_category_id])
get_tags
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id] # @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
@ -15,9 +16,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
@bulletin_categories = BulletinCategory.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| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
@ -30,6 +28,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/1.xml # GET /bulletins/1.xml
def show def show
@bulletin = Bulletin.find(params[:id]) @bulletin = Bulletin.find(params[:id])
get_tags
# get_categorys # get_categorys
# @bulletin_categorys = BulletinCategory.where("_id" => params[:id]) # @bulletin_categorys = BulletinCategory.where("_id" => params[:id])
@ -50,11 +49,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/new.xml # GET /bulletins/new.xml
def new def new
@bulletin = Bulletin.new @bulletin = Bulletin.new
@link_url = panel_announcement_back_end_bulletins_path
# @bulletin.bulletin_files.build # @bulletin.bulletin_files.build
# @bulletin.bulletin_files.new # @bulletin.bulletin_files.new
get_categorys get_categorys
get_tags
respond_to do |format| respond_to do |format|
format.html # new.html.erb format.html # new.html.erb
@ -66,7 +68,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def edit def edit
@bulletin = Bulletin.find(params[:id]) @bulletin = Bulletin.find(params[:id])
# @summary_variable = @bulletin.summary_variable # @summary_variable = @bulletin.summary_variable
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
get_categorys get_categorys
get_tags
end end
# POST /bulletins # POST /bulletins
@ -89,6 +95,32 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
end end
end end
def link_quick_add
# debugger
@bulletin = Bulletin.find(params[:bulletin_id])
@link_url = panel_announcement_back_end_bulletins_path
respond_to do |format|
format.js
end
end
def link_quick_edit
# debugger
@bulletin = Bulletin.find(params[:bulletin_id])
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
respond_to do |format|
format.js
end
end
# PUT /bulletins/1 # PUT /bulletins/1
# PUT /bulletins/1.xml # PUT /bulletins/1.xml
def update def update
@ -97,11 +129,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin.update_user_id = current_user.id @bulletin.update_user_id = current_user.id
# @bulletin.image.clear if params[:bulletin][:image_del] == '1' # @bulletin.image.clear if params[:bulletin][:image_del] == '1'
if params[:bulletin][:image_del] == '1' # if params[:bulletin][:image_del] == '1'
@bulletin.remove_image! # @bulletin.remove_image!
# @bulletin.image_del = nil # @bulletin.image_del = nil
params[:bulletin][:image_del] = nil # params[:bulletin][:image_del] = nil
end # end
respond_to do |format| respond_to do |format|
if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save
@ -151,6 +183,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end end
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
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_sorted_bulletins def get_sorted_bulletins
bulletins = Bulletin.all bulletins = Bulletin.all
@ -194,7 +236,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
a.flatten! a.flatten!
a.uniq a.uniq
end end
end end

View File

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

View File

@ -1,4 +1,4 @@
class Panel::Announcement::Widget::BulletinsController < ObitWidgetController class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
def initialize def initialize
super super

View File

@ -29,10 +29,11 @@ class Bulletin
belongs_to :bulletin_category belongs_to :bulletin_category
embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_links, :cascade_callbacks => true
embeds_many :bulletin_files, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true
# has_many :bulletin_files, :autosave => true, :dependent => :destroy has_many :bulletin_links, :autosave => true, :dependent => :destroy
has_many :bulletin_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
@ -41,6 +42,9 @@ class Bulletin
before_save :set_key before_save :set_key
after_save :save_bulletin_links
after_save :save_bulletin_files
def self.search( search = nil, category_id = nil ) def self.search( search = nil, category_id = nil )
@ -97,6 +101,22 @@ class Bulletin
self.is_hidden self.is_hidden
end end
def save_bulletin_links
self.bulletin_links.each do |t|
if t.should_destroy
t.destroy
end
end
end
def save_bulletin_files
self.bulletin_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
def title def title
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil

View File

@ -5,13 +5,27 @@ class BulletinFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
field :filetitle # field :filetitle
field :description # 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 :to_save, :type => Boolean
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
# belongs_to :bulletin belongs_to :bulletin
embedded_in :bulletin # embedded_in :bulletin
protected
def set_key
if filetitle.new_record?
filetitle.key = 'filetitle'
end
if description.new_record?
description.key = 'description'
end
end
end end

View File

@ -4,10 +4,12 @@ class BulletinLink
include Mongoid::Timestamps include Mongoid::Timestamps
field :url field :url
field :name # field :name
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
embedded_in :bulletin # embedded_in :bulletin
belongs_to :bulletin
end end

View File

@ -1,21 +1,17 @@
<tr id="<%= dom_id bulletin_category %>"> <tr id="<%= dom_id bulletin_category %>" class="with_action">
<td><%= bulletin_category.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<% end %>
<td><%= bulletin_category.display %></td>
<% if is_manager? %>
<td> <td>
<%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %> <br/ > <%= bulletin_category.key %>
<% bulletin_category.object_auths.each do |obj_auth| %> <div class="quick-edit">
<%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %><br /> <ul class="nav nav-pills hide">
<% end %> <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.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %></li>
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td> </td>
<td> <% @site_valid_locales.each do |locale| %>
<% end %> <td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | <% end %>
<%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | <td><%= bulletin_category.display %></td>
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> </tr>
</td>
</tr>

View File

@ -1,36 +1,36 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %> <%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %>
<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %>
<div class="field"> <h2><%= (@bulletin_category.new_record? ? 'Add' : 'Edit') %></h2>
<%= 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 <div id="widget-title">
<%#= f.label :display, 'list', :value => '1', :checked => @a %> <%= f.label :key %>
<%= f.radio_button :display, "Picture" %>Picture <%= f.text_field :key %>
<%#= f.label :display, 'picture', :value => '2', :checked => @b %> </div>
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div> <div id="widget-title">
<%= 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| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge' %>
</div>
</div>
<% end %>
<% end %>
</div>
<div id="widget-title">
<%= f.label :display %>
<%= f.radio_button :display, "List" %>List
<%= f.radio_button :display, "Picture" %>Picture
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
<div class="actions"> <div class="form-actions">
<%= f.submit %> <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div> </div>
<% end %> <% end %>

View File

@ -0,0 +1,13 @@
<!-- <tr class="qe-block hide"> -->
<tr class="qe-block hide">
<td colspan="8">
<legend><%= t(:quick_edit) %></legend>
<%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %>
<%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
</div>
<% end %>
</td>
</tr>

View File

@ -0,0 +1,28 @@
<% # encoding: utf-8 %>
<div id="qe-basic" class="qe-edit-div">
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge' %>
</div>
</div>
<% end %>
<% end %>
</div>
<div id="widget-title">
<%= f.label :display %>
<%= f.radio_button :display, "List" %>List
<%= f.radio_button :display, "Picture" %>Picture
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
</div>

View File

@ -1,38 +1,23 @@
<% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %> <%= flash_messages %>
<br /> <table id="bulletin_categorys" class="table main-list">
<br /> <thead>
<br /> <tr>
<br /> <th class="span1-2"><%= t('bulletin_category.key') %></th>
<br /> <% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th class="span1-2"><%= t('bulletin_category.display') %></th>
</tr>
</thead>
<tbody>
<h1><%= t('bulletin_category.list_announcement_class') %></h1>
<table id="bulletin_categorys">
<tr>
<th><%= t('bulletin_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th><%= t('bulletin_category.display') %></th>
<th><%= t('bulletin.action') %></th>
</tr>
<%# @bulletin_categorys.each do |post| %>
<%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %> <%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %>
<%# end %>
</tbody>
</table> </table>
<br />
<br />
<br />
<br />
<h2>Add New</h2>
<div id="form"><%= render :partial => "form" %></div> <div id="form"><%= render :partial => "form" %></div>

View File

@ -6,10 +6,22 @@
<%= f.file_field :file %> <%= f.file_field :file %>
<%= f.label :file_title %> <%= f.label :file_title %>
<%= f.text_field :filetitle %> <%#= f.text_field :filetitle %>
<%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
<% end %>
<% end %>
<%= f.label :file_description %> <%= f.label :file_description %>
<%= f.text_field :description %> <%#= f.text_field :description %>
<%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
<% end %>
<% end %>
<span class="action"> <span class="action">
<% if bulletin_file.new_record? %> <% if bulletin_file.new_record? %>

View File

@ -0,0 +1,27 @@
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<div class="field">
<%= f.label :link_url %>
<%= f.text_field :url %>
<%= f.label :link_name %>
<%#= f.text_field :name %>
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.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 %>
<span class="action">
<% if bulletin_link.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<% else %>
<%= f.hidden_field :id %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</div>
</div>

View File

@ -1,12 +1,18 @@
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'> <div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<div class="field"> <div class="field">
<%= f.label :link_url %> <%= f.label :link_url %>
<%= f.text_field :url %> <%= f.text_field :url %>
<%= f.label :link_name %> <%= f.label :link_name %>
<%= f.text_field :name %> <%#= f.text_field :name %>
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.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 %>
<span class="action"> <span class="action">
<% if bulletin_link.new_record? %> <% if bulletin_link.new_record? %>

View File

@ -0,0 +1,16 @@
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,17 @@
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(bulletin_link2) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,41 @@
<% # encoding: utf-8 %>
<%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %>
<div id="modal-link" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Add Link / Edit Link</h3>
</div>
<div class="modal-body form-horizontal">
<div class="control-group">
<label for="http" class="control-label">URL</label>
<div class="controls">
<%= f.text_field :url %>
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% @site_valid_locales.each do |locale| %>
<div class="control-group error">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
<div class="controls">
<input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% end %>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
<% end %>

View File

@ -20,108 +20,246 @@
<%= t('announcement.刪除已上傳檔案') %> <%= t('announcement.刪除已上傳檔案') %>
<% end %> <% end %>
</div> </div>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-picture" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
<div class="widget-content clear">
<div class="control-group">
<img class="pull-left upload-picture" src="images/default-img.png" />
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse/選擇檔案
<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
</label>
<span id='fu' class="file-name"></span>
<br>
<input name='fu' class="input-large" type="text">
<br>
<% if @bulletin.image.file %>
<%= f.check_box :remove_image %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
</div>
</div>
</div>
<div class="field"> <div id="widget-date" class="widget-box widget-size-300">
<%= f.label :title %> <div class="widget-action clear">
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %> <a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
<% @site_valid_locales.each do |locale| %> </div>
<td> <h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
<%= I18nVariable.from_locale(locale) %> <div class="widget-content clear">
<%= f.text_field locale %> <div class="control-group">
</td> <label class="control-label">Start</label>
<% end %> <div class="controls">
<% end %> <%= f.date_select :postdate, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
</div> </div>
</div>
<div class="field"> <div class="control-group">
<%= f.label :subtitle %> <label class="control-label">End</label>
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %> <div class="controls">
<% @site_valid_locales.each do |locale| %> <%= f.date_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
<td> </div>
<%= I18nVariable.from_locale(locale) %> </div>
<%= f.text_area locale, :rows => 10, :cols => 40 %> </div>
</td> </div>
<% end %>
<% end %> <div id="widget-status" class="widget-box widget-size-300">
</div> <div class="widget-action clear">
<a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
<div class="widget-content clear">
<div class="controls">
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div class="field"> <div id="widget-tags" class="widget-box widget-size-300">
<%= f.label :text %> <div class="widget-action clear">
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %> <a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
<% @site_valid_locales.each do |locale| %> </div>
<td> <h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<%= I18nVariable.from_locale(locale) %> <div class="widget-content clear form-horizontal">
<%= f.text_area locale, :rows => 10, :cols => 40 %> <% @tags.each do |tag| %>
</td> <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
<% end %> <%= tag[I18n.locale] %>
<% end %> <% end %>
</div>
</div>
</div> </div>
<div class="field">
<%= f.label :postdate %><br /> <!--Wiget End-->
<%= f.date_select :postdate, :order => [:year, :month, :day], :use_month_numbers => true %> <!--Post Start-->
<%#= date_select("bulletin", "postdate", :use_month_numbers => true) %>
</div> <div id="post-body">
<div id="post-body-content" class="clear">
<div class="field">
<%= f.label :deadline %><br /> <%= f.label :category %>
<%= f.date_select :deadline, :use_month_numbers => true, :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year'} %> <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<%#= f.date_select :deadline, :order => [:year, :month, :day],:default => 1.years.from_now, :use_month_numbers => true %>
</div> <div class="btn-group pull-right">
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
<div class="field"> English
<%#= f.label :url %><br /> <span class="caret"></span>
<%#= f.text_field :url, :size => 60 %> </a>
</div> <ul class="dropdown-menu">
<li><a href="#">English</a></li>
<li><a href="#">Chinese</a></li>
<div id='bulletin_links' class="bulletin_links_block <%= @class %>"> <li><a href="#">Japanese</a></li>
<li><a href="#">French</a></li>
<li><a href="#">German</a></li>
<!--<li class="divider"></li>
<li><a href="#">Separated link</a></li>-->
</ul>
</div>
<div class="title">
<%= f.label :title %>
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :subtitle %>
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :text %>
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
<div id='bulletin_links' class="bulletin_links_block <%= @class %>">
<div id='add_bulletin_link' class="info_input bulletin_links_block">
<h2>Bulletin links</h2>
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>
<%#= render :partial => 'link', :locals => { :bulletin_links => @bulletin.bulletin_links , :f => f} %>
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</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 id='bulletin_files' class="bulletin_files_block <%= @class %>">
<div id='add_bulletin_file' class="info_input bulletin_files_block">
<h2>Bulletin files</h2>
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>
<%#= render :partial => 'file', :locals => { :bulletin_files => @bulletin.bulletin_files , :f => f} %>
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
<%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
<br />
<br />
<div id='add_bulletin_link' class="info_input bulletin_links_block">
<h2>Bulletin links</h2>
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div> </div>
<%#= render :partial => 'link', :locals => { :bulletin_links => @bulletin.bulletin_links , :f => f} %> <!--Post End-->
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<div id='bulletin_files' class="bulletin_files_block <%= @class %>">
<div id='add_bulletin_file' class="info_input bulletin_files_block">
<h2>Bulletin files</h2>
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>
<%#= render :partial => 'file', :locals => { :bulletin_files => @bulletin.bulletin_files , :f => f} %>
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
<%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
<br />
<br />
<div class="actions">
<%= f.submit %>
</div> </div>

View File

@ -17,11 +17,13 @@
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<% bulletin.bulletin_links.each_with_index do |blink, i| %>
<tr> <tr>
<td></td> <td><%= link_to blink.i18n_variable.zh_tw, blink.url, :target => '_blank' %></td>
<td></td> <td><%= link_to blink.i18n_variable.en, blink.url, :target => '_blank' %></td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td> <td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr> </tr>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -32,27 +34,25 @@
</div> </div>
<div class="modal-body form-horizontal"> <div class="modal-body form-horizontal">
<div class="control-group"> <div class="control-group">
<label for="http" class="control-label">http://</label> <label for="http" class="control-label">URL</label>
<div class="controls"> <div class="controls">
<input type="text" value="" id="http" class="input-xlarge"> <input type="text" value="" id="http" class="input-xlarge">
<span class="help-inline">Please correct the error</span> <span class="help-inline">Please correct the error</span>
</div> </div>
</div> </div>
<div class="control-group error">
<label for="link-zh-tw" class="control-label">Chinese</label> <% @site_valid_locales.each do |locale| %>
<div class="controls"> <div class="control-group error">
<input type="text" value="" id="link-zh-tw" class="input-xlarge"> <label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
<span class="help-inline">Please correct the error</span> <div class="controls">
</div> <input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
</div> <span class="help-inline">Please correct the error</span>
<div class="control-group"> </div>
<label for="link-en" class="control-label">English</label> </div>
<div class="controls"> <% end %>
<input type="text" value="" id="link-en" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a> <a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a> <a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>

View File

@ -5,13 +5,18 @@
<div class="control-group"> <div class="control-group">
<img class="pull-left upload-picture" src="" /> <img class="pull-left upload-picture" src="" />
<div class="controls file-upload"> <div class="controls file-upload">
<label class="control-label btn" for="input-upload"> <label class="control-label btn" for="input-upload">
Browse/選擇檔案 Browse/選擇檔案
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fu').innerHTML = this.form.fu.value = this.value;"> <%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
</label> </label>
<span id='fu' class="file-name"></span> <span id='fu' class="file-name"></span>
<br> <br>
<input name='fu' class="input-large" type="text"> <input name='fu' class="input-large" type="text">
<br>
<% if bulletin.image.file %>
<%= f.check_box :remove_image %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,9 @@
<%= render 'filter' %>
<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>

View File

@ -0,0 +1,2 @@
//$.each($(".quick_edit"),function(obj){ $(this).remove(); });
$("#<%= "bulletin_#{bulletin_link2.id}" %>").append("<%= j render "bulletin_link_qe" %>");

View File

@ -21,7 +21,7 @@
</li> </li>
<li> <li>
<b><%= t('announcement.title') %></b> <b><%= t('announcement.title') %></b>
<%= @bulletin.title %> <%= @bulletin.title[I18n.locale] %>
</li> </li>
<li> <li>
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
@ -29,23 +29,23 @@
</li> </li>
<li> <li>
<b><%= t('announcement.subtitle') %></b> <b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle %> <%= @bulletin.subtitle[I18n.locale].html_safe %>
</li> </li>
<li> <li>
<b><%= t('announcement.text') %></b> <b><%= t('announcement.text') %></b>
<%= @bulletin.text %> <%= @bulletin.text[I18n.locale].html_safe %>
</li> </li>
<li> <li>
<li> <li>
<b><%= t('announcement.link') %></b> <b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %> <% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %> <%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %> <% end %>
</li> </li>
<li> <li>
<b><%= t('announcement.file') %></b> <b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %> <% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> <%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
<% end %> <% end %>
</li> </li>
<li> <li>

View File

@ -7,7 +7,10 @@ Rails.application.routes.draw do
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index" root :to => "bulletins#index"
resources :bulletins resources :bulletins do
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
end
resources :bulletin_categorys, :controller => 'bulletin_categorys' do resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
end end

View File

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

View File

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

View File

@ -1,31 +1,32 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= f.error_messages %> <%= f.error_messages %>
<%#= debugger %>
<div class="field">
<%= f.label :name %>
<%= @page_context.page.i18n_variable[I18n.locale] %>
</div>
<div class="field"> <div id="post-body">
<%= f.label :context %>
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %> <div class="title">
<% @site_valid_locales.each do |locale| %> <%= f.label :name %>
<td> <%= @page_context.page.i18n_variable[I18n.locale] %>
<%= I18nVariable.from_locale(locale) %> </div>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
</td> <div class="title">
<% end %> <%= f.label :context %>
<% end %> <%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
</div> <% @site_valid_locales.each do |locale| %>
<td>
<br /> <%= I18nVariable.from_locale(locale) %>
<br /> <%= f.text_area locale, :style=>"width:100%" %>
</td>
<div class="actions"> <% end %>
<%= f.submit %> <% end %>
</div> </div>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
</div>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>

View File

@ -1,10 +1,14 @@
<tr id="<%= dom_id page_context %>"> <tr id="<%= dom_id page_context %>" class="with_action">
<td><%= page_context.page.i18n_variable[I18n.locale] %></td> <td>
<td><%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %></td> <%= page_context.page.i18n_variable[I18n.locale] %>
<td><%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td> <div class="quick-edit">
<td><%= User.find(page_context.create_user_id).name %></td> <ul class="nav nav-pills hide">
<td> <li><%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
<%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %> </ul>
</td> </div>
</tr> </td>
<td><%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %></td>
<td><%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= User.find(page_context.create_user_id).name %></td>
</tr>

View File

@ -1,10 +1,15 @@
<tr id="<%= dom_id view_page_context %>">
<td><%= view_page_context.page.i18n_variable[I18n.locale] %></td> <tr id="<%= dom_id view_page_context %>" class="with_action">
<td><%= view_page_context.version %></td> <td>
<td><%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td> <%= view_page_context.page.i18n_variable[I18n.locale] %>
<td><%= User.find(view_page_context.create_user_id).name %></td> <div class="quick-edit">
<td> <ul class="nav nav-pills hide">
<%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %> <li><%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %></li>
</td> </ul>
</tr> </div>
</td>
<td><%= view_page_context.version %></td>
<td><%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= User.find(view_page_context.create_user_id).name %></td>
</tr>

View File

@ -1,7 +1,3 @@
<br />
<br />
<br />
<br />
<h1><%= t('page_content.editing_page_content') %></h1> <h1><%= t('page_content.editing_page_content') %></h1>
@ -9,8 +5,4 @@
<%= render :partial => 'form', :locals => {:f => f} %> <%= render :partial => 'form', :locals => {:f => f} %>
<% end %> <% end %>
<%= link_back %> <%#= link_back %>
<br />
<br />
<br />
<br />

View File

@ -1,36 +1,20 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %></li>
</ul>
<% end -%>
<%= flash_messages %> <%= flash_messages %>
<br /> <table class="table main-list">
<br /> <thead>
<br /> <tr>
<br /> <th class="span7 select"><%= t('page_context.name') %></th>
<br /> <th class="span1-2"><%= t('page_context.version') %></th>
<th class="span1-2"><%= t('page_context.update_time') %></th>
<h1><%= t('page_context.list_page_content') %></h1> <th class="span1-2"><%= t('page_context.last_modified') %></th>
</tr>
<table> </thead>
<tr> <tbody>
<th><%= t('page_context.name') %></th>
<th><%= t('page_context.version') %></th>
<th><%= t('page_context.update_time') %></th>
<th><%= t('page_context.last_modified') %></th>
<th><%= t('page_context.action') %></th>
</tr>
<%= render :partial => 'page_context', :collection => @page_contexts %> <%= render :partial => 'page_context', :collection => @page_contexts %>
</table> </tbody>
</table>
<br />

View File

@ -1,36 +1,19 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %></li>
</ul>
<% end -%>
<%= flash_messages %> <%= flash_messages %>
<br /> <table class="table main-list">
<br /> <thead>
<br /> <tr>
<br /> <th class="span7 select"><%= t('page_context.name') %></th>
<br /> <th class="span1-2"><%= t('page_context.version') %></th>
<th class="span1-2"><%= t('page_context.update_time') %></th>
<h1><%= t('page_context.list_page_content') %></h1> <th class="span1-2"><%= t('page_context.last_modified') %></th>
</tr>
<table> </thead>
<tr> <tbody>
<th><%= t('page_context.name') %></th>
<th><%= t('page_context.version') %></th>
<th><%= t('page_context.update_time') %></th>
<th><%= t('page_context.last_modified') %></th>
<th><%= t('page_context.action') %></th>
</tr>
<%= render :partial => 'view_page_context', :collection => @page_contexts %> <%= render :partial => 'view_page_context', :collection => @page_contexts %>
</table> </tbody>
</table>
<br />

View File

@ -1,6 +1,6 @@
class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationController class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationController
layout 'admin' layout 'new_admin'
def index def index
@web_link_categorys = WebLinkCategory.all @web_link_categorys = WebLinkCategory.all

View File

@ -1,7 +1,7 @@
class Panel::WebResource::BackEnd::WebLinksController < ApplicationController class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
layout 'admin' layout 'new_admin'
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?

View File

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

View File

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

View File

@ -1,25 +1,29 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %> <%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %>
<%#= form_for(@web_link_category, :remote => true, :url => panel_web_resource_back_end_web_link_category_path(@web_link_category)) do |f| %>
<div class="field"> <h2><%= (@web_link_category.new_record? ? 'Add' : 'Edit') %></h2>
<%= f.label :key %><br />
<%= f.text_field :key %> <div id="widget-title">
</div> <%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge' %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="field"> <div class="form-actions">
<%= f.label :name %><br /> <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
<%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_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="actions">
<%= f.submit %>
</div> </div>
<% end %> <% end %>

View File

@ -1,12 +1,16 @@
<tr id="<%= dom_id web_link_category %>">
<td><%= web_link_category.key %></td> <tr id="<%= dom_id web_link_category %>" class="with_action">
<% @site_valid_locales.each do |locale| %> <td>
<td><%= web_link_category.i18n_variable[locale] rescue nil %></td> <%= web_link_category.key %>
<% end %> <div class="quick-edit">
<td> <ul class="nav nav-pills hide">
<%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %> | <li><%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %></li>
<%= link_to t('web_link_category.quick_edit'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :remote => true %> | <li><%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_path(web_link_category), :confirm => t('sure?'), :method => :delete, :remote => true %> </ul>
</td> </div>
</tr> </td>
<% @site_valid_locales.each do |locale| %>
<td><%= web_link_category.i18n_variable[locale] rescue nil %></td>
<% end %>
</tr>

View File

@ -1,43 +1,23 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%#= link_to t('web_link_category.new_web_resource_class'), new_panel_web_resource_back_end_web_link_category_path, :class => 'seclink1' %></li>
</ul>
<% end -%>
<%= flash_messages %> <%= flash_messages %>
<h1><%= t('web_link_category.list_web_resource_class') %></h1> <table id="web_link_categorys" class="table main-list">
<br /> <thead>
<br /> <tr>
<br /> <th class="span1-2"><%= t('web_link_category.key') %></th>
<br /> <% @site_valid_locales.each do |locale| %>
<br /> <th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<table id="web_link_categorys"> <% end %>
<tr> </tr>
<th><%= t('web_link_category.key') %></th> </thead>
<% @site_valid_locales.each do |locale| %> <tbody>
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th><%= t('web_link.action') %></th>
</tr>
<%# @web_link_categorys.each do |post| %>
<%= render :partial => 'web_link_category', :collection => @web_link_categorys %> <%= render :partial => 'web_link_category', :collection => @web_link_categorys %>
<%# end %>
</tbody>
</table> </table>
<br />
<br />
<br />
<br />
<h2>Add New</h2>
<div id="form"><%= render :partial => "form" %></div> <div id="form"><%= render :partial => "form" %></div>

View File

@ -1,62 +1,101 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= f.error_messages %> <%= f.error_messages %>
<%#= debugger %>
<div class="field">
<%= f.label :category %><br />
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
</div>
<div class="field">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
</td>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :url %><br />
<%= f.text_field :url, :size => 60 %>
</div>
<div class="field"> <!--Widget start-->
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %> <div id="sub-wiget">
<% @site_valid_locales.each do |locale| %>
<td> <div id="widget-status" class="widget-box widget-size-300">
<%= I18nVariable.from_locale(locale) %> <div class="widget-action clear">
<%= f.text_area locale, :rows => 10, :cols => 40 %> <a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
</td> </div>
<% end %> <h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
<% end %> <div class="widget-content clear">
</div> <div class="controls">
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
</div>
<div class="field"> </div>
<%= f.label :status %><br />
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hidden') %>
</div>
<div class="field">
<%= f.label :tags %><br />
<% @tags.each do |tag| %>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
<br />
<br />
<div class="actions"> <!--Wiget End-->
<%= f.submit %> <!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :category %>
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
English
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">English</a></li>
<li><a href="#">Chinese</a></li>
<li><a href="#">Japanese</a></li>
<li><a href="#">French</a></li>
<li><a href="#">German</a></li>
<!--<li class="divider"></li>
<li><a href="#">Separated link</a></li>-->
</ul>
</div>
<div class="title">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :url %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div> </div>

View File

@ -1,5 +1,5 @@
<tr id="<%= dom_id post %>"> <tr id="<%= dom_id post %>" class="with_action">
<td> <td>
<% if post.is_top? %> <% if post.is_top? %>
<span class="label label-success"><%= t(:top) %></span> <span class="label label-success"><%= t(:top) %></span>
@ -10,6 +10,12 @@
<% if post.is_hidden? %> <% if post.is_hidden? %>
<span class="label"><%= t(:hidden) %></span> <span class="label"><%= t(:hidden) %></span>
<% end %> <% end %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %></li>
<li><%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td> </td>
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td> <td><%= post.web_link_category.i18n_variable[I18n.locale] %></td>
<td> <td>
@ -20,12 +26,5 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span> <span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %> <% end %>
</td> </td>
<td>
<%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %> |
<%= link_to t(:set_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:cancel_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
| <%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %>
</td>
</tr> </tr>

View File

@ -1,52 +1,21 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('web_link.new_link'), new_panel_web_resource_back_end_web_link_path %></li>
<li><%= link_to t('web_link.link_list'), panel_web_resource_back_end_web_links_path %></li>
<li><%= link_to t('web_link.new_link_class'), panel_web_resource_back_end_web_link_categorys_path %></li>
</ul>
<% end -%>
<%= flash_messages %> <%= flash_messages %>
<br /> <table class="table main-list">
<br /> <thead>
<br /> <tr>
<br /> <th class="span1-2"><%= t('web_link.status') %></th>
<br /> <th class="span1-2"><%= t('web_link.category') %></th>
<th class="span1-2"><%= t('web_link.name') %></th>
<%= form_for :web_link, :action => 'search', :method => 'get', :url => panel_web_resource_back_end_web_links_path do |f| %> <th class="span1-2"><%= t('web_link.tags') %></th>
</tr>
<%#= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('web_link.select') }%> </thead>
<tbody>
Category <%= select_tag "category_id", options_for_select(@web_link_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('web_link.select') %>
<%= submit_tag "OK", :name => nil %>
<% end %>
<br />
<br />
<h1><%= t('web_link.list_link') %></h1>
<table>
<tr>
<th><%= t('web_link.status') %></th>
<th><%= t('web_link.category') %></th>
<th><%= t('web_link.name') %></th>
<th><%= t('web_link.tags') %></th>
<th><%= t('web_link.action') %></th>
</tr>
<% @web_links.each do |post| %> <% @web_links.each do |post| %>
<%= render :partial => 'web_links', :locals => {:post => post} %> <%= render :partial => 'web_links', :locals => {:post => post} %>
<% end %> <% end %>
</table>
</tbody>
<br /> </table>