simple-form

simple_form with Bootstrap check box

南笙酒味 提交于 2019-12-03 04:35:57
I'm using simple_form with Bootstrap and I would like to have my "Remember me" check box be inline to the left of the label, as in the Twitter Bootstrap docs: http://twitter.github.com/bootstrap/base-css.html#forms My form code looks like this: <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => 'well'}) do |f| %> <%= f.input :email %> <%= f.input :password %> <%= f.input :remember_me, :as => :boolean if devise_mapping.rememberable? %> <%= f.button :submit, "Sign In" %> <% end %> The result is the the "Remember me" label on top of a

simple_form_for rails radio button inline

和自甴很熟 提交于 2019-12-03 03:59:07
问题 I am trying to get my buttons to display inline and also have a default value because it can't be blank. I am usingplataformatex/simple_form and bootstrap. = f.collection_radio_buttons :is_private, [[true, 'Private'], [false, 'Public']], :first, :last, style: "display:inline", default: true It is rendering this: <span> <input id="workout_is_private_true" name="workout[is_private]" type="radio" value="true" /> <label class="collection_radio_buttons" for="workout_is_private_true">Private</label

Rails simple_form attribute required mark (*)

拥有回忆 提交于 2019-12-03 03:41:56
问题 I am using Simple Form in my app and I'd like to remove the * to indicate an attribute is required on all of my forms (existing and those yet to be created). I have tried to set in simple_form.rb : # Whether attributes are required by default (or not). Default is true. config.required_by_default = false And I've tried to modify simple_form.en.yml : required: text: 'required' mark: '' # <------ tried setting this to blank. I know I can set :required => false on each field, but I want to clean

Rails 4 simple_form has_many through check boxes not saving

倖福魔咒の 提交于 2019-12-03 03:25:28
I am trying to implement an employee recurrent deductions table through check boxes using simple_form. My code works but the selected recurrent deductions are not saved in my table. I can't work out why. Here are my models. class Employee < ActiveRecord::Base belongs_to :club has_many :employee_recurrents has_many :recurrents, :through => :employee_recurrents end class Recurrent < ActiveRecord::Base belongs_to :club has_many :employee_recurrents has_many :employees, :through => :employee_recurrents end class EmployeeRecurrent < ActiveRecord::Base belongs_to :employee belongs_to :recurrent end

simple_forms custom data attribute

痞子三分冷 提交于 2019-12-03 01:03:43
I would like to have an additional data attribute on an input tag generated by simple_form. The following does not work: <%= f.input :date, :as => 'date_picker', :data => {:datepicker => :datepicker} %> How could this be done? Is it possible at all? As you might have guessed: I am trying to add bootstrap-datepicker to my site without using explicit js to initialize the date picker. rafaelfranca The correct syntax is: f.input :date, :as => 'date_picker', :input_html => { :data => {:datepicker => :datepicker} } For prosperity. On Rails 4.2.5 and Simple Form 3.2.1 The above from @rafaelfranca

Rails 3 + Ajax: how to access my local form builder instance

人走茶凉 提交于 2019-12-02 23:51:18
I have a form that displays a set of inputs. I also have a button, and when clicked, I make an ajax request which is supposed to replace the existing inputs with a different set of inputs. All my ajaxy linking stuff up works fine. The problem is that I'm using a form_for , so in order to display the new form inputs, I need the form builder instance. View File <%= simple_form_for @order do |f| %> <div id="info"> <%= render 'my_first_form_fields_partial', f: f %> </div> <%= link_to 'Change inputs', change_inputs_path, remote: true %> <% end %> I'd like my js.erb to look like this, but f is only

Rails 3 polymorphic association with Carrierwave and Simple Form

孤者浪人 提交于 2019-12-02 21:31:09
I'm trying to set up a polymorphic association for photo uploads which are processed using Carrierwave. I'm using Simple Form to build my forms. I feel like the association is correct so I'm wondering if my problem is just something with the form or controller. Here are my associations: property.rb: class Property < ActiveRecord::Base attr_accessible :image ... has_many :image, :as => :attachable ... end unit.rb class Unit < ActiveRecord::Base attr_accessible :image ... has_many :image, :as => :attachable end image.rb class Image < ActiveRecord::Base belongs_to :attachable, :polymorphic =>

Customize Route to New User Registration Page in Devise Simple_Form_For Posting new form to Devise Registration Controller

笑着哭i 提交于 2019-12-02 20:16:14
问题 an idea - should I be making a new controller that inherits the registrations controller? and then do another devise_for :users, :controllers => {:registration => "newcontroller"} change my trial_signup.html.erb to new.html.erb and make a new folder in app/views/devise/registrations2/new.html.erb Newest Update app/views/devise/trial_signup.html.erb <h2>Trial Sign up</h2> <%= simple_form_for(resource, :as => resource_name, :url => sales_path(resource_name)) do |f| %> <div class="row"> <div

Simple_form: Remove outer label for an inline checkbox with label

拜拜、爱过 提交于 2019-12-02 20:11:13
Using Simple_form 2.0.2 The simple form code using HAML: = f.input :remember_me, as: :boolean, inline_label: 'Remember me' But it renders this: <div class="control-group boolean optional"> <label class="boolean optional control-label" for="admin_remember_me">Remember me</label> <div class="controls"> <input name="admin[remember_me]" type="hidden" value="0" /> <label class="checkbox"><input class="boolean optional" id="admin_remember_me" name="admin[remember_me]" type="checkbox" value="1" />Remember me</label> </div> </div> How do I remove that first label that's rendered, so that I only have

Append/prepend bootstrap icons with simple_form

回眸只為那壹抹淺笑 提交于 2019-12-02 17:09:26
Twitter Bootstrap icons are pretty deadly seen here . Look at the bottom right hand corner of that section. See that email with an icon prepended? That is what I want to do. I want to make simple_form and boostrap play nicely. Here's what I've found that will prepend the icon to the input: = f.input :email, :wrapper => :append do = f.input_field :email <span class="add-on"><i class="icon-envelope"></i></span> But it isn't flush (that could be fixed by changing offsets in CSS) and it's pretty ugly. For reference, here is the CSS fix (add it to your bootstrap_overrides.css.less file): .input