From 9c7558847a5a13504fa44ca8ab75e3f11a89d3e1 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 9 Aug 2013 16:57:42 +0800 Subject: [PATCH] bilingual fixed for all the plugins in desktop --- .../personal_book/desktop/personal_books.js | 79 +++++++----------- .../desktop/personal_books/_form.html.erb | 61 +++++++------- .../desktop/conference_pages.js | 78 +++++++----------- .../desktop/conference_pages/_form.html.erb | 27 ++++--- .../desktop/personal_diploma.js | 79 +++++++----------- .../desktop/personal_diplomas/_form.html.erb | 34 ++++---- .../desktop/personal_experiences.js | 79 +++++++----------- .../personal_experiences/_form.html.erb | 30 +++---- .../personal_honor/desktop/personal_honors.js | 79 +++++++----------- .../desktop/personal_honors/_form.html.erb | 12 ++- .../personal_journal/desktop/journal_pages.js | 79 +++++++----------- .../desktop/journal_pages/_form.html.erb | 24 +++--- .../personal_lab/desktop/personal_lab.js | 81 +++++++------------ .../desktop/personal_labs/_form.html.erb | 32 ++++---- .../desktop/personal_patent.js | 80 +++++++----------- .../desktop/personal_patents/_form.html.erb | 20 ++--- .../desktop/personal_project.js | 79 +++++++----------- .../desktop/personal_projects/_form.html.erb | 32 ++++---- .../desktop/personal_research.js | 79 +++++++----------- .../desktop/personal_researchs/_form.html.erb | 26 +++--- 20 files changed, 450 insertions(+), 640 deletions(-) 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 %>
-
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 %> -
  • +