0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

form_forの自分がよくわからない所をまとめる

Posted at

form_forのhamlの書き方について書いていきます。


.form
  = form_for [@group, @message] do |f|
    = f.text_field :content, class: 'form__message', placeholder: 'type a message'
    .form__mask
      = f.label :image, class: 'form__mask__image' do
        = icon('fas', 'image', class: 'icon')
        = f.file_field :image, class: 'hidden'
    = f.submit 'Send', class: 'form__submit'

form_forのクラス名(ビューが親をflexにすることによって崩れた時など)


= form_for [@group, @message], html: { class: "foo" }

fにクラスをつける


= f.submit "送る", class: "submit-btn"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?