Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kaminari-cells pulls in ActionView::Helpers::TranslationHelper #4

Open
johnlane opened this issue Apr 22, 2016 · 7 comments
Open

Kaminari-cells pulls in ActionView::Helpers::TranslationHelper #4

johnlane opened this issue Apr 22, 2016 · 7 comments

Comments

@johnlane
Copy link

I was having problems with translations in a cell after adding Kaminari to it.

I found that ActionView::Helpers::TranslationHelper was taking precedence over my Trailblazer::Translations. I tracked this down to kaminari-cells.rb.

#11   include ActionView::Helpers::TranslationHelper

Does this gem really need a hard dependency on ActionView::Helpers::TranslationHelper ?

As a work-around, I have put a method in the classes where I have Kaminari::Cells:

def t(*args)
  Trailblazer::Translation.t(*args)
end               
@johnlane johnlane changed the title Kaminari-cells pulls in Kaminari-cells pulls in ActionView::Helpers::TranslationHelper Apr 22, 2016
@apotonick
Copy link
Owner

How do you insert your Trailblazer::TranslationHelper?

@johnlane
Copy link
Author

johnlane commented May 9, 2016

Currently I am including it into Cell::Concept in an initializer:

Cell::Concept.class_eval do
  include Cell::Erb
  include Trailblazer::Translation
  extend  Trailblazer::Translation

 ... other stuff ...

end

@apotonick
Copy link
Owner

You could use prepend.... cough

@johnlane
Copy link
Author

The effect of prepend is to move Trailblazer::Translation up, but not up far enough...

 Kaminari::Helpers::CellsHelper,                 Kaminari::Helpers::CellsHelper,                                                                                   
 Cell::ViewModel::Partial,                       Cell::ViewModel::Partial,
 ActionView::Helpers::TranslationHelper,         ActionView::Helpers::TranslationHelper,
 Kaminari::ActionViewExtension,                  Kaminari::ActionViewExtension,
 Kaminari::Cells,                                Kaminari::Cells,
 SimpleForm::ActionViewExtensions::FormHelper,   SimpleForm::ActionViewExtensions::FormHelper,
 ActionView::Helpers::FormOptionsHelper,         ActionView::Helpers::FormOptionsHelper,
 ActionView::Helpers::JavaScriptHelper,          ActionView::Helpers::JavaScriptHelper,
                                           >     Trailblazer::Translation,
 Cell::Concept,                                  Cell::Concept,
 ActionView::RecordIdentifier,                   ActionView::RecordIdentifier,
 ActionView::ModelNaming,                        ActionView::ModelNaming,
 Trailblazer::Translation,                 <
 Cell::Erb,                                      Cell::Erb,

I've only quickly tried this, I'll give it some more attention tomorrow...

@tjjjwxzq
Copy link
Contributor

tjjjwxzq commented Jan 5, 2017

This blows things up with cells-slim because ActionView::Helpers::TranslationHelper helpfully pulls its friend CaptureHelper along, which overrides the with_output_buffer method from Cell::Slim. Do you see a way of fixing this, or, can I open a PR to add a caveat and workaround to the README?

@apotonick
Copy link
Owner

We should probably just write our own translation "helper" and avoid any Rails mess code?

@tjjjwxzq
Copy link
Contributor

tjjjwxzq commented Jan 6, 2017

Alright 👍 let me see if it's something I can look into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants