best-in-place

Datatables with best_in_place not allowing updating

痞子三分冷 提交于 2019-12-06 07:42:05
I am attempting to use best_in_place with datatables to allow for updating of table entries in-line. However, I have everything rendering correctly and can edit the entry, the change does not persist and same to the database and throws the log below. At present I am just looking to edit the store id and address information: Started PUT "/locations/104" for 127.0.0.1 at 2015-05-02 16:15:17 -0400 Started PUT "/locations/104" for 127.0.0.1 at 2015-05-02 16:15:17 -0400 Processing by LocationsController#update as JSON Processing by LocationsController#update as JSON Parameters: {"location"=>{

Rails best_in_place gem while clicking on the label name

為{幸葍}努か 提交于 2019-12-06 04:38:56
问题 I am using the best in place gem - which is great. Only thing is that I want the user to be able to click not just the best in place element in order to edit it, but also the label. Lets say I have this best in place element: <b>Open Hours</b> <%= best_in_place @provider, :open_hours, :type => :select, :collection => Provider::PROVIDERS_HOURS %> I want to be able to click the Open Hours in order to open the edit element. Is it possible? Thanks 回答1: For single instance of a class you can

best_in_place with a many to many relationship in rails 4

非 Y 不嫁゛ 提交于 2019-12-06 04:13:25
I have made a github repo that you can find here just for this question. I have 3 models: class User < ActiveRecord::Base has_many :user_countries has_many :event_countries, -> { where(user_countries: {:event => true}) }, :through => :user_countries, :source => :country has_many :research_countries, -> { where(user_countries: {:research => true}) }, :through => :user_countries :source => :country end class UserCountry < ActiveRecord::Base belongs_to :country belongs_to :user end class Country < ActiveRecord::Base # ... end So a user should be able to choose event_countries and research

Using best_in_place with rich-text editor like TinyMCE

我们两清 提交于 2019-12-05 10:43:10
I'm using the best_in_place gem to do in-place editing in a Rails application. However, I need (X)HTML editing on some of the text areas, so I need a rich-text editor. TinyMCE is being used elsewhere on the site. However, it's not trivial to add an editor to best_in_place . To grossly oversimplify, the gem uses jQuery to insert the textarea tag on the fly, and TinyMCE initializes at page load, replacing available textarea s with an editor, so when best_in_place puts in its textarea , TinyMCE has already come and gone. I've tried re-initializing TinyMCE after best_in_place inserts its textarea,

Rails best_in_place jQuery in place editing :activator button not working

大憨熊 提交于 2019-12-05 08:49:34
I have a partial set up as follows: <%= best_in_place_if can?(:edit, Artist), @artist, :display_name, type: :input, :activator => "#activator" %> <a href="#" id="activator">Edit</a> When I click the Edit link, nothing happens. If I remove :activator => "#activator" from the best_in_place link, it then allows me to click the text field to start editing as I expect; the only problem is this doesn't work on iPad so I need a separate button to trigger this edit function. Does anyone know of a workaround for getting the :activator setting working, or have another suggestion (including a different

Updating various DOM elements after best_in_place update

房东的猫 提交于 2019-12-05 07:27:56
问题 I have various values in a table that need to be updated after a DOM element is updated using best_in_place. How can you trigger a javascript action like "create.js.erb" called "update.js.erb" after a best in place update? For example, I have a table of item prices, and I need the table's "total" field to update after a user updates an individual item quantity. 回答1: I've seen many people asking this question, but haven't found a satisfactory solution. I found the best approach is to create a

Rails 3 - best_in_place editing

我与影子孤独终老i 提交于 2019-12-05 05:47:20
Hopefully a simple answer; I am using the gem best_in_place and it works great. I'm trying to figure out how to create a drop down menu using: :type => :select, :collection => [] What I want to be able to do is pass in a list of names that have been entered from my user model. Any thoughts how to do this? Can I mix it with collection_select? The :collection parameter accepts an array of key/value pairs: [ [key, value], [key, value], [key, value], ... ] Where the key is the option value and value is the option text . It is best to generate this array in the model corresponding to the object for

How can i integrate country_select gem with best_in_place editing

自古美人都是妖i 提交于 2019-12-04 13:32:20
I am using the best_in_place gem to edit records inline and country_select to render a list of countries to select from. When using best_in_place to edit a select field i do this: <%= best_in_place(@home, :country_name, :type => :select, :collection => [[1, "Spain"], [2, "Italy"]]) %> Now i like to get a list of all the countries that country_select has and pass that into the collection parameter. The country_select gem provides a simple helper to render the select field: <%= country_select("home", "country_name") %> I would like to replace the :collection parameter in best_in_place helper to

Updating various DOM elements after best_in_place update

人盡茶涼 提交于 2019-12-03 22:46:04
I have various values in a table that need to be updated after a DOM element is updated using best_in_place. How can you trigger a javascript action like "create.js.erb" called "update.js.erb" after a best in place update? For example, I have a table of item prices, and I need the table's "total" field to update after a user updates an individual item quantity. I've seen many people asking this question, but haven't found a satisfactory solution. I found the best approach is to create a javascript function that watches for a particular DOM element to update after an ajax:success, and then use

How can I change serialized data using the best_in_place gem?

时光毁灭记忆、已成空白 提交于 2019-12-02 12:32:51
问题 I have a model with serialized data and I want to edit this data using the best_in_place gem. This isn't possible by default when using the best_in_place gem. How can this be done? 回答1: It can be done by extending method_missing and respond_to_missing? to forward the requests to the serialized data. Lets say you have your serialized Hash in data . In the class that's containing the serialized data you can for example use this code: def method_missing(method_name, *arguments, &block) #