From 2a41e3440e13bcda30c7c73c700246a420d8a993 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Wed, 25 Sep 2013 12:58:37 +0800 Subject: [PATCH] Fixed Import data to import journal level types, fixed writing journal --- app/controllers/admin/import_data_controller.rb | 9 ++++++++- .../back_end/writing_books/_list_paper_type.html.erb | 2 +- .../personal_journal/app/models/writing_journal.rb | 4 +++- .../back_end/writing_journals/_list_level_type.html.erb | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/import_data_controller.rb b/app/controllers/admin/import_data_controller.rb index a9be3b28a..1f86544df 100644 --- a/app/controllers/admin/import_data_controller.rb +++ b/app/controllers/admin/import_data_controller.rb @@ -213,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? @@ -241,6 +241,13 @@ class Admin::ImportDataController < OrbitBackendController @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 diff --git a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_list_paper_type.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_list_paper_type.html.erb index 790804a49..8a1bb6e8d 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_list_paper_type.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_list_paper_type.html.erb @@ -5,7 +5,7 @@ <%= t('edit')%> - <%= 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" %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb b/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb index 38c56754a..2ca38468d 100644 --- a/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb +++ b/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb @@ -92,8 +92,10 @@ class WritingJournal def create_link title = ["#{self.paper_title}"] title << self.journal_title if self.journal_title.present? - title.join(', ') 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 diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/back_end/writing_journals/_list_level_type.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/back_end/writing_journals/_list_level_type.html.erb index 6768c0e4b..c66cbee87 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/back_end/writing_journals/_list_level_type.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/back_end/writing_journals/_list_level_type.html.erb @@ -5,7 +5,7 @@ <%= t('edit')%> - <%= 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" %> \ No newline at end of file