add author filter for journal and fix some bug
This commit is contained in:
parent
96602842a3
commit
1880ed11ca
|
@ -38,12 +38,8 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
|||
}
|
||||
|
||||
this.initializeJournalPapers.editpaper = function(){
|
||||
o.highlight_sub_menu_item(1)
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal 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_journal_files", "g");
|
||||
|
@ -56,15 +52,119 @@ orbitDesktop.prototype.initializeJournalPapers = 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_journal_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_journal/desktop/journal_pages/new.json",
|
||||
dataType: 'json',
|
||||
quietMillis: 100,
|
||||
tokenSeparators: [","],
|
||||
data: function (search, page) {
|
||||
return {q: search};
|
||||
},
|
||||
results: function (data, page) {
|
||||
return {results: data.results};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$("#writing_journal_author_tokens").select2("container").find("ul.select2-choices").sortable({
|
||||
containment: 'parent',
|
||||
start: function() { $("#writing_journal_author_tokens").select2("onSortStart"); },
|
||||
update: function() { $("#writing_journal_author_tokens").select2("onSortEnd"); }
|
||||
});
|
||||
}
|
||||
|
||||
var preData = function(){
|
||||
$("#writing_journal_author_tokens").select2('data', JSON.parse($("#writing_journal_author_tokens").attr('data-pre')));
|
||||
}
|
||||
|
||||
uploadFiles();
|
||||
tokesplits();
|
||||
preData();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal 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_journal_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_journal_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_journal/desktop/journal_pages/new.json",
|
||||
dataType: 'json',
|
||||
quietMillis: 100,
|
||||
tokenSeparators: [","],
|
||||
data: function (search, page) {
|
||||
return {q: search};
|
||||
},
|
||||
results: function (data, page) {
|
||||
return {results: data.results};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$("#writing_journal_author_tokens").select2("container").find("ul.select2-choices").sortable({
|
||||
containment: 'parent',
|
||||
start: function() { $("#writing_journal_author_tokens").select2("onSortStart"); },
|
||||
update: function() { $("#writing_journal_author_tokens").select2("onSortEnd"); }
|
||||
});
|
||||
}
|
||||
|
||||
bindHandlers();
|
||||
uploadFiles();
|
||||
tokesplits();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.journal = function(){ // to open add pages in journal papers page
|
||||
|
@ -115,3 +215,5 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"addpaper"}, url: panel_personal_journal_desktop_journal_page_path(@writing_journal) do |f| %>
|
||||
<%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"}, url: panel_personal_journal_desktop_journal_page_path(@writing_journal) do |f| %>
|
||||
<%= render partial: 'form', locals: {:f => f} %>
|
||||
<%end%>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview" content-layout="datalist" base-width="300" per-column="5">
|
||||
<div class="overview" content-layout="datalist" per-column="5" base-width="300">
|
||||
<% @journal_lists.each_with_index do |journal_list,i| %>
|
||||
<div class="g_col">
|
||||
<ul>
|
||||
|
|
Loading…
Reference in New Issue