simple-form

How do you add a tag before each radio button in Simple Form?

一笑奈何 提交于 2019-12-08 08:03:45
问题 Simple necessity, but clearly no easy way to do it with Simple Form. I need to put a span before each radio input in a Rails form that uses Simple form. I've successfully added a span to a text input as stated in this guidelines, but I cannot make out how to do the same thing with radio buttons (as well as check boxes). I don't want to use jQuery, which I am currently using as a workaround. UPDATE 1 As @TarynEast asked in a comment, I tried creating an initializer with the following code I've

How can a dropdown be stylized when using twitter bootstrap with simple_form in a Rails app?

我怕爱的太早我们不能终老 提交于 2019-12-08 07:26:40
问题 I am using simple_form and twitter-bootstrap-rails gems. Every thing is working fine but somehow drop-down is not getting stylized by twitter bootstrap rails ..it shows like normal forms. <%= f.input :category, :collection => ["one", "two", "three", "four"], :input_html => {:class => 'dropdown'}, :label => 'Send To', prompt: "Choose From List" %> IMAGE OF DROPDOWN SHOWING: IMAGE OF DROPDOWN NEEDED AS IN BOOTSTRAP 回答1: One way to get stylized dropdowns with SimpleForm and Bootstrap is to use

Loading error for simple_form in rails 3.2.8 engine

邮差的信 提交于 2019-12-08 04:25:35
问题 When loading simple_form in our rails 3.2.8 engine, the simple_form initializer file simple_form.rb causes error: /config/initializers/simple_form.rb:2:in `<top (required)>': uninitialized constant SimpleForm (NameError) from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>' from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each' Under engine's config/initializers, the simple_form.rb is: # Use

ruby-on-rails client_side_validation simple_form javascript error

杀马特。学长 韩版系。学妹 提交于 2019-12-08 02:43:15
问题 Ruby on Rails application and trying to add client_side_validation working and getting two javascript runtime errors when visiting the screen fields. The errors; Uncaught TypeError: Cannot call method 'add' of undefined Uncaught TypeError: Cannot call method 'remove' of undefined The Gemfile source 'https://rubygems.org' ........ gem 'simple_form' gem 'client_side_validations' gem 'client_side_validations-simple_form' ..... The application.html.erb <!DOCTYPE html> <html> <head> <title><%=

simple_form & bootstrap validations not working

家住魔仙堡 提交于 2019-12-08 00:45:01
问题 I want to setup a 'Create Account' page. The gems I'm using are: rails (3.2.3) simple_form (2.0.1) omniauth-identity twitter-bootstrap-rails (2.0.6) mongoid (2.2.3) The form looks as follows: = simple_form_for @identity, :url => '/auth/identity/register', :html => { :class => 'form-horizontal' } do |f| = f.input :name, :input_html => {:name => 'name'} = f.input :email, :input_html => {:name => 'email'} = f.input :password, :as => 'password', :input_html => {:name => 'password'} = f.input

Add datepicker with rails 3.2.11, simple_form and bootstrap

喜欢而已 提交于 2019-12-07 18:52:24
问题 I am trying to implement datepicker in my simple_form much as has been covered here: How do i write a cleaner date picker input for SimpleForm I create the custom class: # app/inputs/date_picker_input.rb class DatePickerInput < SimpleForm::Inputs::StringInput .... end I then add: `$("input.date_picker").datepicker(); at the bottom of application.js and use the code: <%= f.input :deadline, :as => :date_picker %> However, a datepicker is not activated, nor is an error thrown. Could this be an

Rails: Conditional path in form partial

只谈情不闲聊 提交于 2019-12-07 13:55:11
问题 I have two forms for new and edit that I want to extract to a partial, but, to my begginer knowledge in Rails, they need different paths in order to work. This is my edit form: <%= simple_form_for [@user, @wiki], url: user_wiki_path do |f| %> <%= f.input :title %> <%= f.input :body %> <%= f.submit class: "btn btn-success" %> <% end %> This is my new form: <%= simple_form_for [@user, @wiki], url: user_wikis_path, method: :post do |f| %> <%= f.input :title %> <%= f.input :body %> <%= f.submit

nested model attributes + wicked wizard form not working

北城余情 提交于 2019-12-07 11:17:29
I am making an app based on the railscast tutorial 346(Wicked gem) and 196(nested model). I am trying to combine these 2 together and I am stuck because strong param attributes are not saving. So my app goes like this: I have a user, work, and education model. user.rb: has_many :educations, dependent: :destroy has_many :works, dependent: :destroy accepts_nested_attributes_for :educations, :works education.rb belongs_to :user work.rb belongs_to :user And then i generated the wicked wizard controller which i called UserStepsController: include Wicked::Wizard steps :education, :work def show

Rails Simpleform setting the width of a form input element

我是研究僧i 提交于 2019-12-07 09:53:18
问题 I'm using the gem simpleform inside a table I want to adjust the width of each form element of the simple form can I do that? I tried the following but it doesn't seem to work <td><%= listing.name %></td> <td><%= f.input :suite, :input_html => { :size => 10, :maxlength => 10 } %></td> I looked at the simpleform documentation here but couldn't find how to specifically set the width. Here is what my form inside a table looks like. I'd like to make the columns narrower. As you can see the column

refile simple_form undefined method attachment_field

北战南征 提交于 2019-12-07 08:49:02
问题 I am trying to hook up refile to my view and I am getting the following error: Here are my models: class Job < ActiveRecord::Base acts_as_paranoid acts_as_taggable acts_as_taggable_on :languages belongs_to :company belongs_to :category validates :title, :location, :category, :language_list, :short_description, :description, :application_process, presence: true end class Company < ActiveRecord::Base acts_as_paranoid has_many :jobs attachment :company_logo, type: :image validates :name, :url,