Compare commits

..

21 Commits

Author SHA1 Message Date
Harry Bomrah 592c8c63fe added fix for member_attributes text_area 2015-07-20 20:48:28 +08:00
Harry Bomrah 2ccabb64f3 fix for some edit rendering 2015-07-20 19:50:34 +08:00
Harry Bomrah 9ec5e21500 fix for fallback if site cant communicate to store and also fixed edit mode 2015-07-20 17:29:29 +08:00
Harry Bomrah f9dd55eea2 fixed chinese detection for url. 2015-07-17 14:53:50 +08:00
Harry Bomrah afe1ffd437 page id validations for link and normal page fixed. 2015-07-16 19:42:05 +08:00
Harry Bomrah 898059c6d2 small fixes for various stuff 2015-07-15 14:00:48 +08:00
Harry Bomrah 8b8dd22e88 small bug fix for feeds if feed module is not present. 2015-07-09 14:20:49 +08:00
Harry Bomrah bead39d5b4 small fix 2015-07-08 20:17:30 +08:00
Harry Bomrah 93d66b5866 fix for meember role disabled fields and also role will delete all the attribute fields 2015-07-08 20:00:59 +08:00
Harry Bomrah 59a198005d added some stuff for feeds and utility 2015-07-07 19:55:46 +08:00
Harry Bomrah f7c377d092 allow ip in url for links 2015-07-06 18:36:14 +08:00
Harry Bomrah 1951c581a2 added meta tag mechanism for facebook 2015-07-03 19:52:05 +08:00
Harry Bomrah b2056a2ad5 some test mods for feeds 2015-07-01 15:13:28 +08:00
Harry Bomrah 251133748d fixed zh-cn conversion and also back page from page not available page. 2015-06-25 17:38:23 +08:00
Harry Bomrah 5acfed083a validation for links 2015-06-25 17:02:50 +08:00
Harry Bomrah afde19052e added default hash for links 2015-06-25 15:27:29 +08:00
Harry Bomrah e168b01f9b added page not available in language page. 2015-06-25 13:31:05 +08:00
rulingcom dd3b4f0384 sdk update for groups and orbit_bootstrap by joshua 2015-06-24 18:09:59 +08:00
Harry Bomrah 4068d8488a language switch for orbit bar can be enabled or disabled from backend. 2015-06-24 18:00:09 +08:00
Harry Bomrah 94f1de8de9 changed fields for member roles 2015-06-24 16:54:44 +08:00
Harry Bomrah 3dc625e34f modified dob for member profile 2015-06-24 01:38:12 +08:00
53 changed files with 827 additions and 585 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@
app/views/frontend
/public/uploads/*
public/assets/*
public/site_feeds/*
public/import_status.yml
public/announcement_link_widget_en.json
public/announcement_link_widget_zh_tw.json

View File

@ -47,9 +47,6 @@ gem 'ckeditor'
gem 'unicorn'
gem 'zhconv'
gem 'time_difference'
gem "net-ldap", "~> 0.3.1"
gem 'execjs'
gem 'therubyracer'

View File

@ -43,15 +43,15 @@
}
},
// Equal height for card
equalHeight: function() {
equalHeight: function(el) {
var bigbrother = -1,
$card = $('.group-card-inner');
$el = $(el);
$card.each(function() {
$el.each(function() {
bigbrother = bigbrother > $(this).height() ? bigbrother : $(this).height();
});
$card.each(function() {
$el.each(function() {
$(this).height(bigbrother);
});
},
@ -131,7 +131,8 @@
}
group.cycleFix();
group.equalHeight();
group.equalHeight('.group-card-inner');
group.equalHeight('.group-admin-edit-image-item');
group.plugins();
});

View File

@ -33,8 +33,18 @@ var FormValidator = function(form){
return re.test(value);
},
url : function(value){
if(value == "#"){
return true;
}
var reg = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
return reg.test(value);
},
urlwithip : function(value){
if(value == "#"){
return true;
}
var reg = new RegExp(/^https?\:\/\/[^\/\s]+(\/.*)?$/);
return reg.test(value);
}
}

View File

@ -791,6 +791,15 @@ legend {
display: block;
}
.simple-date-picker input:first-child {
margin-right: 3px;
}
.simple-date-picker select {
margin-right: 3px;
}
/* IE go die */
:root #sidebar .sub-nav-block:before {
display: block\9;

View File

@ -27,7 +27,7 @@ body {
max-width: none;
}
// Override Bootstrap modal
// Override Bootstrap modal
.modal.fade {
top: -65%;
}
@ -37,19 +37,23 @@ body {
.select2-container-multi {
margin-right: 0.9375rem;
min-width: 200px;
.select2-choices {
padding: 0;
border-radius: $general;
.select2-search-field {
input {
padding: 10px 5px;
}
}
}
.select2-search-choice {
padding: 10px 1.75rem 10px 0.7rem;
border-color: lighten($light-gray, 5%);
background: $white;
> div {
&:before {
content: "\F007";
@ -61,9 +65,11 @@ body {
}
}
}
.select2-search-choice-close {
right: 15px;
left: auto;
&:before {
content: "\f057";
font-family: FontAwesome;
@ -74,6 +80,7 @@ body {
font-size: 0.9375rem;
color: $dark-gray;
}
&:hover {
&:before {
color: $red;
@ -82,6 +89,7 @@ body {
}
}
}
.select2-result-label {
> span {
white-space: nowrap;
@ -104,6 +112,7 @@ body {
z-index: 3000;
}
}
.fileupload {
.thumbnail {
max-width: 60%;
@ -116,13 +125,12 @@ body {
height: 50px;
}
// members page
.existing-phone-avatar {
vertical-align: top;
margin: 0 0.5rem 0.5rem 0;
}
.existing-member-count {
width: 60px;
height: 60px;
@ -134,6 +142,7 @@ body {
padding: 8px 0.45rem;
font-size: 0.8125rem;
}
.group-edit-button {
box-sizing: border-box;
vertical-align: top;
@ -151,37 +160,42 @@ body {
.group-member-edit-table {
width: 100%;
tr {
border-bottom: 1px solid $gray;
}
td {
padding: 8px 0.75rem;
&:first-child {
width: 60px;
}
}
.make-admin-checkbox {
display: inline-block;
vertical-align: top;
margin-right: 0.3125rem;
}
.group-member-permission {
display: inline-block;
vertical-align: text-top;
}
}
.group-admin-edit-image-wrap {
margin: 0 24px 1rem 0;
}
.group-admin-edit-image-item {
margin-bottom: 16px;
margin: 0 10px 16px 0;
padding: 16px 0.5rem;
}
.group-admin-edit-image-container {
float: left;
width: 15%;
min-width: 150px;
max-width: 100px;
margin: 0 1rem 16px 0;
}
@ -193,37 +207,64 @@ body {
border-radius: $general;
float: left;
}
.group-admin-edit-image-checkbox {
display: inline-block;
vertical-align: top;
}
.group-admin-edit-image-label {
display: inline-block;
vertical-align: text-top;
font-size: 0.75rem;
}
.group-admin-edit-image-item-inner {
padding: 16px 0.625rem;
background: $white;
border-radius: $general;
}
.group-admin-edit-file-wrap {
margin-bottom: 10px;
}
.group-admin-edit-file-item {
padding: 10px 16px;
float: left;
margin: 0 8px 0.5rem 0;
font-size: 0.8125rem;
.group-admin-edit-file-checkbox {
margin: 0;
}
}
.group-admin-edit-filename {
margin-right: 0.3125rem;
}
.group-admin-edit-file-delete {
padding-bottom: 4px;
border-bottom: 1px dotted $red;
vertical-align: top;
}
@media screen and (min-width: 700px) {
.group-admin-edit-image-item {
float: left;
width: 45%;
}
}
@media screen and (min-width: 960px) {
.group-admin-edit-image-item {
width: 30%;
}
}
@media screen and (min-width: 1150px) {
.group-admin-edit-image-item {
width: 20%;
}
}

View File

@ -203,6 +203,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
color: #fff;
&:hover {
color: #fff;
background-color: #d92b0e;

View File

@ -121,8 +121,8 @@ class Admin::ImportController < OrbitAdminController
if(file['url'])
archive = ArchiveFileMultiple.new({
:file_title_translations=>file['title'],
:choose_lang => ["zh_tw", "en"],
:remote_file_url => file['url'],
:choose_lang => @site_valid_locales,
:remote_file_url => file['url'],
:sort_number=>file['sort_number']
})
archive.save
@ -132,8 +132,8 @@ class Admin::ImportController < OrbitAdminController
if(file['url2'])
archive = ArchiveFileMultiple.new({
:file_title_translations=>file['title'],
:choose_lang => ["zh_tw", "en"],
:remote_file_url => file['url2'],
:choose_lang => @site_valid_locales,
:remote_file_url => file['url2'],
:sort_number=>file['sort_number']
})
archive.save
@ -204,7 +204,7 @@ class Admin::ImportController < OrbitAdminController
File.delete(file)
end
bulletin.approved = true rescue nil
bulletin.approved = true
bulletin.save!
end
@ -559,29 +559,16 @@ class Admin::ImportController < OrbitAdminController
data = JSON.parse(data)
albums = data["albums"]
current_locale = I18n.locale
categories = data["categories"]
I18n.locale = :zh_tw
module_app = ModuleApp.find_by_key("gallery")
categories.each do |category|
cat = Category.where(:title => category[1]["zh_tw"], :module_app_id => module_app.id).first
if cat.nil?
cat = Category.new
cat.title_translations = {"en" => (category[1]["en"] || category[1]["zh_tw"]), "zh_tw" => (category[1]["zh_tw"] || category[1]["en"])}
cat.save
module_app.categories << cat
end
I18n.locale = :en
category = Category.where(:title => "RSS2 Gallery").first
I18n.locale = current_locale
if category.nil?
module_app = ModuleApp.find_by_key("gallery")
category = Category.new
category.title_translations = {"en" => "RSS2 Gallery", "zh_tw" => "RSS2畫廊"}
category.save
module_app.categories << category
end
# I18n.locale = :en
# category = Category.where(:title => "RSS2 Gallery").first
# I18n.locale = current_locale
# if category.nil?
# module_app = ModuleApp.find_by_key("gallery")
# category = Category.new
# category.title_translations = {"en" => "RSS2 Gallery", "zh_tw" => "RSS2畫廊"}
# category.save
# module_app.categories << category
# end
@data_to_send = []
albums.each do |album|
if Album.where(:rss2_id => album["albumid"]).count == 0
@ -591,7 +578,6 @@ class Admin::ImportController < OrbitAdminController
"en" => (album["description"]["en"].nil? ? "" : album["description"]["en"]),
"zh_tw" => (album["description"]["zh_tw"].nil? ? "" : album["description"]["zh_tw"])},
:rss2_id => album["albumid"])
category = Category.where(:title => album["category_name"], :module_app_id => module_app).first
newalbum.category_id = category.id
newalbum.save
else

View File

@ -236,9 +236,37 @@ class MembersController < ApplicationController
end
when 'role'
if !field['id'].blank?
field_data = member.attribute_values.find_by(:attribute_field_id=>field['id'],:key=>field['key']).get_field_value rescue {}
av = member.attribute_values.find_by(:attribute_field_id=>field['id'],:key=>field['key']) rescue nil
if !av.nil?
r = av.attribute_field.role rescue nil
if !r.nil?
if member.roles.include?(r)
field_data = av.get_field_value rescue {}
else
field_data = {}
end
else
field_data = {}
end
else
field_data = {}
end
else
field_data = member.attribute_values.find_by(:key=>field['key']).get_field_value rescue {}
av = member.attribute_values.find_by(:key=>field['key']) rescue nil
if !av.nil?
r = av.attribute_field.role rescue nil
if !r.nil?
if member.roles.include?(r)
field_data = av.get_field_value rescue {}
else
field_data = {}
end
else
field_data = {}
end
else
field_data = {}
end
end
end
next if field_data.blank? or field_data['value'].blank?

View File

@ -34,6 +34,8 @@ class PagesController < ApplicationController
params[:is_frontend_view] = "true"
OrbitHelper.set_params params,current_user
OrbitHelper.set_site_locale locale
OrbitHelper.set_request_object request
OrbitHelper.render_meta_tags []
render :html => render_final_page("home",page,true).html_safe
end
@ -102,6 +104,7 @@ class PagesController < ApplicationController
end
@manifest = @key
OrbitHelper.set_params params,current_user
OrbitHelper.set_request_object request
OrbitHelper.set_site_locale locale
OrbitHelper.set_this_module_app module_app.singularize
OrbitHelper.set_page_categories categories || ["all"]
@ -124,7 +127,7 @@ class PagesController < ApplicationController
if Site.first.enable_redirect_index
redirect_to root_url
else
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found
render :file => "#{Rails.root}/public/411.html", :layout => false, :status => :not_found
end
end
else
@ -381,7 +384,7 @@ class PagesController < ApplicationController
def render_final_page(original_view=get_view,page,layout)
final_html_for_render = ""
OrbitHelper.set_css_to_render_to_empty
if layout
parts = $mobile.blank? ? (page.page_parts rescue []) : (page.mobile_page_parts rescue [])
@ -396,6 +399,7 @@ class PagesController < ApplicationController
OrbitHelper.set_widget_data_count subpart.data_count
OrbitHelper.set_widget_module_app subpart.module
OrbitHelper.set_widget_item_url subpart
OrbitHelper.render_meta_tags []
OrbitHelper.set_widget_title subpart.title
OrbitHelper.set_widget_categories subpart.categories || ["all"]
OrbitHelper.set_widget_tags subpart.tags || []
@ -433,7 +437,6 @@ class PagesController < ApplicationController
@layout_html = render_to_string(@file)
doc = Nokogiri::HTML(@layout_html, nil, "UTF-8")
head = doc.css("head")
head[0].inner_html = head.inner_html + OrbitHelper.get_css_to_render_in_head
@part_partials.each do |key, partial|
html_string = ""
partial.each do |p|
@ -464,7 +467,9 @@ class PagesController < ApplicationController
if original_view != "home"
viewarea = doc.css("*[data-content='true']")[0]
viewarea.inner_html = render_to_string(original_view) rescue "<div></div>"
head[0].inner_html = OrbitHelper.meta_tags_html + head.inner_html
end
head[0].inner_html = head.inner_html + OrbitHelper.get_css_to_render_in_head
link = doc.css("link")[0]
link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url
final_html_for_render = doc.to_html
@ -586,7 +591,7 @@ class PagesController < ApplicationController
def change_to_language(final_html)
if session[:zh_cn]
final_html = ZhConv.convert("zh-cn", final_html)
final_html = ZhConv.convert("zh-cn", final_html,false)
final_html.gsub!('/zh_tw/','/zh_cn/')
final_html.sub!('<a href="'+request.path+'">繁体中文</a>','<a href="'+(request.path.sub('/zh_cn/','/zh_tw/'))+'">繁体中文</a>')
end

View File

@ -1,85 +1,16 @@
class SessionsController < ApplicationController
layout "authentication"
def new
if session[:user_id]
redirect_to admin_dashboards_path
end
end
def create
login_password = params[:password]
login_uid = params[:user_name]
result = false
ldap_filter = "(uid=#{login_uid})"
if login_uid != 'rulingcom'
NccuLdapConnection.establish
if ($nccu_ldap_connection.bind rescue false)
logger.info "=LDAP Binded password ok..."
result = check_auth_with_ldap(login_uid,login_password)
resource = User.find_by(user_name: params[:user_name]) rescue nil
if result && login_password!=''
logger.info "==LDAP password passed..."
# set_flash_message(:notice, :signed_in) if is_navigational_format?
if (resource.nil?)
logger.error "===LDAP passed local block... resource:#{resource.inspect}\n login_uid:#{login_uid}"
flash.now.alert = t('devise.failure.ldap_pass_but_account_not_in_orbit')
render "new"
else
logger.info "===ALL passed"
session[:user_id] = resource.id
session[:login_referer] = nil
if params[:referer_url]
redirect_to URI.parse(params[:referer_url]).path
else
redirect_to admin_dashboards_path
end
end
elsif !resource.nil?
if (resource.authenticate(login_password) && resource.is_confirmed?.eql?(true))
session[:user_id] = resource.id
session[:login_referer] = nil
if params[:referer_url]
redirect_to URI.parse(params[:referer_url]).path
else
redirect_to admin_dashboards_path
end
else
flash.now.alert = t('devise.failure.invalid')
render "new"
end
else
logger.error "==password LDAP fail..."
flash.now.alert = t('devise.failure.ldap_invalid')
render "new"
end
else
logger.error "=LDAP fail..."
flash.now.alert = t('devise.failure.ldap_connection_failed')
render "new"
end
else #if rulingcom account
logger.info "=======Rulingcom account======"
user = User.find_by(user_name: login_uid) rescue nil
if (user && user.authenticate(login_password) && user.is_confirmed?.eql?(true))
def create
user = User.find_by(user_name: params[:user_name]) rescue nil
if (user && user.authenticate(params[:password]) && user.is_confirmed?.eql?(true))
# if user.is_approved? || user.is_admin?
session[:user_id] = user.id
session[:login_referer] = nil
if params[:referer_url]
@ -87,88 +18,14 @@ class SessionsController < ApplicationController
else
redirect_to admin_dashboards_path
end
else
flash.now.alert = t('devise.failure.invalid')
render "new"
end
end
logger.info "=======End Debugging======"
end
def google_result
@code = params[:code]
if @code.nil?
redirect_to root_url
end
end
def google_callback
error = params[:error] rescue nil
if error == "access_denied"
redirect_to auth_failure_path and return
end
auth = env["omniauth.auth"]
user = Google.find_by("google_uid" => auth.uid).user rescue nil
if user.nil? && current_user.nil?
user_connected = false
# else
# flash.now.alert = "User not approved."
# render "new"
# end
else
user_connected = true
if user.nil? && !current_user.nil?
connection_successful = connect_account(auth)
else
if login_user(user,auth)
if params[:referer_url]
redirect_to URI.parse(params[:referer_url]).path and return
else
redirect_to admin_dashboards_path and return
end
end
end
flash.now.alert = "Invalid username or password"
render "new"
end
if user_connected && connection_successful
code = 1
elsif user_connected && !connection_successful
code = 2
else !user_connected && !connection_successful
code = 3
end
redirect_to auth_google_result_path(:code => code)
end
def google_remove
current_user.google.destroy rescue ""
redirect_to admin_member_path(current_user.member_profile.to_param) and return
end
def google_faliure
@code = 2
render "google_result"
end
def connect_account(auth)
if !current_user.nil?
google = Google.new
google.google_uid = auth.uid
google.token = auth.credentials.token
google.connected = true
google.save
current_user.google = google
current_user.save
return true
else
return false
end
end
def login_user(user,auth)
if user.google.token != auth.credentials.token
user.google.token = auth.credentials.token
user.google.save
end
session[:user_id] = user.id
end
def google_result
@ -249,12 +106,4 @@ class SessionsController < ApplicationController
session[:user_id] = nil
redirect_to root_url
end
private
def check_auth_with_ldap(login_uid,login_password)
ldap_filter = "(uid=#{login_uid})"
$nccu_ldap_connection.bind_as(:base => NccuLdapConnection::BASE,:filter => ldap_filter,:password=> login_password) rescue false
end
end

View File

@ -50,6 +50,24 @@ class StoreApiController < ApplicationController
render :layout => "back_end"
end
# this is for feed module.
def get_channel_lists
apps = ModuleApp.where(:feeds_url.ne => nil)
channels = []
if apps.count > 0
apps.each do |app|
channel = {}
channel["title"] = app.title
channel["key"] = app.key
channel["url"] = app.feeds_url
channel["app_icon"] = app.get_registration.get_side_bar.get_icon_class
channels << channel
end
end
render :json => {"channels" => channels}.to_json
end
private
def bundle_install
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }

View File

@ -1,6 +1,5 @@
module Admin::AttributeValuesViewHelper
OPT = [
["YYYY / MM / DD hh : mm","format1"],
["YYYY / MM / DD","format2"],
["YYYY / MM","format3"],
["YYYY","format4"]

View File

@ -20,7 +20,7 @@ module AttributeFieldsHelper
@new_attribute = @attribute_value.nil?
@attribute_value = @attribute_value || (attribute_type.eql?("role") ? @member.attribute_values.build(attribute_field_id: id) : @member.member_profile_field_values.build(member_profile_field: id))
@prefiled_value = @attribute_value.value rescue nil
return instance_eval("render_#{markup}") rescue ""
return instance_eval("render_#{markup}") #rescue ""
end
end
@ -101,14 +101,17 @@ module AttributeFieldsHelper
# @prefiled_value = @attribute_value.get_date
case self.typeC['format']
when 'format1'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true)
when 'format2'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
# when 'format1'
# tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true)
when 'format1','format2'
# tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), self.typeC['format'])
when 'format3'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
# tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), self.typeC['format'])
when 'format4'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
# tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), self.typeC['format'])
end
control_group_wrapper{tmp}
@ -117,6 +120,28 @@ module AttributeFieldsHelper
end
end
def very_simple_picker(object_name, value, format)
id = object_name.gsub("[","_").gsub("]","")
values = value.split("/") rescue []
html = "<div class='simple-date-picker'>"
if format == "format1" || format == "format2"
html = html + "<input type='text' class='span1' #{(!values.blank? ? "value='#{values[2]}'" : "")} placeholder='Date' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode == 9' onkeyup='this.value=(this.value.length <= 2 ? (parseInt(this.value) > 0 && parseInt(this.value) < 32 ? this.value : this.value.substring(0,this.value.length-1)) : this.value.substring(0,this.value.length-1))' onblur='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[2]=this.value; el.value = k.join(\"/\")};'>"
end
if format == "format1" || format == "format2" || format == "format3"
html = html + "<select class='span2' onchange='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[1]=this.value; el.value = k.join(\"/\")};'>"
["January","February","March","April","May","June","July","August","September","October","November","December"].each_with_index do |mon,index|
mon_value = "#{(index < 9 ? "0" : "")}#{(index + 1).to_s}"
html = html + "<option value='#{(index < 9 ? "0" : "")}#{(index + 1).to_s}' #{values[1] == mon_value ? 'selected="selected"' : ""}>#{mon}</option>"
end
html = html + "</select>"
end
html = html + "<input type='text' class='span1' #{(!values.blank? ? "value='#{values[0]}'" : "")} placeholder='Year' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) event.keyCode == 9' onkeyup='this.value=(this.value.length == 4 ? (parseInt(this.value) > 1900 && parseInt(this.value) < 3000 ? this.value : this.value.substring(0,this.value.length-1)) : (this.value.length > 4 ? this.value.substring(0,this.value.length-1) : this.value))' onblur='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[0]=this.value; el.value = k.join(\"/\")};'>"
html = html + hidden_field_tag(object_name, (value || "1901/01/01"))
html = html + "</div>"
html.html_safe
end
def datetime_picker(object_name, value, format, time=false)
content_tag :div, :class => "input-append datetimepick", "data-date-format"=>format, "data-picktime"=>"#{time}" do
concat text_field_tag(object_name, value, :placeholder=>format)
@ -150,7 +175,7 @@ module AttributeFieldsHelper
def render_text_area
control_group_wrapper do |key,value|
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value rescue nil
key = can_muti_lang_input? ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue ''
text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder))

View File

@ -22,7 +22,7 @@ module AttributeValuesHelper
end
def show_minguo_calendar(from_to=nil)
get_minguo
# get_minguo
case from_to
when :to
@ -96,12 +96,14 @@ module AttributeValuesHelper
def get_date_by_format(from_to = nil)
case I18n.locale
when :zh_tw
case
when self.member_profile_field["typeC"]["calendar"] == "west_calendar"
show_west_calender(from_to)
when self.member_profile_field["typeC"]["calendar"] == "tw_calendar"
show_minguo_calendar(from_to)
end #case self.member_profile_field["typeC"]["calendar"]
# case
# when self.member_profile_field["typeC"]["calendar"] == "west_calendar"
# show_west_calender(from_to)
# when self.member_profile_field["typeC"]["calendar"] == "tw_calendar"
# show_minguo_calendar(from_to)
# end #case self.member_profile_field["typeC"]["calendar"]
show_west_calender(from_to)
when :en
show_west_calender(from_to)
end

View File

@ -41,6 +41,10 @@ module OrbitBackendHelper
concat hidden_field(object_name, method, :value => options[:value])
concat separated_picker(object_name, method, options)
end
when 'simple'
content_tag :div, :id => options[:id], :class => options[:class] do
simple_picker(object_name, method, options)
end
else
content_tag :div, :id => options[:id], :class => options[:class] do
default_picker(object_name, method, options)

View File

@ -32,6 +32,19 @@ module OrbitFormHelper
end
end
def simple_picker(object_name, method, options)
html = "<div class='simple-date-picker'>
<input type='text' class='span1' #{(options[:value] ? "value='#{options[:value].day}'" : "")} placeholder='Date' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode == 9' onkeyup='this.value=(this.value.length <= 2 ? (parseInt(this.value) > 0 && parseInt(this.value) < 32 ? this.value : this.value.substring(0,this.value.length-1)) : this.value.substring(0,this.value.length-1))' onblur='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[2]=this.value; el.value = k.join(\"-\")};'>
<select class='span2' onchange='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[1]=this.value; el.value = k.join(\"-\")};'>"
["January","February","March","April","May","June","July","August","September","October","November","December"].each_with_index do |mon,index|
html = html + "<option value='#{(index < 9 ? "0" : "")}#{(index + 1).to_s}' #{(options[:value] && options[:value].month == (index + 1) ? "selected='selected'" : "")}>#{mon}</option>"
end
html = html + "</select><input type='text' class='span1' #{(options[:value] ? "value='#{options[:value].year}'" : "")} placeholder='Year' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) event.keyCode == 9' onkeyup='this.value=(this.value.length == 4 ? (parseInt(this.value) > 1900 && parseInt(this.value) < 3000 ? this.value : this.value.substring(0,this.value.length-1)) : (this.value.length > 4 ? this.value.substring(0,this.value.length-1) : this.value))' onblur='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[0]=this.value; el.value = k.join(\"-\")};'>"
html = html + hidden_field(object_name, method, :value => options[:value] || "1901-01-01")
html = html + "</div>"
html.html_safe
end
def date_picker(object_name, method, options)
custom = {}
custom[:format] = options[:format] || 'yyyy/MM'

View File

@ -267,6 +267,14 @@ module OrbitHelper
"#{request.host_with_port}/#{locale}#{url}"
end
def self.set_request_object(request)
@site_request_object = request
end
def self.request
@site_request_object
end
def self.set_site_locale(locale)
@site_locale = locale
end
@ -339,8 +347,12 @@ module OrbitHelper
!$mobile.blank?
end
def self.set_css_to_render_to_empty
@css_to_render_in_head = []
end
def self.render_css_in_head(css=[])
@css_to_render_in_head = css
@css_to_render_in_head.concat(css)
end
def self.get_css_to_render_in_head
@ -351,6 +363,97 @@ module OrbitHelper
return css_html
end
def self.render_meta_tags(metas=[])
@page_meta_tags = metas
end
def self.meta_tags_html
html = ""
if !@page_meta_tags.nil?
@page_meta_tags.each do |meta|
html = html + "<meta "
meta.keys.each do |attrib|
html = html + "#{attrib}='#{self.strip_html_tags(meta[attrib])}' "
end
html = html + ">"
end
end
html
end
def self.strip_html_tags(string)
ActionView::Base.full_sanitizer.sanitize(string)
end
# get feeds for the module
def self.get_feed_for_module(type)
if ModuleApp.where(:key => "feed").count == 0
return []
end
categories = []
ma = nil
if type == "index"
categories = @categories if !@categories.nil?
ma = @module_app
elsif type == "widget"
categories = @widget_categories if !@widget_categories.nil?
ma = @widget_module_app
end
if categories.first == "all"
feeds = SiteFeed.where(:channel_key => ma.key).enabled
else
feeds = SiteFeed.where(:channel_key => ma.key, :merge_with_category.in => categories).enabled
end
data = []
if feeds.count > 0
temp_ids = []
feeds.each do |feed|
file = File.join(Rails.root,"public","site_feeds",feed.id.to_s,feed.feed_uid.to_s + ".json")
if File.exists?(file)
d = File.read(file)
d = JSON.parse(d)
cat = Category.find(feed.merge_with_category).title
final_d = []
d[ma.key.pluralize].each{|a|
a["category"] = cat
if !temp_ids.include?(a["id"])
temp_ids << a["id"]
a["params"] = a["params"] + "_" + feed.id.to_s + "h"
final_d << a
end
}
data.concat(final_d)
end
end
end
data
end
def self.is_object_from_feed?(uid)
return uid.ends_with?("h")
end
def self.get_from_feed(uidwithid)
temp = uidwithid.split("_")
feed_id = temp[1][0...-1]
uid = temp[0]
object = nil
feed = SiteFeed.find(feed_id) rescue nil
if !feed.nil?
file = File.join(Rails.root,"public","site_feeds",feed.id.to_s,feed.feed_uid.to_s + ".json")
if File.exists?(file)
d = File.read(file)
d = JSON.parse(d)
objects = d[@module_app.key.pluralize]
object = objects.select{|obj| obj["id"] == uid}.first
cat = Category.find(feed.merge_with_category)
object = {} if cat.disable
end
end
object
end
# ===============================================================
# Breadcrumbs
# ===============================================================

View File

@ -13,7 +13,7 @@ class MemberProfile
field :sex
field :sid
field :office_tel
field :birthday, type: DateTime
field :birthday, type: Date
field :address, type: String, localize: true
field :personal_website
field :autobiography, type: String, localize: true

View File

@ -16,6 +16,7 @@ class ModuleApp
field :widget_settings
field :store_permission_granted, type: Boolean, default: false
field :cache_models, type: Array, default: []
field :feeds_url
has_many :categories, dependent: :destroy, :autosave => true
has_and_belongs_to_many :tags, dependent: :destroy, :autosave => true
@ -36,6 +37,7 @@ class ModuleApp
self[:widget_settings] = reg.get_widget_settings
self[:desktop_enabled] = reg.is_desktop_enabled
self[:cache_models] = reg.get_models_to_cache
self[:feeds_url] = reg.get_feeds_url
end
def sub_managers

View File

@ -10,7 +10,7 @@ class Role
has_and_belongs_to_many :member_profiles
has_many :authorizations
has_many :attribute_fields
has_many :attribute_fields, dependent: :destroy
accepts_nested_attributes_for :attribute_fields
has_many :role_statuses, dependent: :destroy

View File

@ -25,6 +25,7 @@ class Site
field :enable_language_detection, :type => Boolean, :default => false
field :enable_redirect_index, :type => Boolean, :default => false
field :enable_zh_cn, :type => Boolean, :default => true
field :enable_language_options, :type => Boolean, :default => true
field :default_locale, :default => "zh_tw"
field :mobile_on, :type => Boolean, :default => false
field :announcement_category, :type => Array, :default=>[]

View File

@ -186,4 +186,4 @@
init();
});
}(jQuery));
}(jQuery));

View File

@ -60,7 +60,6 @@ a.btn-primary {
}
}
// Page heading
.page-module-title {
@extend .unity-title;

View File

@ -1,49 +1,54 @@
@charset "utf-8";
@import "../initial";
// Faqs MODULES
.widget-faqs {
&.widget1 {
.widget-content {
padding-bottom: 10px;
& + .widget-content {
border-top: 1px dotted $theme-gray-light;
}
.widget-content-title {
display: inline-block;
padding: 5px 0;
}
}
&.widget1 {
.widget-content {
padding-bottom: 10px;
// layout-content 下的樣式
.layout-content & {
.widget-title {
@extend .unity-title;
}
}
& + .widget-content {
border-top: 1px dotted $theme-gray-light;
}
// layout-footer 下的樣式
.layout-footer & {
.widget-content {
line-height: 2em;
border-top-color: $theme-gray;
}
.widget-content-title {
display: inline-block;
padding: 5px 0;
}
}
// layout-content 下的樣式
.layout-content & {
.widget-title {
@extend .unity-title;
}
}
// layout-footer 下的樣式
.layout-footer & {
.widget-content {
line-height: 2em;
border-top-color: $theme-gray;
}
}
}
}
}
// Faqs INDEX
.index-faqs {
.index-title {
@extend .unity-title;
}
&.index1 {
.index-content {
list-style-type: decimal-leading-zero;
list-style-position: inside;
& + .index-content {
border-top: 1px dotted $theme-gray-light;
}
.index-title {
@extend .unity-title;
}
&.index1 {
.index-content {
list-style-type: decimal-leading-zero;
list-style-position: inside;
& + .index-content {
border-top: 1px dotted $theme-gray-light;
}
}
}
}
}

View File

@ -1,6 +1,6 @@
@charset 'utf-8';
@charset "utf-8";
@import '../initial';
@import "../initial";
// Gallery MODULES
.widget-gallery {

View File

@ -1,225 +1,271 @@
@charset "utf-8";
@import "../initial";
.modules-menu {
font-family: $sub-font;
max-height: none;
li {
white-space: nowrap;
& > a, & > .fa {
color: #ffffff;
}
&:hover {
& > a, & > .fa {
color: $brand-primary;
text-decoration: none;
}
}
}
.modules-menu-level-0 {
margin: 0;
padding: 0;
list-style: none;
& > li {
margin: 0 -15px;
padding: 0 15px;
border-bottom: 1px solid lighten($theme-gray, 5%);
& > a {
display: inline-block;
padding: 1rem 0;
}
& > .fa {
position: absolute;
right: 10px;
@include size(45px, 45px);
cursor: pointer;
line-height: 45px;
font-size: 1.5em;
text-align: center;
}
&:hover {
& > a {
background-color: transparent;
}
}
@media (min-width: $screen-sm) {
position: relative;
margin: 0 10px;
padding: 0;
border-bottom: none;
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
.modules-menu-level-1 {
right: 15px;
left: auto;
&:before {
right: 10px;
left: auto;
}
& > li {
padding-right: 15px;
padding-left: 15px;
& > a {
padding-left: 0;
}
}
.modules-menu-level-2 {
right: 100%;
left: auto;
&:before {
right: -6px;
left: auto;
@include arrow('left', 6px, 6px, $theme-gray-darker);
}
}
}
}
& > a {
padding: 2rem 0;
border-bottom: 0.5rem solid transparent;
}
& > .fa {
position: static;
@include size(auto, auto);
padding: 0;
line-height: 1;
font-size: 1em;
cursor: default;
}
&:hover {
& > a {
padding: 2rem 0;
border-bottom-color: $brand-primary;
}
.modules-menu-level-1 {
display: block;
}
}
}
}
}
.modules-menu-level-1 {
display: none;
min-width: 100%;
margin: 0 -15px;
padding: 0;
background-color: $theme-gray-dark;
list-style: none;
z-index: 1;
& > li {
position: relative;
& + li {
border-top: 1px solid lighten($theme-gray-dark, 5%);
}
& > a {
display: inline-block;
padding: 0.7em 0 0.7em 30px;
}
& > .fa {
position: absolute;
right: 15px;
@include size(38px, 38px);
line-height: 38px;
font-size: 1.2em;
text-align: center;
cursor: pointer;
}
&:hover {
background-color: darken($brand-primary, 10%);
font-family: $sub-font;
max-height: none;
li {
white-space: nowrap;
& > a, & > .fa {
color: #FFF;
}
}
}
@media (min-width: $screen-sm) {
position: absolute;
left: 15px;
margin-top: -0.5rem;
border-top: 0.5rem solid $brand-primary;
&:before {
content: "";
display: block;
position: absolute;
top: -16px;
left: 10px;
@include arrow('bottom', 10px, 8px, $brand-primary);
}
& > li {
padding-right: 30px;
& > a {
padding-left: 15px;
}
& > .fa {
position: static;
@include size(auto, auto);
padding: 0;
margin-right: 0;
line-height: 1;
float: none;
font-size: 1em;
cursor: default;
color: #ffffff;
}
&:hover {
.modules-menu-level-2 {
display: block;
}
& > a, & > .fa {
color: $brand-primary;
text-decoration: none;
}
}
}
.fa {
&:before {
content: "\f105";
}
}
}
}
.modules-menu-level-2 {
display: none;
margin: 0;
padding: 0;
background-color: $theme-gray-darker;
list-style: none;
& > li {
& + li {
border-top: 1px solid lighten($theme-gray-darker, 5%);
}
& > a {
display: inline-block;
padding: 0.5em 0 0.5em 45px;
}
&:hover {
background-color: darken($brand-primary, 20%);
& > a {
color: #FFF;
.modules-menu-level-0 {
margin: 0;
padding: 0;
list-style: none;
& > li {
margin: 0 -15px;
padding: 0 15px;
border-bottom: 1px solid lighten($theme-gray, 5%);
& > a {
display: inline-block;
padding: 1rem 0;
}
& > .fa {
position: absolute;
right: 10px;
@include size(45px, 45px);
cursor: pointer;
line-height: 45px;
font-size: 1.5em;
text-align: center;
}
&:hover {
& > a {
background-color: transparent;
}
}
@media (min-width: $screen-sm) {
position: relative;
margin: 0 10px;
padding: 0;
border-bottom: none;
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
.modules-menu-level-1 {
right: 15px;
left: auto;
&:before {
right: 10px;
left: auto;
}
& > li {
padding-right: 15px;
padding-left: 15px;
& > a {
padding-left: 0;
}
}
.modules-menu-level-2 {
right: 100%;
left: auto;
&:before {
right: -6px;
left: auto;
@include arrow("left", 6px, 6px, $theme-gray-darker);
}
}
}
}
& > a {
padding: 2rem 0;
border-bottom: 0.5rem solid transparent;
}
& > .fa {
position: static;
@include size(auto, auto);
padding: 0;
line-height: 1;
font-size: 1em;
cursor: default;
}
&:hover {
& > a {
padding: 2rem 0;
border-bottom-color: $brand-primary;
}
.modules-menu-level-1 {
display: block;
}
}
}
}
}
}
@media (min-width: $screen-sm) {
position: absolute;
top: 0;
left: 100%;
&:before {
content: "";
display: block;
position: absolute;
top: 13px;
left: -6px;
@include arrow('right', 6px, 6px, $theme-gray-darker);
}
& > li {
padding-right: 15px;
& > a {
padding-left: 15px;
padding: 0.7em 0 0.7em 15px;
.modules-menu-level-1 {
display: none;
min-width: 100%;
margin: 0 -15px;
padding: 0;
background-color: $theme-gray-dark;
list-style: none;
z-index: 1;
& > li {
position: relative;
& + li {
border-top: 1px solid lighten($theme-gray-dark, 5%);
}
& > a {
display: inline-block;
padding: 0.7em 0 0.7em 30px;
}
& > .fa {
position: absolute;
right: 15px;
@include size(38px, 38px);
line-height: 38px;
font-size: 1.2em;
text-align: center;
cursor: pointer;
}
&:hover {
background-color: darken($brand-primary, 10%);
& > a, & > .fa {
color: #FFF;
}
}
}
}
.fa {
&:before {
content: "\f105";
@media (min-width: $screen-sm) {
position: absolute;
left: 15px;
margin-top: -0.5rem;
border-top: 0.5rem solid $brand-primary;
&:before {
content: "";
display: block;
position: absolute;
top: -16px;
left: 10px;
@include arrow("bottom", 10px, 8px, $brand-primary);
}
& > li {
padding-right: 30px;
& > a {
padding-left: 15px;
}
& > .fa {
position: static;
@include size(auto, auto);
padding: 0;
margin-right: 0;
line-height: 1;
float: none;
font-size: 1em;
cursor: default;
}
&:hover {
.modules-menu-level-2 {
display: block;
}
}
}
.fa {
&:before {
content: "\f105";
}
}
}
}
.modules-menu-level-2 {
display: none;
margin: 0;
padding: 0;
background-color: $theme-gray-darker;
list-style: none;
& > li {
& + li {
border-top: 1px solid lighten($theme-gray-darker, 5%);
}
& > a {
display: inline-block;
padding: 0.5em 0 0.5em 45px;
}
&:hover {
background-color: darken($brand-primary, 20%);
& > a {
color: #FFF;
}
}
}
@media (min-width: $screen-sm) {
position: absolute;
top: 0;
left: 100%;
&:before {
content: "";
display: block;
position: absolute;
top: 13px;
left: -6px;
@include arrow("right", 6px, 6px, $theme-gray-darker);
}
& > li {
padding-right: 15px;
& > a {
padding-left: 15px;
padding: 0.7em 0 0.7em 15px;
}
}
.fa {
&:before {
content: "\f105";
}
}
}
}
}
}
}

View File

@ -1,50 +1,57 @@
@charset "utf-8";
@import "../initial";
// Link MODULES
.widget-link {
// layout-content 下的樣式
.widget-title {
@extend .unity-title;
}
&.widget1 {
.widget-content {
line-height: 2.5em;
& + .widget-content {
border-top: 1px dotted $theme-gray-light;
}
.widget-content-title {
display: inline-block;
}
// layout-content 下的樣式
.widget-title {
@extend .unity-title;
}
// layout-footer 下的樣式
.layout-footer & {
.widget-content {
line-height: 2em;
border-top-color: $theme-gray;
}
&.widget1 {
.widget-content {
line-height: 2.5em;
& + .widget-content {
border-top: 1px dotted $theme-gray-light;
}
.widget-content-title {
display: inline-block;
}
}
// layout-footer 下的樣式
.layout-footer & {
.widget-content {
line-height: 2em;
border-top-color: $theme-gray;
}
}
}
}
}
// Link INDEX
.index-link {
.index-title {
@extend .unity-title;
}
&.index1 {
.index-content {
list-style-type: decimal-leading-zero;
list-style-position: inside;
& + .index-content {
border-top: 1px dotted $theme-gray-light;
}
.index-context {
display: inline-block;
margin: 0 0 10px 2em;
color: darken($theme-gray-light, 20%);
}
.index-title {
@extend .unity-title;
}
&.index1 {
.index-content {
list-style-type: decimal-leading-zero;
list-style-position: inside;
& + .index-content {
border-top: 1px dotted $theme-gray-light;
}
.index-context {
display: inline-block;
margin: 0 0 10px 2em;
color: darken($theme-gray-light, 20%);
}
}
}
}
}

View File

@ -19,3 +19,7 @@
// Widget
@import "widget/breadcrumb";
@import "widget/sitemenu";
.container {
width: 980px !important;
}

View File

@ -1,17 +1,21 @@
@charset "utf-8";
@import "../initial";
.sitemenu-wrap {
padding: 10px 0;
@include clearfix;
.sitemenu-title {
display: none;
}
.sitemenu-list {
margin: 0;
padding: 0;
list-style: none;
}
.sitemenu-item.level-1 {
font-size: 0.8125rem;
position: relative;
@ -23,19 +27,23 @@
color: #fff;
border-radius: .2em;
background: $theme-color-second;
&:hover {
background: darken($theme-color-second, 10%);
}
}
.sitemenu-link.level-1 {
margin-right: .25rem;
color: #fff;
}
.sitemenu-dropdown-toggle {
font-size: 0.75rem;
padding: 2px .3125rem;
cursor: pointer;
}
// sitemenu dropdown
.sitemenu-list.dropdown-menu {
min-width: 100%;
@ -44,10 +52,12 @@
border-radius: .2em;
background: $theme-color-main;
}
.sitemenu-link.level-2 {
color: #fff;
font-size: 0.8125rem;
padding: 4px 0.625rem;
&:hover {
background: lighten($theme-color-second, 5%);
}

View File

@ -16,7 +16,7 @@
data-overlay-template="<h2>{{title}}</h2>{{desc}}"
data-target="{{target}}"
>
<img class="w-ad-banner__image banner-responsive" src="{{image_link}}" alt="{{alt_title}}>
<img class="w-ad-banner__image banner-responsive" src="{{image_link}}" alt="{{alt_title}}">
</div>
</div>
<ul class="w-ad-banner__pager-3 banner-pager"></ul>

View File

@ -10,7 +10,7 @@
data-link="{{link}}"
data-target="{{target}}"
>
<img class="w-ad-banner__image banner-responsive" src="{{image_link}}" alt="{{alt_title}}>
<img class="w-ad-banner__image banner-responsive" src="{{image_link}}" alt="{{alt_title}}">
</div>
</div>
</div>

View File

@ -3,19 +3,19 @@
<span>{{widget-title}}</span>
</h3>
<div class="w-annc__inner row">
<div class="w-annc__img-wrap col-md-4 bullseye">
<div class="w-annc__img-wrap col-xs-4 bullseye">
<img class="w-annc__img" src="{{main_picture}}" alt="{{main_picture_description}}" title="{{main_picture_description}}">
</div>
<ul class="w-annc__list col-md-8" data-level="0" data-list="announcements">
<ul class="w-annc__list col-xs-8" data-level="0" data-list="announcements">
<li class="w-annc__item">
<div class="w-annc__content row">
<h4 class="w-annc__entry-title col-md-9">
<h4 class="w-annc__entry-title col-xs-9">
<span class="w-annc__status-wrap" data-list="statuses" data-level="1">
<span class="w-annc__status label {{status-class}}">{{status}}</span>
</span>
<a class="w-annc__title" href="{{link_to_show}}">{{title}}</a>
</h4>
<span class="w-annc__postdate-wrap col-md-3" date-format="%Y-%m-%d">
<span class="w-annc__postdate-wrap col-xs-3" date-format="%Y-%m-%d">
<i class="fa fa-calendar-o"></i>
<span class="w-annc__postdate">{{postdate}}</span>
</span>

View File

@ -6,7 +6,7 @@
<table class="i-member__table table table-striped">
<thead data-level="2" data-list="members">
<tr class="i-member-tr-head" data-list="profile_data" data-level="3">
<th>{{key}}</th>
<th>{{title}}</th>
</tr>
</thead>
<tbody data-level="2" data-list="members">

View File

@ -13,6 +13,7 @@
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "lib/dropzone" %>
<%= javascript_include_tag "group" %>
<% end %>
<div class="input-area">
<div class="upload-status-notice hide">

View File

@ -116,7 +116,7 @@
<div class="control-group">
<label for="birthday" class="control-label muted"><%= t("users.birthday")%></label>
<div class="controls">
<%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %>
<%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd", :picker_type => "simple" %>
</div>
</div>

View File

@ -193,6 +193,14 @@
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('preferences.enable_language_options') %>
</label>
<div class="controls">
<%= f.check_box :enable_language_options, :class => "toggle-check", data: {disabled: true} %>
</div>
</div>
</div>
<!-- OrbitBar Them -->

View File

@ -222,7 +222,6 @@
<label class="control-label muted" for=""><%= t("date.format")%></label>
<div class="controls">
<select data-type="date" id="${_format[0]}" name="${_format[1]}">
<option value="format1">YYYY / MM / DD hh : mm</option>
<option value="format2">YYYY / MM / DD</option>
<option value="format3">YYYY / MM</option>
<option value="format4">YYYY</option>

View File

@ -116,33 +116,37 @@
</li>
<% end %>
<li>
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
<ul>
<% @site_in_use_locales.each do |l| %>
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
</li>
<% else %>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<a href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
</li>
<% end %>
<% if current_site.enable_zh_cn and l == :zh_tw and !request.path.include?("/admin/") %>
<% if locale == :zh_cn %>
<li class="active">
<%= t(:zh_cn, :locale => :zh_tw) %>
<% if current_site.enable_language_options %>
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
<% zh_cn_added = 0 %>
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
<ul>
<% @site_in_use_locales.each do |l| %>
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
</li>
<% else %>
<li>
<a href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
<a href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
</li>
<% end %>
<% if current_site.enable_zh_cn and zh_cn_added == 0 and !request.path.include?("/admin/") %>
<% zh_cn_added = 1 %>
<% if locale == :zh_cn %>
<li class="active">
<%= t(:zh_cn, :locale => :zh_tw) %>
</li>
<% else %>
<li>
<a href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
</li>
<% end %>
<% end %>
<% end %>
<% end %>
</ul>
</ul>
<% end %>
<% end %>
</li>
<% if !current_user.nil? %>
@ -156,7 +160,7 @@
<% if params[:editmode] == "on" %>
<a tabindex="-1" href="<%= request.fullpath.split("?").first %>" style="color:red;"><i class="icons-bolt"></i>Edit Mode Off</a>
<% else %>
<a tabindex="-1" href="<%= request.fullpath + "?editmode=on" %>"><i class="icons-bolt"></i>Edit Mode On</a>
<a tabindex="-1" href="<%= request.fullpath + "#{(request.query_parameters.empty? ? "?" : "&")}editmode=on" %>"><i class="icons-bolt"></i>Edit Mode On</a>
<% end %>
</li>
<% end %>

View File

@ -5,7 +5,7 @@
<% if params[:action] == "new" %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:page)+' ID' %>
<div class="controls">
<%= f.text_field :page_id, class:"input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;detect_chinese;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces.;Page id is already taken.;Page ID cannot be in chinese.;"} %>
<%= f.text_field :page_id, class:"input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;detect_chinese;cannot_have_dash;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces.;Page id is already taken.;Page ID cannot be in chinese.;Cannot have dash (-) in Page ID.;"} %>
<span><%= t("front_page.name_field_helper") %></span>
</div>
<% end %>

View File

@ -5,7 +5,7 @@
<% if params[:action] == "new" %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star")+t(:link)+' ID' %>
<div class="controls">
<%= f.text_field :page_id, class: "input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces;Page id is already taken.;"} %>
<%= f.text_field :page_id, class: "input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;detect_chinese;cannot_have_dash;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces;Page id is already taken.;Page ID cannot be in chinese.;Cannot have dash (-) in Page ID.;"} %>
<span class="help-block"><%= t("front_page.name_field_helper") %></span>
</div>
<% end %>
@ -40,9 +40,11 @@
else
url = @page.external_url_translations[locale]
end
else
url = "#"
end
%>
<%= n.text_field locale, class:"input-xlarge change", :value=>url rescue nil %>
<%= n.text_field locale, class:"input-xlarge change", data: {"fv-validation" => "required;urlwithip;detect_chinese;", "fv-messages" => "Cannot be empty.;Must be valid url.;Cannont have chinese.;"}, :value=>url rescue "#" %>
<% end %>
</div>
<% end %>

View File

@ -14,5 +14,9 @@
<script type="text/javascript">
$(document).ready(function(){
var fromvalidator = new FormValidator($("form.edit_page"));
fromvalidator.validate_functions.detect_chinese = function(value){
return (value.match(/[\u3400-\u9FBF]/) == null);
}
})
</script>

View File

@ -19,9 +19,14 @@ $(document).ready(function(){
}
fromvalidator.validate_functions.detect_chinese = function(value){
var re1 = new RegExp("^[\u4E00-\uFA29]*$"),
re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); //Chinese character range
return (!(re1.test(value) && (! re2.test(value))));
// var re1 = new RegExp("^[\u4E00-\uFA29]*$"),
// re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); //Chinese character range
// return (!(re1.test(value) && (! re2.test(value))));
return (value.match(/[\u3400-\u9FBF]/) == null);
}
fromvalidator.validate_functions.cannot_have_dash = function(value){
return (value.indexOf("-") == -1 ? true : false);
}
})
</script>

View File

@ -5,7 +5,10 @@ require File.expand_path('../application', __FILE__)
Orbit::Application.initialize!
Orbit::Application.config.secret_key_base = 'acc6ffc5a7d360c9cf2a7bdb4ddf9a897942ec6767413a5c0324a0fa8b86197a96298288a66bd46d8770d8b6edf509aad65716961c2c364ce006b475e6cfd418'
OrbitApp.cleanup_modules
OrbitApp.check_module_permissions
begin
OrbitApp.check_module_permissions
rescue Exception => e
end
if Site.count == 0
site = Site.new

View File

@ -1 +0,0 @@
LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env]

View File

@ -1,16 +0,0 @@
#encoding: utf-8
# require 'mysql2'
$nccu_ldap_connection
module NccuLdapConnection
BASE = 'ou=People,dc=nccu,dc=edu,dc=tw'
def self.establish
$nccu_ldap_connection = Net::LDAP.new
$nccu_ldap_connection.port =LDAP_CONFIG["port"]
$nccu_ldap_connection.host = LDAP_CONFIG["host"]
$nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"])
end
end

View File

@ -1,12 +0,0 @@
defaults: &defaults
authenticate_info: 'cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw'
authenticate_pwd: 'nccu2ucc'
development:
<<: *defaults
host: '140.119.166.23'
port: 389
production:
<<: *defaults
host: '140.119.166.23'
port: 389

View File

@ -412,6 +412,7 @@ en:
preferences:
backend_open: All users can visit backend pages
change: Change
enable_language_options: Enable language option on OrbitBar
classification: Classification
frontend_open: "If Checked, the frontend will be open for all users."
favicon: Favicon

View File

@ -422,6 +422,7 @@ zh_tw:
preference: 系統偏好
preferences:
backend_open: 開啟後台給所有使用者
enable_language_options: 在OrbitBar上打開語系選擇
change: 更改
classification: 類別
enable_zh_cn: 開啟簡體中文

View File

@ -39,6 +39,7 @@ Orbit::Application.routes.draw do
post "/store/install_module" => "store_api#install_module"
post "/store/uninstall_module" => "store_api#uninstall_module"
post "/store/restart_srever_after_install" => "store_api#restart_server_after_install"
get "/feeds/channel_lists" => 'store_api#get_channel_lists'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

View File

@ -40,12 +40,13 @@ module OrbitApp
end
class RegisteredModule
attr_reader :name,:key,:base_path, :module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count, :widget_settings, :icon_class_no_sidebar,:desktop_enabled, :models_to_cache
attr_reader :name,:key,:base_path, :module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count, :widget_settings, :icon_class_no_sidebar,:desktop_enabled, :models_to_cache, :feeds_url
def initialize(name,&block)
@name = name
@key = @name.underscore.singularize
@side_bar = nil
@feeds_url = nil
@module_label = @name
@widget_methods = []
@models_to_cache = []
@ -82,6 +83,14 @@ module OrbitApp
@module_label = name
end
def feeds_url(url)
@feeds_url = url
end
def get_feeds_url
@feeds_url
end
def widget_methods(widgets)
@widget_methods = widgets
end

67
public/411.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page not available</title>
</head>
<body>
<style>
::selection {
color: #fff;
background: #040114;
}
body {
margin: 0;
padding: 0;
font-family: 'Roboto', sans-serif;
font-size: 100%;
background: url(/error_image/not-avai-bg.jpg) center center fixed no-repeat;
background-size: cover;
background-color: #000;
}
#page-not-avai-in-this-lang {
min-height: 768px;
}
.message {
text-align: center;
position: absolute;
left: 50%;
top: 25%;
margin-left: -210px;
}
.message h1 {
margin: 0 0.2em 0 0;
color: #fff;
font-size: 8.5em;
font-weight: normal;
}
.message h2 {
margin: 0;
padding: 0;
color: #fff;
}
.message p {
color: #fff;
}
.home,
.prev-page {
color: #fff;
}
a.home:hover,
.prev-page:hover {
text-decoration: none;
}
</style>
<div id="page-not-avai-in-this-lang">
<section class="message">
<h1>OOPS!</h1>
<h2>Page not available.</h2>
<p>Sorry, this page is not available for this language.<br> You can go back to <a class="home" href="/">home</a> or <a class="prev-page" href="#" onclick="window.history.back();return false;">previous</a> page.</p>
</section>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB