From 5178ce3bde335ee58bd92a1f87356cc901b89e73 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Mon, 11 Mar 2013 17:21:02 +0800 Subject: [PATCH] modify nil of email string and sort --- .../desktop/conference_pages.js | 16 ++++++++++++++-- .../desktop/conference_pages_controller.rb | 9 +++++---- .../personal_journal/desktop/journal_pages.js | 18 +++++++++++++++--- .../desktop/journal_pages_controller.rb | 10 ++++++---- .../desktop/journal_pages_helper.rb | 4 ++-- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js index 86ee0e88f..a60201e06 100644 --- a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js +++ b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js @@ -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(){ o.highlight_sub_menu_item(1); var uploadFiles = function(){ @@ -66,7 +70,11 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){ formatResult: function movieFormatResult(coAuthor) { var markup = ""; if (coAuthor.text !== undefined && coAuthor.email !== undefined) { - markup += coAuthor.text + " -- " + coAuthor.email; + if(!coAuthor.email){ + markup += coAuthor.text + " -- none email"; + } else { + markup += coAuthor.text + " -- " + coAuthor.email; + } }else if (coAuthor.email !== undefined) { markup += coAuthor.text; } @@ -135,7 +143,11 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){ formatResult: function movieFormatResult(coAuthor) { var markup = ""; if (coAuthor.text !== undefined && coAuthor.email !== undefined) { - markup += coAuthor.text + " -- " + coAuthor.email; + if(!coAuthor.email){ + markup += coAuthor.text + " -- none email"; + } else { + markup += coAuthor.text + " -- " + coAuthor.email; + } }else if (coAuthor.email !== undefined) { markup += coAuthor.text; } diff --git a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb index 935e05dfc..93c307404 100644 --- a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb +++ b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_pages_controller.rb @@ -37,10 +37,11 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio @user = [] end - @co_authors = ConferenceCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/) - @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 + @co_authors = ConferenceCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/).asc(:co_author) + # search string + self account name + 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| format.html { render :layout => false} diff --git a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js index a1a769bdf..dd233c3df 100644 --- a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js +++ b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js @@ -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(){ o.highlight_sub_menu_item(1); var uploadFiles = function(){ @@ -66,7 +70,11 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // formatResult: function movieFormatResult(coAuthor) { var markup = ""; if (coAuthor.text !== undefined && coAuthor.email !== undefined) { - markup += coAuthor.text + " -- " + coAuthor.email; + if(!coAuthor.email){ + markup += coAuthor.text + " -- none email"; + } else { + markup += coAuthor.text + " -- " + coAuthor.email; + } }else if (coAuthor.email !== undefined) { markup += coAuthor.text; } @@ -132,10 +140,14 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // multiple: true, minimumInputLength: 1, width: "300px;", - formatResult: function movieFormatResult(coAuthor) { + formatResult: function movieFormatResult(coAuthor, container, query, escapeMarkup) { var markup = ""; if (coAuthor.text !== undefined && coAuthor.email !== undefined) { - markup += coAuthor.text + " -- " + coAuthor.email; + if(!coAuthor.email){ + markup += coAuthor.text + " -- none email"; + } else { + markup += coAuthor.text + " -- " + coAuthor.email; + } }else if (coAuthor.email !== undefined) { markup += coAuthor.text; } 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 e6c5d6c66..d892c6ff0 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 @@ -36,10 +36,12 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr @user = [] end - @co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/) - @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 + @co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/).asc(:co_author) + + # search string + self account name + 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| format.html { render :layout => false} 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 474352629..707383ec3 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 @@ -85,10 +85,10 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper author_name = ids.map{|m| if m == "0" #{:id => 0, :text => current_user.name, :email => current_user.email } - {:id => 0, :name => current_user.name} + {:id => 0, :text => current_user.name} else #{: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 }