Add Brief intro. for all personal plugins

Add Share Setting for Personal Plugins ( if have old data must be add default value "field: is_hidden => false " )
Apply New UI to Member Plugin Edit Page
Personal Plugin Summary fix
Academic Info. list fix

Updated Import method in teachers to make all false positives.

Updated Data import and sync code

Updated Books,Conference, Journal to display properly in the frontend

Journal title being imported correctly now

Fixed Import data to import journal level types, fixed writing journal
This commit is contained in:
Spen 2013-09-18 17:31:53 +08:00 committed by saurabhbhatia
parent 7990d4388c
commit cd8448d447
7 changed files with 66 additions and 33 deletions

View File

@ -22,31 +22,38 @@ class Admin::ImportDataController < OrbitBackendController
@roles = Role.all
@teacher = User.new
I18n.locale = :zh_tw
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
@teacher.first_name = "Please Fill the Name"
if !hash['teacher_zh_tw'].blank?
@teacher.first_name = hash['teacher_zh_tw']
elsif hash['teacher_zh_tw'].blank? && !hash['teacher_en'].blank?
@teacher.first_name = hash['teacher_en']
else
@teacher.first_name = hash['teacher_zh_tw']
end
I18n.locale = :en
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
@teacher.first_name = "Please Fill the Name"
end
I18n.locale = :en
if !hash['teacher_en'].blank?
@teacher.first_name = hash['teacher_en']
elsif hash['teacher_en'].blank? && !hash['teacher_zh_tw'].blank?
@teacher.first_name = hash['teacher_zh_tw']
elsif !hash['teacher_en'].blank? && hash['teacher_zh_tw'].blank?
@teacher.first_name = hash['teacher_en']
elsif hash['teacher_en'].blank? && hash['teacher_zh_tw'].blank?
@teacher.first_name = "Please Fill the Name"
end
#@teacher.first_name = hash['teacher_en']
@teacher.ntu_seq = hash['ntu_seq']
@teacher.sid = hash['ntu_seq']
@teacher.role_ids = ["#{@roles.skip(1).first.id}"]
@teacher.password = "testpass"
@i += 10
if hash['email'].blank?
@teacher.email = "#{@i}@ntu.edu.tw"
else
if !hash['email'].blank?
@user = User.where(email: "#{hash['email']}")
if @user.length == 0
@teacher.email = hash['email']
elsif @user.length > 0
@teacher.email = "#{@i}duplicate@ntu.edu.tw"
end
else
@teacher.email = "#{@i}@ntu.edu.tw"
end
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
@ -130,7 +137,8 @@ class Admin::ImportDataController < OrbitBackendController
title: (cp_node>"PaperTitle").text,
conference: (cp_node>"PublishOn").text,
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
location: (cp_node>"Location").text,
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
conference_title: (cp_node>"PublishOn").text,
remarks: (cp_node>"Remarks").text
}
end
@ -144,6 +152,12 @@ class Admin::ImportDataController < OrbitBackendController
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
I18n.locale = :en
@conference_paper.authors = b[:author]
@ -152,9 +166,17 @@ class Admin::ImportDataController < OrbitBackendController
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
@conference_paper.location = b[:location]
@conference_paper.year = b[:year]
@conference_paper.create_user_id = hash.id
@conference_paper.save!
end
else
@ -191,7 +213,7 @@ class Admin::ImportDataController < OrbitBackendController
endpage:(paper_node>"EndPage").text,
subgroup:(paper_node>"subgroup").text,
remarks: (paper_node>"Remarks").text,
cate: ((paper_node>"subgroup")>"group").text
cate: ((paper_node>"subgroup")>"Group").text
}
end
if @journal_papers.present?
@ -202,21 +224,30 @@ class Admin::ImportDataController < OrbitBackendController
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title].first
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
I18n.locale = :en
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title].first
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
@journal_paper.year = b[:year]
@journal_paper.vol_no = b[:volumeno]
@journal_paper.form_to_start = b[:beginpage]
@journal_paper.form_to_end = b[:endpage]
if !b[:cate].blank?
@level_type = JournalLevelType.where(:key => b[:cate])
if @level_type.present?
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
end
end
@journal_paper.create_user_id = hash.id
@journal_paper.save!
end

View File

@ -8,7 +8,7 @@ defaults: &defaults
development:
<<: *defaults
database: test_site
database: ntu_mb_orbit_test

View File

@ -83,11 +83,12 @@ class WritingBook
end
def create_link
title = ["\"#{self.extracted_chapters}\""]
title << self.book_title
title << self.publisher
title << self.pages
title = []
# title = ["#{self.extracted_chapters}"] if self.extracted_chapters.present?
title << self.paper_title if self.paper_title.present?
title << self.book_title if self.book_title.present?
title << self.publisher if self.publisher.present?
title << self.pages if self.pages.present?
# title << "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})"
title.join(', ')
end

View File

@ -5,7 +5,7 @@
<td class="span2">
<a href="<%= panel_personal_book_back_end_writing_book_paper_type_quick_edit_path(list_paper_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to show_toggle_archive_btn(list_paper_type),
<%= link_to 'Delete',
polymorphic_path([:panel, :personal_book, :back_end, list_paper_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -84,12 +84,11 @@ class WritingConference
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.paper_title}"]
title << self.conference_title if self.conference_title.present?
title << self.sponsor if self.sponsor.present?
title << self.location if self.location.present?
title << "#{period_start_date}-#{period_end_date}" if (self.period_start_date.present? && self.period_end_date.present?)
# title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})"
title.join(', ')

View File

@ -90,10 +90,12 @@ class WritingJournal
end
def create_link
title = ["\"#{self.paper_title}\""]
title << self.journal_title
title.join(', ')
title = ["#{self.paper_title}"]
title << self.journal_title if self.journal_title.present?
title << ( !self.journal_level_types.blank? ? "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})" : nil)
title << "Volume No: "+self.vol_no if (self.vol_no.present? && self.vol_no != "0")
title << "From Page: "+self.form_to_start if (self.form_to_start.present? && self.form_to_start != "0")
title << "To Page: "+self.form_to_end if (self.form_to_end.present? && self.form_to_end != "0")
title.join(', ')
end

View File

@ -5,7 +5,7 @@
<td class="span2">
<a href="<%= panel_personal_journal_back_end_writing_journal_level_type_quick_edit_path(list_level_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to show_toggle_archive_btn(list_level_type),
<%= link_to "Delete",
polymorphic_path([:panel, :personal_journal, :back_end, list_level_type]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>