add conferene list order function
This commit is contained in:
parent
1f58ed5cda
commit
522e0481e1
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,12 +40,12 @@
|
|||
<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 id="view_selection">
|
||||
<li><%= link_to "Conference", panel_personal_conference_desktop_conference_pages_path + "?view=conference_title", :class => "hp hh2 admtxt", "ajax-remote" => "get" %></li>
|
||||
<li><%= link_to "Title", panel_personal_conference_desktop_conference_pages_path + "?view=paper_title", :class => "hp hh2 admtxt", "ajax-remote" => "get" %></li>
|
||||
<li><%= link_to "File", panel_personal_conference_desktop_conference_pages_path + "?view=file", :class => "hp hh2 admtxt", "ajax-remote" => "get" %></li>
|
||||
<li><%= link_to "Keywords", panel_personal_conference_desktop_conference_pages_path + "?view=keywords", :class => "hp hh2 admtxt", "ajax-remote" => "get" %></li>
|
||||
<li><%= link_to "Abstract", panel_personal_conference_desktop_conference_pages_path + "?view=abstract", :class => "hp hh2 admtxt", "ajax-remote" => "get" %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<% @writing_conferences.each do |w| %>
|
||||
<%= publication_record w%>
|
||||
<%= publication_record w, @view_by%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in New Issue