diff --git a/Gemfile b/Gemfile index c0d04304..dcf6d696 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,7 @@ gem 'jquery-rails' gem 'haml-rails' gem 'gravatar_image_tag' gem 'paperclip' -gem 'formtastic', '~> 3.1' -gem 'formtastic-bootstrap' +gem 'simple_form' gem 'favicon_maker' gem 'mini_magick' gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index dfbcc6bc..a8982f58 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,10 +96,6 @@ GEM favicon_maker (1.3.1) docile (~> 1.1) ffi (1.15.0) - formtastic (3.1.5) - actionpack (>= 3.2.13) - formtastic-bootstrap (3.1.1) - formtastic (>= 3.0) git_rev (0.1.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -208,6 +204,9 @@ GEM sentry-raven (3.1.1) faraday (>= 1.0) sexp_processor (4.15.2) + simple_form (5.1.0) + actionpack (>= 5.2) + activemodel (>= 5.2) simplecov (0.13.0) docile (~> 1.1.0) json (>= 1.8, < 3) @@ -248,8 +247,6 @@ DEPENDENCIES coffee-rails faker favicon_maker - formtastic (~> 3.1) - formtastic-bootstrap git_rev gravatar_image_tag haml-rails @@ -265,6 +262,7 @@ DEPENDENCIES ruby-prof sassc-rails sentry-raven + simple_form spring sqlite3 uglifier diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index f89ddf32..13d7ad74 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -1,6 +1,5 @@ @import "bootswatch/slate/variables"; @import "bootstrap"; -@import "formtastic-bootstrap"; @import "bootswatch/slate/bootswatch"; // make room for navigation bar diff --git a/app/views/barcodes/_form.html.haml b/app/views/barcodes/_form.html.haml index 8946a302..983b6c7f 100644 --- a/app/views/barcodes/_form.html.haml +++ b/app/views/barcodes/_form.html.haml @@ -1,7 +1,7 @@ -= semantic_form_for @barcode, :html => { :class => 'form-horizontal' } do |f| - = f.semantic_errors - = f.inputs do += simple_form_for @barcode, :html => { :class => 'form-horizontal' } do |f| + = f.error_notification + .form-inputs = f.input :id, hint: 'the label says…', input_html: { :autofocus => true } = f.input :drink, hint: 'If you edit a drink and click on "add barcode" this will be prefilled for you.', as: "select", collection: @drinks - = f.actions do - = f.action :submit + .form-actions + = f.button :submit, class: 'btn-primary' diff --git a/app/views/drinks/_form.html.haml b/app/views/drinks/_form.html.haml index 537c18a0..506e826f 100644 --- a/app/views/drinks/_form.html.haml +++ b/app/views/drinks/_form.html.haml @@ -2,15 +2,15 @@ %li = link_to 'delete drink', @drink, method: :delete, :data => {confirm: "Really delete drink #{@drink.name}?"} -= semantic_form_for @drink, :html => { :class => 'form-horizontal' } do |f| - = f.semantic_errors - = f.inputs do += simple_form_for @drink, :html => { :class => 'form-horizontal' } do |f| + = f.error_notification + .form-inputs = f.input :name, hint:'the label says…' - = f.input :price, as: :number, hint:'e.g. 1.50; locked due to vandalism', :input_html => { :disabled => true } + = f.input :price, as: :decimal, hint:'e.g. 1.50; locked due to vandalism', :input_html => { :disabled => true } = f.input :bottle_size, hint: '0.5 or 0.33?' = f.input :caffeine, hint: 'in mg/100 ml' = f.input :logo, hint: 'make it look pretty' = f.input :active - = f.actions do - = f.action :submit + .form-actions + = f.button :submit, class: 'btn-primary' = link_to 'Add a barcode', new_barcode_path(:drink => @drink.id), :class => 'btn' diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 4c4716b5..787b0d11 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -1,13 +1,13 @@ -= semantic_form_for @user, :html => { :class => 'form-horizontal' } do |f| - = f.semantic_errors - = f.inputs do += simple_form_for @user, :html => { :class => 'form-horizontal' } do |f| + = f.error_notification + .form-inputs = f.input :name, hint: 'your nickname' = f.input :email, hint: 'your eMail address. Only used to fetch your avatar from gravatar.com.' - = f.input :balance, :as => :number, hint: 'just in case you need to correct this' + = f.input :balance, :as => :decimal, hint: 'just in case you need to correct this' = f.input :active = f.input :audit, hint: 'This will create detailed logs about what you buy and deposit. If you uncheck this box, all records will be deleted.' = f.input :redirect, hint: "Redirect after buying a drink?" - = f.actions do - = f.action :submit + .form-actions + = f.button :submit, class: 'btn-primary' %style .user { display: initial!important; } diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb deleted file mode 100644 index f281ba8b..00000000 --- a/config/initializers/formtastic.rb +++ /dev/null @@ -1,76 +0,0 @@ -# encoding: utf-8 - -# Set the default text field size when input is a string. Default is nil. -# Formtastic::FormBuilder.default_text_field_size = 50 - -# Set the default text area height when input is a text. Default is 20. -# Formtastic::FormBuilder.default_text_area_height = 5 - -# Set the default text area width when input is a text. Default is nil. -# Formtastic::FormBuilder.default_text_area_width = 50 - -# Should all fields be considered "required" by default? -# Defaults to true. -# Formtastic::FormBuilder.all_fields_required_by_default = true - -# Should select fields have a blank option/prompt by default? -# Defaults to true. -# Formtastic::FormBuilder.include_blank_for_select_by_default = true - -# Set the string that will be appended to the labels/fieldsets which are required -# It accepts string or procs and the default is a localized version of -# '*'. In other words, if you configure formtastic.required -# in your locale, it will replace the abbr title properly. But if you don't want to use -# abbr tag, you can simply give a string as below -# Formtastic::FormBuilder.required_string = "(required)" - -# Set the string that will be appended to the labels/fieldsets which are optional -# Defaults to an empty string ("") and also accepts procs (see required_string above) -# Formtastic::FormBuilder.optional_string = "(optional)" - -# Set the way inline errors will be displayed. -# Defaults to :sentence, valid options are :sentence, :list, :first and :none -# Formtastic::FormBuilder.inline_errors = :sentence -# Formtastic uses the following classes as default for hints, inline_errors and error list - -# If you override the class here, please ensure to override it in your stylesheets as well -# Formtastic::FormBuilder.default_hint_class = "inline-hints" -# Formtastic::FormBuilder.default_inline_error_class = "inline-errors" -# Formtastic::FormBuilder.default_error_list_class = "errors" - -# Set the method to call on label text to transform or format it for human-friendly -# reading when formtastic is used without object. Defaults to :humanize. -# Formtastic::FormBuilder.label_str_method = :humanize - -# Set the array of methods to try calling on parent objects in :select and :radio inputs -# for the text inside each @