diff --git a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js index c220269e..3c8199b0 100644 --- a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js +++ b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js @@ -42,63 +42,42 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t o.highlight_sub_menu_item(0); } + 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 languageSelect = function(){ + $(".language_select a").click(function(event) { + $("li[data-language]").hide(); + $("li[data-language="+$(this).data("lang")+"]").show(); + return false; + }); + } + this.initializePersonalBook.editbook = 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 preData = function(){ - $("#writing_journal_author_tokens").select2('data', JSON.parse($("#writing_journal_author_tokens").attr('data-pre'))); - } uploadFiles(); - // preData(); + languageSelect(); } this.initializePersonalBook.addbook = 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(){ - - - } - bindHandlers(); uploadFiles(); - + languageSelect(); } diff --git a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form.html.erb index 6220508b..2ed83d0f 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form.html.erb @@ -8,14 +8,12 @@ <% end %>