simple-form

Default disable_with for simple_form submit

落花浮王杯 提交于 2019-12-05 06:01:05
I want to change the default behavior of my submit button in simple_form so that I needn't explicitly specify :disable_with => true for all my forms. How can I make this particular change in the simple_form.rb? This is a little different in newer versions of Rails, as setting the property disable_with is deprecated. I wrote an article on this: http://www.railsonmaui.com/blog/2014/02/23/simple-form-and-disable-processing-by-default/ Here's the new code: SimpleForm::FormBuilder.class_eval do def submit_with_override(field, options = {}) data_disable_with = { disable_with: 'Processing...' }

Simple Form Error Notification

拈花ヽ惹草 提交于 2019-12-05 05:28:33
问题 I am trying to figure out how to use Simple Form with Rails, Devise, Omniauth and Bootstrap. I have several problems, but one of them is error notifications. I have a devise sign in and sign up form inside Bootstrap modals. The registration form is as follows. Note that I removed the required: true function from the form because I don't like the asterisk being appended to the label (but I did try putting it back to see if the error notifications would work). <% if user_signed_in? %> <li> <%=

Multiple inputs on a single line with Twitter Bootstrap and Simple Form 2.0

隐身守侯 提交于 2019-12-05 04:37:07
问题 I am using simple_form 2.0 with twitter bootstrap. I am trying to determine what is the proper wrapper format in order to get something like [city] [State] [Zip] I believe my form needs to be <div class="control-group"> <%= f.input :city,:wrapper => :small, :placeholder => "City", :input_html => { :class=>"span2", :maxlength => 10},:label => false %> <%= f.input :region, :wrapper => :small , :placeholder => "Region", :input_html => { :class=>"span1", :maxlength => 5}, :label => false %> <%= f

Rails simple_form association

旧街凉风 提交于 2019-12-05 02:40:48
问题 I'm trying to create a form for 'Member' using simple_form and having trouble displaying an association where it display the organization as below instead of the id, or organization_name. Am I missing something here? How should I go about this? **Organization:0x0000000485cf88 Organization:0x0000000485c948 Organization:0x0000000485c358** class Organization < ActiveRecord::Base has_many :members attr_accessible :organization_name end class Member < ActiveRecord::Base belongs_to :organization

How do you handle single table inheritance in SimpleForm so a single helper handles all models?

余生颓废 提交于 2019-12-05 02:15:23
问题 We have a model "EventSession" which has several subtypes via STI, including "NetworkingEventSession" and "DiningEventSession"... we want to be able to handle all of them from one controller and one view in some cases, but simple form is looking at the objects when iterating through in simple_form_for @session and trying to use the networking_event_session_path helper, which we don't currently have defined, instead of the regular event_session_helper path, which would work fine and is what we

Simple Form: Is it possible to remove labels and replace them with placeholders using the labels i18n? [duplicate]

╄→гoц情女王★ 提交于 2019-12-05 00:03:27
This question already has answers here : How to use placeholders instead of labels in simple_form? (4 answers) Closed 4 years ago . I'm trying to produce a regular simpleform form = simple_form_for [:hq, @team, @order] do |f| .tickets = f.select :tickets, :aaa => "aaa" = render "ticket" .details .left = f.input :address1 = f.input :address2 = f.input :state = f.input :country = f.input :email .right = f.input :comments But I want the inputs to not be rendered with a label, just the title "Address Line 1" in the placeholder. I know I can do this with f.input :address1, :placeholder => "whatever

Creating multiple nested forms using simple_form and rails 4

此生再无相见时 提交于 2019-12-04 23:55:53
I'm trying to create a simple app with the following models: categories --[has_many]--> questions --[has_many]--> answers I have the following code for creating categories + questions(categories/_form.haml.html): = simple_form_for(@category) do |f| = f.error_notification = f.input :title, label: "Category title: " = f.simple_fields_for :questions, @category.questions.build do |q| = q.input :content, label: "Question content: " = f.button :submit And I'm using all the same code for creating questions + answers(questions/_form.haml.html). I have all the relations, strong parameters, nested attrs

Parsing JSON errors using simple_form and AJAX in rails

自古美人都是妖i 提交于 2019-12-04 19:46:24
I have a form that is using Simple Forms and remote => true on the users dashboard (which is handled by a dashboard view and dashboard controller). The form allows a user to add a custom game rule; however, it's loading the form via a Jquery's .load() function. The form is loading from the "rules" view (handled by a rules controller). When the user clicks the submit button, I'm not getting any error validation. Her is the create action on the rule controller: def create @rule = Rule.new(params[:rule]) respond_to do |format| if @rule.save format.html { redirect_to dashboard_path, notice: 'Rule

Make all input fields on the same line

若如初见. 提交于 2019-12-04 19:09:09
Im trying to use css to make all the fields for my form display on one line. It's part of the header nav on my page so it is important that it shows on one line instead of multiple lines. Here's my header code at the moment. <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse"> <span class="i-bar"></span> <span class="i-bar"></span> <span class="i-bar"></span> </a> <a class="brand" href="/">Bandini</a> <div class="container nav-collapse"> <ul class="nav"> <li><%= link_to "Clients",

how to specify label for select in simpleform rails

我们两清 提交于 2019-12-04 16:05:46
问题 <%= f.association :opportunity_status, :label => "Status", :input_html => {} %> <%= f.select :source_type, options_for_select(["lead","vteam"],["lead"]) %> On first line every thing is OK. On second line if I attach label the way I did in first line it show an error. How can I specify label for select using simpleform? 回答1: This is because f.select is not a simple_form method and does not support :label This should work for you w/ simple form <%= f.input :source_type, :label => "Lead or VTeam