diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb
index 57f205a65..c61aec8e2 100644
--- a/app/views/desktop/index.html.erb
+++ b/app/views/desktop/index.html.erb
@@ -11,7 +11,7 @@
-
+
diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_p_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_p_controller.rb
deleted file mode 100644
index 3526d6ff0..000000000
--- a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_p_controller.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Panel::PersonalJournal::Desktop::JournalPController < ApplicationController
- def journal_p
- render panel_personal_journal_desktop_journal_p_path, :layout => false
- end
-end
diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb
index 83f9408de..eff597fbf 100644
--- a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb
+++ b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb
@@ -1,7 +1,16 @@
class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationController
def index
- @writing_journal = WritingJournal.where(create_user_id: current_user.id)
+ @writing_journals = WritingJournal.where(create_user_id: current_user.id)
@level_types = JournalLevelType.all
+ @view_by = params[:view]
+
+ if @view_by.nil?
+ @writing_journals = @writing_journals.asc(:paper_title)
+ else
+ @writing_journals = @writing_journals.asc(@view_by).asc(:paper_title)
+ end
+
+ @level_types = ConferencePaperType.all
respond_to do |format|
format.html { render :layout => false}
@@ -73,37 +82,6 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
render :json => {success: true, msg: t('delete.success.paper')}
end
- def get_journals_json
- publications = WritingJournal.where(create_user_id: current_user.id)
-
- sort_publications= Hash.new
- data = Array.new
-
- publications.each do |publication|
- if sort_publications[publication.journal_title].nil?
- sort_publications[publication.journal_title] = Array.new
- end
- sort_publications[publication.journal_title] <<
- { title: publication.paper_title,
- keywords: publication.keywords,
- abstract: publication.abstract,
- coauthors: publication.authors,
- year: publication.year,
- url_edit: edit_panel_personal_journal_desktop_journal_page_path(publication),
- url_delete: panel_personal_journal_desktop_journal_page_path(publication),
- files: publication.writing_journal_files.collect{|file|
- {title: file.title, url: file.file.url, icon: check_file_type(file.file.url)}
- }
- }
- end
-
- sort_publications.each do |journal, papers|
- data << {title: journal, papers: papers}
- end
-
- render json: JSON.pretty_generate(data)
- end
-
def journal_type
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_windows_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_windows_controller.rb
new file mode 100644
index 000000000..52a8df064
--- /dev/null
+++ b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_windows_controller.rb
@@ -0,0 +1,5 @@
+class Panel::PersonalJournal::Desktop::JournalWindowsController < ApplicationController
+ def journal_window
+ render panel_personal_journal_desktop_journal_window_path, :layout => false
+ end
+end
diff --git a/vendor/built_in_modules/personal_journal/app/helpers/panel/.gitkeep b/vendor/built_in_modules/personal_journal/app/helpers/panel/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb b/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb
new file mode 100644
index 000000000..bdddd92ec
--- /dev/null
+++ b/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb
@@ -0,0 +1,74 @@
+module Panel::PersonalJournal::Desktop::JournalPagesHelper
+ def publication_record publication, view
+ content_tag :li,
+ :class => "list_t_item" do
+ marker + \
+ content(publication, view) + \
+ 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, view
+ case view
+ when "journal_title"
+ des = content_tag(:div, publication.journal_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
+ content_tag :div,
+ :class => "list_item_function" do
+ content_tag(:a, t("edit"),
+ :class => "journal_paper_edit admbg2 admtxt",
+ :href => edit_panel_personal_journal_desktop_journal_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_journal_desktop_journal_page_path(publication))
+ end
+ end
+
+ def link_publication_file publication
+ publication.writing_journal_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
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 64f123f05..7374abbf4 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
@@ -47,11 +47,11 @@ class WritingJournal
current_user = update_user_id
end
- authors_db = CoAuthor.where(:name_id => current_user).map(&:co_author)
+ authors_db = JournalCoAuthor.where(:name_id => current_user).map(&:co_author)
authors_list.delete(User.find(current_user).name)
authors_list = authors_list.delete_if{|author| authors_db.include?author}
authors_list.each do |author|
- CoAuthor.new(:co_author => author, :name_id => current_user).save
+ JournalCoAuthor.new(:co_author => author, :name_id => current_user).save
end
end
diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb
index cca8a6973..2a38748b2 100644
--- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb
+++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb
@@ -143,7 +143,7 @@
- <%= f.text_field :tags, size: "20", placeholder: t("personal_journal.tags"), class: "s_grid_6 s_grid"%>
+ >
diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb
index 4a351773c..c3a346e8b 100644
--- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb
+++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb
@@ -41,11 +41,11 @@
View
- Journal
- Title
- File
- Keywords
- Abstract
+ <%= link_to "Journal", panel_personal_journal_desktop_journal_pages_path + "?view=journal_title", :class => "hp hh2 admtxt", "ajax-remote" => "get" %>
+ <%= link_to "Title", panel_personal_journal_desktop_journal_pages_path + "?view=paper_title", :class => "hp hh2 admtxt", "ajax-remote" => "get" %>
+ <%= link_to "File", panel_personal_journal_desktop_journal_pages_path + "?view=file", :class => "hp hh2 admtxt", "ajax-remote" => "get" %>
+ <%= link_to "Keywords", panel_personal_journal_desktop_journal_pages_path + "?view=keywords", :class => "hp hh2 admtxt", "ajax-remote" => "get" %>
+ <%= link_to "Abstract", panel_personal_journal_desktop_journal_pages_path + "?view=abstract", :class => "hp hh2 admtxt", "ajax-remote" => "get" %>
@@ -81,7 +81,9 @@
-
+ <% @writing_journals.each do |w| %>
+ <%= publication_record w, @view_by%>
+ <% end %>
diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_p.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_window.html.erb
similarity index 100%
rename from vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_p.html.erb
rename to vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_window.html.erb
diff --git a/vendor/built_in_modules/personal_journal/config/routes.rb b/vendor/built_in_modules/personal_journal/config/routes.rb
index e9e5594f0..5a03564d1 100644
--- a/vendor/built_in_modules/personal_journal/config/routes.rb
+++ b/vendor/built_in_modules/personal_journal/config/routes.rb
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
namespace :panel do
namespace :personal_journal do
namespace :desktop do
- match 'journal_p'=>'journal_p#journal_p'
+ match 'journal_window'=>'journal_windows#journal_window'
match 'get_journals_json' => 'journal_pages#get_journals_json'
match 'journal_type' => 'journal_pages#journal_type'
resources :journal_pages, except: :show