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 c220269e4..3c8199b0f 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 6220508bb..2ed83d0fc 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 %>
-
Share
-
+
Language
+
@@ -27,24 +25,46 @@
    -
  • + <% @site_valid_locales.each_with_index do |locale, i| %> + <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %> + <% data = "data-language=" + locale %> +
  • <%= data %> > <%= f.fields_for :paper_title_translations do |f| %> <%= f.text_area locale, class: "s_grid_12 s_grid s_grid_h_3", size: "20x4", - placeholder: t("personal_book.paper_title"), + placeholder: t("personal_book.paper_title")+ "("+I18nVariable.from_locale(locale)+")", value: (@personal_book.paper_title_translations[locale.to_s] rescue nil) %> <% end %>
  • -
  • +
  • <%= data %> > <%= f.fields_for :book_title_translations do |f| %> <%= f.text_field locale, size: "20", - placeholder: t("personal_book.book_title"), + placeholder: t("personal_book.book_title") + "("+I18nVariable.from_locale(locale)+")", class: "s_grid_12 s_grid", value: (@personal_book.book_title_translations[locale.to_s] rescue nil) %> <% end %>
  • +
  • <%= data %> > + <%= f.fields_for :extracted_chapters_translations do |f| %> + <%= f.text_field locale, + size: "20", + placeholder: t("personal_book.extracted_chapters")+ "("+I18nVariable.from_locale(locale)+")", + class: "s_grid_12 s_grid", + value: (@personal_book.extracted_chapters_translations[locale.to_s] rescue nil) %> + <% end %> +
  • +
  • <%= data %> > + <%= f.fields_for :publishers_translations do |f| %> + <%= f.text_field locale, + size: "20", + placeholder: t("personal_book.publishers")+ "("+I18nVariable.from_locale(locale)+")", + class: "s_grid_12 s_grid", + value: (@personal_book.publishers_translations[locale.to_s] rescue nil) %> + <% end %> +
  • + <% end %>
  • <%= label_tag("", t("personal_book.book_paper_type"), class: "s_grid_4 s_grid") %> <%= f.select :book_paper_type_id, BookPaperType.all.collect {|t| [ t.title, t.id ]}, {:class => "s_grid s_grid_8"} %> @@ -59,24 +79,7 @@ <% end %> <% end %>
  • -
  • - <%= f.fields_for :extracted_chapters_translations do |f| %> - <%= f.text_field locale, - size: "20", - placeholder: t("personal_book.extracted_chapters"), - class: "s_grid_12 s_grid", - value: (@personal_book.extracted_chapters_translations[locale.to_s] rescue nil) %> - <% end %> -
  • -
  • - <%= f.fields_for :publishers_translations do |f| %> - <%= f.text_field locale, - size: "20", - placeholder: t("personal_book.publishers"), - class: "s_grid_12 s_grid", - value: (@personal_book.publishers_translations[locale.to_s] rescue nil) %> - <% end %> -
  • +