-
+
<% @conference_lists.each_with_index do |conference_list,i| %>
- <% if ( i % 5 ) == 0 %>
- <% end %>
- -
+
-
@@ -30,10 +28,8 @@
<%= title %>
<%= level.join(",") %>
- <% if ( i % 5 ) == 4 %>
- <% end %>
<% end %>
diff --git a/vendor/built_in_modules/personal_conference/config/locales/en.yml b/vendor/built_in_modules/personal_conference/config/locales/en.yml
index 5fb77c18..d4cd006b 100644
--- a/vendor/built_in_modules/personal_conference/config/locales/en.yml
+++ b/vendor/built_in_modules/personal_conference/config/locales/en.yml
@@ -28,11 +28,13 @@ en:
file_name : "File Name"
description : "File Description"
+ create_success : "Successfully Create"
+ update_success : "Successfully Update"
+ delete_success : "Successfully Delete"
add: "Add"
back: "Back"
delete: "Delete"
edit: "Edit"
- no_: "No"
nothing: "Nothing"
show: "Show"
sure?: "Are you sure?"
diff --git a/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml b/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml
index 177f9c03..967d14d0 100644
--- a/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml
+++ b/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml
@@ -28,11 +28,12 @@ zh_tw:
file_name : "檔案名稱"
description : "描述"
+ create_success : "新增完成!!"
+ update_success : "更新完成!!"
add: "新增"
back: "返回"
delete: "刪除"
edit: "編輯"
- no_: "No"
nothing: "無"
show: "顯示"
sure?: "您肯定嗎?"
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 eff597fb..42210178 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
@@ -22,13 +22,24 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types= JournalPaperType.all
- @journal_co_author_candidate =
- JournalCoAuthor.where(name_id: current_user.id).map{|c|c.co_author}
+ #@journal_co_author_candidate =
+ # JournalCoAuthor.where(name_id: current_user.id).map{|c|c.co_author}
@journal_candidate =
WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq
+ if (not params[:q].nil?) and (current_user.name.include?params[:q])
+ @user = [{ :id => 0, :name => current_user.name}] # self account name
+ else
+ @user = []
+ end
+
+ @co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/)
+ @co_authors = [{ :id => params[:q], :name => params[:q] }] + # search string
+ @user + # self account name
+ @co_authors.map{|m| { :id => m.id, :name => m.co_author } } # match pattern
respond_to do |format|
format.html { render :layout => false}
+ format.json { render :json => @co_authors.to_json }
end
end
@@ -48,7 +59,7 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@writing_journal = WritingJournal.new(params[:writing_journal])
if @writing_journal.save
- render json: {success: true, msg: t('create.success.paper')}.to_json
+ render json: {success: true, msg: t('create_success')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("
")
render json: {success: false, msg: error_msg}.to_json
@@ -60,31 +71,23 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@writing_journal= WritingJournal.find(params[:id])
if @writing_journal.update_attributes(params[:writing_journal])
- render json: {success: true, msg: t('update.success.paper')}.to_json
+ render json: {success: true, msg: t('update_success')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("
")
render json: {success: false, msg: error_msg}.to_json
end
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
-
def destroy
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy
- render :json => {success: true, msg: t('delete.success.paper')}
+ render :json => {success: true, msg: t('delete_success')}
end
def journal_type
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
+ all_journal_lists = all_journal_lists.asc(:journal_title)
all_journal_lists = all_journal_lists.map do |j|
[ j.journal_title,
j.journal_level_type_ids.map do |type|
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
index 747d724a..291f7fe9 100644
--- 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
@@ -6,15 +6,20 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
marker + \
content(publication, view) + \
edit_or_delete(publication)
-
end
end
def marker
content_tag :div,
:class => "list_item_action"
- content_tag(:a, "",:href=>"", :class => "icon-check-empty", "toggle-onclick"=>"icon-check-empty icon-check", "ajax-remote"=>"false") + \
- content_tag(:a, "",:href=>"", :class => "icon-star-empty", "toggle-onclick"=>"icon-star-empty icon-star", "ajax-remote"=>"false")
+ content_tag(:a, "",:href=>"",
+ :class => "icon-check-empty",
+ "toggle-onclick"=>"icon-check-empty icon-check",
+ "ajax-remote"=>"false") + \
+ content_tag(:a, "",:href=>"",
+ :class => "icon-star-empty",
+ "toggle-onclick"=>"icon-star-empty icon-star",
+ "ajax-remote"=>"false")
end
def content publication, view
@@ -73,4 +78,16 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
file_type = ""
end
end
+
+ def generate_authors_name ids
+ author_name = ids.map{|m|
+ if m == "0"
+ {:id => 0, :name => current_user.name}
+ else
+ {:id => m, :name => ConferenceCoAuthor.find(m).co_author}
+ end
+ }
+
+ author_name.to_json
+ end
end
diff --git a/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb b/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb
index 5d8617c7..4edf44b2 100644
--- a/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb
+++ b/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb
@@ -8,6 +8,7 @@ class JournalCoAuthor
field :email
belongs_to :journal_co_author_relations
+ has_and_belongs_to_many :writing_journals
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/
validates :email, format: { with: VALID_EMAIL_REGEX },
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 7374abbf..8c721b64 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
@@ -12,6 +12,7 @@ class WritingJournal
has_and_belongs_to_many :tags, :class_name => "PersonalJournalTag"
has_and_belongs_to_many :journal_author_types
has_and_belongs_to_many :journal_level_types
+ has_and_belongs_to_many :journal_co_authors
has_many :writing_journal_files, :autosave => true, :dependent => :destroy
belongs_to :journal_paper_type
@@ -35,25 +36,44 @@ class WritingJournal
accepts_nested_attributes_for :writing_journal_files, :allow_destroy => true
after_save :save_writing_journal_files
before_validation :add_http
- before_save :save_co_author
+ #before_save :save_co_author
validates :paper_title, :at_least_one => true
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 save_co_author
- authors_list = authors.split(",").map{|n| n.strip.gsub(/\s+/," ")}.reject{|n| n.empty? }
- if new_record?
- current_user = create_user_id
- else
- current_user = update_user_id
- end
+ attr_reader :author_tokens
- 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|
- JournalCoAuthor.new(:co_author => author, :name_id => current_user).save
- end
+ def author_tokens=(ids)
+ authors_ids = ids.split(",").map{|id|
+ begin
+ JournalCoAuthor.find(m).id
+ rescue
+ if id != "0"
+ new_co_author = JournalCoAuthor.new(:co_author => id, :name_id => create_user_id)
+ new_co_author.save
+ new_co_author.id
+ else
+ id
+ end
+ end
+ }
+ self.journal_co_author_ids = authors_ids
end
+ # old method
+ #def save_co_author
+ # authors_list = authors.split(",").map{|n| n.strip.gsub(/\s+/," ")}.reject{|n| n.empty? }
+ # if new_record?
+ # current_user = create_user_id
+ # else
+ # current_user = update_user_id
+ # end
+
+ # 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|
+ # JournalCoAuthor.new(:co_author => author, :name_id => current_user).save
+ # end
+ #end
def self.search( category_id = nil )
if category_id.to_s.size > 0
diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb
index 29801f0b..4efbace0 100644
--- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb
+++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb
@@ -1,11 +1,11 @@
-<% @journal_co_author_relations.each_with_index do |journal_co_author_relation,i| %>
- -
-
<%= journal_co_author_relation.relation %>
-
- <%= link_to 'Edit', edit_panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
- <%= link_to 'Destroy', panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
-
-
-<% end %>
+ <% @journal_co_author_relations.each_with_index do |journal_co_author_relation,i| %>
+ -
+
<%= journal_co_author_relation.relation %>
+
+ <%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
+ <%= link_to t('delete'), panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), "confirm-message"=>t('sure?'), "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
+
+
+ <% end %>
diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb
index 0200dfe4..fa6d19fa 100644
--- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb
+++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb
@@ -8,9 +8,9 @@
-
+
<% @journal_co_authors.each_with_index do |co_author,i| %>
-
+
-
- <%= link_to 'Edit', edit_panel_personal_journal_desktop_journal_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
- <%= link_to 'Destroy', panel_personal_journal_desktop_journal_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
+ <%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
+ <%= link_to t('delete'), panel_personal_journal_desktop_journal_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>t('sure?'), "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
-
-
+
<% 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 817567a0..efe3fc7d 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
@@ -1,8 +1,8 @@