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

This commit is contained in:
Matthew K. Fu JuYuan 2012-05-09 15:54:59 +08:00
commit 9a6b66c57d
60 changed files with 1123 additions and 319 deletions

View File

@ -19,6 +19,9 @@ gem "mongo_session_store-rails3"
gem 'nokogiri' gem 'nokogiri'
gem 'radius' gem 'radius'
gem 'rake' gem 'rake'
gem 'resque' # background jobs
gem 'resque-scheduler' # job scheduling
gem 'resque-restriction'
gem 'ruby-debug19' gem 'ruby-debug19'
gem 'rubyzip' gem 'rubyzip'
gem 'sinatra' gem 'sinatra'

View File

@ -153,6 +153,20 @@ GEM
rake (0.9.2.2) rake (0.9.2.2)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
redis (2.2.2)
redis-namespace (1.0.3)
redis (< 3.0.0)
resque (1.20.0)
multi_json (~> 1.0)
redis-namespace (~> 1.0.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-restriction (0.3.0)
resque (>= 1.7.0)
resque-scheduler (1.9.9)
redis (>= 2.0.1)
resque (>= 1.8.0)
rufus-scheduler
rspec (2.8.0) rspec (2.8.0)
rspec-core (~> 2.8.0) rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0) rspec-expectations (~> 2.8.0)
@ -182,6 +196,8 @@ GEM
ruby_parser (2.3.1) ruby_parser (2.3.1)
sexp_processor (~> 3.0) sexp_processor (~> 3.0)
rubyzip (0.9.6.1) rubyzip (0.9.6.1)
rufus-scheduler (2.0.16)
tzinfo (>= 0.3.23)
ruport (1.6.3) ruport (1.6.3)
fastercsv fastercsv
pdf-writer (= 1.1.8) pdf-writer (= 1.1.8)
@ -222,6 +238,8 @@ GEM
uglifier (1.2.3) uglifier (1.2.3)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (>= 1.0.2) multi_json (>= 1.0.2)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.1.1) warden (1.1.1)
rack (>= 1.0) rack (>= 1.0)
watchr (0.7) watchr (0.7)
@ -259,6 +277,9 @@ DEPENDENCIES
radius radius
rails (>= 3.1.0, < 3.2.0) rails (>= 3.1.0, < 3.2.0)
rake rake
resque
resque-restriction
resque-scheduler
rspec (~> 2.0) rspec (~> 2.0)
rspec-rails (~> 2.0) rspec-rails (~> 2.0)
ruby-debug19 ruby-debug19

View File

@ -1,7 +1,9 @@
# /usr/bin/ruby -Ku
# Add your own tasks in files placed in lib/tasks ending in .rake, # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__) require File.expand_path('../config/application', __FILE__)
require 'resque/tasks'
require 'rake/dsl_definition' require 'rake/dsl_definition'
require 'rake' require 'rake'

BIN
app/assets/images/Thumbs.db Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -66,7 +66,7 @@ $(document).ready(function(){
function getEvent(selet){ function getEvent(selet){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/static/Other.xml", url: "/static/nccu_calendar.xml",
dataType: "xml", dataType: "xml",
timeout: 1000, timeout: 1000,
error: function(xml){ error: function(xml){

View File

@ -0,0 +1,34 @@
#banner_nav {
position: absolute;
z-index: 10;
bottom: 0;
margin-right: 5px;
right: 0;
}
#banner_nav>li {
float: left;
display: inline-block;
*display: inline;
}
#banner_nav>li>a {
width: 10px;
height: 10px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
background-color: #FFFFFF;
opacity: .5;
filter: alpha(opacity = 50);
margin: 0 4px 10px;
text-indent: -9999px;
box-shadow: 0 0 5px rgba(0,0,0,.7);
}
#banner_nav>li>a:hover {
opacity: 1;
filter: alpha(opacity = 100);
}
#banner_nav>li.activeSlide>a {
opacity: 1;
filter: alpha(opacity = 100);
}

View File

@ -10,7 +10,7 @@
} }
.checkbox{ .checkbox{
padding: 5px; padding: 5px;
margin: 0; margin: 10px;
display: inline-block; display: inline-block;
color:#777777; color:#777777;
text-shadow: 0 1px 0px rgba(255,255,255,.4); text-shadow: 0 1px 0px rgba(255,255,255,.4);
@ -20,7 +20,7 @@
border-style: solid; border-style: solid;
border-width: 0px 1px 1px 0; border-width: 0px 1px 1px 0;
border-color: #dfdfdf; border-color: #dfdfdf;
/*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
@ -28,7 +28,7 @@
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
border-radius: 3px; border-radius: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px;*/ -webkit-border-radius: 3px;
} }
.checkbox .check-icon { .checkbox .check-icon {
display: none; display: none;
@ -80,3 +80,6 @@ img.member-img {
.popover-content p { .popover-content p {
font-size: 12px; font-size: 12px;
} }
.preview_trigger {
margin: 5px 10px 0 0;
}

View File

@ -113,6 +113,7 @@
background-image: none; background-image: none;
overflow: hidden; overflow: hidden;
width: 28px; width: 28px;
margin-bottom: 0;
position: relative; position: relative;
} }
#orbit-bar .nav > li > a.orbit-bar-home { #orbit-bar .nav > li > a.orbit-bar-home {
@ -579,6 +580,35 @@
.popover-title { .popover-title {
display: none; display: none;
} }
/*show link and file*/
.linkAndFile {
clear: both;
}
.linkAndFile>div {
margin-top: 20px;
}
.linkAndFile [class^="icons-"] {
float: left;
margin-top: 10px;
}
.linkAndFile .showLink, .linkAndFile .showFile {
background-color: #ededed;
padding: 5px;
border-radius: 5px;
margin-left: 25px;
}
.linkAndFile .showLink a, .linkAndFile .showFile a {
display: inline-block;
margin: 5px 10px;
}
.linkAndFile>div>a:last-child {
margin-right: 5px
}
.news_paragraph p {
line-height: 20px;
}
/*icons*/ /*icons*/
.the-icons i:after { .the-icons i:after {
content: attr(class); content: attr(class);
@ -652,6 +682,9 @@
resize: none; resize: none;
max-height: 500px; max-height: 500px;
} }
#banner [id^="slideshow-"] {
z-index: 2 !important;
}
[class^="icons-"] { [class^="icons-"] {
display: inline-block; display: inline-block;
width: 16px; width: 16px;
@ -734,15 +767,99 @@
.icons-unlock { .icons-unlock {
background-position: -192px -32px; background-position: -192px -32px;
} }
.icons-thumbtack {
background-position: -224px -32px;
}
.icons-pin {
background-position: -257px -32px;
}
.icons-shield {
background-position: -288px -32px;
}
.icons-key {
background-position: -320px -32px;
}
.icons-fire {
background-position: -352px -32px;
}
.icons-bulls-eye {
background-position: -384px -32px;
}
.icons-flash {
background-position: -416px -32px;
}
.icons-time { .icons-time {
background-position: -448px -32px; background-position: -448px -32px;
} }
.icons-halo {
background-position: -480px -32px;
}
.icons-hourglass {
background-position: -513px -32px;
}
.icons-alarm-clock {
background-position: -545px -32px;
}
.icons-paper {
background-position: -577px -32px;
}
.icons-banner { .icons-banner {
background-position: -608px -32px; background-position: -608px -32px;
} }
/*3*/ /*3*/
.icons-phone {
background-position: 0px -64px;
}
.icons-mobile {
background-position: -32px -64px;
}
.icons-mail {
background-position: -64px -64px;
}
.icons-mail-open {
background-position: -96px -64px;
}
.icons-mail-read {
background-position: -128px -64px;
}
.icons-content { .icons-content {
background-position: -160px -66px; background-position: -160px -64px;
}
.icons-content-out {
background-position: -192px -64px;
}
.icons-content-in {
background-position: -224px -64px;
}
.icons-projector {
background-position: -256px -64px;
}
.icons-tape {
background-position: -288px -64px;
}
.icons-chat-a {
background-position: -320px -64px;
}
.icons-chat-b {
background-position: -352px -64px;
}
.icons-chat-c {
background-position: -384px -64px;
}
.icons-comment {
background-position: -416px -64px;
}
.icons-rss {
background-position: -448px -64px;
}
.icons-ship {
background-position: -480px -64px;
}
.icons-send {
background-position: -512px -64px;
}
.icons-bell {
background-position: -544px -64px;
} }
.icons-announcement { .icons-announcement {
background-position: -576px -64px; background-position: -576px -64px;
@ -803,20 +920,110 @@
.icons-page-copy { .icons-page-copy {
background-position: -64px -128px; background-position: -64px -128px;
} }
.icons- { .icons-folder {
background-position: -0px -128px; background-position: -96px -128px;
}
.icons-folder-open {
background-position: -128px -128px;
}
.icons-folder-lock {
background-position: -160px -128px;
}
.icons-folder-plus {
background-position: -192px -128px;
}
.icons-folder-minus {
background-position: -224px -128px;
}
.icons-page-plus {
background-position: -256px -128px;
}
.icons-page-minus {
background-position: -288px -128px;
}
.icons-page-edit {
background-position: -320px -128px;
}
.icons-page-download {
background-position: -352px -128px;
} }
/*6*/ /*6*/
.icons-house-w {
background-position: 0px -160px;
}
.icons-house-b {
background-position: -32px -160px;
}
.icons-signs {
background-position: -64px -160px;
}
.icons-globe { .icons-globe {
background-position: -96px -160px; background-position: -96px -160px;
} }
.icons-map {
background-position: -128px -160px;
}
.icons-markers {
background-position: -160px -160px;
}
.icons-barrier {
background-position: -192px -160px;
}
.icons-assist {
background-position: -224px -160px;
}
.icons-cones {
background-position: -256px -160px;
}
.icons-group {
background-position: -288px -160px;
}
.icons-cuble {
background-position: -320px -160px;
}
.icons-structure { .icons-structure {
background-position: -352px -160px; background-position: -352px -160px;
} }
.icons-layer {
background-position: -384px -160px;
}
/*7*/ /*7*/
.icons-shopcar-a {
background-position: 0px -192px;
}
.icons-shopcar-b {
background-position: -34px -192px;
}
.icons-purchase { .icons-purchase {
background-position: -64px -192px; background-position: -64px -192px;
} }
.icons-shopcart {
background-position: -96px -192px;
}
.icons-van {
background-position: -128px -192px;
}
.icons-form {
background-position: -160px -192px;
}
.icons-gift {
background-position: -192px -192px;
}
.icons-credit-card {
background-position: -224px -192px;
}
.icons-cash {
background-position: -256px -192px;
}
.icons-assets {
background-position: -288px -192px;
}
.icons-computer {
background-position: -320px -192px;
}
.icons-library {
background-position: -352px -192px;
}
/*8*/ /*8*/
.icons-dashboard { .icons-dashboard {
background-position: 0 -224px; background-position: 0 -224px;
@ -846,21 +1053,90 @@
background-position: -256px -224px; background-position: -256px -224px;
} }
/*9*/ /*9*/
.icons-book-cover {
background-position: 0px -256px;
}
.icons-book-make {
background-position: -32px -256px;
}
.icons-binder {
background-position: -64px -256px;
}
.icons-album {
background-position: -96px -256px;
}
.icons-camera {
background-position: -128px -256px;
}
.icons-video-camera {
background-position: -160px -256px;
}
.icons-pillar {
background-position: -192px -256px;
}
.icons-chart {
background-position: -224px -256px;
}
.icons-picture { .icons-picture {
background-position: -256px -256px; background-position: -256px -256px;
} }
.icons-pictures {
background-position: -288px -256px;
}
.icons-brief {
background-position: -320px -256px;
}
.icons-film {
background-position: -352px -256px;
}
.icons-asset { .icons-asset {
background-position: -384px -256px; background-position: -384px -256px;
} }
.icons-asset-upload {
background-position: -448px -256px;
}
.icons-asset-download { .icons-asset-download {
background-position: -416px -256px; background-position: -416px -256px;
} }
.icons-asset-upload {
background-position: -448px -256px;
}
.icons-music {
background-position: -480px -256px;
}
.icons-book-open-w {
background-position: -512px -256px;
}
.icons-book-open-b {
background-position: -544px -256px;
}
.icons-clapper-board {
background-position: -576px -256px;
}
/*10*/ /*10*/
.icons- { .icons-date {
background-position: -0px -288px; background-position: 0px -288px;
}
.icons-screen {
background-position: -32px -288px;
}
.icons-iphone {
background-position: -64px -288px;
}
.icons-ipad {
background-position: -96px -288px;
}
.icons-ipod {
background-position: -128px -288px;
}
.icons-battery-low {
background-position: -160px -288px;
}
.icons-battery-mid {
background-position: -192px -288px;
}
.icons-battery-full {
background-position: -224px -288px;
}
.icons-battery-charge {
background-position: -256px -288px;
} }
/*11*/ /*11*/
.icons-pie { .icons-pie {
@ -888,14 +1164,50 @@
background-position: -224px -320px; background-position: -224px -320px;
} }
/*12*/ /*12*/
.icons-heart-w {
background-position: 0px -352px;
}
.icons-heart-b {
background-position: -32px -352px;
}
.icons-like {
background-position: -64px -352px;
}
.icons-hate {
background-position: -96px -352px;
}
.icons-medal {
background-position: -128px -352px;
}
.icons-warning {
background-position: -160px -352px;
}
.icons-check {
background-position: -192px -352px;
}
.icons-check-box-solid {
background-position: -224px -352px;
}
.icons-check-box-dot {
background-position: -256px -352px;
}
.icons-check-2 { .icons-check-2 {
background-position: -288px -352px; background-position: -288px -352px;
} }
.icons-check-circle-solid {
background-position: -320px -352px;
}
.icons-check-circle-dot {
background-position: -352px -352px;
}
.icons-check-circle-b {
background-position: -384px -352px;
}
.icons-star-thin { .icons-star-thin {
background-position: -416px -352px; background-position: -416px -352px;
} }
.icons- { .icons-star {
background-position: -0px -352px; background-position: -448px -352px;
} }
/*13*/ /*13*/
.icons- { .icons- {
@ -940,5 +1252,5 @@
} }
/*21*/ /*21*/
.icons- { .icons- {
background-position: -0px -640px background-position: -0px -640px;
} }

View File

@ -5,6 +5,35 @@ class Admin::DashboardsController < ApplicationController
# before_filter :is_admin? # before_filter :is_admin?
def index def index
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
end
protected
def get_module_app_count(*args)
a = {}
total = 0
args.each do |module_app|
module_app_class = module_app.classify.constantize
count = module_app_class.count
a.merge!(module_app => count)
total += count
end
[a.sort {|a,b| b[1]<=>a[1]}, total]
end
def get_recently_updated(*args)
a = {}
args.each do |module_app|
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:updated_at, :desc).limit(10)
objects.each do |object|
a.merge!(object => object.updated_at)
end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9]
end end
end end

View File

@ -43,8 +43,8 @@ class Admin::PagePartsController < ApplicationController
def update def update
@part = PagePart.find(params[:id]) @part = PagePart.find(params[:id])
if @part.update_attributes(params[:page_part]) if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
flash.now[:notice] = t('admin.update_success_content') flash.now[:notice] = t('admin.update_success_content')
@part.save
respond_to do |format| respond_to do |format|
format.html { format.html {
redirect_to admin_page_url( @part.page ) redirect_to admin_page_url( @part.page )
@ -87,4 +87,13 @@ class Admin::PagePartsController < ApplicationController
end end
end end
protected
def set_children_sub_menu(part)
part.page.children.each do |child|
child_part = child.page_parts.detect{ |x| x.name.eql?(part.name) } rescue nil
child_part.update_attributes(:kind => part.kind, :public_r_tag => part.public_r_tag, :public_r_tag_object_id => part.public_r_tag_object_id) rescue nil
end
end
end end

View File

@ -0,0 +1,29 @@
module Admin::DashboardHelper
def get_link(title)
case title
when 'bulletin'
panel_announcement_back_end_bulletins_path
when 'news_bulletin'
panel_news_back_end_news_bulletins_path
when'page_context'
panel_page_content_back_end_page_contexts_path
when'web_link'
panel_web_resource_back_end_web_links_path
end
end
def get_link_to_object(object)
case object._type.underscore
when 'bulletin'
panel_announcement_back_end_bulletin_path(object)
when 'news_bulletin'
panel_news_back_end_news_bulletin_path(object)
when'page_context'
panel_page_content_back_end_page_context_path(object)
when'web_link'
panel_web_resource_back_end_web_link_path(object)
end
end
end

View File

@ -132,7 +132,7 @@ module ApplicationHelper
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
# stylesheets << "<link href='/assets/menu.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
theme = page.design.themes.detect{ |d| d.id == page.theme_id } theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme

15
app/jobs/fetch_time.rb Normal file
View File

@ -0,0 +1,15 @@
# require 'open-uri'
# require 'nokogiri'
class FetchTime < Resque::Plugins::RestrictionJob
restrict :per_300 => 10
@queue = :low
def self.perform()
# sleep 10
doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241'))
CronMail.time_check(doc.at('#ct').children.first.text).deliver
puts "Mail Sent"
true
end
end

12
app/jobs/nccu_calendar.rb Normal file
View File

@ -0,0 +1,12 @@
class NccuCalendar
require 'open-uri'
@queue = :high
def self.perform()
File.open(File.join(Rails.root, 'public/static', 'nccu_calendar.rss'),'w') do |file|
file << open('http://events.nccu.edu.tw/Feed').read
CronMail.time_check("NCCU Calendar synced").deliver
end
puts "NccuCalendar Synced"
end
end

15
app/jobs/sync_db.rb Normal file
View File

@ -0,0 +1,15 @@
class SyncDb
@queue = :high
def self.perform()
self.start_sync
end
def self.start_sync
task = 'mid_site:sync'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
puts "SyncDb Synced"
end
end

33
app/mailer/cron_mail.rb Normal file
View File

@ -0,0 +1,33 @@
class CronMail < ActionMailer::Base
default :from => "orbit_test@rulingcom.com"
def get_settings
# @@smtp_settings = {
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine",
# :tls => true,
# :enable_starttls_auto => true
# }
@@smtp_settings = {
:address => @site['mail_settings']['address'],
:port => @site['mail_settings']['port'],
:domain => @site['mail_settings']['domain'],
:authentication => @site['mail_settings']['authentication'],
:user_name => @site['mail_settings']['user_name'],
:password => @site['mail_settings']['password'],
:tls => @site['mail_settings']['tls'],
:enable_starttls_auto => @site['mail_settings']['enable_starttls_auto']
}
end
def time_check(msg)
get_settings
#attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
mail(:to => "Chris <chris@rulingcom.com>", :subject => msg)
end
end

View File

@ -32,6 +32,17 @@ class Item
nodes.reverse nodes.reverse
end end
# Get an array of ancestor's id
def ancestor_ids
node, nodes = self, []
while !node.parent.blank? do
node = node.parent rescue nil
nodes << node.id if node
end
# nodes << node = node.parent while !node.parent.blank? rescue nil
nodes.reverse
end
# Build the url from the array of ancestors # Build the url from the array of ancestors
def url def url
urls = ancestors.map{ |a| a.name } << self.name urls = ancestors.map{ |a| a.name } << self.name

View File

@ -28,8 +28,20 @@ class Page < Item
def create_parts def create_parts
page_design = self.design page_design = self.design
parent = self.parent
menu_part = parent.page_parts.detect{|page_part| page_part.kind.eql?('public_r_tag') && page_part.public_r_tag.eql?('sub_menu') && page_part.public_r_tag_object_id.eql?(parent.id.to_s)} if parent
page_design.layout.layout_parts.each do |layout_part| page_design.layout.layout_parts.each do |layout_part|
self.page_parts.new(:name => layout_part.name) unless self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)} current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
current_part = self.page_parts.build(:name => layout_part.name) unless current_part
if menu_part && current_part.name.eql?(menu_part.name)
if current_part.new_record?
current_part.kind = menu_part.kind
current_part.public_r_tag = menu_part.public_r_tag
current_part.public_r_tag_object_id = menu_part.public_r_tag_object_id
else
current_part.update_attributes(:kind => menu_part.kind, :public_r_tag => menu_part.public_r_tag, :public_r_tag_object_id => menu_part.public_r_tag_object_id)
end
end
end end
end end

View File

@ -8,6 +8,7 @@ class PagePart
field :kind field :kind
field :public_r_tag field :public_r_tag
field :public_r_tag_object_id, :default => nil field :public_r_tag_object_id, :default => nil
field :public_r_tag_option, :default => nil
field :widget_path field :widget_path
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy

View File

@ -13,11 +13,14 @@ class Site
field :public_key, :type => Binary field :public_key, :type => Binary
field :title_always_on, :type => Boolean, :default => false field :title_always_on, :type => Boolean, :default => false
field :mail_settings, :type => Hash
field :school field :school
field :department field :department
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_many :site_metas, :autosave => true, :dependent => :destroy has_many :site_metas, :autosave => true, :dependent => :destroy
before_save :set_key before_save :set_key
@ -33,7 +36,6 @@ class Site
end end
def up_to_date? def up_to_date?
p res = %x(git remote show origin)
res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil
res.eql?('local out of date') ? false : true res.eql?('local out of date') ? false : true
end end
@ -46,6 +48,10 @@ class Site
@footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil @footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end end
def sub_menu
@sub_menu ||= I18nVariable.first(:conditions => {:key => 'sub_menu', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
METAS.each do |meta| METAS.each do |meta|
define_method meta do define_method meta do
fetch_meta = self.site_metas.where(key: meta).limit(1) fetch_meta = self.site_metas.where(key: meta).limit(1)
@ -66,6 +72,7 @@ class Site
def set_key def set_key
title.key = 'title' if title && (title.key.blank? rescue true) title.key = 'title' if title && (title.key.blank? rescue true)
footer.key = 'footer' if footer && (footer.key.blank? rescue true) footer.key = 'footer' if footer && (footer.key.blank? rescue true)
sub_menu.key = 'sub_menu' if sub_menu && (sub_menu.key.blank? rescue true)
end end
end end

View File

@ -3,6 +3,8 @@ class Tag
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
field :key
belongs_to :module_app belongs_to :module_app
end end

View File

@ -1,8 +1,8 @@
<div id="isotope"> <div id="isotope">
<div class="item element"> <div class="item element">
<h3><i class="icons-content"></i><a href=""><%= t(:content) %></a></h3> <h3><i class="icons-content"></i><%= t(:content) %></h3>
<div class="detail w-a h-b"> <div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_content) %></span>9,517</p> <p class="totle"><span><%= t(:all_content) %></span><%= @module_app_contents_total %></p>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -23,46 +23,12 @@
<div class="overview"> <div class="overview">
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody>
<tr> <% @module_app_contents.each do |module_app_content| %>
<td>公告</td> <tr>
<td class="span2">2,304</td> <td><%= link_to t("dashboard.#{module_app_content[0]}"), get_link(module_app_content[0]) %></td>
</tr> <td class="span2"><%= module_app_content[1] %></td>
<tr> </tr>
<td>新聞</td> <% end %>
<td class="span2">783</td>
</tr>
<tr>
<td>連結</td>
<td class="span2">45</td>
</tr>
<tr>
<td>連結</td>
<td class="span2">62</td>
</tr>
<tr>
<td>連結</td>
<td class="span2">52</td>
</tr>
<tr>
<td>新聞</td>
<td class="span2">20</td>
</tr>
<tr>
<td>公告</td>
<td class="span2">41</td>
</tr>
<tr>
<td>公告</td>
<td class="span2">37</td>
</tr>
<tr>
<td>公告</td>
<td class="span2">41</td>
</tr>
<tr>
<td>公告</td>
<td class="span2">20</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -70,7 +36,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="item element"> <!-- <div class="item element">
<h3><i class="icons-member"></i><a href=""><%= t(:member) %></a></h3> <h3><i class="icons-member"></i><a href=""><%= t(:member) %></a></h3>
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_member) %></span>2,217</p> <p class="totle"><span><%= t(:all_member) %></span>2,217</p>
@ -211,8 +177,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="item element"> <!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:referral_in_links) %></a></h3> <h3><i class="icons-"></i><a href=""><%= t(:referral_in_links) %></a></h3>
<div class="detail w-a h-a"> <div class="detail w-a h-a">
<p class="totle"><span><%= t(:statistics) %></span>517</p> <p class="totle"><span><%= t(:statistics) %></span>517</p>
@ -282,8 +248,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="item element"> <!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:most_visited_page) %></a></h3> <h3><i class="icons-"></i><a href=""><%= t(:most_visited_page) %></a></h3>
<div class="detail noStatistics w-b h-a"> <div class="detail noStatistics w-b h-a">
<table class="table table-striped"> <table class="table table-striped">
@ -460,7 +426,6 @@
<div class="item element"> <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:site_info) %></a></h3> <h3><i class="icons-"></i><a href=""><%= t(:site_info) %></a></h3>
<div class="detail noStatistics w-b h-a"> <div class="detail noStatistics w-b h-a">
<!--<p class="totle"><span><%= t(:statistics) %></span>9,517</p>-->
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -515,11 +480,10 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="item element"> <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:recent_update) %></a></h3> <h3><i class="icons-"></i><%= t(:recent_update) %></h3>
<div class="detail noStatistics w-a h-a"> <div class="detail noStatistics w-b h-a">
<!--<p class="totle"><span><%= t(:statistics) %></span>9,517</p>-->
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -540,46 +504,12 @@
<div class="overview"> <div class="overview">
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody>
<tr> <% @recent_updated.each do |object| %>
<td>Title1</td> <tr>
<td class="span2">公告</td> <td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td>
</tr> <td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td>
<tr> </tr>
<td>Title2</td> <% end %>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -4,7 +4,8 @@
<span id='name_list'> <span id='name_list'>
<% if @r_tag.eql?('sub_menu') %> <% if @r_tag.eql?('sub_menu') %>
<%= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> <%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
<% else %> <% else %>
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %> <%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
<% end %> <% end %>

View File

@ -1,5 +1,5 @@
<% if @r_tag.eql?('sub_menu') %> <% if @r_tag.eql?('sub_menu') %>
$('#name_list select').html("<%= j options_for_select(t(:horizontal) => :horizontal, t(:vertical) => :vertical) %>") // $('#name_list select').html("<%= j options_for_select(t(:horizontal) => :horizontal, t(:vertical) => :vertical) %>")
<% else %> <% else %>
$('#name_list select').html("<%= j options_from_collection_for_select(@tag_objects, :id, :title) %>") $('#name_list select').html("<%= j options_from_collection_for_select(@tag_objects, :id, :title) %>")
<% end %> <% end %>

View File

@ -0,0 +1,12 @@
<%= content_tag :li, :class => active_for_controllers('sites') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), admin_site_site_info_path(@site) %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('sites')) do -%>
<%= content_tag :li, link_to(t('admin.site_info'), admin_site_site_info_path(@site)), :class => active_for_action('sites', 'site_info') %>
<%#= content_tag :li, link_to(t('admin.system_info'), admin_site_system_info_path(@site)), :class => active_for_action('sites', 'system_info') %>
<%#= content_tag :li, link_to(t('admin.site_language'), admin_site_language_path(@site)), :class => active_for_action('sites', 'language') %>
<%= content_tag :li, link_to(t('admin.mail_setting'), admin_site_mail_setting_path(@site)), :class => active_for_action('sites', 'mail_setting') %>
<%#= content_tag :li, link_to(t('admin.ui_theme'), admin_site_ui_theme_path(@site)), :class => active_for_action('sites', 'ui_theme') %>
<% end -%>
<% end -%>

View File

@ -1 +1,5 @@
<% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
language.html.erb language.html.erb

View File

@ -1 +1,76 @@
mail_setting.html.erb <% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
<div id="poststuff">
<%= form_for @site, :url => admin_site_path(@site), :html => {:class => "clear"} do |f| %>
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.fields_for :site_settings, @site['site_settings'] do |f| %>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_address' %></label>
<div class="controls">
<%= f.text_field :address, :value => (@site['site_settings']['address'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_port' %></label>
<div class="controls">
<%= f.text_field :port, :value => (@site['site_settings']['port'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_domain' %></label>
<div class="controls">
<%= f.text_field :domain, :value => (@site['site_settings']['domain'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_authentication' %></label>
<div class="controls">
<%= f.text_field :authentication, :value => (@site['site_settings']['authentication'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_user_name' %></label>
<div class="controls">
<%= f.text_field :user_name, :value => (@site['site_settings']['user_name'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_password' %></label>
<div class="controls">
<%= f.text_field :password, :value => (@site['site_settings']['password'] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_tls' %></label>
<div class="controls">
<%= f.check_box :tls, :checked => (@site['site_settings']['tls'].eql?('1') rescue false) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.mail_enable_starttls_auto' %></label>
<div class="controls">
<%= f.check_box 'enable_starttls_auto', :checked => (@site['site_settings']['enable_starttls_auto'].eql?('1') rescue false) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
</div>
<% end %>
</div>
</div>
<div class="form-actions">
<%= f.submit t("submit"), :class => "btn btn-primary" %>
<%= f.submit t("cancel"), :class => "btn ", :type => 'reset' %>
</div>
<% end %>
</div>

View File

@ -1,3 +1,7 @@
<% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
<div id="poststuff"> <div id="poststuff">
<%= form_for @site, :url => admin_site_path(@site), :html => {:class => "clear"} do |f| %> <%= form_for @site, :url => admin_site_path(@site), :html => {:class => "clear"} do |f| %>
<div id="post-body"> <div id="post-body">
@ -9,20 +13,22 @@
<% end %> <% end %>
</ul> </ul>
<div class="tab-content form-horizontal"> <div class="tab-content form-horizontal">
<div class="control-group"> <div class="control-group" style="margin-bottom: 0;">
<label class="control-label"><%= t 'admin.site_title' %></label>
<div class="controls"> <div class="controls">
<%= f.check_box :title_always_on %> <%= t 'admin.always_display_title' %> <label class="checkbox">
<%= f.check_box :title_always_on %> <%= t 'admin.always_display_title' %>
</label>
</div> </div>
</div> </div>
<% @site_valid_locales.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t 'admin.site_title' %></label>
<div class="controls"> <div class="controls">
<%= f.fields_for :title, @site.title do |f| %> <%= f.fields_for :title, @site.title do |f| %>
<%= f.text_field locale, :class => "input-xxlarge" %> <%= f.text_field locale, :class => "input-xxlarge" %>
<% end %> <% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> <p class="help-block"><%= (t 'admin.site_title_help').html_safe %></p>
</div> </div>
</div> </div>
<% end %> <% end %>
@ -30,12 +36,12 @@
<% @site_valid_locales.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<div class="control-group"> <div class="control-group">
<label class="control-label"><%= t 'admin.keywords' %></label> <label class="control-label"><%= t 'admin.site_keywords' %></label>
<div class="controls"> <div class="controls">
<%= f.fields_for :keywords, @site.keywords do |f| %> <%= f.fields_for :keywords, @site.keywords do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %> <%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<% end %> <% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> <p class="help-block"><%= (t 'admin.site_keywords_help').html_safe %></p>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -44,7 +50,7 @@
<%= f.fields_for :description, @site.description do |f| %> <%= f.fields_for :description, @site.description do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %> <%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<% end %> <% end %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> <p class="help-block"><%= (t 'admin.site_description_help').html_safe %></p>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -53,6 +59,15 @@
<%= f.fields_for :footer, @site.footer do |f| %> <%= f.fields_for :footer, @site.footer do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %> <%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %>
<% end %> <% end %>
<p class="help-block"><%= (t 'admin.site_footer_help').html_safe %></p>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'admin.site_sub_menu' %></label>
<div class="controls">
<%= f.fields_for :sub_menu, @site.sub_menu do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %>
<% end %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@ -1 +1,5 @@
<% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
system_info.html.erb system_info.html.erb

View File

@ -1 +1,5 @@
<% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
ui_theme.html.erb ui_theme.html.erb

View File

@ -10,12 +10,13 @@
<li><%#= link_to content_tag(:i, nil, :class => 'icons-asset') + t('admin.asset'), admin_assets_path %></li> <li><%#= link_to content_tag(:i, nil, :class => 'icons-asset') + t('admin.asset'), admin_assets_path %></li>
<li class="divider"></li> <li class="divider"></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-structure') + t('admin.structure'), admin_items_path %></li> <li><%= link_to content_tag(:i, nil, :class => 'icons-structure') + t('admin.structure'), admin_items_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), admin_site_site_info_path(@site) %></li>
<li><%#= link_to content_tag(:i, nil, :class => 'icons-plus-cube') + t('admin.add_item') %></li> <li><%#= link_to content_tag(:i, nil, :class => 'icons-plus-cube') + t('admin.add_item') %></li>
</ul> </ul>
</div> </div>
<ul class="nav"> <ul class="nav">
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li> <li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
<li><a class="orbit-bar-desktop" href="#">Desktop</a></li> <li><a class="orbit-bar-desktop" href="https://i.nccu.edu.tw/Login.aspx?ReturnUrl=/Default.aspx" target="_blank">Desktop</a></li>
</ul> </ul>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li class="dropdown language"> <li class="dropdown language">

View File

@ -27,6 +27,7 @@
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %> <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %>
<% end -%> <% end -%>
<% end -%> <% end -%>
@ -66,14 +67,3 @@
<%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %>
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('sites') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), admin_site_site_info_path(@site) %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('sites')) do -%>
<%= content_tag :li, link_to(t('admin.site_info'), admin_site_site_info_path(@site)), :class => active_for_action('sites', 'site_info') %>
<%= content_tag :li, link_to(t('admin.system_info'), admin_site_system_info_path(@site)), :class => active_for_action('sites', 'system_info') %>
<%= content_tag :li, link_to(t('admin.language'), admin_site_language_path(@site)), :class => active_for_action('sites', 'language') %>
<%= content_tag :li, link_to(t('admin.mail_setting'), admin_site_mail_setting_path(@site)), :class => active_for_action('sites', 'mail_setting') %>
<%= content_tag :li, link_to(t('admin.ui_theme'), admin_site_ui_theme_path(@site)), :class => active_for_action('sites', 'ui_theme') %>
<% end -%>
<% end -%>

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title><%= @title || APP_CONFIG['orbit'] %></title> <title><%= @title || APP_CONFIG['orbit'] %></title>
<link rel="shortcut icon" href="<%= asset_path "ncculogo.ico" %>">
<!--[if lt IE 9]> <!--[if lt IE 9]>
<%= javascript_include_tag "html5" %> <%= javascript_include_tag "html5" %>
<![endif]--> <![endif]-->
@ -25,7 +26,11 @@
<div class="viewport"> <div class="viewport">
<div class="overview"> <div class="overview">
<ul class="nav nav-list"> <ul class="nav nav-list">
<%= render 'layouts/side_bar' %> <% if !(yield :side_bar).blank? %>
<%= yield :side_bar %>
<% else %>
<%= render 'layouts/side_bar' %>
<% end %>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<%= page_title(@item).html_safe %> <%= page_title(@item).html_safe %>
<link rel="shortcut icon" href="<%= asset_path "ncculogo.ico" %>">
<%= page_metas(@item).html_safe %> <%= page_metas(@item).html_safe %>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<%= javascript_include_tag "html5" %> <%= javascript_include_tag "html5" %>

View File

@ -62,6 +62,8 @@ module Orbit
# Enable the asset pipeline # Enable the asset pipeline
config.assets.enabled = true config.assets.enabled = true
#config.time_zone = 'Taipei'
ENV['TZ'] = 'Asia/Taipei'
end end
end end
Orbit_Apps = [] Orbit_Apps = []

View File

@ -0,0 +1,20 @@
require 'resque_scheduler'
# require 'resque_scheduler/server'
# require 'yaml'
Resque.redis = 'localhost:6379'
#Resque.redis.namespace = "resque:SchedulerExample"
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
#Resque::Scheduler.dynamic = true
Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file }
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))

View File

@ -162,6 +162,14 @@ en:
list_users: Users list list_users: Users list
list_infos: User information list list_infos: User information list
list_roles: User roles list list_roles: User roles list
mail_address: Address
mail_port: Port
mail_domain: Domain
mail_authentication: Authentication
mail_user_name: User Name
mail_password: Password
mail_tls: TLS
mail_enable_starttls_auto: Enable Start TLS Auto
member: Member member: Member
menu_enabled_for: Menu enabled for menu_enabled_for: Menu enabled for
module: module:
@ -205,6 +213,7 @@ en:
site_description: Site description site_description: Site description
site_footer: Site footer site_footer: Site footer
site_settings: Site Setting site_settings: Site Setting
site_sub_menu: Site sub-menu
site_title: Site title site_title: Site title
super_pages: Super pages super_pages: Super pages
structure: Structure structure: Structure
@ -242,6 +251,12 @@ en:
panel: User panel panel: User panel
role: User role role: User role
dashboard:
bulletin: Announcement
news_bulletin: News
page_context: Page
web_link: Link
panel: panel:
modal: modal:

View File

@ -159,6 +159,14 @@ zh_tw:
list_users: 使用列表 list_users: 使用列表
list_infos: 用戶資料列表 list_infos: 用戶資料列表
list_roles: 用戶身份列表 list_roles: 用戶身份列表
mail_address: 郵件地址
mail_port: 傳輸埠
mail_domain: 網域名稱
mail_authentication: 認證
mail_user_name: 帳號
mail_password: 密碼
mail_tls: TLS
mail_enable_starttls_auto: Enable Start TLS Auto
member: 會員 member: 會員
menu_enabled_for: 選單啟用 menu_enabled_for: 選單啟用
module: module:
@ -195,6 +203,7 @@ zh_tw:
site_description: 網站描述 site_description: 網站描述
site_footer: 網站頁尾 site_footer: 網站頁尾
site_settings: 基本設定 site_settings: 基本設定
site_sub_menu: 網站次選單
site_title: 網站標題 site_title: 網站標題
setup_member: 成員設置 setup_member: 成員設置
setup_translations: 語系設定 setup_translations: 語系設定
@ -237,6 +246,12 @@ zh_tw:
panel: 用戶面板 panel: 用戶面板
role: 用戶身份 role: 用戶身份
dashboard:
bulletin: 公告
news_bulletin: 新聞
page_context: 頁面
web_link: 鏈接
panel: panel:

55
config/resque.god Normal file
View File

@ -0,0 +1,55 @@
rails_env = 'development' #ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/orbit/orbit"
num_workers = rails_env == 'production' ? 5 : 2
num_workers.times do |num|
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "resque-#{num}"
w.group = 'resque'
w.interval = 30.seconds
p "/usr/bin/rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
# w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}"
w.uid = 'kaito'
w.gid = 'staff'
# restart if memory gets too high
w.transition(:up, :restart) do |on|
on.condition(:memory_usage) do |c|
c.above = 350.megabytes
c.times = 2
end
end
# determine the state on startup
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
c.interval = 5.seconds
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
c.interval = 5.seconds
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_running) do |c|
c.running = false
end
end
end
end

View File

@ -0,0 +1,17 @@
# do_mail_matt:
# every: 10s
# class: FetchTime
# args:
# description: Runs the perform method in FetchTime
nccu_daily_ldap_sync:
cron: * * [0,12] * * *
class: SyncDb
args:
description: Sync NCCU middle site with Orbit for LDAP data
nccu_claender_sync:
cron: * * [0,12] * * *
class: NccuCalendar
args:
description: Sync NCCU calendar RSS Feeds

View File

@ -1,5 +1,5 @@
Orbit::Application.routes.draw do Orbit::Application.routes.draw do
mount Resque::Server, :at => "/admin/resque"
devise_for :users devise_for :users
# routes for sinatra app # routes for sinatra app
@ -12,6 +12,7 @@ Orbit::Application.routes.draw do
# routes for admin # routes for admin
namespace :admin do namespace :admin do
mount Resque::Server.new, :at => "/resque"
resources :assets resources :assets
resources :app_auths resources :app_auths
resources :object_auths do resources :object_auths do

BIN
dump.rdb

Binary file not shown.

View File

@ -29,9 +29,10 @@ module ParserBackEnd
public_r_tags = parse_content_edits(body, page, id) public_r_tags = parse_content_edits(body, page, id)
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true) parse_footer(body, page, true)
parse_sub_menu(body, page, true)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page, id, true)
end end
body.to_html body.to_html

View File

@ -1,19 +1,19 @@
module ParserCommon module ParserCommon
include ActionView::Helpers::TagHelper include ActionView::Helpers::TagHelper
def menu_level(page, current, menu, edit = false) def menu_level(page, current_page, current, menu, edit = false)
res = '' res = ''
if page.children.size > 0 if page.ordered_and_visible_children.size > 0
res << "<ul class='" res << "<ul class='"
res << menu.values["class_#{current}"] rescue nil res << menu.values["class_#{current}"] rescue nil
res << "'>" res << "'>"
i = nil i = nil
i = 1 if menu.values["li_incremental_#{current}"] i = 1 if menu.values["li_incremental_#{current}"]
if menu.values['home'] && current == 1 if menu.values['home'] && current == 1
res << menu_li(page, current, menu, i, edit) res << menu_li(page, current_page, current, menu, i, edit)
end end
page.ordered_and_visible_children.each do |child| page.ordered_and_visible_children.each do |child|
res << menu_li(child, current, menu, i, edit) res << menu_li(child, current_page, current, menu, i, edit)
i += 1 if i i += 1 if i
end end
res << "</ul>" res << "</ul>"
@ -21,28 +21,40 @@ module ParserCommon
res res
end end
def menu_li(page, current, menu, i, edit) def menu_li(page, current_page, current, menu, i, edit)
res = "<li class=" res = "<li class='"
res << menu.values["li_class_#{current}"] rescue nil res << menu.values["li_class_#{current}"] rescue nil
res << "_#{i}" if i res << "_#{i}" if i
res << ">" res << " active" if (current_page.id.eql?(page.id) || current_page.ancestor_ids.include?(page.id))
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" res << "'>"
res << "<a href='/#{edit ? admin_page_path(page.id) : page.full_name}'><span>#{page.i18n_variable[I18n.locale]}</span></a>"
if page.ordered_and_visible_children.size > 0 && current <= menu.levels if page.ordered_and_visible_children.size > 0 && current <= menu.levels
res << "<span class='dot'></span>" res << "<span class='dot'></span>"
res << menu_level(page, current + 1, menu, edit) res << menu_level(page, current_page, current + 1, menu, edit)
end unless (page.is_home? rescue nil) end unless (page.is_home? rescue nil)
res << "</li>" res << "</li>"
end end
# ad_banners # ad_banners
def parse_ad_banners(body = nil, page = nil, id = nil) def parse_ad_banners(body = nil, page = nil, id = nil, edit=nil)
body.css('ad_banner').each do |banner| body.css('ad_banner').each do |banner|
res = '' res = ''
ad_banner = AdBanner.find(banner["id"]) rescue nil ad_banner = AdBanner.find(banner["id"]) rescue nil
if ad_banner if ad_banner
res << "<script type='text/javascript'> res << "<script type='text/javascript'>
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); }); $(document).ready(function(){
$('#slideshow-#{ad_banner.title.dehumanize}').cycle({
delay: -1000,
fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}',
timeoutFn: getTimeout,
pager: '#banner_nav',
pagerAnchorBuilder: function(idx, slide) {
return \"<li><a href='#'>sfdsfsf</a></li>\";
}
});
});
</script>" </script>"
res << "<ul id='banner_nav' class='clear'></ul>"
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>" res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
printable_ad_images = [] printable_ad_images = []
ad_banner.ad_images.each do |ad_image| ad_banner.ad_images.each do |ad_image|
@ -55,7 +67,7 @@ module ParserCommon
printable_ad_images.shuffle! printable_ad_images.shuffle!
printable_ad_images.each do |ad_image| #TODO Need Reflact printable_ad_images.each do |ad_image| #TODO Need Reflact
res << "<img src='#{ad_image.file}' " res << "<img src='#{ad_image.file}' "
res << "alt='#{ad_image.title || ' '}' " res << "alt='#{ad_image.title[I18n.locale] || ' '}' "
res << "time_to_next='#{ad_banner.transition_msec}' " res << "time_to_next='#{ad_banner.transition_msec}' "
res << "link_open='#{ad_image.link_open}' " res << "link_open='#{ad_image.link_open}' "
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' " # res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
@ -70,7 +82,7 @@ module ParserCommon
end end
# page_images # page_images
def parse_images(body, page) def parse_images(body, page, id = nil, edit=nil)
body.css('.page_image').each do |page_image| body.css('.page_image').each do |page_image|
# image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
# image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
@ -92,38 +104,59 @@ module ParserCommon
page_menu = body.css('.page_menu').first page_menu = body.css('.page_menu').first
home = get_homepage home = get_homepage
menu = page.design.layout.menu menu = page.design.layout.menu
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 1, menu, edit)) fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, page, 1, menu, edit))
page_menu.swap(fragment) page_menu.swap(fragment)
end end
# sub_menus # sub_menus
def parse_sub_menus(body = nil, page = nil, id = nil) def parse_sub_menus(body = nil, page = nil, id = nil, edit=nil)
body.css('sub_menu').each do |sub_menu| body.css('sub_menu').each do |sub_menu|
menu_page = Page.find(sub_menu['id']) rescue nil
res = '' res = ''
res << "<div class='category_list'>" if menu_page && menu_page.ordered_and_visible_children.size > 0
res << "<h3 class='h3'>#{page.i18n_variable[I18n.locale]}</h3>" res << "<div class='category_list'>"
res << "<ul class='list'>" res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>"
page.ordered_and_visible_children.each do |child| res << "<ul class='list'>"
res << "<li>" menu_page.ordered_and_visible_children.each do |child|
res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>" res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>"
res << "</li>" res << "<a href='/#{edit ? admin_page_path(child.id) : child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>"
res << "</li>"
end
res << "</ul>"
res << "</h3>"
res << "</div>"
end end
res << "</ul>"
res << "</h3>"
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body, res) fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
sub_menu.swap(fragment) sub_menu.swap(fragment)
end end
end end
# page_menu # page_footer
def parse_footer(body, page, edit=nil) def parse_footer(body, page, edit=nil)
page_footer = body.css('.page_footer').first page_footer = body.css('.page_footer').first
res = "<div, id='footer', class='footer'>" if page_footer
res << @site.footer[I18n.locale] res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>"
res << "</div>" res << @site.footer[I18n.locale] rescue nil
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) res << "</div>"
page_footer.swap(fragment) rescue nil fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_footer.swap(fragment) rescue nil
else
''
end
end
# page_sub_menu
def parse_sub_menu(body, page, edit=nil)
page_sub_menu = body.css('.page_sub_menu').first
if page_sub_menu
res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>"
res << @site.sub_menu[I18n.locale] rescue nil
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_sub_menu.swap(fragment) rescue nil
else
''
end
end end
end end

View File

@ -26,7 +26,8 @@ module ParserFrontEnd
parse_menu(body, page) parse_menu(body, page)
public_r_tags = parse_contents(body, page, id,params[:preview]) public_r_tags = parse_contents(body, page, id,params[:preview])
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true) parse_footer(body, page)
parse_sub_menu(body, page)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page,id)

View File

@ -1,3 +1,4 @@
require 'resque_scheduler/tasks'
# encoding: utf-8 # encoding: utf-8
namespace :anc do namespace :anc do

39
lib/tasks/resque.rake Normal file
View File

@ -0,0 +1,39 @@
# require "resque/tasks"
# require 'resque/scheduler'
# require 'resque/scheduler'
#
# task "resque:setup" => :environment
# Resque tasks
require 'resque/tasks'
require 'resque_scheduler/tasks'
namespace :resque do
task :setup => :environment do
require 'resque'
require 'resque_scheduler'
require 'resque/scheduler'
# you probably already have this somewhere
Resque.redis = 'localhost:6379'
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
#Resque::Scheduler.dynamic = true
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
Resque.schedule = YAML.load_file('config/resque_schedule.yml')
# If your schedule already has +queue+ set for each job, you don't
# need to require your jobs. This can be an advantage since it's
# less code that resque-scheduler needs to know about. But in a small
# project, it's usually easier to just include you job classes here.
# So, someting like this:
#require 'jobs'
end
end

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>國立政治大學校園活動行事曆</title>
<link rel="alternate" href="http://events.nccu.edu.tw/" />
<subtitle>本日最新活動</subtitle>
<dc:language>zh-tw</dc:language>
<entry>
<title>2012年世界狂歡節-「框」住瞬間「框」住世界</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2901&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/01-101/05/08 00:00-23:59</summary>
</entry>
<entry>
<title>2012年世界狂歡節-環友世界</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2902&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/01-101/05/10 00:00-23:59</summary>
</entry>
<entry>
<title>2012年世界狂歡節-從政大看台灣</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2903&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/01-101/05/10 08:00-22:00</summary>
</entry>
<entry>
<title>2012年世界狂歡節-美食嘉年華</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2905&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/08-101/05/10 12:00-14:00</summary>
</entry>
<entry>
<title>2012年世界狂歡節-「原,夜」晚會</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2906&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/08 19:00-21:00</summary>
</entry>
<entry>
<title>2012年世界狂歡節-開幕式</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2907&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/05/08 12:10-13:30</summary>
</entry>
<entry>
<title>職場講座「數位文本實務課程」</title>
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2874&amp;key2=20120508" />
<author>
<name />
</author>
<summary type="text">101/04/24-101/05/15 12:20-13:50</summary>
</entry>
</feed>

View File

@ -14,7 +14,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
if !params[:category_id].blank? if !params[:category_id].blank?
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) tmp = AnnouncementTag.find(params[:tag_id]) rescue nil
tmp = AnnouncementTag.where(key: params[:tag_id])[0] unless tmp
@bulletins = tmp.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else else
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end end

View File

@ -26,7 +26,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
end end
def bulletins_and_web_links def bulletins_and_web_links
@tags = AnnouncementTag.all @tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest'])
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil

View File

@ -91,12 +91,20 @@
</div> </div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3> <h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<div class="widget-content clear form-horizontal"> <div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %> <p>
<%= content_tag :label,:class => "checkbox inline" do -%> <% @tags.each do |tag| %>
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%> <%= content_tag :label,:class => "checkbox inline" do -%>
<%= tag[I18n.locale] %> <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
<% end %> <% end %>
<% end %> </p>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<hr>
<input type="text" class="input-xlarge">
</div> </div>
</div> </div>
<% if params[:action] != 'new' %> <% if params[:action] != 'new' %>

View File

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

View File

@ -3,7 +3,7 @@
<h3 class="h3"><%= t('announcement.categories') %></h3> <h3 class="h3"><%= t('announcement.categories') %></h3>
<ul class="list"> <ul class="list">
<% @bulletin_categorys.each do |category| %> <% @bulletin_categorys.each do |category| %>
<li> <li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %> <%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
</li> </li>
<% end %> <% end %>
@ -11,13 +11,11 @@
</div> </div>
<div class="tag_cloud"> <div class="tag_cloud">
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3> <h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
<ul class="cloud"> <div class="cloud">
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<li class="hot<%#=rand(4) + 1%>"> <%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id), :class => "hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil}" %>
<%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id) %>
</li>
<% end %> <% end %>
</ul> </div>
</div> </div>
<!-- <div class="clear"></div> --> <!-- <div class="clear"></div> -->
<!-- <div class="rss_feed"> <!-- <div class="rss_feed">

View File

@ -13,7 +13,9 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
if !params[:category_id].blank? if !params[:category_id].blank?
@news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) tmp = NewsTag.find(params[:tag_id]) rescue nil
tmp = NewsTag.where(key: params[:tag_id])[0] unless tmp
@news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) rescue nil
else else
@news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end end

View File

@ -8,25 +8,24 @@
<h1 class="h1"><%= t('news.list_news') %></h1> <h1 class="h1"><%= t('news.list_news') %></h1>
<% end %> <% end %>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tbody>
<th><%= t('news.news_bulletin.category') %></th> <tr>
<th><%= t('news.news_bulletin.title') %></th> <th class="span2"><%= t('news.news_bulletin.image') %></th>
<th><%= t('news.news_bulletin.postdate') %></th> <th><%= t('news.news_bulletin.title') %></th>
</tr> <th class="span2 pagination-right"><%= t('news.news_bulletin.postdate') %></th>
</tr>
<% @news_bulletins.each do |post| %> <% @news_bulletins.each do |post| %>
<tr> <tr>
<td><%= post.news_bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= image_tag post.image %></td>
<td><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post) %> <td>
<%#= link_to post.title, panel_news_back_end_news_bulletin_path(post) %> <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
</td> <%= post.subtitle[I18n.locale].html_safe %>
<td><%= post.postdate %></td> </td>
</tr> <td><%= post.postdate %></td>
</tr>
<% end %> <% end %>
</tbody>
</table> </table>
<%= paginate @news_bulletins, :params => {:inner => 'false'} %> <%= paginate @news_bulletins, :params => {:inner => 'false'} %>

View File

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

View File

@ -3,7 +3,7 @@
<h3 class="h3"><%= t('announcement.categories') %></h3> <h3 class="h3"><%= t('announcement.categories') %></h3>
<ul class="list"> <ul class="list">
<% @news_bulletin_categorys.each do |category| %> <% @news_bulletin_categorys.each do |category| %>
<li> <li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %> <%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
</li> </li>
<% end %> <% end %>
@ -11,13 +11,11 @@
</div> </div>
<div class="tag_cloud"> <div class="tag_cloud">
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3> <h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
<ul class="cloud"> <div class="cloud">
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<li class="hot<%#=rand(4) + 1%>"> <%= link_to tag[I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag.id), :class => "hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil}" %>
<%= link_to tag[I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag.id) %>
</li>
<% end %> <% end %>
</ul> </div>
</div> </div>
<!-- <div class="clear"></div> --> <!-- <div class="clear"></div> -->
<!-- <div class="rss_feed"> <!-- <div class="rss_feed">

View File

@ -16,9 +16,9 @@
</table> </table>
<% end %> <% end %>
<div id="web_link_pagination" class="paginationFixed">
<%= paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path, :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path, :class => 'btn btn-primary pull-right' %>
<div id="web_link_pagination" class="paginationFixed">
<%= paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div> </div>