about summary refs log tree commit diff stats
path: root/app/views/admin/blogs/_form.html.haml
blob: c3720ba3a2f41700a2351fa8a19da8722baeecb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%fieldset#content
  .title-field
    = f.label :title
    = f.text_field :title, placeholder: "Title"
  .slug-field
    = f.label :slug, "https://feffernoo.se/says/"
    = f.text_field :slug, placeholder: "insert-slug-here"
  .body-field
    = f.label :body
    = f.text_area :body
%fieldset#details
  - if f.object.errors.any?
    #errors.details-module
      %h3 Error!
      %ul
        - f.object.errors.full_messages.each do |error|
          %li= error
  - unless f.object.new_record?
    #entry-preview-link.details-module
      - if f.object.published
        = link_to "View post", blog_url(f.object.slug_was), target: "entry-preview"
      - else
        = link_to "Preview post", admin_blog_url(f.object.id), target: "entry-preview"
  .details-module
    .tags-field
      = f.label :tag_list, "Tags"
      = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",")
  .details-module
    .published-field
      = f.check_box :published
      = f.label :published
    .datetime-field
      = f.label :published_at
      = f.text_field :published_at
  .details-module
    = f.fields_for :records, Record.new do |builder|
      .should-create-record-field
        = builder.check_box :_destroy, {checked: false}, "0", "1"
        = builder.label :_destroy, "Create record?"
      .record-description-field
        = builder.text_area :description, placeholder: "record text"
  .details-module.image-uploads
    %h4 Images
    - f.object.images.each do |image|
      = image_tag image.variant(:thumb)
      = f.hidden_field :images, multiple: true, value: image.signed_id
      %pre= url_for image
      %hr
    = f.file_field :images, multiple: true
  .details-module= f.submit