
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
bootstrap-editable-rails
Advanced tools
In-place editing with Twitter Bootstrap for Rails 3/4
This gem is based on X-editable (v1.5.1) which is the new version of Bootstrap Editable.
https://github.com/vitalets/x-editable
See http://vitalets.github.com/x-editable
Add this line to your application's Gemfile:
gem 'bootstrap-editable-rails'
And then execute:
$ bundle
Write the top of app/assets/javascripts/application.js
like this:
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-editable
//= require bootstrap-editable-rails
//= require_tree .
and need to load bootstrap-editable.css
at the place where you like.
Follow the documents of X-editable above.
Additional required attribute is resource
.
<a href="#" id="username" data-type="text" data-resource="post" data-name="username" data-url="/posts/1" data-original-title="Enter username">superuser</a>
then, sends PUT /posts/1
request with the body:
post[username]=superuser
When using textarea
type, textarea_format
helper method for formatting line breaks is available.
<a href="#" id="body" data-type="textarea" data-resource="post" data-name="body" data-url="/posts/1" data-original-title="Enter body">
<%= textarea_format(@post.body) %>
</a>
PostsController receives the parameters
{ "id" => "1", "post" => { "username" => "superuser" } }
and must respond with 2xx (means success) status code if successful.
For example, scaffold works well by 204 because default dataType is json.
def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
format.json { head :no_content } # 204 No Content
else
format.html { render action: "edit" }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end
The scaffold above will not work with jQuery 1.9.0 (included in jquery-rails 2.2.0) because of jQuery's bug.
https://github.com/jquery/jquery/pull/1142
If you use the old version of jQuery, please update jquery-rails to avoid it.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that bootstrap-editable-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.