about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/main/entries.scss4
-rw-r--r--app/models/blog.rb2
-rw-r--r--app/views/admin/blogs/_form.html.haml10
3 files changed, 12 insertions, 4 deletions
diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index 37b0a49..609a5f7 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss
@@ -194,6 +194,10 @@
194 box-sizing: border-box; 194 box-sizing: border-box;
195 } 195 }
196 196
197 video {
198 max-width: 100%;
199 }
200
197 figure { 201 figure {
198 background-color: #eee; 202 background-color: #eee;
199 border: 1px solid #bbb; 203 border: 1px solid #bbb;
diff --git a/app/models/blog.rb b/app/models/blog.rb index db05432..37b60dd 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb
@@ -15,7 +15,7 @@ class Blog < ApplicationRecord
15 validates :body, presence: true, if: :published 15 validates :body, presence: true, if: :published
16 validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published 16 validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published
17 validates :user, presence: true 17 validates :user, presence: true
18 validates :images, content_type: ['image/png', 'image/jpeg'] 18 validates :images, content_type: ['image/png', 'image/jpeg', 'video/mp4']
19 19
20 before_validation :set_draft_title 20 before_validation :set_draft_title
21 before_save :set_published_at 21 before_save :set_published_at
diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index f64ebe5..323d499 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml
@@ -42,9 +42,13 @@
42 .details-module.image-uploads 42 .details-module.image-uploads
43 %h4 Images 43 %h4 Images
44 - f.object.images.each do |image| 44 - f.object.images.each do |image|
45 = image_tag image.variant(:thumb) 45 - if image.representable?
46 = f.hidden_field :images, multiple: true, value: image.signed_id 46 = image_tag image.variant(:thumb)
47 %pre= rails_blob_url(image) 47 - else
48 = image.filename.to_s
49 - unless image.new_record?
50 = f.hidden_field :images, multiple: true, value: image.signed_id
51 %pre= rails_blob_url(image)
48 %hr 52 %hr
49 = f.file_field :images, multiple: true 53 = f.file_field :images, multiple: true
50 .details-module= f.submit 54 .details-module= f.submit