Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ files/* Gemfile.lock config/database.yml app/serializers public/assets *~ Session.vim *toto Loading app/controllers/ayuda_controller.rb +10 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,14 @@ class AyudaController < ApplicationController # Actualiza una ayuda contextual def modificar_crear @ayuda = Ayuda.find_by_id params[:id] @langs = FastGettext.default_available_locales @ayuda_idioma = {} @langs.each do |lang| # ayuda_idioma = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang] = AyudaIdioma.find_or_create_by(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang].update_attributes params[:ayuda_idioma][lang] msg @ayuda_idioma[lang] if @ayuda_idioma[lang].errors.any? end end private Loading @@ -49,11 +57,11 @@ class AyudaController < ApplicationController @langs = FastGettext.default_available_locales @ayuda_idioma = {} @langs.each do |lang| @ayuda_idioma[lang] = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) # @ayuda_idioma[lang] = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang] = AyudaIdioma.find_or_initialize_by(lang: lang, ayuda_id: @ayuda.id) end #FastGettext.default_available_locales.each do |lang| #end end end app/helpers/application_helper.rb +2 −2 Original line number Diff line number Diff line Loading @@ -137,9 +137,9 @@ module ApplicationHelper #include_tiny_mce_if_needed cadena = "<div class=\"elemento\">".html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "tinymce mceEditor", :type => "d", :name => otros[:name]}) cadena += tinymce_assets cadena += tinymce :uploadimage_hint => @proyecto.id, :language => session[:idioma_seleccionado] cadena += tinymce :uploadimage_hint => (@proyecto ? @proyecto.id : 'tinymce_upload'), :language => session[:idioma_seleccionado] else cadena = ("<div class=\"elemento" + clase +"\">").html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "textoarea"+clase, :type => "d", :name => otros[:name], :rows=>2 }) cadena = ("<div class=\"elemento" + clase +"\">").html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "textoarea"+clase, :type => "d", :name => otros[:name], :rows=>2, value: otros[:value] }) end return cadena << "</div>".html_safe end Loading app/views/ayuda/_formulario.html.erb +37 −35 Original line number Diff line number Diff line <!-- Formulario --> <%= comienzo_formulario( {action: 'modificar_crear', id: @ayuda } , false ) %> <div class="linea"> <%= selector _("Sección"), 'ayuda', 'section', [@ayuda.section], false, "3_2", obligatorio: true, disabled: true %> <%= selector _("Menú"), 'ayuda', 'menu', [@ayuda.menu], true, "3_2", obligatorio: true, disabled: true %> Loading @@ -22,7 +20,7 @@ <% @langs.each do |lang| -%> <li id="lang_selector_<%= lang %>"> <%= link_to_function lang.upcase, " [#{all_langs_ids}].each(Element.hide); Element.show('lang_box_#{lang}') " %> Element.show('lang_box_#{lang}'); " %> <%#= link_to_function lang.upcase, " [#{all_langs_ids}].each(Element.hide); Element.show('lang_box_#{lang}'); Element.show('lang_selector_#{lang}').addClassName('elemento_activado') " %> Loading @@ -31,17 +29,21 @@ </ul> </div> <!-- Formulario --> <%= comienzo_formulario( {action: 'modificar_crear', id: @ayuda } , true ) %> <% @langs.each do |lang| %> <% lang_box_style = (lang == I18n.locale.to_s) ? '' : 'display:none;' %> <div id="lang_box_<%= lang %>" style="<%= lang_box_style %>"> <div class="linea"> Estamos en el idioma <%= lang %> <%#= texto_area _("Texto de ayuda %{lang}")%{lang: lang}, "ayuda_idioma_#{lang}", "body", "editor_rico" %> <%= texto _("Título de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "titulo", "", {value: @ayuda_idioma[lang].titulo} %> </div> <div class="linea"> <%= texto _("URL de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "url", "", {value: @ayuda_idioma[lang].url} %> </div> <% end %> <div class="linea"> <%#= texto_area _("Texto de ayuda"), "ayuda_idioma", "body", "editor_rico" %> <%= texto_area _("Texto de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "body", "", {value: @ayuda_idioma[lang].body} %> </div> </div> <% end %> <%= formulario_final %> <!-- Final formulario --> app/views/ayuda/modificar_crear.js.erb 0 → 100644 +2 −0 Original line number Diff line number Diff line $('MB_window').hide(); $('MB_overlay').hide(); Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ files/* Gemfile.lock config/database.yml app/serializers public/assets *~ Session.vim *toto Loading
app/controllers/ayuda_controller.rb +10 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,14 @@ class AyudaController < ApplicationController # Actualiza una ayuda contextual def modificar_crear @ayuda = Ayuda.find_by_id params[:id] @langs = FastGettext.default_available_locales @ayuda_idioma = {} @langs.each do |lang| # ayuda_idioma = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang] = AyudaIdioma.find_or_create_by(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang].update_attributes params[:ayuda_idioma][lang] msg @ayuda_idioma[lang] if @ayuda_idioma[lang].errors.any? end end private Loading @@ -49,11 +57,11 @@ class AyudaController < ApplicationController @langs = FastGettext.default_available_locales @ayuda_idioma = {} @langs.each do |lang| @ayuda_idioma[lang] = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) # @ayuda_idioma[lang] = @ayuda.ayuda_idioma.find_by_lang(lang) || AyudaIdioma.new(lang: lang, ayuda_id: @ayuda.id) @ayuda_idioma[lang] = AyudaIdioma.find_or_initialize_by(lang: lang, ayuda_id: @ayuda.id) end #FastGettext.default_available_locales.each do |lang| #end end end
app/helpers/application_helper.rb +2 −2 Original line number Diff line number Diff line Loading @@ -137,9 +137,9 @@ module ApplicationHelper #include_tiny_mce_if_needed cadena = "<div class=\"elemento\">".html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "tinymce mceEditor", :type => "d", :name => otros[:name]}) cadena += tinymce_assets cadena += tinymce :uploadimage_hint => @proyecto.id, :language => session[:idioma_seleccionado] cadena += tinymce :uploadimage_hint => (@proyecto ? @proyecto.id : 'tinymce_upload'), :language => session[:idioma_seleccionado] else cadena = ("<div class=\"elemento" + clase +"\">").html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "textoarea"+clase, :type => "d", :name => otros[:name], :rows=>2 }) cadena = ("<div class=\"elemento" + clase +"\">").html_safe + rotulo +"<br/>".html_safe + text_area( objeto, atributo , {:disabled => otros[:disabled], :class => "textoarea"+clase, :type => "d", :name => otros[:name], :rows=>2, value: otros[:value] }) end return cadena << "</div>".html_safe end Loading
app/views/ayuda/_formulario.html.erb +37 −35 Original line number Diff line number Diff line <!-- Formulario --> <%= comienzo_formulario( {action: 'modificar_crear', id: @ayuda } , false ) %> <div class="linea"> <%= selector _("Sección"), 'ayuda', 'section', [@ayuda.section], false, "3_2", obligatorio: true, disabled: true %> <%= selector _("Menú"), 'ayuda', 'menu', [@ayuda.menu], true, "3_2", obligatorio: true, disabled: true %> Loading @@ -22,7 +20,7 @@ <% @langs.each do |lang| -%> <li id="lang_selector_<%= lang %>"> <%= link_to_function lang.upcase, " [#{all_langs_ids}].each(Element.hide); Element.show('lang_box_#{lang}') " %> Element.show('lang_box_#{lang}'); " %> <%#= link_to_function lang.upcase, " [#{all_langs_ids}].each(Element.hide); Element.show('lang_box_#{lang}'); Element.show('lang_selector_#{lang}').addClassName('elemento_activado') " %> Loading @@ -31,17 +29,21 @@ </ul> </div> <!-- Formulario --> <%= comienzo_formulario( {action: 'modificar_crear', id: @ayuda } , true ) %> <% @langs.each do |lang| %> <% lang_box_style = (lang == I18n.locale.to_s) ? '' : 'display:none;' %> <div id="lang_box_<%= lang %>" style="<%= lang_box_style %>"> <div class="linea"> Estamos en el idioma <%= lang %> <%#= texto_area _("Texto de ayuda %{lang}")%{lang: lang}, "ayuda_idioma_#{lang}", "body", "editor_rico" %> <%= texto _("Título de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "titulo", "", {value: @ayuda_idioma[lang].titulo} %> </div> <div class="linea"> <%= texto _("URL de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "url", "", {value: @ayuda_idioma[lang].url} %> </div> <% end %> <div class="linea"> <%#= texto_area _("Texto de ayuda"), "ayuda_idioma", "body", "editor_rico" %> <%= texto_area _("Texto de ayuda %{lang}")%{lang: lang.upcase}, "ayuda_idioma[#{lang}]", "body", "", {value: @ayuda_idioma[lang].body} %> </div> </div> <% end %> <%= formulario_final %> <!-- Final formulario -->
app/views/ayuda/modificar_crear.js.erb 0 → 100644 +2 −0 Original line number Diff line number Diff line $('MB_window').hide(); $('MB_overlay').hide();