modify nil of email string and sort

This commit is contained in:
Rueshyna 2013-03-11 17:21:02 +08:00 committed by Matt K. Fu
parent 95128a3465
commit 5178ce3bde
5 changed files with 42 additions and 15 deletions

View File

@ -37,6 +37,10 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
} }
} }
this.initializeConferencePapers.cancelpaper = function(){
o.highlight_sub_menu_item(0);
}
this.initializeConferencePapers.editpaper = function(){ this.initializeConferencePapers.editpaper = function(){
o.highlight_sub_menu_item(1); o.highlight_sub_menu_item(1);
var uploadFiles = function(){ var uploadFiles = function(){
@ -66,7 +70,11 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
formatResult: function movieFormatResult(coAuthor) { formatResult: function movieFormatResult(coAuthor) {
var markup = ""; var markup = "";
if (coAuthor.text !== undefined && coAuthor.email !== undefined) { if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
if(!coAuthor.email){
markup += coAuthor.text + " -- none email";
} else {
markup += coAuthor.text + " -- " + coAuthor.email; markup += coAuthor.text + " -- " + coAuthor.email;
}
}else if (coAuthor.email !== undefined) { }else if (coAuthor.email !== undefined) {
markup += coAuthor.text; markup += coAuthor.text;
} }
@ -135,7 +143,11 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
formatResult: function movieFormatResult(coAuthor) { formatResult: function movieFormatResult(coAuthor) {
var markup = ""; var markup = "";
if (coAuthor.text !== undefined && coAuthor.email !== undefined) { if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
if(!coAuthor.email){
markup += coAuthor.text + " -- none email";
} else {
markup += coAuthor.text + " -- " + coAuthor.email; markup += coAuthor.text + " -- " + coAuthor.email;
}
}else if (coAuthor.email !== undefined) { }else if (coAuthor.email !== undefined) {
markup += coAuthor.text; markup += coAuthor.text;
} }

View File

@ -37,10 +37,11 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
@user = [] @user = []
end end
@co_authors = ConferenceCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/) @co_authors = ConferenceCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/).asc(:co_author)
@co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")}#{t("author")}" }] + # search string # search string + self account name + match pattern
@user + # self account name @co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")} #{t("author")}" }] +
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } } # match pattern @user +
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } }
respond_to do |format| respond_to do |format|
format.html { render :layout => false} format.html { render :layout => false}

View File

@ -37,6 +37,10 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
} }
} }
this.initializeJournalPapers.cancelpaper = function(){
o.highlight_sub_menu_item(0);
}
this.initializeJournalPapers.editpaper = function(){ this.initializeJournalPapers.editpaper = function(){
o.highlight_sub_menu_item(1); o.highlight_sub_menu_item(1);
var uploadFiles = function(){ var uploadFiles = function(){
@ -66,7 +70,11 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
formatResult: function movieFormatResult(coAuthor) { formatResult: function movieFormatResult(coAuthor) {
var markup = ""; var markup = "";
if (coAuthor.text !== undefined && coAuthor.email !== undefined) { if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
if(!coAuthor.email){
markup += coAuthor.text + " -- none email";
} else {
markup += coAuthor.text + " -- " + coAuthor.email; markup += coAuthor.text + " -- " + coAuthor.email;
}
}else if (coAuthor.email !== undefined) { }else if (coAuthor.email !== undefined) {
markup += coAuthor.text; markup += coAuthor.text;
} }
@ -132,10 +140,14 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
multiple: true, multiple: true,
minimumInputLength: 1, minimumInputLength: 1,
width: "300px;", width: "300px;",
formatResult: function movieFormatResult(coAuthor) { formatResult: function movieFormatResult(coAuthor, container, query, escapeMarkup) {
var markup = ""; var markup = "";
if (coAuthor.text !== undefined && coAuthor.email !== undefined) { if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
if(!coAuthor.email){
markup += coAuthor.text + " -- none email";
} else {
markup += coAuthor.text + " -- " + coAuthor.email; markup += coAuthor.text + " -- " + coAuthor.email;
}
}else if (coAuthor.email !== undefined) { }else if (coAuthor.email !== undefined) {
markup += coAuthor.text; markup += coAuthor.text;
} }

View File

@ -36,10 +36,12 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
@user = [] @user = []
end end
@co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/) @co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/).asc(:co_author)
@co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")}#{t("author")}" }] + # search string
@user + # self account name # search string + self account name + match pattern
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } } # match pattern @co_authors = [{ :id => params[:q], :text => params[:q], :email => "#{t("add")}#{t("author")}" }] +
@user +
@co_authors.map{|m| { :id => m.id, :text => m.co_author, :email => m.email } }
respond_to do |format| respond_to do |format|
format.html { render :layout => false} format.html { render :layout => false}

View File

@ -85,10 +85,10 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
author_name = ids.map{|m| author_name = ids.map{|m|
if m == "0" if m == "0"
#{:id => 0, :text => current_user.name, :email => current_user.email } #{:id => 0, :text => current_user.name, :email => current_user.email }
{:id => 0, :name => current_user.name} {:id => 0, :text => current_user.name}
else else
#{:id => m, :text => JournalCoAuthor.find(m).co_author, :email => JournalCoAuthor.find(m).email} #{:id => m, :text => JournalCoAuthor.find(m).co_author, :email => JournalCoAuthor.find(m).email}
{:id => m, :name => JournalCoAuthor.find(m).co_author} {:id => m, :text => JournalCoAuthor.find(m).co_author}
end end
} }