Sha256: c90c52154f6435ebdf0c4b2ec5e6f3d58bdc528c681c9df8bec7f84be7e666e4

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

Lolita::Hooks.component(:"/lolita/configuration/tab/error_msg").before do
  tab = self.component_locals[:tab]
  if tab.translatable?
    self.send(:render_component,"lolita/translation",:switch, :tab => tab)
  end
end

Lolita::Hooks.component(:"/lolita/configuration/tab/fields").after do
  tab = self.component_locals[:tab]
  if tab.translatable?  
    self.render_component tab.build_translations_nested_form(self.resource)
  end
end

Lolita::Hooks.component(:"/lolita/configuration/tab/fields").around do
  tab = self.component_locals[:tab]
  if tab.translatable?
    content = nil
    resource.in(resource.original_locale) do 
      content = let_content
    end
    self.send(:render_component,"lolita/translation",:language_wrap, {
      :tab => tab, 
      :content => content, 
      :active => true,
      :translation_locale => resource.original_locale
    })
  else
    let_content
  end
end

Lolita::Hooks.component(:"/lolita/configuration/nested_form/fields").around do
  tab = self.component_locals[:nested_form].parent
  if tab.translatable? && current_form.object.respond_to?(:locale)
    self.send(:render_component,"lolita/translation",:language_wrap, {
      :tab => tab, 
      :content => let_content, 
      :active => false,
      :translation_locale => current_form.object.locale
    })
  else
    let_content
  end
end

Lolita::Hooks.component(:"/lolita/configuration/tabs/display").before do
  self.render_component "lolita/translation", :assets
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lolita-translation-0.6.3 lib/lolita-translation/lolita/component_hooks.rb
lolita-translation-0.6.2 lib/lolita-translation/lolita/component_hooks.rb
lolita-translation-0.6.1 lib/lolita-translation/lolita/component_hooks.rb
lolita-translation-0.6.0 lib/lolita-translation/lolita/component_hooks.rb
lolita-translation-0.5.0 lib/lolita-translation/lolita/component_hooks.rb