diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js
new file mode 100644
index 0000000..e0d9bf9
--- /dev/null
+++ b/app/assets/javascripts/orbit-bar-search.js
@@ -0,0 +1,10 @@
+$(document).ajaxStop(function() {
+ $('.nav').find('.dropdown').on({
+ mouseleave: function() {
+ $(this).removeClass("open");
+ },
+ mouseenter: function() {
+ $(this).addClass("open")
+ }
+ });
+});
\ No newline at end of file
diff --git a/app/assets/stylesheets/member_select.css b/app/assets/stylesheets/member_select.css
index 0d4e9df..775bf93 100644
--- a/app/assets/stylesheets/member_select.css
+++ b/app/assets/stylesheets/member_select.css
@@ -85,7 +85,6 @@
width: auto;
}
-
/* Check Box Card */
.checkbox-card {
margin: 0;
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 0000000..927719b
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -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] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員
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
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8bd19c1..e6f5a6b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -194,8 +194,8 @@ module ApplicationHelper
stylesheets << "\n"
stylesheets << "\n" if page.design.css_reset
# stylesheets << "\n"
- # stylesheets << "\n"
- stylesheets << "\n"
+ # stylesheets << "\n"
+ stylesheets << "\n"
stylesheets << "\n" if page.design.css_default
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "\n" if theme
@@ -204,9 +204,12 @@ module ApplicationHelper
def page_javascripts(page, edit=nil)
javascripts = ''
+ unless edit
+ javascripts << "\n"
+ end
# javascripts << "\n"
# javascripts << "\n"
- javascripts << "\n"
+ javascripts << "\n"
page.design.javascripts.each do |js|
javascripts << ""
end
@@ -303,7 +306,7 @@ module ApplicationHelper
# NTU link
def get_link(site_number)
- "http://#{request.host}:2#{site_number}00"
+ "http://#{site_number}.#{request.domain(3)}"
end
def sortable(column, title = nil, options = {})
diff --git a/app/views/admin/member_selects/_modal_select.html.erb b/app/views/admin/member_selects/_modal_select.html.erb
index e8d14e7..99f4f02 100644
--- a/app/views/admin/member_selects/_modal_select.html.erb
+++ b/app/views/admin/member_selects/_modal_select.html.erb
@@ -28,7 +28,7 @@
<%= t(:promoter) %>:
++ <%= link_to user.name, "mailto:#{user.email}", class: "promoter-name" %> / <%= user.office_tel %> +
+or
+