From 6d54dbd5f80c2fb4612a44d4181cb4536da1d8ac Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 13 Aug 2013 17:00:44 +0800 Subject: [PATCH] bilingual for files fixed and description added and also filename display after selecting filenames Conflicts: app/assets/javascripts/desktop/orbitdesktop.js --- .../javascripts/desktop/orbitdesktop.js | 2 +- .../personal_book/desktop/personal_books.js | 4 +-- .../app/models/writing_book_file.rb | 2 +- .../personal_books/_form_file.html.erb | 33 ++++++++++++------- .../desktop/conference_pages.js | 4 +-- .../app/models/writing_conference_file.rb | 2 +- .../conference_pages/_form_file.html.erb | 33 ++++++++++++------- .../desktop/personal_diploma.js | 4 +-- .../desktop/personal_experiences.js | 4 +-- .../personal_honor/desktop/personal_honors.js | 4 +-- .../personal_journal/desktop/journal_pages.js | 4 +-- .../app/models/writing_journal_file.rb | 2 +- .../desktop/journal_pages/_form_file.html.erb | 33 ++++++++++++------- .../personal_lab/desktop/personal_lab.js | 4 +-- .../personal_lab/app/models/lab_file.rb | 2 +- .../desktop/personal_labs/_form_file.html.erb | 33 ++++++++++++------- .../desktop/personal_patent.js | 4 +-- .../app/models/writing_patent_file.rb | 2 +- .../personal_patents/_form_file.html.erb | 33 ++++++++++++------- .../desktop/personal_project.js | 4 +-- .../app/models/project_file.rb | 2 +- .../personal_projects/_form_file.html.erb | 33 ++++++++++++------- .../desktop/personal_research.js | 4 +-- .../app/models/research_file.rb | 2 +- .../personal_researchs/_form_file.html.erb | 33 ++++++++++++------- 25 files changed, 182 insertions(+), 105 deletions(-) diff --git a/app/assets/javascripts/desktop/orbitdesktop.js b/app/assets/javascripts/desktop/orbitdesktop.js index 559a6846a..9685011bb 100755 --- a/app/assets/javascripts/desktop/orbitdesktop.js +++ b/app/assets/javascripts/desktop/orbitdesktop.js @@ -418,7 +418,7 @@ var orbitDesktop = function(dom){ total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null; break; case "column": - var column; x=0; + var column,x = 0; entries = column_container.find("div[column=true]"); if(entries.length!=0){ entries.each(function(i,ul){ 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 3c8199b0f..64baaff2b 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 @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_book/app/models/writing_book_file.rb b/vendor/built_in_modules/personal_book/app/models/writing_book_file.rb index c30cf8e94..4efa4ede7 100644 --- a/vendor/built_in_modules/personal_book/app/models/writing_book_file.rb +++ b/vendor/built_in_modules/personal_book/app/models/writing_book_file.rb @@ -5,7 +5,7 @@ class WritingBookFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js index 533d5fbd7..be1fbfe69 100644 --- a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js +++ b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){ var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_conference/app/models/writing_conference_file.rb b/vendor/built_in_modules/personal_conference/app/models/writing_conference_file.rb index f098bce01..5fdca8efa 100644 --- a/vendor/built_in_modules/personal_conference/app/models/writing_conference_file.rb +++ b/vendor/built_in_modules/personal_conference/app/models/writing_conference_file.rb @@ -5,7 +5,7 @@ class WritingConferenceFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb index 3afd51f27..66a048cfa 100644 --- a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2 s_grid" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, class: 's_grid_4 s_grid' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4 s_grid', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js b/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js index af1f803d2..9f9cf6e98 100644 --- a/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js +++ b/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalDiploma = function(target,url,cache){ / var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js b/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js index b811f3208..bbada5fdc 100644 --- a/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js +++ b/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalExperience = function(target,url,cache) var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js b/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js index f2a181d0c..7d0d27edc 100644 --- a/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js +++ b/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalHonor = function(target,url,cache){ // var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js index bef4d8394..da74534d2 100644 --- a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js +++ b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_journal/app/models/writing_journal_file.rb b/vendor/built_in_modules/personal_journal/app/models/writing_journal_file.rb index 22416a0a8..2758dca51 100644 --- a/vendor/built_in_modules/personal_journal/app/models/writing_journal_file.rb +++ b/vendor/built_in_modules/personal_journal/app/models/writing_journal_file.rb @@ -5,7 +5,7 @@ class WritingJournalFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js b/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js index 787fc7d70..82103f3a0 100644 --- a/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js +++ b/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js @@ -65,8 +65,8 @@ orbitDesktop.prototype.initializePersonalLab = function(target,url,cache){ // th var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_lab/app/models/lab_file.rb b/vendor/built_in_modules/personal_lab/app/models/lab_file.rb index 517fb222d..5f2285588 100644 --- a/vendor/built_in_modules/personal_lab/app/models/lab_file.rb +++ b/vendor/built_in_modules/personal_lab/app/models/lab_file.rb @@ -5,7 +5,7 @@ class LabFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb b/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb +++ b/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js b/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js index cff5e8f78..d6a113b1d 100644 --- a/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js +++ b/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalPatent = function(target,url,cache){ // var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_patent/app/models/writing_patent_file.rb b/vendor/built_in_modules/personal_patent/app/models/writing_patent_file.rb index df7c5b459..1a19f8ea0 100644 --- a/vendor/built_in_modules/personal_patent/app/models/writing_patent_file.rb +++ b/vendor/built_in_modules/personal_patent/app/models/writing_patent_file.rb @@ -5,7 +5,7 @@ class WritingPatentFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/personal_patents/_form_file.html.erb b/vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/personal_patents/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/personal_patents/_form_file.html.erb +++ b/vendor/built_in_modules/personal_patent/app/views/panel/personal_patent/desktop/personal_patents/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js b/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js index e9d947467..55d8b7474 100644 --- a/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js +++ b/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalProject = function(target,url,cache){ / var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_project/app/models/project_file.rb b/vendor/built_in_modules/personal_project/app/models/project_file.rb index 5d36d7a55..d4706f0d9 100644 --- a/vendor/built_in_modules/personal_project/app/models/project_file.rb +++ b/vendor/built_in_modules/personal_project/app/models/project_file.rb @@ -5,7 +5,7 @@ class ProjectFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb b/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb +++ b/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %> diff --git a/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js b/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js index 062b27aa2..4c1c477bf 100644 --- a/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js +++ b/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js @@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalResearch = function(target,url,cache){ var languageSelect = function(){ $(".language_select a").click(function(event) { - $("li[data-language]").hide(); - $("li[data-language="+$(this).data("lang")+"]").show(); + $("*[data-language]").hide(); + $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } diff --git a/vendor/built_in_modules/personal_research/app/models/research_file.rb b/vendor/built_in_modules/personal_research/app/models/research_file.rb index c14df3332..408f09d7f 100644 --- a/vendor/built_in_modules/personal_research/app/models/research_file.rb +++ b/vendor/built_in_modules/personal_research/app/models/research_file.rb @@ -5,7 +5,7 @@ class ResearchFile mount_uploader :file, AssetUploader - # field :description, localize: true + field :description, localize: true field :should_destroy, :type => Boolean field :title, localize: true diff --git a/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb b/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb index 646677d48..66a048cfa 100644 --- a/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb +++ b/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb @@ -2,21 +2,32 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <% end %>
- - <%= f.text_field :title, :class => 's_grid_4' %> - - - <%= f.fields_for :file_title_translations do |f| %> - <%= f.text_field locale, - class: 's_grid_4', - value: (form_file.file_title_translations[locale] rescue nil) %> + <% @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 :file_title_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_title_translations[locale] rescue nil) %> + <% end %> + + + <%= data %>> + <%= f.fields_for :file_description_translations do |f| %> + <%= f.text_field locale, + class: 's_grid_4', + placeholder: I18nVariable.from_locale(locale), + value: (form_file.file_description_translations[locale] rescue nil) %> + <% end %> + <% end %> - - <% if form_file.new_record? %>