Ray's changes

This commit is contained in:
Christophe Vilayphiou 2012-05-09 04:15:02 +08:00
parent 8d70d87120
commit 9ead6cafda
10 changed files with 403 additions and 72 deletions

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

@ -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);
@ -734,15 +764,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 +917,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 +1050,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 +1161,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 +1249,5 @@
} }
/*21*/ /*21*/
.icons- { .icons- {
background-position: -0px -640px background-position: -0px -640px;
} }

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

@ -1,7 +1,7 @@
module ParserCommon module ParserCommon
include ActionView::Helpers::TagHelper include ActionView::Helpers::TagHelper
def menu_level(page, current_page_id, current, menu, edit = false) def menu_level(page, current_page, current, menu, edit = false)
res = '' res = ''
if page.ordered_and_visible_children.size > 0 if page.ordered_and_visible_children.size > 0
res << "<ul class='" res << "<ul class='"
@ -10,10 +10,10 @@ module ParserCommon
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_page_id, 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_page_id, 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,16 +21,16 @@ module ParserCommon
res res
end end
def menu_li(page, current_page_id, 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 << " active" if page.id.eql?(current_page_id) res << " active" if (current_page.id.eql?(page.id) || current_page.ancestor_ids.include?(page.id))
res << "'>" res << "'>"
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" 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_page_id, 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
@ -104,7 +104,7 @@ 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, page.id, 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

View File

@ -14,21 +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 %> <% if @bulletin.bulletin_links.size > 0 %>
<b><%= t('announcement.link') %></b> <div>
<% @bulletin.bulletin_links.each do | blink | %> <i class="icons-link"></i>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> <div class="showLink">
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</div>
</div>
<% end %> <% end %>
<% end %> <% if @bulletin.bulletin_files.size > 0 %>
<div>
<% if @bulletin.bulletin_files.size > 0 %> <i class="icons-paperclip"></i>
<b><%= t('announcement.file') %></b> <div class="showFile">
<% @bulletin.bulletin_files.each do | bfile | %> <% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle[I18n.locale], 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} if bfile.file.file %>
<% end %>
</div>
</div>
<% end %> <% end %>
<% 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>

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]) ? '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

@ -9,21 +9,21 @@
<% end %> <% end %>
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>
<tr> <tr>
<th><%= t('news.news_bulletin.image') %></th> <th class="span2"><%= t('news.news_bulletin.image') %></th>
<th><%= t('news.news_bulletin.title') %></th> <th><%= t('news.news_bulletin.title') %></th>
<th><%= t('news.news_bulletin.postdate') %></th> <th class="span2 pagination-right"><%= t('news.news_bulletin.postdate') %></th>
</tr> </tr>
<% @news_bulletins.each do |post| %> <% @news_bulletins.each do |post| %>
<tr> <tr>
<td><%= image_tag post.image %></td> <td><%= image_tag post.image %></td>
<td> <td>
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post) %> <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %> <%= post.subtitle[I18n.locale].html_safe %>
</td> </td>
<td><%= post.postdate %></td> <td><%= post.postdate %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>

View File

@ -14,20 +14,28 @@
<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 %> <% if @news_bulletin.news_bulletin_links.size > 0 %>
<b><%= t('announcement.link') %></b> <div>
<% @news_bulletin.news_bulletin_links.each do | blink | %> <i class="icons-link"></i>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> <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 %> <% end %>
<% end %> <% if @news_bulletin.news_bulletin_files.size > 0 %>
<div>
<% if @news_bulletin.news_bulletin_files.size > 0 %> <i class="icons-paperclip"></i>
<b><%= t('announcement.file') %></b> <div class="showFile">
<% @news_bulletin.news_bulletin_files.each do | bfile | %> <% @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 %> <%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</div>
</div>
<% end %> <% end %>
<% 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>

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]) ? '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">