2
使用Rails 4.1.6,simple_form 3.1.0.rc2,Bootstrap 3 我想在我的simple_form中設置一個按鈕來打開Bootsrap模式窗口來執行JS用戶選擇如何插入一個按鈕來打開simple_form裏面的模式窗口
我簡單的格式如下:
.form-inputs
.row
.col-sm-8.col-md-8.col-lg-8
- if ((current_user.has_role? :superadmin) || (current_user.has_role? :media_admin))
.form-group
%button.btn.btn-default{:'data-toggle' => "modal" , :'data-target' => "#myModal"}
Select Owner of album
= f.input :user_id, as: :hidden, input_html: {value: current_user.id}
.row
.col-sm-8.col-md-8.col-lg-8
= f.input :title, :label => t(:title, scope: :album).capitalize
= f.input :description, as: :text, :label => t(:description, scope: :album).capitalize
,我增加了一個標準的引導模態試驗
#myModal.modal.fade{ tabindex: "-1" ,role: "dialog", :'aria-labelledby' => "myModalLabel", :'aria-hidden' => "true"}
.modal-dialog
.modal-content
.modal-header
%button.close{type: "button", :'data-dismiss' => "modal" }
%span{:'aria-hidden' => true}
×
%span.sr-only
Close
%h4#myModalLabel.modal-title
Modal Title
.modal-body
= "Modal body"
.modal-footer
%button.btn.btn-default{type: "button", :'data-dismiss' => "modal" }
Close
%button.btn.btn-primary{type: "button", :'data-dismiss' => "modal" }
Save changes
當我打「選擇相冊'按鈕的所有者,它作爲提交一個,並嘗試保存表格數據....不打開模式形式
我錯過任何東西?
面臨同樣的,任何改進? – 2016-02-22 07:48:22