have done conference author filter, journal haven't been done, yet
This commit is contained in:
parent
4f64ff3568
commit
96602842a3
1
Gemfile
1
Gemfile
|
@ -13,6 +13,7 @@ gem 'exception_notification' # Send error trace
|
|||
gem 'execjs'
|
||||
gem 'jquery-rails', '2.1.4'
|
||||
gem 'jquery-ui-rails'
|
||||
gem "select2-rails"
|
||||
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
|
||||
|
||||
# gem "memcached", "~> 1.4.3"
|
||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -141,6 +141,7 @@ GEM
|
|||
jquery-rails
|
||||
railties (>= 3.1.0)
|
||||
json (1.7.7)
|
||||
libv8 (3.11.8.13)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
|
@ -224,6 +225,7 @@ GEM
|
|||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.0.3)
|
||||
rb-readline (0.4.2)
|
||||
rdoc (3.12.1)
|
||||
json (~> 1.4)
|
||||
redis (3.0.2)
|
||||
|
@ -233,6 +235,7 @@ GEM
|
|||
chinese_pinyin (>= 0.3.0)
|
||||
redis (>= 2.1.1)
|
||||
redis-namespace (>= 1.0.2)
|
||||
ref (1.0.2)
|
||||
resque (1.23.0)
|
||||
multi_json (~> 1.0)
|
||||
redis-namespace (~> 1.0)
|
||||
|
@ -275,6 +278,9 @@ GEM
|
|||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
select2-rails (3.3.0)
|
||||
sass-rails (~> 3.2)
|
||||
thor (~> 0.14)
|
||||
selenium-webdriver (2.30.0)
|
||||
childprocess (>= 0.2.5)
|
||||
multi_json (~> 1.0)
|
||||
|
@ -313,6 +319,9 @@ GEM
|
|||
sunspot (= 1.3.3)
|
||||
sunspot_solr (1.3.3)
|
||||
terminal-table (1.4.5)
|
||||
therubyracer (0.11.4)
|
||||
libv8 (~> 3.11.8.12)
|
||||
ref
|
||||
thor (0.17.0)
|
||||
tilt (1.3.3)
|
||||
tinymce-rails (3.5.8)
|
||||
|
@ -357,6 +366,7 @@ DEPENDENCIES
|
|||
jquery-rails (= 2.1.4)
|
||||
jquery-ui-rails
|
||||
kaminari!
|
||||
libv8 (~> 3.11.8)
|
||||
mime-types
|
||||
mini_magick
|
||||
mongo_session_store-rails3 (= 3.0.6)
|
||||
|
@ -373,6 +383,7 @@ DEPENDENCIES
|
|||
radius
|
||||
rails (~> 3.2.9)
|
||||
rake
|
||||
rb-readline
|
||||
redis (>= 2.1.1)
|
||||
redis-namespace
|
||||
redis-search
|
||||
|
@ -384,6 +395,7 @@ DEPENDENCIES
|
|||
rspec-rails (~> 2.0)
|
||||
rubyzip
|
||||
sass-rails
|
||||
select2-rails
|
||||
shoulda-matchers
|
||||
simplecov
|
||||
sinatra
|
||||
|
@ -393,6 +405,7 @@ DEPENDENCIES
|
|||
sunspot-rails-tester
|
||||
sunspot_mongo
|
||||
sunspot_solr
|
||||
therubyracer
|
||||
tinymce-rails
|
||||
uglifier
|
||||
watchr
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
//= require orbitdesktop
|
||||
//= require jquery.gridster
|
||||
//= require desktop/books_pages
|
||||
//= require jquery.tokeninput
|
||||
//= require select2
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
*= require desktop/desktop-media
|
||||
*= require desktop/desktop-timeline
|
||||
*= require orbit-bar
|
||||
*= require select2
|
||||
*/
|
|
@ -38,12 +38,8 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
|
|||
}
|
||||
|
||||
this.initializeConferencePapers.editpaper = function(){
|
||||
o.highlight_sub_menu_item(1)
|
||||
}
|
||||
|
||||
this.initializeConferencePapers.addpaper = function(){ // to open add pages in conference papers page
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
o.highlight_sub_menu_item(1);
|
||||
var uploadFiles = function(){
|
||||
$('#add_plugin_file a.add').click(function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_writing_conference_files", "g");
|
||||
|
@ -56,13 +52,119 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
|
|||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.action a.remove_existing_record').click(function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
}
|
||||
|
||||
var tokesplits = function(){
|
||||
$("#writing_conference_author_tokens").select2({
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
width: "300px;",
|
||||
formatResult: function movieFormatResult(coAuthor) {
|
||||
var markup = "";
|
||||
if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
|
||||
markup += coAuthor.text + " -- " + coAuthor.email;
|
||||
}else if (coAuthor.email !== undefined) {
|
||||
markup += coAuthor.text;
|
||||
}
|
||||
return markup;
|
||||
},
|
||||
ajax: {
|
||||
url: "/panel/personal_conference/desktop/conference_pages/new.json",
|
||||
dataType: 'json',
|
||||
quietMillis: 100,
|
||||
tokenSeparators: [","],
|
||||
data: function (search, page) {
|
||||
return {q: search};
|
||||
},
|
||||
results: function (data, page) {
|
||||
return {results: data.results};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$("#writing_conference_author_tokens").select2("container").find("ul.select2-choices").sortable({
|
||||
containment: 'parent',
|
||||
start: function() { $("#writing_conference_author_tokens").select2("onSortStart"); },
|
||||
update: function() { $("#writing_conference_author_tokens").select2("onSortEnd"); }
|
||||
});
|
||||
}
|
||||
|
||||
var preData = function(){
|
||||
$("#writing_conference_author_tokens").select2('data', JSON.parse($("#writing_conference_author_tokens").attr('data-pre')));
|
||||
}
|
||||
|
||||
uploadFiles();
|
||||
tokesplits();
|
||||
preData();
|
||||
}
|
||||
|
||||
this.initializeConferencePapers.addpaper = function(){ // to open add pages in conference papers page
|
||||
var uploadFiles = function(){
|
||||
$('#add_plugin_file a.add').click(function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_writing_conference_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
var x = get_html(old_id,new_id);
|
||||
var newfield = $(x);
|
||||
$(this).parents('table').append(newfield);
|
||||
newfield.find('.action a.delete').click(function(){
|
||||
newfield.remove();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('.action a.remove_existing_record').click(function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
}
|
||||
|
||||
console.log("hi");
|
||||
var bindHandlers = function(){
|
||||
o.simple_drop_down();
|
||||
}
|
||||
|
||||
var tokesplits = function(){
|
||||
$("#writing_conference_author_tokens").select2({
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
width: "300px;",
|
||||
formatResult: function movieFormatResult(coAuthor) {
|
||||
var markup = "";
|
||||
if (coAuthor.text !== undefined && coAuthor.email !== undefined) {
|
||||
markup += coAuthor.text + " -- " + coAuthor.email;
|
||||
}else if (coAuthor.email !== undefined) {
|
||||
markup += coAuthor.text;
|
||||
}
|
||||
return markup;
|
||||
},
|
||||
ajax: {
|
||||
url: "/panel/personal_conference/desktop/conference_pages/new.json",
|
||||
dataType: 'json',
|
||||
quietMillis: 100,
|
||||
tokenSeparators: [","],
|
||||
data: function (search, page) {
|
||||
return {q: search};
|
||||
},
|
||||
results: function (data, page) {
|
||||
return {results: data.results};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$("#writing_conference_author_tokens").select2("container").find("ul.select2-choices").sortable({
|
||||
containment: 'parent',
|
||||
start: function() { $("#writing_conference_author_tokens").select2("onSortStart"); },
|
||||
update: function() { $("#writing_conference_author_tokens").select2("onSortEnd"); }
|
||||
});
|
||||
}
|
||||
|
||||
bindHandlers();
|
||||
uploadFiles();
|
||||
tokesplits();
|
||||
}
|
||||
|
||||
this.initializeConferencePapers.conference = function(){ // to open add pages in conference papers page
|
||||
|
|
|
@ -32,19 +32,19 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
|
|||
WritingConference.where(create_user_id: current_user.id).map{|j|j.conference_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 = ConferenceCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/)
|
||||
@co_authors = [{ :id => params[:q], :name => params[:q] }] + # search string
|
||||
@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, :name => m.co_author } } # match pattern
|
||||
@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
|
||||
|
||||
|
|
|
@ -83,12 +83,13 @@ module Panel::PersonalConference::Desktop::ConferencePagesHelper
|
|||
def generate_authors_name ids
|
||||
author_name = ids.map{|m|
|
||||
if m == "0"
|
||||
{:id => 0, :name => current_user.name}
|
||||
#{:id => 0, :text => current_user.name, :email => current_user.email }
|
||||
{:id => 0, :text => current_user.name }
|
||||
else
|
||||
{:id => m, :name => ConferenceCoAuthor.find(m).co_author}
|
||||
#{:id => m, :text => ConferenceCoAuthor.find(m).co_author, :email => ConferenceCoAuthor.find(m).email}
|
||||
{:id => m, :text => ConferenceCoAuthor.find(m).co_author}
|
||||
end
|
||||
}
|
||||
|
||||
author_name.to_json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ class WritingConference
|
|||
def author_tokens=(ids)
|
||||
authors_ids = ids.split(",").map{|id|
|
||||
begin
|
||||
ConferenceCoAuthor.find(m).id
|
||||
ConferenceCoAuthor.find(id).id
|
||||
rescue
|
||||
if id != "0"
|
||||
new_co_author = ConferenceCoAuthor.new(:co_author => id, :name_id => create_user_id)
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<div class="toolbar hh1">
|
||||
<div class="fn_g hp">
|
||||
<%= f.submit t("save"), name: "commit", value: "Save", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
|
||||
<!-- class: bt-cancle can't be remove -->
|
||||
<%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
|
||||
<% if not @writing_conference.new_record? %>
|
||||
<%= submit_tag t("cancel"), :type => "button", "ajax-remote" => "get", :href => panel_personal_conference_desktop_conference_pages_path, class: "bt-cancel ini_input hp hh1 thmadm thmtxt" %>
|
||||
<%= submit_tag t("cancel"), :type => "button", "ajax-remote" => "get", :href => panel_personal_conference_desktop_conference_pages_path, class: "ini_input hp hh1 thmadm thmtxt" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="hh1 hp sdm">
|
||||
|
@ -26,8 +25,7 @@
|
|||
<div class="scrollbar sb_h vp">
|
||||
<div class="track">
|
||||
<div class="thumb thmc2">
|
||||
<div class="end">
|
||||
</div>
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -100,14 +98,12 @@
|
|||
<li class="s_grid_row">
|
||||
<%= label_tag("", t("personal_conference.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div column="true">
|
||||
<div class="s_form">
|
||||
<ul>
|
||||
<li class="s_grid_row">
|
||||
<%= f.label :author_tokens, t("personal_conference.authors") %><br />
|
||||
<%= f.text_area :author_tokens,
|
||||
class: "s_grid_6 s_grid",
|
||||
size: "20x2",
|
||||
|
@ -209,25 +205,6 @@
|
|||
<!-- </div>
|
||||
</div> -->
|
||||
|
||||
<%= stylesheet_link_tag "token-input-facebook" %>
|
||||
<%= javascript_include_tag :defaults, "jquery.tokeninput" %>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(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.conference_title_autocomplete_list = <%= @conference_candidate.to_json.html_safe %>;
|
||||
// orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"}, url: panel_personal_conference_desktop_conference_page_path(@writing_conference) do |f| %>
|
||||
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_conference_desktop_conference_page_path(@writing_conference) do |f| %>
|
||||
<%= render partial: 'form', locals: {:f => f} %>
|
||||
<%end%>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"}, url: panel_personal_conference_desktop_conference_pages_path do |f| %>
|
||||
<%= form_for @writing_conference, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_conference_desktop_conference_pages_path do |f| %>
|
||||
<%= render partial: 'form', locals: {:f => f} %>
|
||||
<%end%>
|
||||
|
||||
|
|
|
@ -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
|
||||
@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, :name => m.co_author } } # match pattern
|
||||
@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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 %>;
|
||||
|
|
Loading…
Reference in New Issue