Comments (15)
Hi, thanks for your comments. I think it's usually best to let the developer handle how to display things and not give anything done by default. As you say, it can be done using the 'dispolay_as' feature, even though I may agree with you that this can be a little hard to do for a new rails developer. Maybe a better docs or a wiki page talking about this could help.
About adding an option to do it, I rather think that it might be more useful to add a new feature to make 'display_as' work with a helper method directly. People usually use this feature as a bridge to some other rails helper method, like number_to_currency
or simple_format
, so maybe provide a direct way to implement this could be a better solution.
About your note about the text beeing displayed without format during the ajax request you're right, we'll look into it and thanks for the catch!
from best_in_place.
Hi, I've just implemented a new feature display_with
which provides direct bindings for view helpers. You can use it like this:
= best_in_place @user, :large_comment, :display_with => :simple_format
from best_in_place.
When I do this:
best_in_place user, :notes, :type => :textarea, :display_with => :simple_format
I get this error:
undefined method 'white_list_sanitizer' for Module:Class
Am I using it wrong? I googled the error but the solutions didn't work. "Module:Class" is throwing me off. It's almost as if the helper is being called in the wrong context or on the wrong object?
from best_in_place.
Same error here.
from best_in_place.
and me too!
from best_in_place.
Added as a new issue : #78
from best_in_place.
Hi all,
This issue is now solved with pull request #79.
You can checkout Rails Action View's SanitizeHelper, which includes sanitize(html, options = {})
(the method that ended up breaking), called from our old friend TextHelper's simple_format(text, html_options={}, options={})
.
After some investigation, I realized that SanitizeHelper's white_list_sanitizer
should always be initialized (check out this). But it wasn't! Was Ruby falling apart or something...?
The answer is no. The problem is that we used Action View's Helpers in the non-right way, without loading every single Helper as we should do. In our previous approach, the ClassMethods weren't correctly load, so our dear white_list_sanitizer
wasn't initialized when accessed, and thus our call to simple_format
was broken.
Now we are using an instance of ActionView::Base, so everything is loaded in a more right way, and everything keeps being as simple as always.
More insight can be found in here and here.
from best_in_place.
I still get this issue when doing, for example,
best_in_place(model, :chart, type: :textarea, nil: 'Click to edit your chart', display_with: :simple_format)
.
The error I get is this:
undefined method
white_list_sanitizer' for Module:Class`.
Also, I am using decorators a la Draper.
from best_in_place.
Hello @cbanke1
Which best_in_place are you using? This fix is not yet in any version of the gem, so if you want to use it you have to use the gem directly from the git repository.
We are planning to do a release (which will be 1.0.5) in less than two weeks.
Did it fix the issue?
from best_in_place.
@albertbellonch
No, I do not believe. I have it set in the gemfile as such:
gem 'best_in_place', git: "https://github.com/bernat/best_in_place.git"
but I still get the undefined method white_list_sanitizer exception.
Should I also specify a commit? It seems like pulling from github should pull the most recent master.
UPDATE: I think I fixed the issue, which was local. I'll come back if I have more information. Thanks for all your help!
from best_in_place.
Me 2
from best_in_place.
same here
from best_in_place.
I am using display_with: :simple_format. Its working fine. But then, the text does not remain editable at all.
I tried fetching directly from git repo, but it doesn't help. Any input will be helpful.
Thanks.
from best_in_place.
@Akshg I am running into the sample issue. :simple_format
works but text is not editable anymore.
from best_in_place.
@cg5544 Even i was am facing the same issue at that time. Any progress?
from best_in_place.
Related Issues (20)
- Rails 6 deprecation warnings
- undefined method `service_path' when adding best_in
- editing an item in a jsonb column
- undefined method `service_path' when adding best_in_place
- bip_text Test Helper datapicker MiniTest failure
- How to select foreign_key using friendly_id's hash_id?
- BestInPlaceEditor is not defined HOT 1
- Still okay to use? HOT 1
- Usage in Rails 6 HOT 28
- Rails 6 Deprecation warning
- Textarea not working HOT 1
- Rails 6 deprecation warning HOT 4
- How do differ best_in_place xhr request from othes?
- Project status HOT 6
- ActionView::Template::Error (wrong number of arguments (given 1, expected 3..4)) with cancan
- update is sent even though no change is made
- Render partial not working in ajax:success
- Release a new version, please HOT 1
- ignore this
- Add Ruby 3.2 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from best_in_place.