post replacements: add option to fix source after replacement.

Adds a "Final Source" field to the post replacement dialog. If
specified, the post's source field will be changed to this value after
replacement.

This makes fixing the source back to the HTML page after
replacement easier.
This commit is contained in:
evazion
2017-06-22 15:19:41 -05:00
parent 55512130e1
commit c27668d2ef
4 changed files with 16 additions and 4 deletions

View File

@@ -4,7 +4,8 @@ class PostReplacement < ApplicationRecord
belongs_to :post
belongs_to :creator, class_name: "User"
before_validation :initialize_fields
attr_accessible :replacement_url
attr_accessible :replacement_url, :final_source
attr_accessor :final_source
def initialize_fields
self.creator = CurrentUser.user
@@ -37,7 +38,7 @@ class PostReplacement < ApplicationRecord
post.image_width = upload.image_width
post.image_height = upload.image_height
post.file_size = upload.file_size
post.source = upload.source
post.source = final_source.presence || upload.source
post.tag_string = upload.tag_string
rescale_notes
update_ugoira_frame_data(upload)