Skip to content

Instantly share code, notes, and snippets.

@hanaori
Created January 20, 2016 07:42
Show Gist options
  • Save hanaori/213b75bde01ed89b3d19 to your computer and use it in GitHub Desktop.
Save hanaori/213b75bde01ed89b3d19 to your computer and use it in GitHub Desktop.
app/views/rails_admin/main/edit.html.haml
/ オリジナル:https://github.com/sferik/rails_admin/blob/master/app/views/rails_admin/main/edit.html.haml
= rails_admin_form_for @object, url: edit_path(@abstract_model, @object.id), as: @abstract_model.param_key, html: { method: "put", multipart: true, class: "form-horizontal denser", data: { title: @page_name } } do |form|
/ ↓ 挿入部分 ↓
- if @model_name == "Brand" or @model_name == "Item"
%table.table{:class => "table-striped table-bordered"}
%caption 画像の表示順編集
%tr
%th ID
- if @model_name == "Product"
%th Name
%th Order
- @order_objects.each do |order_object|
%tr
%td= order_object.id
- if @model_name == "Product"
%td= order_object.name
%td
%input{:name => "products[][order]", :type => "number", :value => order_object.order}/
%input{:name => "products[][id]", :type => "hidden", :value => order_object.id}/
  / ↑ 挿入部分 ↑
= form.generate action: :update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment