have done conference author filter, journal haven't been done, yet
This commit is contained in:
1 parent
db60a3bcfa
commit
625f2e9ad6
14 files changed
+217
-147
No files matched your search
+7
-7
@@ -26,24 +26,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_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
|
||||
@user = [{ :id => 0, :text => current_user.name, :email => current_user.email}] # 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
|
||||
@co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")}#{t("author")}" }] + # search string
|
||||
@user + # self account name
|
||||
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } } # match pattern
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
format.json { render :json => @co_authors.to_json }
|
||||
format.json { render :json => {:results => @co_authors}.to_json }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
+3
-1
@@ -84,9 +84,11 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
|
||||
def generate_authors_name ids
|
||||
author_name = ids.map{|m|
|
||||
if m == "0"
|
||||
#{:id => 0, :text => current_user.name, :email => current_user.email }
|
||||
{:id => 0, :name => current_user.name}
|
||||
else
|
||||
{:id => m, :name => ConferenceCoAuthor.find(m).co_author}
|
||||
#{:id => m, :text => JournalCoAuthor.find(m).co_author, :email => JournalCoAuthor.find(m).email}
|
||||
{:id => m, :name => JournalCoAuthor.find(m).co_author}
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class WritingJournal
|
||||
def author_tokens=(ids)
|
||||
authors_ids = ids.split(",").map{|id|
|
||||
begin
|
||||
JournalCoAuthor.find(m).id
|
||||
JournalCoAuthor.find(id).id
|
||||
rescue
|
||||
if id != "0"
|
||||
new_co_author = JournalCoAuthor.new(:co_author => id, :name_id => create_user_id)
|
||||
|
||||
-14
@@ -99,7 +99,6 @@
|
||||
<div class="s_form">
|
||||
<ul>
|
||||
<li class="s_grid_row">
|
||||
<%= f.label :author_tokens, t("personal_journal.authors") %><br />
|
||||
<%= f.text_area :author_tokens,
|
||||
class: "s_grid_6 s_grid",
|
||||
size: "20x2",
|
||||
@@ -230,19 +229,6 @@
|
||||
<!-- </div>
|
||||
</div>
|
||||
-->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#writing_conference_author_tokens").tokenInput("/panel/personal_conference/desktop/conference_pages/new.json", {
|
||||
crossDomain: false,
|
||||
prePopulate: $("#writing_conference_author_tokens").data("pre"),
|
||||
theme: "facebook",
|
||||
hintText: "<%=t("hintText")%>",
|
||||
noResultsText: "<%=t("noResultsText")%>",
|
||||
searchingText: "<%=t("searchingText")%>"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
orbitDesktop.prototype.initializeJournalPapers.journal_title_autocomplete_list = <%= @journal_candidate.to_json.html_safe %>;
|
||||
// orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
|
||||
|
||||
Reference in new issue
Block a user