bilingual for files fixed and description added and also filename display after selecting filenames

Conflicts:
	app/assets/javascripts/desktop/orbitdesktop.js
This commit is contained in:
Harry Bomrah 2013-08-13 17:00:44 +08:00 committed by saurabhbhatia
parent cb070cc537
commit 6d54dbd5f8
25 changed files with 182 additions and 105 deletions

View File

@ -418,7 +418,7 @@ var orbitDesktop = function(dom){
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null; total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
break; break;
case "column": case "column":
var column; x=0; var column,x = 0;
entries = column_container.find("div[column=true]"); entries = column_container.find("div[column=true]");
if(entries.length!=0){ if(entries.length!=0){
entries.each(function(i,ul){ entries.each(function(i,ul){

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class WritingBookFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class WritingConferenceFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, class: 's_grid_4 s_grid' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4 s_grid', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalDiploma = function(target,url,cache){ /
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalExperience = function(target,url,cache)
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalHonor = function(target,url,cache){ //
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class WritingJournalFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -65,8 +65,8 @@ orbitDesktop.prototype.initializePersonalLab = function(target,url,cache){ // th
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class LabFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalPatent = function(target,url,cache){ //
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class WritingPatentFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalProject = function(target,url,cache){ /
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class ProjectFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>

View File

@ -63,8 +63,8 @@ orbitDesktop.prototype.initializePersonalResearch = function(target,url,cache){
var languageSelect = function(){ var languageSelect = function(){
$(".language_select a").click(function(event) { $(".language_select a").click(function(event) {
$("li[data-language]").hide(); $("*[data-language]").hide();
$("li[data-language="+$(this).data("lang")+"]").show(); $("*[data-language="+$(this).data("lang")+"]").show();
return false; return false;
}); });
} }

View File

@ -5,7 +5,7 @@ class ResearchFile
mount_uploader :file, AssetUploader mount_uploader :file, AssetUploader
# field :description, localize: true field :description, localize: true
field :should_destroy, :type => Boolean field :should_destroy, :type => Boolean
field :title, localize: true field :title, localize: true

View File

@ -2,21 +2,32 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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" %>
<label></label>
<% end %> <% end %>
</div> </div>
</td> </td>
<td> <% @site_valid_locales.each_with_index do |locale, i| %>
<%= f.text_field :title, :class => 's_grid_4' %> <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
</td> <% data = "data-language=" + locale %>
<td> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
</td> </td>
<td <%= style %> <%= 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 %>
</td>
<% end %>
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% if form_file.new_record? %>