member plugin init edit

This commit is contained in:
chris 2013-02-21 17:53:08 +08:00
commit 680d7908b9
234 changed files with 2085 additions and 3308 deletions

1
.gitignore vendored
View File

@ -20,4 +20,3 @@ config/application.rb
app/assets/javascripts/.DS_Store
solr
Gemfile.lock

View File

@ -76,8 +76,8 @@ group :test, :development do
gem 'pry-remote'
gem 'pry-stack_explorer'
gem 'pry-debugger'
gem 'debugger'
gem 'faker'
gem "sunspot-rails-tester"
gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing.
gem "rspec", "~> 2.0"
@ -93,4 +93,3 @@ group :test, :development do
# gem "bluecloth"
end
gem 'debugger'

384
Gemfile.lock Normal file
View File

@ -0,0 +1,384 @@
GIT
remote: git://github.com/amatsuda/kaminari.git
revision: 2e09b5374fec33b57c6387ca7bac89ecaa60c9eb
specs:
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
GIT
remote: git://github.com/charlotte-ruby/impressionist.git
revision: 0894f6a550a33f83f4937d655e9f0774521781e4
specs:
impressionist (1.2.0)
httpclient (~> 2.2)
nokogiri (~> 1.5)
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bcrypt-ruby (3.0.0)
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
bourne (1.1.2)
mocha (= 0.10.5)
brakeman (1.9.2)
erubis (~> 2.6)
fastercsv (~> 1.5)
haml (~> 3.0)
highline (~> 1.6)
multi_json (~> 1.2)
ruby2ruby (~> 2.0)
ruby_parser (~> 3.1.1)
sass (~> 3.0)
terminal-table (~> 1.4)
bson (1.8.2)
bson_ext (1.8.2)
bson (~> 1.8.2)
builder (3.0.4)
capybara (2.0.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
carrierwave (0.6.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
carrierwave-mongoid (0.2.2)
carrierwave (~> 0.6.1)
mongoid (~> 2.1)
childprocess (0.3.8)
ffi (~> 1.0, >= 1.0.11)
chinese_pinyin (0.4.1)
chronic (0.9.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.4.0)
columnize (0.3.6)
database_cleaner (0.9.1)
debug_inspector (0.0.2)
debugger (1.2.4)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.1.7)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.1.8)
delorean (2.1.0)
chronic
devise (1.5.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
diff-lcs (1.1.3)
encrypted_strings (0.3.3)
erubis (2.7.0)
exception_notification (3.0.1)
actionmailer (>= 3.0.4)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
fastercsv (1.5.5)
fattr (2.2.1)
ffi (1.4.0)
haml (3.1.8)
highline (1.6.15)
hike (1.2.1)
httpclient (2.3.2)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.0.1)
jquery-rails
railties (>= 3.1.0)
json (1.7.7)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
method_source (0.8.1)
mime-types (1.21)
mini_magick (3.5.0)
subexec (~> 0.2.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
mongo (1.8.2)
bson (~> 1.8.2)
mongo_session_store-rails3 (3.0.6)
actionpack (>= 3.0)
mongo
mongoid (2.6.0)
activemodel (~> 3.1)
mongo (~> 1.7)
tzinfo (~> 0.3.22)
mongoid-encryptor (0.0.5)
activesupport (~> 3.0)
encrypted_strings (~> 0.3.3)
mongoid (~> 2)
mongoid-tree (0.7.0)
mongoid (~> 2.0)
multi_json (1.6.1)
net-ldap (0.3.1)
nokogiri (1.5.6)
options (2.3.0)
fattr
orm_adapter (0.0.7)
polyglot (0.3.3)
pr_geohash (1.0.0)
progress_bar (0.4.0)
highline (~> 1.6.1)
options (~> 2.3.0)
pry (0.9.12)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pry-debugger (0.2.1)
debugger (~> 1.2.0)
pry (~> 0.9.10)
pry-remote (0.1.6)
pry (~> 0.9)
slop (~> 3.0)
pry-stack_explorer (0.4.9)
binding_of_caller (>= 0.7)
pry (~> 0.9.11)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-protection (1.3.2)
rack
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
radius (0.7.3)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12.1)
json (~> 1.4)
redis (3.0.2)
redis-namespace (1.2.1)
redis (~> 3.0.0)
redis-search (0.9.0)
chinese_pinyin (>= 0.3.0)
redis (>= 2.1.1)
redis-namespace (>= 1.0.2)
resque (1.23.0)
multi_json (~> 1.0)
redis-namespace (~> 1.0)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-restriction (0.3.0)
resque (>= 1.7.0)
resque-scheduler (2.0.0)
redis (>= 2.0.1)
resque (>= 1.20.0)
rufus-scheduler
rmmseg-cpp-huacnlee (0.2.9)
rsolr (1.0.8)
builder (>= 2.1.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
rspec-rails (2.12.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
ruby2ruby (2.0.3)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.1.1)
sexp_processor (~> 4.1)
rubyzip (0.9.9)
rufus-scheduler (2.0.17)
tzinfo (>= 0.3.23)
sass (3.2.5)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.30.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
sexp_processor (4.1.5)
shoulda-matchers (1.4.2)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
sinatra (1.3.4)
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
slop (3.4.3)
social-share-button (0.1.1)
spork (0.9.2)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.2)
sunspot (1.3.3)
pr_geohash (~> 1.0)
rsolr (~> 1.0.7)
sunspot-rails-tester (0.0.4)
sunspot_rails (~> 1.2)
sunspot_mongo (1.0.1)
sunspot_rails
sunspot_rails (1.3.3)
nokogiri
sunspot (= 1.3.3)
sunspot_solr (1.3.3)
terminal-table (1.4.5)
thor (0.17.0)
tilt (1.3.3)
tinymce-rails (3.5.8)
railties (>= 3.1.1)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.2.1)
rack (>= 1.0)
watchr (0.7)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
brakeman
bson_ext
capybara
carrierwave
carrierwave-mongoid
chinese_pinyin (= 0.4.1)
coffee-rails
database_cleaner
debugger
delorean
devise (= 1.5.3)
exception_notification
execjs
factory_girl_rails
faker
impressionist!
jquery-rails (= 2.1.4)
jquery-ui-rails
kaminari!
mime-types
mini_magick
mongo_session_store-rails3 (= 3.0.6)
mongoid (> 2.1, < 3.0.0)
mongoid-encryptor
mongoid-tree
net-ldap (~> 0.3.1)
nokogiri
progress_bar
pry
pry-debugger
pry-remote
pry-stack_explorer
radius
rails (~> 3.2.9)
rake
redis (>= 2.1.1)
redis-namespace
redis-search
resque
resque-restriction
resque-scheduler
rmmseg-cpp-huacnlee (= 0.2.9)
rspec (~> 2.0)
rspec-rails (~> 2.0)
rubyzip
sass-rails
shoulda-matchers
simplecov
sinatra
social-share-button
spork
sprockets
sunspot-rails-tester
sunspot_mongo
sunspot_solr
tinymce-rails
uglifier
watchr

View File

@ -35,7 +35,7 @@ div[data-role="page"] {
}
.main-menu ul {
background-color: #333;
width: 280px;
width: 210px;
list-style: none;
margin: 0 auto;
padding: 0;
@ -128,8 +128,8 @@ div[data-role="page"] {
left: 0;
}
.header .language .ui-btn-text i {
font-size: .83em;
margin-top: .2em;
font-size: 1.1em;
margin-top: .33em;
}
.header .language .ui-icon {
background-image: none;
@ -213,6 +213,9 @@ div[data-role="page"] {
padding: 0 10px 20px;
margin-bottom: 0;
}
#announcement_content .content {
padding: 10px;
}
#map div[data-role="content"] {
padding: 0;
}
@ -323,7 +326,7 @@ div[id^="dialog"] .content {
}
@media(min-width:600px) {
.main-menu ul {
width: 560px;
width: 420px;
}
.main-menu ul li {
width: 128px;
@ -331,7 +334,7 @@ div[id^="dialog"] .content {
}
@media(min-width:768px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@ -342,7 +345,7 @@ div[id^="dialog"] .content {
}
@media(min-width:800px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@ -350,7 +353,7 @@ div[id^="dialog"] .content {
}
@media(min-width:961px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@ -358,7 +361,7 @@ div[id^="dialog"] .content {
}
@media(min-width: 1024px) {
.main-menu ul {
width: 800px;
width: 600px;
}
.main-menu ul li {
width: 188px;

View File

@ -88,7 +88,7 @@ class Admin::AssetsController < OrbitBackendController
def delete
if params[:ids]
asset = Asset.any_in(:_id => params[:ids]).delete_all
asset = Asset.any_in(:_id => params[:ids]).destroy_all
end
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -114,7 +114,7 @@ class Admin::DesignsController < OrbitBackendController
def delete
if params[:ids]
designs = Design.any_in(:_id => params[:ids]).delete_all
designs = Design.any_in(:_id => params[:ids]).destroy_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -36,12 +36,11 @@ helper Admin::PagePartsHelper
if @item.module_app
@module_app = @item.module_app
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
@frontend_path = @item.app_frontend_url
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
case @item.module_app.key
when 'announcement'
@ -59,7 +58,7 @@ helper Admin::PagePartsHelper
end
else
@categories = nil
@module_app = @module_apps[0]
@module_app = @module_apps[0]
end
end

View File

@ -1,4 +1,4 @@
class Admin::SubRolesController < RolesController
class Admin::SubRolesController < Admin::RolesController
end

View File

@ -11,31 +11,40 @@ class DefaultWidgetController< OrbitWidgetController
end
def default_widget
@tag_class = nil
if !params[:id].blank?
redirect_to eval("#{@page_part.module_app.widget_fields_link_method['title']['method']}('#{params[:id]}', {inner: #{params[:inner] || true}})")
else
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
data_limit = case @page_part
when Page
@fields = @page_part.frontend_field
@page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
when PagePart
@fields = @page_part.widget_field
@page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
case @page_part
when Page
@fields = @page_part.frontend_field
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
@paginate = true
@page_id = @page_part.id
when PagePart
@fields = @page_part.widget_field
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
if @paginate
@data = eval(@default_widget["query"]).includes(@widget_image_field).page(params[:page_main]).per(@data_limit).desc(:created_at)
else
@data = eval(@default_widget["query"]).limit(@data_limit).includes(@widget_image_field).desc(:created_at)
end
case params[:type]
when "typeA"
@tag_class = 'default_widget_typeA'
@partial = "typeA"
when /typeB_/
@tag_class = "default_widget_#{params[:type]}"
@partial = "typeB"
when "typeC"
@tag_class = 'default_widget_typeC'
@partial = "typeC"
end
end
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field).desc(:created_at)
case params[:type]
when "typeA"
@tag_class = 'default_widget_typeA'
render "typeA"
when /typeB_/
@tag_class = "default_widget_#{params[:type]}"
render "typeB"
when "typeC"
@tag_class = 'default_widget_typeC'
render "typeC"
end
end
end

View File

@ -2,6 +2,11 @@ class FrontController < ApplicationController
layout false
def show_breadcrumb
@ancestors = Page.find(params[:id]).ancestors_and_self
@ancestors = nil if @ancestors.size == 1
end
def show_banner
@ad_banner = AdBanner.find(params[:id]) rescue nil
end

View File

@ -64,17 +64,23 @@ class PagesController < ApplicationController
protected
def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
elsif !params[:category_id].blank?
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],category: params[:category_id]).any_in(tag: [nil,'']).first
elsif !params[:tag_id].blank?
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],tag: params[:tag_id]).any_in(category: [nil,'']).first
if params[:same_page_id]
@item = Item.find(params[:same_page_id])
else
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
elsif !params[:category_id].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], category: params[:category_id]).any_in(tag: [nil,'']).first
elsif !params[:tag_id].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], tag: params[:tag_id]).any_in(category: [nil,'']).first
end
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
end
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).first unless @item
raise PageError,'Missing Frontend Page' if @item.nil?
end

View File

@ -3,24 +3,24 @@ module DefaultWidgetHelper
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
end
def link_to_field(row_data,field,switch)
def link_to_field(row_data,field, switch, options=nil)
method_ary = @page_part.module_app.widget_fields_link_method
field = field.to_sym
if(method_ary.has_key?(field) and (switch == "true"))
url = case method_ary[field][:args]
when nil # no args
get_data_link(method_ary[field][:method])
get_data_link(method_ary[field]["method"], options)
when :self # passing self
get_data_link(method_ary[field][:method],row_data.id)
get_data_link(method_ary[field]['method'], options,row_data.id)
else
ary = method_ary[field][:args].clone
object_hash = ary.each do |key,val|
ary[key]= type_trans_or_to_s(row_data.send(val[0]).send(val[1]))
end
get_data_link(method_ary[field][:method],object_hash)
get_data_link(method_ary[field]['method'], options,object_hash)
end
link_to row_data.send(field),url
link_to row_data.send(field), url
else
type_trans_or_to_s(row_data.send(field) )
end
@ -45,13 +45,17 @@ module DefaultWidgetHelper
end
end
def get_data_link(method_entry,object = nil)
def get_data_link(method_entry, options=nil, object = nil)
case object
when nil
eval method_entry
when NilClass
eval eval("#{method_entry}(#{options})")
when BSON::ObjectId
object = "'#{object.to_s}'"
eval("#{method_entry}(#{object}, #{options})")
when Hash
eval("#{method_entry}(#{object.merge options})")
else
object = "'#{object.to_s}'" if object.class == BSON::ObjectId
eval("#{method_entry}(#{object})" )
''
end
end

View File

@ -23,7 +23,7 @@ class AdImage
belongs_to :ad_banner
before_validation :add_http
validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
validates :out_link, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :allow_blank => true
def display?
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false)

View File

@ -12,7 +12,7 @@ class Item
field :enabled_for, :type => Array, :default => nil
field :menu_enabled_for, :type => Array, :default => nil
field :title, localize: true
field :sitemap_enabled, :type => Hash
field :sitemap_enabled, :type => Hash, :default => {}
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
@ -23,6 +23,7 @@ class Item
before_destroy :destroy_children
after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?"
after_save :rebuild_children_path, :if => "path_changed?"
def enabled_for_lang(lang)
enabled_for.include?(lang)
@ -57,7 +58,7 @@ class Item
end
def show_in_sitemap_for(locale)
if sitemap_enabled && !sitemap_enabled[locale].blank?
if !sitemap_enabled.blank? && !sitemap_enabled[locale].blank?
sitemap_enabled[locale].eql?('true') ? true : false
else
true
@ -68,7 +69,6 @@ class Item
def rebuild_path
self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/')
self.rebuild_children_path
end
def rebuild_children_path

View File

@ -2,7 +2,7 @@ class Link < Item
field :url
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
validates :url, :presence => true, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i
before_validation :add_http

View File

@ -27,6 +27,11 @@ class Page < Item
before_save :create_parts, if: Proc.new { |page| page.new_record? || page.design_id_changed? }
before_save :delete_empty_frontend_field, :generate_html
def generate_parts
create_parts
self.save
end
protected
def create_parts

View File

@ -7,7 +7,8 @@
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
<% elsif @r_tag.eql?('sitemap') %>
<% elsif @r_tag.eql?('breadcrumb') %>
<% else %>
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
<% end %>
</span>
</span>

View File

@ -1,23 +0,0 @@
<div class="site-map">
<% @items.each_with_index do |item, i| %>
<div class="map-block">
<h4><%= i+1 %> <a href='<%= item.path %>'><%= item.title %></a></h4>
<ul>
<% item.children.each_with_index do |child, ii| %>
<li class="clear"><%= "#{i+1}-#{ii+1}" %> <a href='<%= child.path %>'><%= child.title %></a></span></li>
<% end if item.children %>
</ul>
</div>
<% end %>
</div>
<%= javascript_include_tag "lib/jquery.masonry.min.js" %>
<script>
$(document).ready(function(){
$('.site-map').masonry({
itemSelector: '.map-block',
columnWidth: 220,
isAnimated: true
});
});
</script>

View File

@ -11,7 +11,7 @@
<% @data.each do |row_data| %>
<tr>
<% @fields.each do |field|%>
<td><%= content_tag(:span,link_to_field(row_data,field[0],field[2]),:class=>field[1])%></td>
<td><%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%></td>
<% end %>
</tr>
<% end %>

View File

@ -7,7 +7,7 @@
</div>
<div class="wrap">
<% @fields.each do |field|%>
<%= content_tag(:span,link_to_field(row_data,field[0]),:class=>field[1])%>
<%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% end %>
</div>
<% end %>

View File

@ -6,7 +6,7 @@
<% @data.each do |row_data| %>
<%= content_tag(:li) do %>
<% @fields.each do |field|%>
<%= content_tag(:span,link_to_field(row_data,field[0]),:class=>field[1])%>
<%= content_tag(:span, link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% end %>
<% end %>
<% end %>

View File

@ -0,0 +1,4 @@
<%= render @partial %>
<% if @paginate %>
<%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %>
<% end %>

View File

@ -13,7 +13,7 @@
<li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= panel_personal_journal_desktop_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' custom-load="journal" onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeConference' href="<%= panel_personal_conference_desktop_conference_p_path %>" class="widget_fn wh3 hh3" id='d_conference_p' custom-load="conference" onclick="return false;"><span class="widget_icon"><img src="" alt="Conference Papers" id="conference_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeConference' href="<%= panel_personal_conference_desktop_conference_window_path %>" class="widget_fn wh3 hh3" id='d_conference_p' custom-load="conference" onclick="return false;"><span class="widget_icon"><img src="" alt="Conference Papers" id="conference_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeBooks' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>

View File

@ -0,0 +1,15 @@
<% unless @ancestors.blank? %>
<ul class="breadcrumb">
<% @ancestors.each_with_index do |node, i| %>
<% last = i == @ancestors.size-1 %>
<li class='<%= 'active' if last %>'>
<% if last %>
<%= node.title %>
<% else %>
<%= link_to node.title, "/#{node.path}" %>
<span class="divider">/</span>
<% end %>
</li>
<% end %>
</ul>
<% end %>

View File

@ -1,6 +1,6 @@
<% if @menu_page && @menu_page.visible_children.size > 0 %>
<div class='category_list'>
<h3 class='h3'><%= @menu_page.title %></h3>
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
<ul class='list'>
<% @menu_page.visible_children.each do |child| %>
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">

View File

@ -37,17 +37,18 @@ markups:
muti_lang_input_supprt: true
ext_support: true
public_r_tags:
- ad_banner
- sub_menu
- sitemap
- breadcrumb
page_part_kinds:
- text
- public_r_tag
- module_widget
widget_field:
- title
- category
@ -57,7 +58,7 @@ widget_field:
- content
- link
- file
widget_field_type:
- title
- category
@ -76,4 +77,4 @@ default_widget_style:
- style2
- style3
- style4
- style5
- style5

View File

@ -209,11 +209,6 @@ Orbit::Application.routes.draw do
match 'desktop_publications/books_list'=>'desktop_publications#books_list'
match 'desktop_publications/books_add'=>'desktop_publications#books_add'
match 'desktop_publications/conference_p' => 'desktop_publications#conference_p'
match 'desktop_publications/conference_p_list/'=>'desktop_publications#conference_p_list'
match 'desktop_publications/conference_p_add/'=>'desktop_publications#conference_p_add'
# end
# namespace :desktop_research do
match 'desktop_research/research_d' => 'desktop_research#research_d'
match 'desktop_research/research_d_list/' => 'desktop_research#research_d_list'
@ -255,7 +250,7 @@ Orbit::Application.routes.draw do
end
end
controller_paths :front, %w[show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap]
controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap]
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
# scope 'app' do
@ -274,7 +269,9 @@ Orbit::Application.routes.draw do
root :to => 'mobile#index', :as => 'mobile'
end
match '/panel/orbit_app/widget/:type' => 'pages#index_from_link', :constraints => lambda { |request|
request.query_string.include?("same_page_id=")
}
match '/panel/orbit_app/widget/:type' => 'default_widget#default_widget'

View File

@ -6,28 +6,53 @@ FactoryGirl.definition_file_paths = Dir["#{Rails.root}/vendor/built_in_modules/*
FactoryGirl.find_definitions
CoAuthorRelation.destroy_all
CoAuthor.destroy_all
JournalLevelType.destroy_all
WritingJournalFile.destroy_all
WritingJournal.destroy_all
ConferenceCoAuthorRelation.destroy_all
ConferenceCoAuthor.destroy_all
ConferencePaperType.destroy_all
WritingConferenceFile.destroy_all
WritingConference.destroy_all
#Dir[Rails.root.join("spec/factories/*.rb")].each {|f| require f}
10.size.times do
FactoryGirl.create(:journal_level)
2.times do
FactoryGirl.create(:conference_paper_type)
end
10.times do
FactoryGirl.create(:relations)
FactoryGirl.create(:conference_co_author_relation)
end
50.times do
FactoryGirl.create(:paper_record)
FactoryGirl.create(:conference_co_author)
end
50.times do
FactoryGirl.create(:co_author_candidate)
FactoryGirl.create(:writing_conference)
end
puts "Success!"
# =======
#
#CoAuthorRelation.destroy_all
#CoAuthor.destroy_all
#JournalLevelType.destroy_all
#WritingJournalFile.destroy_all
#WritingJournal.destroy_all
#
#10.size.times do
# FactoryGirl.create(:journal_level)
#end
#
#10.times do
# FactoryGirl.create(:journal_relation)
#end
#
#50.times do
# FactoryGirl.create(:journal)
#end
#
#50.times do
# FactoryGirl.create(:journal_co_author)
#end
#puts "Success!"

View File

@ -30,6 +30,7 @@ module ParserBackEnd
parse_images_edit(body, page)
parse_footer_edit(body, page)
parse_sub_menu_edit(body, page)
parse_breadcrumb_edit(body, page)
parse_counter_edit(body)
public_r_tags.each do |tag|
send("parse_#{tag}s_edit", body, page, true)

View File

@ -144,6 +144,32 @@ module ParserCommon
end
end
# breadcrumb
def parse_breadcrumbs_edit(body = nil, page = nil, edit=nil)
body.css('breadcrumb').each do |breadcrumb|
ancestors = Page.find(page.id).ancestors_and_self rescue nil
ancestors = nil if ancestors.size == 1
res = ''
if ancestors
res << "<ul class='breadcrumb'>"
ancestors.each_with_index do |node, i|
last = i == ancestors.size-1
res << "<li class=#{'active' if last}>"
if last
res << node.title
else
res << "<a herf='/#{node.path}'>#{node.title}</a>"
res << "<span class='divider'>/</span>"
end
res << "</li>"
end
res << "</ul>"
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
breadcrumb.swap(fragment)
end
end
# page_footer
def parse_footer_edit(body, page)
page_footer = body.css('.page_footer').first
@ -172,10 +198,23 @@ module ParserCommon
end
end
def parse_breadcrumb_edit(body, page)
page_breadcrumb = body.css('.page_breadcrumb').first
if page_breadcrumb
res = "<div id='#{page_breadcrumb['id']}', class='#{page_breadcrumb['class']}'>"
res << @site.breadcrumb rescue nil
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_breadcrumb.swap(fragment) rescue nil
else
''
end
end
# sitemap
def parse_sitemaps_edit(body = nil, page = nil, edit=nil)
sitemap = body.css('sitemap').first
url = admin_site_sitemap_frontend_path(@site)
url = front_show_sitemap_path
options = "?inner=true"
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>")
sitemap.swap(fragment)
@ -219,7 +258,7 @@ module ParserCommon
raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil?
"/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
end
options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part"
options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part"
ret << "<div class='dymanic_load widget' path='#{url + options}'></div>"
when 'public_r_tag'
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"

View File

@ -11,6 +11,7 @@ module ParserFrontEnd
parse_images(body, page)
parse_menu(body, page)
parse_sub_menu(body, page, site)
parse_breadcrumb(body, page, site)
parse_counter(body)
i18n.merge!({locale => body.to_html})
end
@ -18,8 +19,8 @@ module ParserFrontEnd
end
def parse_page_content(page)
category = params[:category_id].blank? ? page[:category] : params[:category_id]
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
category = params[:category_id].blank? ? page[:category] : params[:category_id]
body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front|
if front['value']
@ -92,6 +93,18 @@ module ParserFrontEnd
end
end
# page_breadcrumb
def parse_breadcrumb(body, page, site)
page_breadcrumb = body.css('.page_breadcrumb').first
if page_breadcrumb
res = "<orbit_front path='\#{front_show_breadcrumb_path(@item)}' class='dymanic_load widget'></orbit_front>"
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
page_breadcrumb.swap(fragment)
else
''
end
end
# page_contents
def parse_contents(body, page, edit=nil, locale)
public_r_tags = []
@ -101,6 +114,7 @@ module ParserFrontEnd
if (content["main"] == "true" && !page.module_app.nil?)
if page.app_frontend_url == 'default_widget'
url = "/panel/orbit_app/widget/#{page.frontend_style}?inner=true"
url << "&id=\#{params[:id] if params[:id] && !params[:id].eql?(page.id.to_s)}"
else
url = "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}\#{(\"/\" + params[:id]) if params[:id] && !params[:id].eql?(page.id.to_s)}\#{(\"/\" + params[:controller_action]) if params[:controller_action] && params[:id]}?inner=true"
end
@ -123,9 +137,7 @@ module ParserFrontEnd
else
"/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true"
end
options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part"
options = "&part_id=\#{part.id}&category_id=\#{part[:category]}&tag_id=\#{part[:tag]}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part"
ret << "<orbit_front path='#{url + options}' part_id=#{part.id} class='dymanic_load widget'></orbit_front>"
when 'public_r_tag'
@ -178,5 +190,9 @@ module ParserFrontEnd
def generate_sub_menus(*args)
"<div class='dymanic_load' path='#{front_show_page_sub_menu_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
end
# breadcrumb
def generate_breadcrumbs(*args)
"<div class='dymanic_load' path='#{front_show_breadcrumb_path(args[1])}'></div>"
end
end

View File

@ -1,313 +1,10 @@
# encoding: utf-8
namespace :migrate do
task :i18n => :environment do
p 'Start Bulletin'
bulletins = Bulletin.admin_manager_all
i = 1
bulletins.each do |bulletin|
p "#{i}/#{bulletins.size} - #{bulletin.id}"
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => bulletin.id, :language_value_type => bulletin.class})
bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
p bulletin.save(:validate => false)
i += 1
end
p 'End Bulletin'
p '====================================================='
p 'Start BulletinCategory'
categories = BulletinCategory.admin_manager_all
i = 1
categories.each do |category|
p "#{i}/#{categories.size} - #{category.id}"
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p category.save(:validate => false)
i += 1
end
p 'End BulletinCategory'
p '====================================================='
p 'Start BulletinFile'
files = BulletinFile.all
i = 1
files.each do |file|
p "#{i}/#{files.size} - #{file.id}"
description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p file.save(:validate => false)
i += 1
end
p 'End BulletinFile'
p '====================================================='
p 'Start BulletinLink'
links = BulletinLink.all
i = 1
links.each do |link|
p "#{i}/#{links.size} - #{link.id}"
title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p link.save(:validate => false)
i += 1
end
p 'End BulletinLink'
p '====================================================='
p 'Start UnitListForAnc'
units = UnitListForAnc.all
i = 1
units.each do |unit|
p "#{i}/#{units.size} - #{unit.id}"
title = I18nVariable.first(:conditions => {:language_value_id => unit.id, :language_value_type => unit.class})
unit.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p unit.save(:validate => false)
i += 1
end
p 'End UnitListForAnc'
p '====================================================='
p '====================================================='
p 'Start PageContext'
page_contexts = PageContext.all
i = 1
page_contexts.each do |page_context|
p "#{i}/#{page_contexts.size} - #{page_context.id}"
context = I18nVariable.first(:conditions => {:language_value_id => page_context.id, :language_value_type => page_context.class})
page_context.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
p page_context.save(:validate => false)
i += 1
end
p 'End PageContext'
p '====================================================='
p '====================================================='
p 'Start WebLink'
links = WebLink.all
i = 1
links.each do |link|
p "#{i}/#{links.size} - #{link.id}"
# the original key was 'name'
title = I18nVariable.first(:conditions => {:key => 'name', :language_value_id => link.id, :language_value_type => link.class})
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
context = I18nVariable.first(:conditions => {:key => 'context', :language_value_id => link.id, :language_value_type => link.class})
link.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context
p link.save(:validate => false)
i += 1
end
p 'End WebLink'
p '====================================================='
p 'Start WebLinkCategory'
categories = WebLinkCategory.admin_manager_all
i = 1
categories.each do |category|
p "#{i}/#{categories.size} - #{category.id}"
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p category.save(:validate => false)
i += 1
end
p 'End WebLinkCategory'
p '====================================================='
p '====================================================='
p 'Start Meta'
metas = Meta.all
i = 1
metas.each do |meta|
p "#{i}/#{metas.size} - #{meta.id}"
title = I18nVariable.first(:conditions => {:language_value_id => meta.id, :language_value_type => meta.class})
meta.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p meta.save(:validate => false)
i += 1
end
p 'End Meta'
p '====================================================='
p '====================================================='
p 'Start Attribute'
attributes = Attribute.all
i = 1
attributes.each do |attribute|
p "#{i}/#{attributes.size} - #{attribute.id}"
title = I18nVariable.first(:conditions => {:language_value_id => attribute.id, :language_value_type => attribute.class})
attribute.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p attribute.save(:validate => false)
i += 1
end
p 'End Attribute'
p '====================================================='
p 'Start AttributeField'
attribute_fields = AttributeField.all
i = 1
attribute_fields.each do |attribute_field|
p "#{i}/#{attribute_fields.size} - #{attribute_field.id}"
title = I18nVariable.first(:conditions => {:language_value_id => attribute_field.id, :language_value_type => attribute_field.class})
attribute_field.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p attribute_field.save(:validate => false)
i += 1
end
p 'End AttributeField'
p '====================================================='
p 'Start Role'
roles = Role.all
i = 1
roles.each do |role|
p "#{i}/#{roles.size} - #{role.id}"
title = I18nVariable.first(:conditions => {:language_value_id => role.id, :language_value_type => role.class})
role.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p role.save(:validate => false)
i += 1
end
p 'End Role'
p '====================================================='
p '====================================================='
p 'Start AdImage'
ad_images = AdImage.all
i = 1
ad_images.each do |image|
p "#{i}/#{ad_images.size} - #{image.id}"
# no key is set and title = context, this is due to original error in the code
title = I18nVariable.first(:conditions => {:language_value_id => image.id, :language_value_type => image.class})
image.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
image.context_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p image.save(:validate => false)
i += 1
end
p 'End AdImage'
p '====================================================='
p '====================================================='
p 'Start Asset'
assets = Asset.all
i = 1
assets.each do |asset|
p "#{i}/#{assets.size} - #{asset.id}"
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => asset.id, :language_value_type => asset.class})
asset.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
description = I18nVariable.first(:conditions => {:key => 'description', :language_value_id => asset.id, :language_value_type => asset.class})
asset.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
p asset.save(:validate => false)
i += 1
end
p 'End Asset'
p '====================================================='
p 'Start AssetCategory'
categories = AssetCategory.all
i = 1
categories.each do |category|
p "#{i}/#{categories.size} - #{category.id}"
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p category.save(:validate => false)
i += 1
end
p 'End AssetCategory'
p '====================================================='
p '====================================================='
p 'Start Item'
items = Item.all
i = 1
items.each do |item|
p "#{i}/#{items.size} - #{item.id}"
title = I18nVariable.first(:conditions => {:language_value_id => item.id, :language_value_type => item.class})
item.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p item.save(:validate => false)
i += 1
end
p 'End Item'
p '====================================================='
p 'Start Page'
pages = Page.all
i = 1
pages.each do |item|
p "#{i}/#{pages.size} - #{item.id}"
# the key was originally 'title', changed to 'page_title' to avoit conflict with parent
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => item.id, :language_value_type => item.class})
item.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
p item.save(:validate => false)
i += 1
end
p 'End Page'
p '====================================================='
p 'Start PagePart'
page_parts = PagePart.all
i = 1
page_parts.each do |part|
p "#{i}/#{page_parts.size} - #{part.id}"
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => part.id, :language_value_type => part.class})
part.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
content = I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => part.id, :language_value_type => part.class})
part.content_translations = {'en' => content['en'], 'zh_tw' => content['zh_tw']} if content
p part.save(:validate => false)
i += 1
end
p 'End PagePart'
p '====================================================='
p '====================================================='
p 'Start Site'
site = Site.first
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => site.id, :language_value_type => site.class})
site.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
footer = I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => site.id, :language_value_type => site.class})
site.footer_translations = {'en' => footer['en'], 'zh_tw' => footer['zh_tw']} if footer
sub_menu = I18nVariable.first(:conditions => {:key => 'sub_menu', :language_value_id => site.id, :language_value_type => site.class})
site.sub_menu_translations = {'en' => sub_menu['en'], 'zh_tw' => sub_menu['zh_tw']} if sub_menu
p site.save(:validate => false)
p 'End Site'
end
task :news_p => :environment do
news_bulletins = NewsBulletin.admin_manager_all rescue nil
i = 1
news_bulletins.each do |news|
p "#{i}/#{news_bulletins.size} - #{news.id}"
news.subtitle_translations = {'en' => (news.subtitle_translations['en'].gsub(/^\<p\>/, '').gsub(/\<\/p\>$/, '') rescue ''), 'zh_tw' => (news.subtitle_translations['zh_tw'].gsub(/^\<p\>/, '').gsub(/\<\/p\>$/, '') rescue nil)}
p news.save(:validate => false) if news.changed?
i += 1
end if news_bulletins
end
task :sitemap_i18n => :environment do
Item.all.each do |item|
item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : nil
item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : {}
item.save
end
end
@ -492,4 +189,29 @@ namespace :migrate do
pp.save
end
end
task :clean_parts => :environment do
PagePart.where(widget_style: /\d/, kind: 'module_widget').each{|part| part.update_attributes({kind: 'text', widget_style: nil, widget_field: nil})}
PagePart.where(widget_style: /\d/).each{|part| part.update_attributes({widget_style: nil, widget_field: nil})}
end
task :delete_import_archive => :environment do
categories = ArchiveFileCategory.where(key: /import_/).entries
unless categories.blank?
categories.each do |category|
files = category.archive_files
unless files.blank?
files.each(&:destroy)
end
category.destroy
end
end
end
task :save_pages => :environment do
Page.all.each do |page|
page.save
end
end
end

View File

@ -4,7 +4,7 @@ namespace :pages do
task :build => :environment do
Item.delete_all
Item.destroy_all
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')

View File

@ -4,8 +4,8 @@ namespace :site do
task :build => :environment do
Site.delete_all
Purchase.delete_all
Site.destroy_all
Purchase.destroy_all
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

View File

@ -9,7 +9,7 @@
"settings":"d_settings.png",
"publication":"d_publication.png",
"journal_p":"d_journal_p.png",
"seminar_p":"d_seminar_p.png",
"conference_p":"d_conference_p.png",
"books":"d_books.png",
"research":"d_research.png",
"research_d":"d_research_d.png",
@ -36,4 +36,4 @@
"connection":"d_connection.png",
"appstore":"d_appstore.png"
}
}
}

1038
route

File diff suppressed because one or more lines are too long

View File

@ -286,7 +286,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def delete
if params[:ids]
bulletins = Bulletin.any_in(:_id => params[:ids]).delete_all
bulletins = Bulletin.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -12,7 +12,7 @@ class BulletinLink
belongs_to :bulletin
before_validation :add_http
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
validates :url, :presence => true, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i
protected

View File

@ -16,4 +16,17 @@ en:
update_bulletin_success: Announcement was successfully updated
update_bulletin_category_success: Announcement category was successfully updated
all_articles: All Articles
add_new: New
add_new: New
widget:
index: Index widget
bulletins_and_web_links: "Abreast of bulletins and web link"
#init don't merge
all_articles: "All article"
add_new: New
categories: Categories
approval_setting: "Approval setting"
tags: Tag
default_widget:
bulletin_category_with_title: Category
title: Title
postdate: "Post date"

View File

@ -13,6 +13,7 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
respond_to do |format|
format.html # index.html.erb
format.js
format.xml { render :xml => @archive_files }
end
end

View File

@ -12,5 +12,9 @@ class ArchiveFileCategory
has_many :archive_files
validates :title, :at_least_one => true
def self.from_id(id)
ArchiveFileCategory.find(id) rescue nil
end
end

View File

@ -6,7 +6,7 @@
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('archive_file_category.edit'), edit_panel_archive_back_end_archive_file_category_path(archive_file_category), :remote => true %></li>
<li><%= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<!-- <li><%#= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('sure?'), :method => :delete, :remote => true %></li> -->
</ul>
</div>
</td>

View File

@ -1,30 +1,30 @@
<tr id="<%= dom_id post %>" class="with_action">
<tr id="<%= dom_id archive_file %>" class="with_action">
<td>
<% if post.is_top? %>
<% if archive_file.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<% if archive_file.is_hot? %>
<span class="label label-important"><%= t(:hot) %></span>
<% end %>
<% if post.is_hidden? %>
<% if archive_file.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
<% if is_manager?%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('archive_file.edit'), edit_panel_archive_back_end_archive_file_path(post) %></li>
<li><%= link_to t('archive_file.delete'), panel_archive_back_end_archive_file_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('archive_file.edit'), edit_panel_archive_back_end_archive_file_path(archive_file) %></li>
<li><%= link_to t('archive_file.delete'), panel_archive_back_end_archive_file_path(archive_file), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
<%end%>
</td>
<td><%= post.archive_file_category.title %></td>
<td><%= archive_file.archive_file_category.title %></td>
<td>
<%= link_to post.title, panel_archive_front_end_archive_file_path(post) %>
<%= link_to archive_file.title, panel_archive_front_end_archive_file_path(archive_file) %>
</td>
<td>
<% post.tags.each do |tag| %>
<% archive_file.tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>

View File

@ -10,14 +10,11 @@
<th class="span1-2"><%= t('archive_file.tags') %></th>
</tr>
</thead>
<tbody>
<% @archive_files.each do |post| %>
<%= render :partial => 'archive_files', :locals => {:post => post} %>
<% end %>
<tbody id="tbody_archive">
<%= render :partial => 'archive_file', :collection => @archive_files %>
</tbody>
</table>
<%= paginate @archive_files %>
<div id="archive_pagination">
<%= paginate @archive_files %>
</div>

View File

@ -0,0 +1,2 @@
$("#tbody_archive").html("<%= j render :partial => 'archive_file', :collection => @archive_files %>");
$("#archive_pagination").html("<%= j paginate @archive_files %>");

View File

@ -4,17 +4,17 @@
<%#= paginate @archive_files, :params => {:inner => false}%>
<% if @title %>
<h1 class="h1"><%= @title %></h1>
<% end %>
<%# if @title %>
<!-- <h1 class="h1"><%#= @title %></h1> -->
<%# end %>
<ul class="subm">
<% @archive_file_categorys.each do |afcpost| %>
<li><%= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li>
<% end %>
</ul>
<!-- <ul class="subm"> -->
<%# @archive_file_categorys.each do |afcpost| %>
<!-- <li><%#= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li> -->
<%# end %>
<!-- </ul> -->
<h3><%= @archive_files.first.archive_file_category.title rescue nil %></h3>
<h3><%= @current_category.title rescue nil %></h3>
<% @archive_files.each do |post| %>

View File

@ -3,7 +3,6 @@ Rails.application.routes.draw do
namespace :panel do
namespace :archive do
namespace :back_end do
root :to => "archive_files#index"
resources :archive_files
resources :archive_file_categorys
resources :tags

View File

@ -3,7 +3,7 @@ module Archive
module_label 'archive.archive'
base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
version "0.1"
organization "Rulingcom"

View File

@ -2,12 +2,9 @@ zh_tw:
miss_module_i18n:
# miss_plugin_i18n:
# personal_experience: 經歷
# personal_honor: 榮譽
# personal_project: 研究計畫
# personal_research: 研究
# personal_conference: 研討會論文

View File

@ -280,7 +280,7 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
def delete
if params[:ids]
writing_books = WritingBook.any_in(:_id => params[:ids]).delete_all
writing_books = WritingBook.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_book_back_end_writing_books_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -146,7 +146,7 @@ class Panel::PersonalBook::Plugin::WritingBooksController < OrbitBackendControll
def delete
if params[:ids]
writing_books = WritingBook.any_in(:_id => params[:ids]).delete_all
writing_books = WritingBook.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_book_plugin_writing_books_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -51,7 +51,7 @@ class WritingBook
after_save :save_writing_book_files
validates :url, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :unless => Proc.new{self.url.blank?}
validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?}
def self.search( category_id = nil )

View File

@ -1,11 +1,9 @@
module PersonalBook
OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do
OrbitApp.registration "Book",:type=> 'ModuleApp' do
module_label 'module_name.personal_book'
base_url File.expand_path File.dirname(__FILE__)
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:admin_path=>"/panel/personal_book/back_end/writing_books",:i18n=>'module_name.personal_book'
end
end

View File

@ -279,7 +279,7 @@ class Panel::PersonalConference::BackEnd::WritingConferencesController < OrbitBa
def delete
if params[:ids]
writing_conferences = WritingConference.any_in(:_id => params[:ids]).delete_all
writing_conferences = WritingConference.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_conference_back_end_writing_conferences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -0,0 +1,63 @@
class Panel::PersonalConference::Desktop::ConferenceCoAuthorRelationsController < ApplicationController
def index
@conference_co_author_relations = ConferenceCoAuthorRelation.all
new
respond_to do |format|
format.html {render layout: false }
end
end
def edit
@conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id])
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@conference_co_author_relation = ConferenceCoAuthorRelation.new
end
def create
@conference_co_author_relation = ConferenceCoAuthorRelation.new(params[:conference_co_author_relation])
@conference_co_author_relations = ConferenceCoAuthorRelation.all
if @conference_co_author_relation.save
newv = render_to_string partial: "show_form", object: @conference_co_author_relations
render json: {success: true, msg: "New Relation successfully saved!", newvalue: newv}.to_json
else
error_msg = @conference_co_author_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id])
if @conference_co_author_relation.update_attributes(params[:conference_co_author_relation])
@conference_co_author_relations = ConferenceCoAuthorRelation.all
newv = render_to_string partial: "show_form", object: @conference_co_author_relations
render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json
else
error_msg = @conference_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id])
@conference_co_author_relation.destroy
reset_co_author_relation
render :json => {success: true, msg: "deleted successfully!"}
end
private
def reset_co_author_relation
co_author = ConferenceCoAuthor.where(co_author_relations_id: @co_author_relation.id)
co_author.map do |c|
c.update_attributes(co_author_relations_id: nil)
end
end
end

View File

@ -0,0 +1,59 @@
class Panel::PersonalConference::Desktop::ConferenceCoAuthorsController < ApplicationController
def index
nils, not_nils = ConferenceCoAuthor.where(name_id: current_user.id)\
.asc(:co_author).partition{|p| p.email.nil?}
@conference_co_authors = not_nils + nils
@conference_co_author_relations = ConferenceCoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@conference_co_author = ConferenceCoAuthor.new
@conference_co_author_relations = ConferenceCoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def edit
@conference_co_author = ConferenceCoAuthor.find(params[:id])
@conference_co_author_relations = ConferenceCoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
@conference_co_author = ConferenceCoAuthor.new(params[:conference_co_author])
@conference_co_author.name_id= current_user.id
if @conference_co_author.save
render json: {success:true, msg: t('create.sucess.co_author')}.to_json
else
error_msg = @conference_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@conference_co_author = ConferenceCoAuthor.find(params[:id])
if @conference_co_author.update_attributes(params[:co_author])
render json: {success:true, msg: t('update.sucess.co_author')}.to_json
else
error_msg = @conference_co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@conference_co_author = ConferenceCoAuthor.find(params[:id])
@conference_co_author.destroy
render :json => {success: true, msg: "Co-author deleted successfully!"}
end
end

View File

@ -1,5 +0,0 @@
class Panel::PersonalConference::Desktop::ConferencePController < ApplicationController
def conference_p
render panel_personal_conference_desktop_conference_p_path, :layout => false
end
end

View File

@ -1,11 +1,82 @@
class Panel::PersonalConference::Desktop::ConferencePagesController < ApplicationController
def index
@writing_conferences = WritingConference.all
@level_types = ConferencePaperType.all
respond_to do |format|
format.html { render :layout => false}
end
end
def show
end
def new
@writing_conference = WritingConference.new
@paper_types = ConferencePaperType.all
@author_types = ConferenceAuthorType.all
#@co_author_candidate =
# CoAuthor.where(name_id: current_user.id).map{|c|c.co_author}
#@conference_candidate =
# WritingConference.where(create_user_id: current_user.id).map{|j|j.conference_title}.uniq
respond_to do |format|
format.html { render :layout => false}
end
end
def edit
@writing_conference = WritingConference.find(params[:id])
@paper_types = ConferencePaperType.all
@author_types = ConferenceAuthorType.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
params[:writing_conference][:create_user_id] = current_user.id
@writing_conference = WritingConference.new(params[:writing_conference])
if @writing_conference.save
render json: {success: true, msg: t('create.success.paper')}.to_json
else
error_msg = @writing_conference.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
params[:writing_conference][:update_user_id] = current_user.id
@writing_conference= WritingConference.find(params[:id])
if @writing_conference.update_attributes(params[:writing_conference])
render json: {success: true, msg: t('update.success.paper')}.to_json
else
error_msg = @writing_conference.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@writing_conference = WritingConference.find(params[:id])
@writing_conference.destroy
render :json => {success: true, msg: t('delete.success.paper')}
end
def conference_type
conference_types = ConferencePaperType.all
all_conference_lists = WritingConference.where(create_user_id: current_user.id)
all_conference_lists = all_conference_lists.map do |j|
[ j.conference_title,
j.conference_paper_type_ids.map do |type|
conference_types.find(type).title
end
]
end
@conference_lists = all_conference_lists.uniq
respond_to do |format|
format.html { render :layout => false}
end

View File

@ -0,0 +1,5 @@
class Panel::PersonalConference::Desktop::ConferenceWindowsController < ApplicationController
def conference_window
render panel_personal_conference_desktop_conference_window_path, :layout => false
end
end

View File

@ -147,7 +147,7 @@ class Panel::PersonalConference::Plugin::WritingConferencesController < OrbitBac
def delete
if params[:ids]
writing_conferences = WritingConference.any_in(:_id => params[:ids]).delete_all
writing_conferences = WritingConference.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_personal_conference_plugin_writing_conferences_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end

View File

@ -0,0 +1,65 @@
module Panel::PersonalConference::Desktop::ConferencePagesHelper
def publication_record publication
content_tag :li,
:class => "list_t_item" do
marker + \
content(publication) + \
edit_or_delete(publication)
end
end
def marker
content_tag :div,
:class => "list_item_action"
content_tag(:a, "", :class => "icon-check-empty") + \
content_tag(:a, "", :class => "icon-star-empty")
end
def content publication
content_tag(:div, "conference : " + publication.conference_title,
:class => "list_t_title") + \
content_tag(:div, "title : " + publication.paper_title,
:class => "list_t_des") + \
content_tag(:div, "keyword :" + publication.keywords,
:class => "list_t_des") + \
content_tag(:div, "abstract : " + publication.abstract,
:class => "list_t_des") + \
content_tag(:div, link_publication_file(publication),
:class => "list_t_des")
end
def edit_or_delete publication
content_tag :div,
:class => "list_item_function" do
content_tag(:a, t("edit"),
:class => "journal_paper_edit admbg2 admtxt",
:href => edit_panel_personal_conference_desktop_conference_page_path(publication),
"ajax-remote" => "get") + \
content_tag(:a, t("delete"),
"ajax-remote" => "delete",
"confirm-message" => t("sure?"),
"callback-method" => "paperDelete",
:class => "journal_paper_delete admbg2 admtxt",
:href => panel_personal_conference_desktop_conference_page_path(publication))
end
end
def link_publication_file publication
publication.writing_conference_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title, :class => "filetitle"),
file.file.url,
:class => "file",
"target" => "_blank")
}.inject(:+)
end
def check_file_type file
if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
else
file_type = ""
end
end
end

View File

@ -0,0 +1,20 @@
class ConferenceCoAuthor
include Mongoid::Document
LANGUAGE_TYPES = [ "English", "Chinese" ]
field :name_id, type: BSON::ObjectId
field :co_author, localize: true
field :email
belongs_to :conference_co_author_relations
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
allow_blank: true,
uniqueness: { case_sensitive: false }
validates :co_author, presence: true
before_save { |coauthor| coauthor.email = email.downcase if not coauthor.email.nil?}
end

View File

@ -0,0 +1,11 @@
class ConferenceCoAuthorRelation
include Mongoid::Document
include Mongoid::Timestamps
field :relation, localize: true
has_and_belongs_to_many :conference_co_authors
validates :relation, presence: true,
uniqueness: { case_sensitive: false }
end

View File

@ -48,7 +48,7 @@ class WritingConference
after_save :save_writing_conference_files
validates :url, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :unless => Proc.new{self.url.blank?}
validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?}
def self.search( category_id = nil )

View File

@ -0,0 +1,11 @@
<%= f.text_field :relation %>
<!--
<#%= f.fields_for :relation_translations do |f| %>
<#%= f.text_field locale,
value: (@conference_co_author_relation.relation_translations[locale] rescue nil) %>
<#% end %>
-->
<%= f.submit "Save", class: "ini_input hp hh2 thmtxt thmc2", style: "margin-left: 10px;" %>
<% if not @conference_co_author_relation.new_record? %>
<%= submit_tag "Cancel", :type => "button", class: "bt-cancel-type ini_input hp hh2 thmtxt" %>
<% end %>

View File

@ -0,0 +1,3 @@
<%= form_for(@conference_co_author_relation, url: panel_personal_conference_desktop_conference_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
<%= render partial: 'form' , locals: {:f => f}%>
<% end %>

View File

@ -0,0 +1,17 @@
<% @conference_co_author_relations.each_with_index do |conference_co_author_relation,i| %>
<% if ( i % 6 ) == 0 %>
<div class="s_grid_con s_form">
<ul>
<% end %>
<li class="s_grid_row">
<div class="form_space" id="form_space_<%= i.to_s %>"><%= conference_co_author_relation.relation %></div>
<div class="list_item_function">
<%= link_to 'Edit', edit_panel_personal_conference_desktop_conference_co_author_relation_path(conference_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
<%= link_to 'Destroy', panel_personal_conference_desktop_conference_co_author_relation_path(conference_co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 6 ) == 5 %>
</ul>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,3 @@
<%= form_for(@conference_co_author_relation, url: panel_personal_conference_desktop_conference_co_author_relation_path(@conference_co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %>
<%= render partial: 'form' , locals: {:f => f}%>
<% end %>

View File

@ -0,0 +1,35 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn ini_input hp hh2 thmc2 thmtxt" %>
<%= submit_tag "Cancel", :type => "button", class: "bt-cancel fn_btn ini_input hp hh2 thmtxt" %>
</div>
</div>
<div id="new_co_author" class="s_grid_con s_form vp">
<ul>
<li class="s_grid_row">
<%= f.label :co_author, class: "s_grid s_grid_2" %>
<%= f.text_field :co_author, class: "s_grid_4 s_grid"%>
<!--
<%#= f.fields_for :co_author_translations do |f| %>
<%#= f.text_field locale,
class: "s_grid_4 s_grid",
value: (@conference_co_author.co_author_translations[locale] rescue nil) %>
<%# end %>
-->
</li>
<li class="s_grid_row">
<%= f.label :email, class: "s_grid s_grid_2"%>
<%= f.text_field :email, class: "s_grid s_grid_4" %>
</li>
<li class="s_grid_row">
<%= f.label :type, class: "s_grid s_grid_2"%>
<select name="conference_co_author[co_author_relations_id]" id="" class="s_grid s_grid_4">
<%= options_for_select(
@conference_co_author_relations.map do |relation|
[relation.relation, relation.id]
end
)%>
</select>
</li>
</ul>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @conference_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_conference_desktop_conference_co_author_path(@conference_co_author) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<% end %>

View File

@ -0,0 +1,34 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<%= link_to "New Co-Author", new_panel_personal_conference_desktop_conference_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Type", panel_personal_conference_desktop_conference_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
</div>
</div>
<div id="co_author" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<% @conference_co_authors.each_with_index do |co_author,i| %>
<% if ( i % 4 ) == 0 %>
<div class="g_col">
<ul>
<% end %>
<li class="list_t_item">
<ul class="info">
<li><div class="name"><%= co_author.co_author %></div></li>
<li><div class="email"><i class="icon-envelope"></i> <%= co_author.email %></div></li>
<li><div class="relations"><i class="icon-user"></i> <%= @conference_co_author_relations.find(co_author.conference_co_author_relations_id).relation unless co_author.conference_co_author_relations_id.nil?%></div></li>
</ul>
<div class="list_item_function">
<%= link_to 'Edit', edit_panel_personal_conference_desktop_conference_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
<%= link_to 'Destroy', panel_personal_conference_desktop_conference_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 4 ) == 3 %>
</ul>
</div>
<% end %>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
<%= form_for @conference_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"conferenceCoAuthorformCallback"} , url: panel_personal_conference_desktop_conference_co_authors_path do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<% end %>

View File

@ -0,0 +1,220 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<%= f.submit t("save"), name: "commit", value: "Save", class: "fn_btn ini_input hp hh2 thmc2 thmtxt" %>
<!-- class: bt-cancle can't be remove -->
<% if not @writing_conference.new_record? %>
<%= submit_tag t("cancel"), :type => "button", class: "bt-cancel ini_input hp hh2 thmadm thmtxt" %>
<% end %>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Share</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Full</a></li>
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
<li><a class="hp hh2 admtxt" href="">Private</a></li>
<li><a class="hp hh2 admtxt" href="">Group</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
</div>
</div>
<div id="paper_add" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row">
<%= f.fields_for :paper_title_translations do |f| %>
<%= f.text_area locale,
class: "s_grid_6 s_grid",
size: "20x2",
placeholder: t("personal_conference.paper_title"),
value: (@writing_conference.paper_title_translations[locale.to_s] rescue nil) %>
<% end %>
</li>
<li class="s_grid_row">
<%= f.fields_for :conference_title_translations do |f| %>
<%= f.text_field locale,
size: "20",
placeholder: t("personal_conference.conference_title"),
class: "s_grid_6 s_grid",
# "autocomplete-list" => "conference_title_autocomplete_list",
value: (@writing_conference.conference_title_translations[locale.to_s] rescue nil) %>
<% end %>
<span class="icon-plus input_append"></span>
</li>
<li class="s_grid_row">
<div>
<%= label_tag("", t("personal_conference.paper_type")) %>
<ul>
<% @paper_types.each_with_index do |paper_type, i| %>
<li class="s_grid_row">
<%= radio_button_tag "writing_conference[conference_paper_type_ids][]",
paper_type.id,
@writing_conference.conference_paper_type_ids.include?(paper_type.id),
id: "field-#{i}"
%><%= label_tag("field-#{i}", paper_type.title) %>
</li>
<% end %>
</ul>
</div>
</li>
<li class="s_grid_row">
<%= f.text_field :keywords, size: "20", placeholder: t("personal_conference.keywords"), class: "s_grid_6 s_grid"%>
</li>
<li class="s_grid_row">
<div>
<%= label_tag("", t("personal_conference.conference_time")) %>
<ul>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.period_start_date"), class: "s_grid_1 s_grid") %>
<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.period_end_date"), class: "s_grid_1 s_grid") %>
<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %>
</li>
</ul>
</div>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.sponsor"), class: "s_grid_2 s_grid") %><%= f.text_field :sponsor, size: "20", placeholder: "Sponsor", class: "s_grid_4 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.location"), class: "s_grid_2 s_grid") %><%= f.text_field :location, size: "20", placeholder: "Location", class: "s_grid_4 s_grid"%>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%>
</li>
</div>
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row">
<%= f.fields_for :authors_translations do |f| %>
<%= f.text_area locale,
class: "s_grid_6 s_grid",
size: "20x2",
placeholder: t("personal_conference.authors"),
# "autocomplete-list" => "coauthor_autocomplete_list",
value: (@writing_conference.authors_translations[locale.to_s] rescue nil) %>
<% end %>
<span class="icon-plus input_append"></span>
</li>
<li class="s_grid_row">
<select name="writing_conference[conference_author_type_ids][]" id="" class="s_grid s_grid_6">
<%= options_for_select(
[t("personal_conference.author_type")] +
@author_types.map do |author_type|
[author_type.title, author_type.id]
end
)
%>
</select>
</li>
<li class="s_grid_row">
<select name="" id="" class="s_grid s_grid_6">
<option value="">Status</option>
<option value="">Published</option>
<option value="">Pending</option>
<option value="">Writing</option>
</select>
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_conference.publication_date"), class: "s_grid_3 s_grid") %>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %>
</li>
<li class="s_grid_row">
<%= f.label :year, t("personal_conference.year"), :class => "s_grid_2 s_grid" %>
<%= select_year((@writing_conference.year ? @writing_conference.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_conference[year]', :class => "s_grid_4 s_grid"} ) %>
</li>
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" placeholder=<%= t("tags") %>><span class="icon-plus input_append"></li>
<li class="s_grid_row">
<%= f.text_area :abstract, size: "20x22", placeholder: t("personal_conference.abstract"), class: "s_grid_6 s_grid full_height"%>
</li>
</ul>
</div>
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row">
<table class="s_table">
<thead>
<tr>
<th class="s_grid_2"><%= t("personal_conference.file")%></th>
<th class="s_grid_3"><%= t("personal_conference.file_name")%></th>
<th class="s_grid_1"><%= t("personal_conference.description") %></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block s_action">
<%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %>
<a class="add setting_btn thmc1 thmtxt w1 hh2 hp" href=""><i class="icon-plus icon-white"></i> add</a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %>
<%= f.fields_for :writing_conference_files, writing_conference_file do |f| %>
<%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</li>
</div>
<div class="s_grid_con s_form">
<li class="s_grid_row">
<ul>
<%= f.text_area :note, size: "20x22", placeholder: t("personal_conference.note"), class: "s_grid_6 s_grid full_height"%>
</ul>
</li>
</div>
</div>
</div>
<script type="text/javascript">
orbitDesktop.prototype.initializeJournalPapers.conference_title_autocomplete_list = <%= @conference_candidate.to_json.html_safe %>;
orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
</script>
<script>
$('#add_plugin_file a.add').click(function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_writing_conference_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
var newfield = $(("<%= escape_javascript(add_attribute 'form_file', f, :writing_conference_files) %>").replace(old_id, new_id));
$(this).parents('table').append(newfield);
newfield.find('.action a.delete').click(function(){
newfield.remove();
});
return false;
});
$('.action a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>

View File

@ -0,0 +1,31 @@
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class="list_item">
<td>
<div>
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2 s_grid" %>
<% end %>
</div>
</td>
<td>
<%= f.text_field :title %>
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_3 s_grid',
value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,40 @@
<div class="toolbar hh2">
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Share</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
<li><a class="hp hh2 admtxt" href="">Private</a></li>
<li><a class="hp hh2 admtxt" href="">Group</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
</div>
</div>
<div id="conference_list" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<% @conference_lists.each_with_index do |conference_list,i| %>
<% if ( i % 5 ) == 0 %>
<div class="g_col">
<ul>
<% end %>
<li class="list_t_item">
<div class="list_item_action">
<i class="icon-file"></i>
</div>
<% title, level = conference_list %>
<div class="list_t_title"><%= title %></div>
<div class="list_t_desc"><%= level.join(",") %></div>
</li>
<% if ( i % 5 ) == 4 %>
</ul>
</div>
<% end %>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,4 @@
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_conference_desktop_conference_page_path(@writing_conference) do |f| %>
<%= render partial: 'form', locals: {:f => f} %>
<%end%>

View File

@ -1,75 +1,77 @@
<div class="toolbar hh2">
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-check"></span></div>
<div class="admbg sdm_o">
<ul id="journal_selection_options">
<li><a class="hp hh2 admtxt" href="all">All</a></li>
<li><a class="hp hh2 admtxt" href="none">None</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">More</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Delete</a></li>
<li><a class="hp hh2 admtxt" href="">Tag</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Tag</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">All</a></li>
<li><a class="hp hh2 admtxt" href="">Starred</a></li>
<li><a class="hp hh2 admtxt" href="">MIT</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Status</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">All</a></li>
<li><a class="hp hh2 admtxt" href="">Published</a></li>
<li><a class="hp hh2 admtxt" href="">Pending</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">View</div>
<div class="admbg sdm_o">
<ul id="journal_view_selection">
<li><a class="hp hh2 admtxt" href="journal">Journal</a></li>
<li><a class="hp hh2 admtxt" href="title">Title</a></li>
<li><a class="hp hh2 admtxt" href="file">File</a></li>
<li><a class="hp hh2 admtxt" href="keywords">Keywords</a></li>
<li><a class="hp hh2 admtxt" href="abstract">Abstract</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Share</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Full</a></li>
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
<li><a class="hp hh2 admtxt" href="">Private</a></li>
<li><a class="hp hh2 admtxt" href="">Group</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-check"></span></div>
<div class="admbg sdm_o">
<ul id="journal_selection_options">
<li><a class="hp hh2 admtxt" href="all">All</a></li>
<li><a class="hp hh2 admtxt" href="none">None</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">More</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Delete</a></li>
<li><a class="hp hh2 admtxt" href="">Tag</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Tag</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">All</a></li>
<li><a class="hp hh2 admtxt" href="">Starred</a></li>
<li><a class="hp hh2 admtxt" href="">MIT</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Status</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">All</a></li>
<li><a class="hp hh2 admtxt" href="">Published</a></li>
<li><a class="hp hh2 admtxt" href="">Pending</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">View</div>
<div class="admbg sdm_o">
<ul id="journal_view_selection">
<li><a class="hp hh2 admtxt" href="conference">Conference</a></li>
<li><a class="hp hh2 admtxt" href="title">Title</a></li>
<li><a class="hp hh2 admtxt" href="file">File</a></li>
<li><a class="hp hh2 admtxt" href="keywords">Keywords</a></li>
<li><a class="hp hh2 admtxt" href="abstract">Abstract</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Share</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">Full</a></li>
<li><a class="hp hh2 admtxt" href="">Abstract</a></li>
<li><a class="hp hh2 admtxt" href="">Friends</a></li>
<li><a class="hp hh2 admtxt" href="">Private</a></li>
<li><a class="hp hh2 admtxt" href="">Group</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
</div>
</div>
<div id="paper_list" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
</div>
</div>
</div>
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<% @writing_conferences.each do |w| %>
<%= publication_record w%>
<% end %>
</div>
</div>
</div>

View File

@ -1,107 +1,4 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<button class="fn_btn hh2 thmc2 thmtxt">Save</button>
<button class="fn_btn hh2 admbg2">Cancel</button>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Year</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">2012</a></li>
<li><a class="hp hh2 admtxt" href="">2011</a></li>
<li><a class="hp hh2 admtxt" href="">2010</a></li>
<li><a class="hp hh2 admtxt" href="">2009</a></li>
<li><a class="hp hh2 admtxt" href="">2008</a></li>
<li><a class="hp hh2 admtxt" href="">2007</a></li>
<li><a class="hp hh2 admtxt" href="">2006</a></li>
<li><a class="hp hh2 admtxt" href="">2005</a></li>
<li><a class="hp hh2 admtxt" href="">2004</a></li>
<li><a class="hp hh2 admtxt" href="">2003</a></li>
<li><a class="hp hh2 admtxt" href="">2002</a></li>
<li><a class="hp hh2 admtxt" href="">2001</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2">Language</div>
<div class="admbg sdm_o">
<ul>
<li><a class="hp hh2 admtxt" href="">English</a></li>
<li><a class="hp hh2 admtxt" href="">Chinese</a></li>
</ul>
</div>
</div>
<div class="hh2 hp sdm">
<div class="sdm_t hh2"><span class="icon-question-sign"></span></div>
</div>
</div>
<div id="paper_add" class="tinycanvas vp">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div class="overview">
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row"><textarea class="s_grid_6 s_grid" name="" id="">Conference Title</textarea></li>
<li class="s_grid_row">
<label>Paper type</label><input type="radio" name="" value="Books" />Oral<input type="radio" name="" value="Chapter" />Poster</li>
<li class="s_grid_row"><label>Conference time</label></li>
<li class="s_grid_row"><select name="" id="" class="s_grid s_grid_1">
<option value=""></option>
</select>
<label class="s_grid s_grid_1">Year</label>
<select name="" id="" class="s_grid s_grid_1">
<option value=""></option>
</select>
<label class="s_grid s_grid_1">Month</label>
<select name="" id="" class="s_grid s_grid_1">
<option value=""></option>
</select>
<label class="s_grid s_grid_1">Day</label>
</li>
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_conference_desktop_conference_pages_path do |f| %>
<%= render partial: 'panel/personal_conference/desktop/conference_pages/form', locals: {:f => f} %>
<%end%>
<li class="s_grid_row"><input class="s_grid s_grid_2" type="text" value="Location"><input class="s_grid s_grid_2" type="text" value="Sponsor"></li>
<li class="s_grid_row"><label class="s_grid_2 s_grid" for="">Reference URL</label><input class="s_grid_4 s_grid" type="text" value="www.sample.com"></li>
</ul>
</div>
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row"><textarea class="s_grid s_grid_6" name="" id="">Author</textarea><span class="icon-plus input_append"></span></li>
<li class="s_grid_row">
<select name="" id="" class="s_grid s_grid_4">
<option value="">Author Type</option>
<option value="">First Author</option>
<option value="">Corresponding Author</option>
<option value="">Second Author</option>
<option value="">Third Author</option>
<option value="">Fourth Author</option>
</select>
<select name="" id="" class="s_grid s_grid_2">
<option value="">Status</option>
<option value="">Published</option>
<option value="">Pending</option>
<option value="">Writing</option>
</select>
</li>
<li class="s_grid_row"><label class="s_grid s_grid_2" for="">Date of Publication</label><input class="s_grid s_grid_4" type="text" value="2012 / 05 / 01"></li>
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" value="Tags"><span class="icon-plus input_append"></li>
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" value="Keywords"><span class="icon-plus input_append"></li>
<li class="s_grid_row"><input class="s_grid s_grid_6" type="text" value="Associated Project"><span class="icon-plus input_append"></span></li>
<li class="s_grid_row"><label class="s_grid s_grid_2" for="">Abstract</label><input type="file"></li>
<li class="s_grid_row"><label class="s_grid s_grid_2" for="">Full Text</label><input type="file"></li>
</ul>
</div>
<div class="s_grid_con s_form">
<ul>
<li class="s_grid_row"><textarea name="" id="" rows="20" class="s_grid s_grid_6">Abstract</textarea></li>
<li class="s_grid_row"><textarea name="" id="" rows="6" class="s_grid s_grid_6">Note</textarea></li>
</ul>
</div>
</div>
</div>
</div>

View File

@ -13,10 +13,10 @@
<div id="panel_l" class="ph">
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= panel_personal_conference_desktop_conference_pages_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="" callback-method="addconference" custom-load="add" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= new_panel_personal_conference_desktop_conference_page_path %>" callback-method="conference" class="admtxt hh2 w2 hp" onclick='return false;'>Conference</a></li>
<li><a href="" callback-method="coauthor" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="<%= panel_personal_conference_desktop_conference_pages_path %>" load="true" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= new_panel_personal_conference_desktop_conference_page_path %>" callback-method="addconference" custom-load="add" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= panel_personal_conference_desktop_conference_type_path %>" callback-method="conference" class="admtxt hh2 w2 hp" onclick='return false;'>Conference</a></li>
<li><a href="<%= panel_personal_conference_desktop_conference_co_authors_path %>" callback-method="coauthor" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>

View File

@ -1,135 +1,46 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
_locale: English
add: Add
back: Back
create: Create
delete: Delete
disable: Disable
downloaded: Downloaded
download: Download
edit: Edit
enable: Enable
hide: Hide
homepage: Homepage
_locale: "English"
personal_conference:
year : "Year"
language : "Language"
paper_title : "Paper Title"
paper_type : "Paper Type"
conference_title : "Conference Name"
conference_time: "Conference Time"
period_start_date : "Start Date"
period_end_date : "End Date"
location : "Location"
sponsor : "Sponsor"
authors : "Authors"
tags : "Tags"
keywords : "Keywords"
# total_pages : "Total Pages"
# form_to_start : "From"
# form_to_end : "To"
# from : "From"
# to : "To"
abstract : "Abstract"
publication_date : "Date of Publication"
url : "Reference URL"
note : "Note"
author_type : "Author Type"
file : "File"
file_name : "File Name"
description : "File Description"
add: "Add"
back: "Back"
delete: "Delete"
edit: "Edit"
no_: "No"
nothing: Nothing
show: Show
sure?: Are you sure?
update: Update
nothing: "Nothing"
show: "Show"
sure?: "Are you sure?"
update: "Update"
yes_: "Yes"
announcement:
sure?: Sure?
no_: "No"
cancel : "Cancel"
save: "save"
web_resource:
list_lower: list
list_link: Links list
# admin:
# action: Action
# add_language: Add language
# admin: Admin
# action: Action
# announcement: Announcement
# asset: Asset
# attributes: Attributes
# cant_delete_self: You can not delete yourself.
# cant_revoke_self_admin: You can not revoke your admin role yourself.
# class: Class
# content: Content
# create_error_link: Error when creating link.
# create_error_page: Error when creating page.
# create_success_home: Homepage was successfully created.
# create_success_layout: Layout was successfully created.
# create_success_link: Link was successfully created.
# create_success_page: Page was successfully created.
# create_success_snippet: Snippet was successfully created.
# create_success_user: User was successfully created.
# data: Data
# delete_language: Delete language
# description: Description
# design: Design
# disable_language: Disable language
# editing_home: Editing homepage
# editing_layout: Editing layout
# editing_link: Editing link
# editing_page: Editing page
# editing_snippet: Editing snippet
# editing_user_info: Editing user information
# editing_user_role: Editing user role
# email: Email
# enable_language: Enable language
# file_name: Filename
# file_size: File size
# format: Format
# home: Home
# id: ID
# info: Information
# is_published: Is published
# item: Item
# key: Key
# language: Language
# layout: Layout
# layout_name: Layout name
# list_assets: Assets list
# list_designs: Designs list
# list_items: Items list
# list_puchases: Purchases list
# list_snippets: Snippets list
# list_users: Users list
# list_user_infos: User information list
# list_user_roles: User roles list
# member: Member
# move_down: Move down
# move_up: Move up
# multilingual: Multilingual
# my_avatar: My Avatar
# no_home_page: You don't have a homepage
# no_layout: You don't have a layout
# name: Name
# new_asset: New asset
# new_component: New component
# new_home: New homepage
# new_layout: New layout
# new_link: New link
# new_page: New page
# new_snippet: New snippet
# new_user: New user
# new_user_info: New user information
# new_user_role: New user role
# non_multilingual: Non multilingual
# options: Options
# orig_upload_file: Original filename
# position: Position
# published?: Published?
# purchase: Purchase
# registered: Registered
# role: Role
# roles: Roles
# title: Title
# translation: Translation
# type: Type
# up_to_date: Up-to-date
# update_error_link: Error when updating link.
# update_error_page: Error when updating page.
# update_success_content: Content was successfully updated.
# update_success_home: Homepage was successfully updated.
# update_success_layout: Layout was successfully updated.
# update_success_link: Link was successfully updated.
# update_success_page: Page was successfully updated.
# update_success_snippet: Snippet was successfully updated.
# update_success_user: User was successfully updated.
# url: URL
# user: User
# user_info: User information
# user_panel: User panel
# user_role: User role
panel:
error_msg:
time_series_illegal: "must be before end time"

View File

@ -1,244 +1,46 @@
zh_tw:
_locale: 中文
module_name:
personal_conference: 研討會論文
add: 新增
back: 回去
create: 創造
delete: 刪除
disable: 禁用
edit: 編輯
enable: 啟用
hide: 隱藏
homepage: 首頁
_locale: "中文"
personal_conference:
year : "年度"
language : "語言"
paper_title : "論文名稱"
paper_type : "論文型態"
conference_title : " 會議名稱"
conference_time: "會議時間"
period_start_date : "起"
period_end_date : "訖"
location : "地點"
sponsor : "贊助"
authors : "作者"
tags : "領域"
keywords : "關鍵字"
# total_pages : "總頁數"
# form_to_start : "From"
# form_to_end : "To"
# from : "起"
# to : "訖"
abstract : "摘要"
publication_date : "發表日期"
url : "參考連結"
note : "記事"
author_type : "作者類別"
file : "檔案"
file_name : "檔案名稱"
description : "描述"
add: "新增"
back: "返回"
delete: "刪除"
edit: "編輯"
no_: "No"
nothing:
show: 顯示
sure?: 您肯定嗎?
update: 更新
yes_: "Yes"
web_resource:
list_lower: 列表
list_link: 鏈接列表
category: 分類
name: 名稱
describe: 描述
url: 路徑
edit: 編輯
delete: 刪除
cate_auth: 分類授權
# Chinese (Taiwan) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho)
date:
formats:
default: "%Y-%m-%d"
short: "%b%d日"
long: "%Y年%b%d日"
day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
order: [ :year, :month, :day ]
nothing: "無"
show: "顯示"
sure?: "您肯定嗎?"
update: "更新"
yes_: "是"
no_: "否"
cancel : "取消"
save: "儲存"
time:
formats:
default: "%Y年%b%d日 %A %H:%M:%S %Z"
short: "%b%d日 %H:%M"
long: "%Y年%b%d日 %H:%M"
am: "上午"
pm: "下午"
datetime:
distance_in_words:
half_a_minute: "半分鐘"
less_than_x_seconds:
one: "不到一秒"
other: "不到 %{count} 秒"
x_seconds:
one: "一秒"
other: "%{count} 秒"
less_than_x_minutes:
one: "不到一分鐘"
other: "不到 %{count} 分鐘"
x_minutes:
one: "一分鐘"
other: "%{count} 分鐘"
about_x_hours:
one: "大約一小時"
other: "大約 %{count} 小時"
x_days:
one: "一天"
other: "%{count} 天"
about_x_months:
one: "大約一個月"
other: "大約 %{count} 個月"
x_months:
one: "一個月"
other: "%{count} 個月"
about_x_years:
one: "大約一年"
other: "大約 %{count} 年"
over_x_years:
one: "一年多"
other: "%{count} 年多"
almost_x_years:
one: "接近一年"
other: "接近 %{count} 年"
prompts:
year: "年"
month: "月"
day: "日"
hour: "時"
minute: "分"
second: "秒"
number:
format:
separator: "."
delimiter: ","
precision: 3
significant: false
strip_insignificant_zeros: false
currency:
format:
format: "%u %n"
unit: "NT$"
separator: "."
delimiter: ","
precision: 2
significant: false
strip_insignificant_zeros: false
percentage:
format:
delimiter: ""
precision:
format:
delimiter: ""
human:
format:
delimiter: ""
precision: 1
significant: false
strip_insignificant_zeros: false
storage_units:
format: "%n %u"
units:
byte:
one: "Byte"
other: "Bytes"
kb: "KB"
mb: "MB"
gb: "GB"
tb: "TB"
decimal_units:
format: "%n %u"
units:
# 10^-21 zepto, 10^-24 yocto
atto: "渺" # 10^-18
femto: "飛" # 10^-15 毫微微
pico: "漠" # 10^-12 微微
nano: "奈" # 10^-9 毫微
micro: "微" # 10^-6
mili: "毫" # 10^-3 milli
centi: "厘" # 10^-2
deci: "分" # 10^-1
unit: ""
ten:
one: "十"
other: "十" # 10^1
hundred: "百" # 10^2
thousand: "千" # 10^3 kilo
million: "百萬" # 10^6 mega
billion: "十億" # 10^9 giga
trillion: "兆" # 10^12 tera
quadrillion: "千兆" # 10^15 peta
# 10^18 exa, 10^21 zetta, 10^24 yotta
support:
array:
words_connector: ", "
two_words_connector: " 和 "
last_word_connector: ", 和 "
select:
prompt: "請選擇"
activerecord:
errors:
template: # ~ 2.3.5 backward compatible
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
full_messages:
format: "%{attribute} %{message}"
messages:
inclusion: "沒有包含在列表中"
exclusion: "是被保留的關鍵字"
invalid: "是無效的"
confirmation: "不符合確認值"
accepted: "必須是可被接受的"
empty: "不能留空"
blank: "不能是空白字元"
too_long: "過長(最長是 %{count} 個字)"
too_short: "過短(最短是 %{count} 個字)"
wrong_length: "字數錯誤(必須是 %{count} 個字)"
not_a_number: "不是數字"
not_an_integer: "必須是整數"
greater_than: "必須大於 %{count}"
greater_than_or_equal_to: "必須大於或等於 %{count}"
equal_to: "必須等於 %{count}"
less_than: "必須小於 %{count}"
less_than_or_equal_to: "必須小於或等於 %{count}"
odd: "必須是奇數"
even: "必須是偶數"
taken: "已經被使用"
record_invalid: "校驗失敗: %{errors}"
activemodel:
errors:
template:
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
errors:
format: "%{attribute} %{message}"
messages:
inclusion: "沒有包含在列表中"
exclusion: "是被保留的關鍵字"
invalid: "是無效的"
confirmation: "不符合確認值"
accepted: "必須是可被接受的"
empty: "不能留空"
blank: "不能是空白字元"
too_long: "過長(最長是 %{count} 個字)"
too_short: "過短(最短是 %{count} 個字)"
wrong_length: "字數錯誤(必須是 %{count} 個字)"
not_a_number: "不是數字"
not_an_integer: "必須是整數"
greater_than: "必須大於 %{count}"
greater_than_or_equal_to: "必須大於或等於 %{count}"
equal_to: "必須等於 %{count}"
less_than: "必須小於 %{count}"
less_than_or_equal_to: "必須小於或等於 %{count}"
odd: "必須是奇數"
even: "必須是偶數"
template:
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
helpers:
select:
prompt: "請選擇"
submit:
create: "新增%{model}"
update: "更新%{model}"
submit: "儲存%{model}"
error_msg:
time_series_illegal: "啟始時間必須早於結束時間"

View File

@ -3,8 +3,11 @@ Rails.application.routes.draw do
namespace :panel do
namespace :personal_conference do
namespace :desktop do
match 'conference_p' => 'conference_p#conference_p'
resources :conference_pages, :only => [:index, :new]
match 'conference_window' => 'conference_windows#conference_window'
match 'conference_type' => 'conference_pages#conference_type'
resources :conference_pages, except: :show
resources :conference_co_authors, except: :show
resources :conference_co_author_relations, except: :show
end
namespace :back_end do
match 'writing_conference_setting' => "writing_conferences#writing_conference_setting" ,:as => :writing_conference_setting

View File

@ -1,11 +1,9 @@
module PersonalConference
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
OrbitApp.registration "Conference",:type=> 'ModuleApp' do
module_label 'module_name.personal_conference'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_conference/plugin/profile",:admin_path=>"/panel/personal_conference/back_end/writing_conferences",:i18n=>'module_name.personal_conference'
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/personal_seminar/plugin/profile",:admin_path=>"/panel/personal_seminar/back_end/writing_seminars",:i18n=>'module_name.personal_seminar'
end
end

View File

@ -0,0 +1,11 @@
types = ["friend", "teacher", "student", "schoolmate", "parent", "best friend", "instructor", "labmate", "TA", "mate"]
FactoryGirl.define do
factory(:conference_co_author_relation, class: "ConferenceCoAuthorRelation") do |f|
f.sequence(:relation_translations) do |n|
{ zh_tw: "#{types[n%types.size]}",
en: "#{types[n%types.size]}" }
end
end
end

Some files were not shown because too many files have changed in this diff Show More