Tag: 最佳

best_in_place gem,在没有页面重新加载的情况下查看不显示更新的编辑

我将best_in_place gem添加到我的项目中,并且更新在页面重新加载发生之前不会生效。 我可以在我的节目视图中看到它闪烁,但它需要重新加载页面。 为什么是这样? 我的名单控制器: respond_to :html, :xml, :js def update @list = List.find(params[:id]) @list.update_attributes(params[:list]) respond_with(@list, :location => list_url(@list)) end 我的名单显示视图 – 我的gem文件 – group :assets do gem ‘sass-rails’, ‘~> 3.2.3’ gem ‘coffee-rails’, ‘~> 3.2.1’ gem ‘best_in_place’ # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem ‘therubyracer’, :platforms => :ruby gem ‘jquery-ui-rails’ gem ‘uglifier’, ‘>= […]

best_in_place gem初始化

轨道3.2.11 的Gemfile: gem ‘jquery-rails’ gem “best_in_place” aplication.js //= require jquery //= require jquery_ujs //= require best_in_place post.js.coffee jQuery -> $(‘.best_in_place’).best_in_place() show.html.erb 查看内联表单,但我得到了jsexception,并没有触发输入,松散焦点等追溯: Uncaught SyntaxError: Unexpected token u jquery.js:525 jQuery.extend.parseJSON jquery.js:525 BestInPlaceEditor.setHtmlAttributes best_in_place.js:265 BestInPlaceEditor.forms.input.activateForm best_in_place.js:309 BestInPlaceEditor.activate best_in_place.js:54 BestInPlaceEditor.clickHandler best_in_place.js:260 jQuery.event.dispatch jquery.js:3046 elemData.handle 在jquery.js的行 if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); 我怎么能解决这个问题? upd问题解决了。 […]

具有嵌套属性的Best_In_Place内联编辑

我目前正在尝试使用best_in_place gem来在HTML表格中进行内联编辑。 我在购物车的展示视图中显示了一个购物车。 在购物车的展示视图中,我可以添加lineItems。 创建LineItem时,还会使用lineItem_id创建新的可用记录,然后在购物车中显示其lineitem。 Cart和LineItem表都来自外部数据库,因此我无法添加列,这就是为什么我不能只为LineItem添加一个可用的布尔属性。 **cart.rb class Cart << AR::Base has many LineItems end **line_item.rb class LineItems <<AR::Base belongs_to Cart has_one :available accepts_nested_attributes_for :available end **available.rb class Available<<AR::Base belongs_to LineItems end **views/cart/show.html.erb @cart.lineitems.each do |line_items| line_items_path, :type => type: :checkbox, collection: %w[No Yes] %> end 我希望能够使用best_in_place编辑html表中的line_item.available.boolean,该表位于购物车展示视图中,但我没有任何运气..任何帮助都会令人惊叹! =]我知道在阅读之后,使用嵌套属性是不可能的,但是如果我能以某种方式摆脱可用模型并在show table中有一个字段,我可以为line_item编辑以查看lineItem是否可用那也很棒。 我对任何想法持开放态度!

具有best_in_place的数据表不允许更新

我试图使用带有数据表的best_in_place来允许在线更新表条目。 但是,我已正确呈现所有内容并且可以编辑条目,更改不会持久且与数据库相同并抛出下面的日志。 目前我只想编辑商店ID和地址信息: 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”=>{“address”=>”90000”}, “authenticity_token”=>”B0Eshgp8 OCRi5YJQOs+orNRo9VOMmRgyaO4fc3nEDzs=”, “id”=>”104”} Parameters: {“location”=>{“address”=>”90000”}, “authenticity_token”=>”B0Eshgp8 OCRi5YJQOs+orNRo9VOMmRgyaO4fc3nEDzs=”, “id”=>”104”} ←[1m←[36mLocation Load (0.0ms)←[0m ←[1mSELECT `locations`.* FROM `locations` WHERE `locations`.`id` = 104 LIMIT 1←[0m ←[1m←[36mLocation […]

在单击标签名称时,使用Rails best_in_place gem

我正在使用最好的gem – 这很棒。 唯一的问题是我希望用户能够不仅点击最佳位置元素来编辑它,还能点击标签。 让我说我有这个最好的位置元素: Open Hours :select, :collection => Provider::PROVIDERS_HOURS %> 我希望能够单击“打开时间”以打开编辑元素。 可能吗? 谢谢

如何使用best_in_place gem更改序列化数据?

我有一个带有序列化数据的模型,我想使用best_in_place gem编辑这些数据。 使用best_in_place gem时,默认情况下这是不可能的。 如何才能做到这一点?