bootstrap-ruby / bootstrap-editable-rails Goto Github PK
View Code? Open in Web Editor NEWIn-place editing with Twitter Bootstrap for Rails
Home Page: http://rubygems.org/gems/bootstrap-editable-rails
License: MIT License
In-place editing with Twitter Bootstrap for Rails
Home Page: http://rubygems.org/gems/bootstrap-editable-rails
License: MIT License
This is shipping a coffee script file, thus requiring the application to have coffee script included. That either shouldn't be the case, or coffee script should be listed as a dependency.
I'd like to be able to keep the code markup cleaner and DRYier and in some cases where I have a collection of editable stuff, it seems from 'bootstrap-editable-rails.js' that I cannot define the endpoint to then just set the id of the record and have it appended to the endpoint to create the url, I've also tried it in code... am I missing something or is it in fact the way it works now?
e.g.:
$('.editable').editable(function(){
url:'<% posts_path %>',
resource:'post'
})
<span class="editable" data-pk="1" data-name="title">Title</span>
# PUT /posts/1
Hi,
I'm receiving the following error:
undefined method 'start_with?' for /bootstrap-editable\/.*\.(?:png|gif)$/:Regexp
def valid_asset_uri?(str)
# Quick prefix check before attempting a full parse
str.start_with?("file://".freeze) && parse_asset_uri(str) ? true : false
rescue URI::InvalidURIError
false
end
Gem consumed: https://rubygems.org/gems/bootstrap-editable-rails/versions/0.0.9 On removing this gem the error goes but I cannot trace back all usages of this gem.
Sprocket: https://www.rubydoc.info/gems/sprockets/4.0.0
Already removed all assets.precompile.
I have seen documentation for this error in github but it doesn't fit my case.
Any pointers will help!
Duplicate of: rails/sprockets-rails#491 opening it under this thread in case someone has any context.
The embedded datepicker css contains some 'top' & 'left' values on the .datepicker-dropdown:before and :after. These values don't exist in the current version of the standalone datepicker and cause a bug where the left column of dates is unclickable when it is oriented on top of an input.
To fix, maybe the datepicker css should be updated, or it should be removed and a dependency added on the bootstrap-datepicker-rails gem.
On update the Rails controller correctly responds with 204 No Content, but the "editable-unsaved" css class is added to the anchor tag.
Using Rails 4.1, ruby 1.9.1, jquery-rails-3.1.0, bootstrap 3
This is related to vitalets/x-editable#219
There is no 'error:' callback in x-ediable until version 1.4.4 !
The best you can do is add
$('a.editable-click').editable({
ajaxOptions: {
error: function (xhr, status, error) {
if(xhr.status == 422){
var msg = 'Error: ';
errors = $.parseJSON(xhr.responseText);
$.each(errors, function(k, v) {
msg += k + ": " + v;
});
//Edit the response, to be more awesome.
xhr.responseText = msg;
}
}
}
});
This edits the content of the error message before x-editable's error() callback fills it into Bootstrap's error blocks.
There's little to be 'fixed' until this gem is updated to use version 1.4.4, so I thought I'd document this problem with a workaround.
Let us say the rails app has a link as below:
I use the latest version of bootstrap-editable-rails gem.
<%= link_to "howdy1","#", :id => "identity_new_account_name", :class => "s_account_name" %>
I load the javascript with the following code.
// init editables
jQuery('.s_account_name').editable({});
jQuery('#identity_new_account_name').editable('option',
'validate', function(v) {
if (!v)
return 'Required field!';
});
jQuery('#identity_new_account_name').editable('option', 'send', 'never');
jQuery('#identity_new_account_name').editable('option', 'savenochange', 'never');
When I include
//= require bootstrap-editable
//= require bootstrap-editable-rails
in application.js
and do bundle exec rake assets:precompile
it doesn't load full calendar http://fullcalendar.io/
When I remove it, it loads fullCalendar and works as expected. I tried a lot but couldn't figure out the issue.
FYI, my application is hosted on Heroku.
Like this
$("#how").click(function(e) {
e.stopPropagation()
e.preventDefault()
$("#com").editable({
'toggle',
validate: function(value) {
if($.trim(value) == '') {
return 'The content can not be blank!';
}
}
})
})
I want to both 'toggle by other dom' and 'validate blank' feature
Hi,
this gem is working great and nice tutorial how to implement it, but how can I update nested attributes?
Thanks
I just started to using your awesome gem. But I found x-editable is of 1.4.6 while ours is of 1.4.3...
(I forked this project and am not sure if only replacing the .css and .js files would be sufficient for this upgrade.)
I'm trying to use the type = select
The field pops up and there is a select box, but the values don't show up.
The Task record has a foreign key = rating_id and the value I want to show from the rating table is = ratingname
This is my view code:
<a href="#" class="answer" data-type="select" data-placement="right" data-resource="task" data-source="/ratings" data-name="ratingname" data-url="/tasks/<%= task.id %>" data-original-title="Select Rating">
<%= textarea_format(task.rating.ratingname) %>
</a>
I'm trying to use the type=select in Rails4. But, I'm getting an error in the strong parameters code.
This is the accessory view code:
<td>
<a href="#" class="xeditable" data-emptytext="Type" data-type="select" data-pk="1" data-resource="accessories" data-source="/accessorytypes" data-name="accessorytype_id" data-url="/accessories/<%= accessory.id %>" data-original-title="Select Type">
<%= accessory.accessorytype.name if accessory.accessorytype_id != nil %>
</a>
This is the javascript (coffee) and it works for type=text
$(".xeditable").editable
placement: 'bottom'
This is the error:
ActionController::ParameterMissing at /accessories/5
====================================================
> param is missing or the value is empty: accessory
app/controllers/accessories_controller.rb, line 88
This is line 88 (strong parameter):
params.require(:accessory).permit(:user_id, :manufacturer,:manufacture_year, :model, :accessorytype_id, :description, :sold, :count, :bow_id, :note, :sold_id, :archive)
I'm trying to use a table created with an index do.
So the same column gets repeated in each row.
The first row is editable, the rest aren't.
Is there a way for me to fix this?
UPDATE - I see this is the same as the other issue
Not sure this is really an issue for you, but I've seen a couple people run into it with bootstrap-editable-rails and x-editable-rails. It seems to happen with turbolinks. I think we fixed it for ourselves.
We're using editable in a maybe slightly unusual way, so I'm not sure most Rails apps would ever see this. We have all of our photos on a page and a user can click a photo to bring up the details in a modal for view and edit. This means we have to change Editable options on each photo click event, but I don't think that was causing the problem.
We started seeing this:
Uncaught RangeError: Maximum call stack size exceeded bootstrap-editable-rails.js?body=1:9
(anonymous function) bootstrap-editable-rails.js?body=1:9
EditableForm.saveWithUrlHook bootstrap-editable-rails.js?body=1:33
EditableForm.saveWithUrlHook bootstrap-editable-rails.js?body=1:34
... more of these ...
I found the problem happens when the user clicks a photo to bring up the modal (makes changes which do work normally or changes nothing), goes to another page, comes back, makes a change to an editable field, and clicks save.
Seems to be somewhere around here:
originalUrl = this.options.url
...
this.options.url = function(_this){
...
After a page change, this.options.url became a recursive call to itself. To get around it, I removed //= require bootstrap-editable-rails
from application.js and replaced it with a slightly modified coffeescript version in this gist. Seems happy now.
Hope it helps, and thanks!
Anyway to incorporate the bootstrap2 support of x-editable into the gem as well?
Hi @tkawa,
I have set up the Bootstrap-Ruby organisation a while ago to foster a curated collection of tools for using Bootstrap in Ruby projects: https://github.com/bootstrap-ruby/
I think this project would be a great candidate to join our organisation!
IMO the advantages would be:
Let me know what you think, it would be great to have bootstrap-editable-rails on board! ๐
All 200 response (including render :nothing
) are rendered as errors.
Here's a vanilla app that shows this behavior: https://github.com/gavinhughes/editable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.