Giter VIP home page Giter VIP logo

bootstrap-editable-rails's People

Contributors

deandeblock avatar gavinhughes avatar mthomps avatar tkawa avatar zzip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap-editable-rails's Issues

Uncaught RangeError: Maximum call stack size exceeded

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!

How do you use the type = select

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>

Rails4 strong parameter issue

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)

bootstrap-datepicker css is out of date/incorrect

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.

If I add toggle option, how to add other params ?

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

No way to define a 'url' and then just provide the 'pk'/'id'?

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

No error callback

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.

Conflicts with Full Calendar plugin

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.

Editable columns in table

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

NoMethodError for bootstrap-editable-rails Sprocket 4.0.x

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.

Upgrade to the latest x-editable 1.4.6

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.)

Updating nested attributes

Hi,

this gem is working great and nice tutorial how to implement it, but how can I update nested attributes?

Thanks

Unable to set the option - saveonchange as "never"

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');
  • After I do an in-place edit on the text "howdy1" and click the "tick mark", the submit should never be done, whereas the 1.3 version of x-editable packaged with this gem submits an ajax call to my controller.
  • To fix this problem, I got rid of this gem (bootstrap-editable-rails), and downloaded the 1.4 version from http://vitalets.github.com/x-editable/index.html here. It works now.
  • It would be nice to package the 1.4 version fo x-editable in the gem.

Join the Bootstrap-Ruby organisation!

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:

  • encourage contributions from other developers when this project is in a repo dedicated to Ruby Bootstrap projects
  • easier to find this project for Rubyists looking to use Bootstrap in their projects

Let me know what you think, it would be great to have bootstrap-editable-rails on board! ๐Ÿ˜„

Not require coffee script

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.