This commit is contained in:
Manson Wang 2014-02-11 14:42:12 +08:00 committed by manson
parent d23a956085
commit b020b8e13f
15 changed files with 144 additions and 16 deletions

View File

@ -0,0 +1,10 @@
$(document).ajaxStop(function() {
$('.nav').find('.dropdown').on({
mouseleave: function() {
$(this).removeClass("open");
},
mouseenter: function() {
$(this).addClass("open")
}
});
});

View File

@ -85,7 +85,6 @@
width: auto; width: auto;
} }
/* Check Box Card */ /* Check Box Card */
.checkbox-card { .checkbox-card {
margin: 0; margin: 0;

View File

@ -0,0 +1,40 @@
# encoding: utf-8
class SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
def create
@site = Site.first
private_key = OpenSSL::PKey::RSA.new(@site.private_key)
wresult = private_key.private_decrypt(request.params['wresult'])
@ids = wresult.split("@")
login_uid = @ids[0]
resource = User.first(conditions:{user_id: login_uid})
if !resource.blank?
resource_name = resource.class.to_s.downcase
sign_in(resource_name, resource)
session[:user_id_type] = "myntu"
redirect_to after_sign_in_path_for(resource)
else
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
redirect_to :root
end
end
def destroy
@user_id_type = session[:user_id_type]
sign_out
if @user_id_type == "myntu"
redirect_to "https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignout1.0&wreply=https://galogin.ntu.edu.tw"
else
redirect_to root_path
end
end
end

View File

@ -194,8 +194,8 @@ module ApplicationHelper
stylesheets << "<link href='#{asset_path 'orbit_bar_bootstrap'}' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='#{asset_path 'orbit_bar_bootstrap'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.css_reset.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_reset stylesheets << "<link href='#{page.design.css_reset.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_reset
# stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n" # stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
# stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n" # stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
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
@ -204,9 +204,12 @@ module ApplicationHelper
def page_javascripts(page, edit=nil) def page_javascripts(page, edit=nil)
javascripts = '' javascripts = ''
unless edit
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
end
# javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n" # javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n"
# javascripts << "<script type='text/javascript' src='/assets/jquery.cycle.all.latest.js'></script>\n" # javascripts << "<script type='text/javascript' src='/assets/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
page.design.javascripts.each do |js| page.design.javascripts.each do |js|
javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>" javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
end end
@ -303,7 +306,7 @@ module ApplicationHelper
# NTU link # NTU link
def get_link(site_number) def get_link(site_number)
"http://#{request.host}:2#{site_number}00" "http://#{site_number}.#{request.domain(3)}"
end end
def sortable(column, title = nil, options = {}) def sortable(column, title = nil, options = {})

View File

@ -28,7 +28,7 @@
<div class="form-actions"> <div class="form-actions">
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button> <button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
<%= submit_tag t(:submit), class: "btn btn-primary" %> <%= submit_tag t(:submit), class: "btn btn-primary" %>
<%= hidden_field_tag field, @field %> <%= hidden_field_tag field, @field %>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -54,7 +54,7 @@
<div class="form-actions condition"> <div class="form-actions condition">
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button> <button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
<%= submit_tag t(:submit), class: "btn btn-primary" %> <%= submit_tag t(:submit), class: "btn btn-primary" %>
<%= hidden_field_tag field, @field %> <%= hidden_field_tag field, @field %>
</div> </div>
</fieldset> </fieldset>
<% end %> <% end %>

View File

@ -0,0 +1,14 @@
<% unless users.blank? %>
<div class="promoter-block">
<p class="promoter-title"><%= t(:promoter) %></p>
<ul>
<% users.each do |user| %>
<li class="promoter">
<p>
<%= link_to user.name, "mailto:#{user.email}", class: "promoter-name" %> / <span class="promoter-phone"><%= user.office_tel %></span>
</p>
</li>
<% end %>
</ul>
</div>
<% end %>

View File

@ -1,4 +1,5 @@
<% content_for :page_specific_javascript do -%> <% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "member-selection" %>
<%= javascript_include_tag "lib/jquery.nanoscroller" %> <%= javascript_include_tag "lib/jquery.nanoscroller" %>
<%= javascript_include_tag "lib/checkbox.card" %> <%= javascript_include_tag "lib/checkbox.card" %>
<% end -%> <% end -%>

View File

@ -12,10 +12,11 @@
<input name="utf8" type="hidden" value="" /> <input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" /> <input name="authenticity_token" type="hidden" value="" />
</div> </div>
<!-- <div class="other-sign-in"> <div class="other-sign-in">
<a class="btn btn-primary" type="submit">Other Sign In</a> <% @request_hosts = request.host_with_port.split(".") %>
<a class="btn btn-primary" type="submit" href="https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignin1.0&wtrealm=https://galogin.ntu.edu.tw/saml_login&wctx=<%= @request_hosts[0] %>">使用計中帳號登入</a>
<p>or</p> <p>or</p>
</div> --> </div>
<div class="form-block"> <div class="form-block">
<div class="form-list clearfix"> <div class="form-list clearfix">
<form class="content" accept-charset="UTF-8" action="/users/sign_in" method="post"> <form class="content" accept-charset="UTF-8" action="/users/sign_in" method="post">

View File

@ -7,6 +7,16 @@
</form> </form>
</li> </li>
<!-- ntu sites -->
<li id="orbit-tag" class="dropdown">
<a class="dropdown-toggle orbit-bar-language" data-icons="&#xe02d;" href="#" data-toggle="dropdown"></a>
<ul class="dropdown-menu language-menu">
<% t('ntu.site_names').each do |site| %>
<li><%= link_to site[1], get_link(site[0]) %></li>
<% end %>
</ul>
</li>
<!-- Language --> <!-- Language -->
<li id="orbit-language" class="dropdown"> <li id="orbit-language" class="dropdown">
<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="<%= t('site.language')%>"><%= t(:_locale, :locale => I18n.locale) %></a> <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="<%= t('site.language')%>"><%= t(:_locale, :locale => I18n.locale) %></a>
@ -30,7 +40,7 @@
<% if @site.desktop_closed %> <% if @site.desktop_closed %>
<li><%= link_to content_tag(:i, nil, class: 'icons-screen') + ' ' + t(:desktop), desktop_path, tabindex: '-1' %></li> <li><%= link_to content_tag(:i, nil, class: 'icons-screen') + ' ' + t(:desktop), desktop_path, tabindex: '-1' %></li>
<% end %> <% end %>
<li><%= link_to content_tag(:i, nil, class: 'icons-logout') + ' ' + t(:logout), destroy_user_session_path, tabindex: '-1' %></li> <li><%= link_to content_tag(:i, nil, class: 'icons-logout') + ' ' + t(:logout), user_logout_path, tabindex: '-1' %></li>
<li class="divider"></li> <li class="divider"></li>
<li><a tabindex="-1" href="#"><i class="icons-lifebuoy"></i> <%= t(:help) %></a></li> <li><a tabindex="-1" href="#"><i class="icons-lifebuoy"></i> <%= t(:help) %></a></li>
</ul> </ul>
@ -50,6 +60,12 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<%= form_for :user, url: user_session_path, html: {class: 'container'} do |f| %> <%= form_for :user, url: user_session_path, html: {class: 'container'} do |f| %>
<div class="other-sign-in">
<% @request_hosts = request.host_with_port.split(".") %>
<a class="btn btn-primary" type="submit" href="https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignin1.0&wtrealm=https://galogin.ntu.edu.tw/saml_login&wctx=<%= @request_hosts[0] %>">使用計中帳號登入</a>
<p>or</p>
</div>
<div class="input-prepend"> <div class="input-prepend">
<span class="add-on"> <span class="add-on">
<i class="icon-user"></i> <i class="icon-user"></i>

View File

@ -1,10 +1,10 @@
#built-in-modules #built-in-modules
gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git' gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git', :branch => 'ntu_ga'
gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git' gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git', :branch => 'ntu_ga'
gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git' gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git'
gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git' gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git'
gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git' gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git', :branch => 'ntu_ga'
gem 'page_content', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-pagecontent.git' gem 'page_content', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-pagecontent.git', :branch => 'ntu_ga'
gem 'personal_book', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalbook.git' gem 'personal_book', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalbook.git'
gem 'personal_conference', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalconference.git' gem 'personal_conference', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalconference.git'
gem 'personal_diploma', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personaldiploma.git' gem 'personal_diploma', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personaldiploma.git'
@ -15,4 +15,7 @@ gem 'personal_lab', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-
gem 'personal_patent', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalpatent.git' gem 'personal_patent', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalpatent.git'
gem 'personal_project', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalproject.git' gem 'personal_project', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalproject.git'
gem 'personal_research', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalresearch.git' gem 'personal_research', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalresearch.git'
gem 'web_resource', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-webresource.git' gem 'web_resource', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-webresource.git'
gem 'ask', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-ask.git', :branch => 'ntu_ga'
gem 'survey', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-survey.git', :branch => 'ntu_ga'

View File

@ -397,6 +397,7 @@ en:
system_email: System Email system_email: System Email
preview: Preview preview: Preview
profile: Profile profile: Profile
promoter: Promoter
publications: Publications publications: Publications
purchase: Purchase purchase: Purchase
quantity: Quantity quantity: Quantity

17
config/locales/ntu.en.yml Normal file
View File

@ -0,0 +1,17 @@
en:
ntu:
rss_origin: Back to NTU Announcements
site_names:
"www": "Dean of General Affairs"
"sec": "Office of the Dean and Secretariat"
"doc": "Documentation Division"
"general": "General Service Division"
"property": "Property Management Division"
"construction": "Construction and Maintenance Division"
"cashier": "Cashier Division"
"procurement": "Procurement Division"
"fss": "Facilities Service Division"
"police": "Campus Security"
"social": "General Affairs Division, College of Social Science"
"medicine": "General Service Division, College of Medicine"

View File

@ -0,0 +1,17 @@
zh_tw:
ntu:
rss_origin: 回臺大校園公佈欄
site_names:
"www": "總務處"
"sec": "總務長室暨總務處秘書室"
"doc": "文書組"
"general": "事務組"
"property": "保管組"
"construction": "營繕組"
"cashier": "出納組"
"procurement": "採購組"
"fss": "經營管理組"
"police": "駐警隊"
"social": "社科院總務分處"
"medicine": "醫學院總務分處"

View File

@ -397,6 +397,7 @@ zh_tw:
sidebar_nav: 側欄導引 sidebar_nav: 側欄導引
system_email: 系統信箱 system_email: 系統信箱
profile: 基本資料 profile: 基本資料
promoter: 承辦人
publications: 著作 publications: 著作
purchase: 購買 purchase: 購買
quantity: 數量 quantity: 數量

View File

@ -9,6 +9,11 @@ Orbit::Application.routes.draw do
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
end end
devise_scope :user do
get 'user_login' => 'sessions#create'
match 'user_logout' => 'sessions#destroy'
end
mount Resque::Server, :at => "/admin/resque" mount Resque::Server, :at => "/admin/resque"
mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs" mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs"