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

This commit is contained in:
Christophe Vilayphiou 2012-05-08 17:24:40 +08:00
commit d2e07f537a
19 changed files with 104 additions and 135 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -18,6 +18,7 @@ class Site
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 +34,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 +46,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 +70,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

@ -57,6 +57,14 @@
<% end %> <% end %>
</div> </div>
</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>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

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.news_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.news_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 -%>

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]-->

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

@ -205,6 +205,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

View File

@ -195,6 +195,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: 語系設定

View File

@ -29,6 +29,7 @@ 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)

View File

@ -3,7 +3,7 @@ module ParserCommon
def menu_level(page, current, menu, edit = false) def menu_level(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 << "'>"
@ -127,14 +127,32 @@ module ParserCommon
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 << @site.footer[I18n.locale] rescue nil
res << "</div>" res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_footer.swap(fragment) rescue nil 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

@ -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 = NewsTag.find(params[:tag_id]) rescue nil
tmp = NewsTag.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) rescue nil
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

@ -7,7 +7,7 @@
<% sys_user.sub_roles.each do |sr| %> <% sys_user.sub_roles.each do |sr| %>
<div class="for_unit" style="display:none;"> <%= sr.key %></div> <div class="for_unit" style="display:none;"> <%= sr.key %></div>
<% end %> <% end %>
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %> <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon"> <div class="check-icon">
</div> </div>
<div class='member-avatar'> <div class='member-avatar'>

View File

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

@ -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">
<tbody>
<tr> <tr>
<th><%= t('news.news_bulletin.category') %></th> <th><%= 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><%= t('news.news_bulletin.postdate') %></th>
</tr> </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) %>
<%= post.subtitle[I18n.locale].html_safe %>
</td> </td>
<td><%= post.postdate %></td> <td><%= post.postdate %></td>
</tr> </tr>
<% end %>
<% end %> </tbody>
</table> </table>
<%= paginate @news_bulletins, :params => {:inner => 'false'} %> <%= paginate @news_bulletins, :params => {:inner => 'false'} %>

View File

@ -14,58 +14,21 @@
<div class="news_paragraph"> <div class="news_paragraph">
<%= @news_bulletin.text[I18n.locale].html_safe %> <%= @news_bulletin.text[I18n.locale].html_safe %>
</div> </div>
<% if @news_bulletin.news_bulletin_links.size > 0 %>
<b><%= t('announcement.link') %></b>
<% @news_bulletin.news_bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
<% end %>
<% if @news_bulletin.news_bulletin_files.size > 0 %>
<b><%= t('announcement.file') %></b>
<% @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 %>
<% end %>
<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 %>