add author filter for journal and fix some bug
This commit is contained in:
parent
12fdb5a0ca
commit
3c6ca3c254
|
@ -1,117 +1,219 @@
|
|||
orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // this init journal papers
|
||||
this.initializeJournalPapers.formCallback = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
this.initializeJournalPapers.formCallback = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.list = function(){ // to open list part in journal papers page
|
||||
var journalData;
|
||||
var bindHandlers = function(){ // to bind handlers for list page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.list = function(){ // to open list part in journal papers page
|
||||
var journalData;
|
||||
var bindHandlers = function(){ // to bind handlers for list page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
var bindSecondaryHandlers = function(){
|
||||
$("#journal_p div#paper_list a.icon-check-empty").click(function(){
|
||||
if($(this).hasClass("icon-check-empty")){
|
||||
$(this).switchClass("icon-check-empty","icon-check",0);
|
||||
} else if($(this) .hasClass("icon-check")) {
|
||||
$(this).switchClass("icon-check","icon-check-empty",0);
|
||||
} else if($(this).hasClass("icon-star")){
|
||||
$(this).removeClass("icon-star").addClass("icon-star-empty");
|
||||
} else if($(this).hasClass("icon-star-empty")){
|
||||
$(this).removeClass("icon-star-empty").addClass("icon-star");
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.paperDelete = function(data,dom){
|
||||
var parent = dom.parent().parent();
|
||||
if(data.success){
|
||||
parent.hide("slide",function(){parent.remove();});
|
||||
o.notify(data.msg,"success");
|
||||
}
|
||||
}
|
||||
|
||||
var bindSecondaryHandlers = function(){
|
||||
$("#journal_p div#paper_list a.icon-check-empty").click(function(){
|
||||
if($(this).hasClass("icon-check-empty")){
|
||||
$(this).switchClass("icon-check-empty","icon-check",0);
|
||||
} else if($(this) .hasClass("icon-check")) {
|
||||
$(this).switchClass("icon-check","icon-check-empty",0);
|
||||
} else if($(this).hasClass("icon-star")){
|
||||
$(this).removeClass("icon-star").addClass("icon-star-empty");
|
||||
} else if($(this).hasClass("icon-star-empty")){
|
||||
$(this).removeClass("icon-star-empty").addClass("icon-star");
|
||||
this.initializeJournalPapers.editpaper = function(){
|
||||
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");
|
||||
$(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();
|
||||
});
|
||||
}
|
||||
|
||||
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 false;
|
||||
})
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.paperDelete = function(data,dom){
|
||||
var parent = dom.parent().parent();
|
||||
if(data.success){
|
||||
parent.hide("slide",function(){parent.remove();});
|
||||
o.notify(data.msg,"success");
|
||||
}
|
||||
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"); }
|
||||
});
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.editpaper = function(){
|
||||
o.highlight_sub_menu_item(1)
|
||||
var preData = function(){
|
||||
$("#writing_journal_author_tokens").select2('data', JSON.parse($("#writing_journal_author_tokens").attr('data-pre')));
|
||||
}
|
||||
|
||||
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();
|
||||
$('#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;
|
||||
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();
|
||||
});
|
||||
|
||||
|
||||
$('.action a.remove_existing_record').click(function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
|
||||
}
|
||||
bindHandlers();
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.journal = function(){ // to open add pages in journal papers page
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
bindHandlers();
|
||||
console.log("hi");
|
||||
var bindHandlers = function(){
|
||||
o.simple_drop_down();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.coAuthorformCallback = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(3));
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
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
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
bindHandlers();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.coAuthorformCallback = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(3));
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.coauthor = function(){ // to open add pages in coauthor page
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
this.initializeJournalPapers.coauthor = function(){ // to open add pages in coauthor page
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
}
|
||||
bindHandlers();
|
||||
}
|
||||
this.initializeJournalPapers.coauthorRelationForm = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
$("#co_author_relation_table").html(data.newvalue);
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
o.notify(data.msg,"success");
|
||||
$("#co_author_relation_table").html(data.newvalue);
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.coauthorRelationEditForm = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
$("#co_author_relation_table").html(data.newvalue);
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
o.notify(data.msg,"success");
|
||||
$("#co_author_relation_table").html(data.newvalue);
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.allnone = function(d,o){
|
||||
this.initializeJournalPapers.allnone = function(d,o){
|
||||
switch(o.attr("href")){
|
||||
case "all":
|
||||
$("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check");
|
||||
break;
|
||||
break;
|
||||
case "none":
|
||||
$("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty");
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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