diff --git a/Gemfile.lock b/Gemfile.lock index 62118728a..2b459329b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -141,6 +141,7 @@ GEM jquery-rails railties (>= 3.1.0) json (1.7.7) + libv8 (3.11.8.13) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -224,6 +225,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.0.3) + rb-readline (0.4.2) rdoc (3.12.1) json (~> 1.4) redis (3.0.2) @@ -233,6 +235,7 @@ GEM chinese_pinyin (>= 0.3.0) redis (>= 2.1.1) redis-namespace (>= 1.0.2) + ref (1.0.2) resque (1.23.0) multi_json (~> 1.0) redis-namespace (~> 1.0) @@ -313,6 +316,9 @@ GEM sunspot (= 1.3.3) sunspot_solr (1.3.3) terminal-table (1.4.5) + therubyracer (0.11.3) + libv8 (~> 3.11.8.12) + ref thor (0.17.0) tilt (1.3.3) tinymce-rails (3.5.8) @@ -357,6 +363,7 @@ DEPENDENCIES jquery-rails (= 2.1.4) jquery-ui-rails kaminari! + libv8 (~> 3.11.8) mime-types mini_magick mongo_session_store-rails3 (= 3.0.6) @@ -373,6 +380,7 @@ DEPENDENCIES radius rails (~> 3.2.9) rake + rb-readline redis (>= 2.1.1) redis-namespace redis-search @@ -393,6 +401,7 @@ DEPENDENCIES sunspot-rails-tester sunspot_mongo sunspot_solr + therubyracer tinymce-rails uglifier watchr diff --git a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb index 4915d5c73..377d8a116 100644 --- a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb +++ b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb @@ -1,6 +1,14 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < ApplicationController def index + @view_by = params[:view] @writing_conferences = WritingConference.all + + if @view_by.nil? + @writing_conferences = @writing_conferences.asc(:paper_title) + else + @writing_conferences = @writing_conferences.asc(@view_by).asc(:paper_title) + end + @level_types = ConferencePaperType.all respond_to do |format| diff --git a/vendor/built_in_modules/personal_conference/app/helpers/panel/personal_conference/desktop/conference_pages_helper.rb b/vendor/built_in_modules/personal_conference/app/helpers/panel/personal_conference/desktop/conference_pages_helper.rb index cac790d3a..afff7344f 100644 --- a/vendor/built_in_modules/personal_conference/app/helpers/panel/personal_conference/desktop/conference_pages_helper.rb +++ b/vendor/built_in_modules/personal_conference/app/helpers/panel/personal_conference/desktop/conference_pages_helper.rb @@ -1,9 +1,9 @@ module Panel::PersonalConference::Desktop::ConferencePagesHelper - def publication_record publication + def publication_record publication, view content_tag :li, :class => "list_t_item" do marker + \ - content(publication) + \ + content(publication, view) + \ edit_or_delete(publication) end end @@ -15,17 +15,26 @@ module Panel::PersonalConference::Desktop::ConferencePagesHelper 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") + def content publication, view + case view + when "conference_title" + des = content_tag(:div, publication.conference_title, + :class => "list_t_des") + when "keywords" + des = content_tag(:div, publication.keywords, + :class => "list_t_des") + when "abstract" + des = content_tag(:div, publication.abstract, + :class => "list_t_des") + when "file" + des = content_tag(:div, link_publication_file(publication), + :class => "list_t_des") + else + end + + content_tag(:div, publication.paper_title, + :class => "list_t_title") + des + end def edit_or_delete publication diff --git a/vendor/built_in_modules/personal_conference/app/models/writing_conference.rb b/vendor/built_in_modules/personal_conference/app/models/writing_conference.rb index efb05cf9b..9248c9775 100644 --- a/vendor/built_in_modules/personal_conference/app/models/writing_conference.rb +++ b/vendor/built_in_modules/personal_conference/app/models/writing_conference.rb @@ -2,24 +2,21 @@ class WritingConference include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes - - # scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) } - - LANGUAGE_TYPES = [ "English", "Chinese" ] + # scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) } + + LANGUAGE_TYPES = [ "English", "Chinese" ] field :paper_title, localize: true field :conference_title, localize: true field :authors, localize: true field :location, localize: true field :sponsor, localize: true - + has_and_belongs_to_many :tags, :class_name => "PersonalConferenceTag" - has_and_belongs_to_many :conference_author_types has_and_belongs_to_many :conference_paper_types - - + field :year field :language field :period_start_date, :type => Date @@ -31,54 +28,41 @@ class WritingConference field :note field :create_user_id, :type => BSON::ObjectId field :update_user_id, :type => BSON::ObjectId - + # field :is_top, :type => Boolean, :default => false # field :is_hot, :type => Boolean, :default => false # field :is_hidden, :type => Boolean, :default => false - + has_many :writing_conference_files, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :writing_conference_files, :allow_destroy => true - + # before_save :update_avliable_language, :clean_checkboxs validates :paper_title, :at_least_one => true - before_validation :add_http - after_save :save_writing_conference_files - 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 ) - - if category_id.to_s.size > 0 - - find(:all, :conditions => {writing_conference_category_id: category_id}).desc( :is_top, :title ) - - else - - find(:all).desc( :is_top, :title) - - end - + if category_id.to_s.size > 0 + find(:all, :conditions => {writing_conference_category_id: category_id}).desc( :is_top, :title ) + else + find(:all).desc( :is_top, :title) + end end - def self.widget_datas - - where( :is_hidden => false ).desc(:is_top, :created_at) - + where( :is_hidden => false ).desc(:is_top, :created_at) end def is_top? self.is_top - end + end def sorted_tags tags.order_by(I18n.locale, :asc) end - + def update_avliable_language VALID_LOCALES.each do |locale| if (title_translations[locale].blank? rescue true) @@ -88,25 +72,25 @@ class WritingConference end end end - + def save_writing_conference_files - self.writing_conference_files.each do |t| - if t.should_destroy - t.destroy - end + self.writing_conference_files.each do |t| + if t.should_destroy + t.destroy + end end end - + def create_link - - title = ["\"#{self.paper_title}\""] - title << self.conference_title - title << self.sponsor - title << self.location - title << "#{period_start_date}-#{period_end_date}" - # title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})" - title.join(', ') - + + title = ["\"#{self.paper_title}\""] + title << self.conference_title + title << self.sponsor + title << self.location + title << "#{period_start_date}-#{period_end_date}" + # title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})" + title.join(', ') + end protected @@ -122,5 +106,5 @@ class WritingConference self.conference_author_type_ids.delete('') self.conference_level_type_ids.delete('') end - + end diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/index.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/index.html.erb index 7a3848df0..e30c9e4a7 100644 --- a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/index.html.erb +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/index.html.erb @@ -40,12 +40,12 @@