- now = Time.zone.now

%div.page-header
  %h1 イベント作成
= form_for(@event, class: 'form-horizotal', role: 'form') do |f|
  - if @event.errors.any?
    %div{ class: 'alert alert-danger' }
      %ul
        - @event.errors.full_messages.each do |msg|
          %li
            =msg

  %div.form-group
    = f.label :name
    = f.text_field :name, class: 'form-control'
  %div.form-group
    = f.label :place
    = f.text_field :place, class: 'form-control'
  %div.form-group
    = f.label :start_time
    = f.datetime_select :start_time, start_year: now.year, end_year: now.year + 1
  %div.form-group
    = f.label :end_time
    = f.datetime_select :end_time, start_year: now.year, end_year: now.year + 1
  %div.form-group
    = f.label :content
    = f.text_area :content, class: 'form-control', row: 10

  = f.submit '作成', class: 'btn btn-default', data: { disable_with: '作成中。。。' }

- now = Time.zone.now

%div.page-header
  %h1 イベント作成
= form_for(@event, class: 'form-horizotal', role: 'form') do |f|
  - if @event.errors.any?
    %div{ class: 'alert alert-danger' }
      %ul
        - @event.errors.full_messages.each do |msg|
          %li
            =msg

  %div.form-group
    = f.label :name
    = f.text_field :name, class: 'form-control'
  %div.form-group
    = f.label :place
    = f.text_field :place, class: 'form-control'
  %div.form-group
    - if @event.event_image?
      %div.thumbnail
        = image_tag @event.event_image.url
    = f.file_field :event_image
    = f.hidden_field :event_image_cache
  %div.form-group
    = f.label :start_time
    = f.datetime_select :start_time, start_year: now.year, end_year: now.year + 1
  %div.form-group
    = f.label :end_time
    = f.datetime_select :end_time, start_year: now.year, end_year: now.year + 1
  %div.form-group
    = f.label :content
    = f.text_area :content, class: 'form-control', row: 10

  = f.submit '作成', class: 'btn btn-default', data: { disable_with: '作成中。。。' }

Add image in new page
Add image in new page
