pageflow 13.6.0 → 14.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +72 -5
- data/app/assets/javascripts/pageflow/dist/react-client.js +22 -27
- data/app/assets/javascripts/pageflow/dist/react-server.js +22 -27
- data/app/assets/javascripts/pageflow/editor/collections/files_collection.js +0 -1
- data/app/assets/javascripts/pageflow/editor/models/file_uploader.js +3 -1
- data/app/assets/javascripts/pageflow/editor/models/hosted_file.js +2 -7
- data/app/assets/javascripts/pageflow/editor/models/image_file.js +1 -1
- data/app/assets/javascripts/pageflow/editor/models/uploaded_file.js +12 -10
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/general.js +4 -4
- data/app/assets/javascripts/pageflow/editor/views/uploader_view.js +18 -27
- data/app/assets/javascripts/pageflow/slideshow/page_split_layout.js +8 -8
- data/app/assets/javascripts/pageflow/slideshow/page_widget.js +1 -1
- data/app/assets/stylesheets/pageflow/delayed_text_fade_in.scss +10 -5
- data/app/assets/stylesheets/pageflow/editor/file_stages.scss +0 -4
- data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +0 -4
- data/app/assets/stylesheets/pageflow/hide_text.scss +2 -2
- data/app/assets/stylesheets/pageflow/lt_ie9.scss +5 -5
- data/app/assets/stylesheets/pageflow/navigation_bar.scss +1 -0
- data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -0
- data/app/assets/stylesheets/pageflow/page.scss +2 -2
- data/app/assets/stylesheets/pageflow/page_transitions/crossfade.scss +1 -1
- data/app/assets/stylesheets/pageflow/page_transitions/fade.scss +11 -11
- data/app/assets/stylesheets/pageflow/page_transitions/fade_to_black.scss +13 -10
- data/app/assets/stylesheets/pageflow/page_types/audio.scss +3 -3
- data/app/assets/stylesheets/pageflow/page_types/video.scss +9 -9
- data/app/assets/stylesheets/pageflow/page_types/video/content_hiding.scss +2 -2
- data/app/assets/stylesheets/pageflow/page_types/video/mobile_poster.scss +3 -3
- data/app/assets/stylesheets/pageflow/print_view.scss +8 -5
- data/app/assets/stylesheets/pageflow/slideshow.scss +6 -5
- data/app/assets/stylesheets/pageflow/themes/default/base.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page.scss +3 -168
- data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/page/content_text_margin.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page/header.scss +172 -0
- data/app/assets/stylesheets/pageflow/themes/default/page/hyphenate.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page/line_lengths.scss +12 -14
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/vjs_mapping.scss +6 -6
- data/app/assets/stylesheets/pageflow/themes/default/{video_wrapper.scss → uncropped_media_wrapper.scss} +1 -1
- data/app/controllers/pageflow/editor/files_controller.rb +11 -8
- data/app/helpers/pageflow/background_image_helper.rb +2 -1
- data/app/helpers/pageflow/files_helper.rb +1 -0
- data/app/helpers/pageflow/pages_helper.rb +31 -0
- data/app/helpers/pageflow/video_files_helper.rb +3 -3
- data/app/jobs/pageflow/process_file_job.rb +15 -5
- data/app/models/concerns/pageflow/hosted_file.rb +42 -33
- data/app/models/concerns/pageflow/uploaded_file.rb +10 -0
- data/app/models/pageflow/audio_file.rb +1 -1
- data/app/models/pageflow/audio_file_url_templates.rb +1 -1
- data/app/models/pageflow/draft_entry.rb +1 -1
- data/app/models/pageflow/image_file.rb +38 -52
- data/app/models/pageflow/image_file_css_background_image_urls.rb +4 -4
- data/app/models/pageflow/image_file_url_templates.rb +2 -2
- data/app/models/pageflow/positioned_file.rb +1 -1
- data/app/models/pageflow/text_track_file.rb +15 -32
- data/app/models/pageflow/text_track_file_url_templates.rb +2 -3
- data/app/models/pageflow/video_file.rb +1 -1
- data/app/models/pageflow/video_file_url_templates.rb +1 -1
- data/app/state_machines/pageflow/{image_file_state_machine.rb → processed_file_state_machine.rb} +4 -10
- data/app/views/pageflow/editor/files/_file.json.jbuilder +4 -0
- data/app/views/pageflow/entries/edit.html.erb +2 -2
- data/app/views/pageflow/entries/mobile_navigation/_page.html.erb +1 -0
- data/app/views/pageflow/entries/navigation/_page.html.erb +2 -1
- data/config/initializers/paperclip.rb +6 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20181115165746_change_processed_attachment_to_attachment_on_s3_for_images.rb +16 -0
- data/db/migrate/20190306161431_copy_file_attributes_of_failed_uploads.rb +25 -0
- data/lib/pageflow/configuration.rb +23 -5
- data/lib/pageflow/configuration/defaults.rb +2 -9
- data/lib/pageflow/version.rb +1 -1
- data/spec/factories/audio_files.rb +17 -10
- data/spec/factories/hosted_files.rb +13 -11
- data/spec/factories/image_files.rb +18 -11
- data/spec/factories/text_track_files.rb +30 -10
- data/spec/factories/video_files.rb +16 -9
- metadata +9 -8
- data/app/assets/javascripts/pageflow/dist/react.js +0 -29944
- data/app/jobs/pageflow/upload_file_to_s3_job.rb +0 -25
@@ -19,10 +19,9 @@ $page-header-title-min-width-for-split-layout: 525px !default;
|
|
19
19
|
$page-content-width: 60% !default;
|
20
20
|
|
21
21
|
.page {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
h3,
|
22
|
+
&_header-subtitle,
|
23
|
+
&_header-tagline,
|
24
|
+
&_sub_header,
|
26
25
|
p {
|
27
26
|
max-width: $page-content-max-width;
|
28
27
|
width: $page-content-width;
|
@@ -32,7 +31,7 @@ $page-content-width: 60% !default;
|
|
32
31
|
}
|
33
32
|
}
|
34
33
|
|
35
|
-
|
34
|
+
&_header-title {
|
36
35
|
max-width: $page-header-title-max-width;
|
37
36
|
width: 100%;
|
38
37
|
}
|
@@ -70,10 +69,10 @@ $page-content-width: 60% !default;
|
|
70
69
|
|
71
70
|
@media screen and (min-width: $page-min-width-for-split-layout) {
|
72
71
|
&-with_split_layout {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
.page_header-subtitle,
|
73
|
+
.page_header-title,
|
74
|
+
.page_header-tagline,
|
75
|
+
.page_sub_header,
|
77
76
|
p {
|
78
77
|
width: $page-content-split-layout-width;
|
79
78
|
}
|
@@ -81,11 +80,10 @@ $page-content-width: 60% !default;
|
|
81
80
|
}
|
82
81
|
|
83
82
|
&.text_position_right {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
h3,
|
83
|
+
.page_header-subtitle,
|
84
|
+
.page_header-title,
|
85
|
+
.page_header-tagline,
|
86
|
+
.page_sub_header,
|
89
87
|
p {
|
90
88
|
@include margin-start(auto);
|
91
89
|
max-width: $page-content-position-right-max-width;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// Map placeholder names to concrete vjs css class names.
|
2
2
|
|
3
3
|
$vjs-selector-mapping: (
|
4
|
-
page-with_progress_bar: ".
|
5
|
-
page-audio: ".
|
4
|
+
page-with_progress_bar: ".audio_page, .video_page",
|
5
|
+
page-audio: ".audio_page",
|
6
6
|
|
7
7
|
background: ".page_background-for_page_with_player_controls",
|
8
8
|
|
@@ -14,12 +14,12 @@ $vjs-selector-mapping: (
|
|
14
14
|
// Use playing class that is removed with delay to prevent
|
15
15
|
// mask image on scroller from being removed too early in slim
|
16
16
|
// player controls.
|
17
|
-
scroller-playing: ".
|
17
|
+
scroller-playing: ".video_page .scroller.is_playing_delayed, .audio_page .scroller.is_playing_delayed",
|
18
18
|
|
19
19
|
// If video has played, content is faded immediately. This can be
|
20
20
|
// used by the slim player controls to not display the scroller mask
|
21
21
|
// if the content fades anyway.
|
22
|
-
scroller-fading: ".
|
22
|
+
scroller-fading: ".video_page.has_played .scroller",
|
23
23
|
|
24
24
|
container: ".controls",
|
25
25
|
|
@@ -31,8 +31,8 @@ $vjs-selector-mapping: (
|
|
31
31
|
container-hover: ".is_control_bar_hovered .controls",
|
32
32
|
container-focused: ".is_control_bar_focused .controls",
|
33
33
|
|
34
|
-
container-video: ".
|
35
|
-
container-fading: ".
|
34
|
+
container-video: ".video_page .controls",
|
35
|
+
container-fading: ".video_page .controls",
|
36
36
|
|
37
37
|
container-unplayed: ".unplayed .controls",
|
38
38
|
|
@@ -20,7 +20,6 @@ module Pageflow
|
|
20
20
|
verify_edit_lock!(entry)
|
21
21
|
|
22
22
|
@file = entry.create_file!(file_type.model, create_params)
|
23
|
-
@file.publish!
|
24
23
|
|
25
24
|
respond_with(:editor, @file)
|
26
25
|
rescue ActiveRecord::RecordInvalid => e
|
@@ -57,6 +56,16 @@ module Pageflow
|
|
57
56
|
collection_name: params[:collection_name]))
|
58
57
|
end
|
59
58
|
|
59
|
+
def publish
|
60
|
+
entry = DraftEntry.find(params[:entry_id])
|
61
|
+
file = entry.find_file(file_type.model, params[:id])
|
62
|
+
|
63
|
+
authorize!(:update, file.to_model)
|
64
|
+
file.publish!
|
65
|
+
|
66
|
+
head(:no_content)
|
67
|
+
end
|
68
|
+
|
60
69
|
def update
|
61
70
|
entry = DraftEntry.find(params[:entry_id])
|
62
71
|
file = entry.find_file(file_type.model, params[:id])
|
@@ -81,7 +90,7 @@ module Pageflow
|
|
81
90
|
private
|
82
91
|
|
83
92
|
def create_params
|
84
|
-
|
93
|
+
file_params.permit(:file_name, :content_type, :file_size)
|
85
94
|
.merge(file_configuration_params)
|
86
95
|
.merge(file_parent_file_params)
|
87
96
|
.merge(file_custom_params)
|
@@ -95,12 +104,6 @@ module Pageflow
|
|
95
104
|
file_configuration_params
|
96
105
|
end
|
97
106
|
|
98
|
-
def file_attachment_params
|
99
|
-
file_params
|
100
|
-
.permit(attachment: [:tmp_path, :original_name, :content_type])
|
101
|
-
.merge(file_params.permit(:attachment))
|
102
|
-
end
|
103
|
-
|
104
107
|
def file_configuration_params
|
105
108
|
configuration = file_params[:configuration].try(:permit!)
|
106
109
|
|
@@ -9,7 +9,8 @@ module Pageflow
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def background_image_tag(image_id, options = {})
|
12
|
-
|
12
|
+
image = ImageFile.find_by_id(image_id)
|
13
|
+
if image&.ready?
|
13
14
|
options = options.merge(:'data-src' => image.attachment.url(:medium))
|
14
15
|
options = options.merge(:'data-printsrc' => image.attachment.url(:print))
|
15
16
|
image_tag('', options)
|
@@ -21,6 +21,37 @@ module Pageflow
|
|
21
21
|
classes.join(' ')
|
22
22
|
end
|
23
23
|
|
24
|
+
def page_default_content(page)
|
25
|
+
safe_join([
|
26
|
+
page_header(page),
|
27
|
+
page_print_image(page),
|
28
|
+
page_text(page)
|
29
|
+
])
|
30
|
+
end
|
31
|
+
|
32
|
+
def page_header(page)
|
33
|
+
content_tag(:h3, class: 'page_header') do
|
34
|
+
safe_join([
|
35
|
+
content_tag(:span, page.configuration['tagline'],
|
36
|
+
class: 'page_header-tagline'),
|
37
|
+
content_tag(:span, page.configuration['title'],
|
38
|
+
class: 'page_header-title'),
|
39
|
+
content_tag(:span, page.configuration['subtitle'],
|
40
|
+
class: 'page_header-subtitle')
|
41
|
+
])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def page_print_image(page)
|
46
|
+
background_image_tag(page.configuration['background_image_id'], 'class' => 'print_image')
|
47
|
+
end
|
48
|
+
|
49
|
+
def page_text(page)
|
50
|
+
content_tag(:div, class: 'page_text') do
|
51
|
+
content_tag(:p, raw(page.configuration['text']))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
24
55
|
# @api private
|
25
56
|
def page_has_content(page)
|
26
57
|
has_title = ['title','subtitle','tagline'].any? do |attribute|
|
@@ -29,7 +29,7 @@ module Pageflow
|
|
29
29
|
video_file = VideoFile.find_by_id(video_id)
|
30
30
|
poster = ImageFile.find_by_id(poster_image_id)
|
31
31
|
|
32
|
-
if poster
|
32
|
+
if poster&.ready?
|
33
33
|
options = options.merge('data-src' => poster.attachment.url(:medium))
|
34
34
|
options = options.merge('data-printsrc' => poster.attachment.url(:print))
|
35
35
|
elsif video_file
|
@@ -58,12 +58,12 @@ module Pageflow
|
|
58
58
|
|
59
59
|
options[:data] = {}
|
60
60
|
|
61
|
-
if mobile_poster
|
61
|
+
if mobile_poster&.ready?
|
62
62
|
options[:data][:mobile_poster] = mobile_poster.attachment.url(:medium)
|
63
63
|
options[:data][:mobile_large_poster] = mobile_poster.attachment.url(:large)
|
64
64
|
end
|
65
65
|
|
66
|
-
if poster
|
66
|
+
if poster&.ready?
|
67
67
|
options[:data][:poster] = poster.attachment.url(:medium)
|
68
68
|
options[:data][:large_poster] = poster.attachment.url(:large)
|
69
69
|
elsif video_file
|
@@ -5,14 +5,24 @@ module Pageflow
|
|
5
5
|
include StateMachineJob
|
6
6
|
|
7
7
|
def perform_with_result(file, _options)
|
8
|
-
file.
|
9
|
-
file.save!
|
8
|
+
file.attachment.reprocess!
|
10
9
|
|
11
|
-
|
10
|
+
if file.valid?
|
11
|
+
:ok
|
12
|
+
else
|
13
|
+
reset_invalid_attachment(file)
|
14
|
+
:error
|
15
|
+
end
|
12
16
|
rescue ActiveRecord::RecordInvalid, Errno::ENAMETOOLONG
|
13
|
-
file
|
14
|
-
|
17
|
+
reset_invalid_attachment(file)
|
18
|
+
|
15
19
|
:error
|
16
20
|
end
|
21
|
+
|
22
|
+
def reset_invalid_attachment(file)
|
23
|
+
file_name = file.file_name
|
24
|
+
file.attachment = nil
|
25
|
+
file.file_name = file_name
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
@@ -4,35 +4,34 @@ module Pageflow
|
|
4
4
|
include UploadedFile
|
5
5
|
|
6
6
|
included do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
alias_attribute :file_name, :attachment_on_s3_file_name
|
8
|
+
alias_attribute :content_type, :attachment_on_s3_content_type
|
9
|
+
alias_attribute :file_size, :attachment_on_s3_file_size
|
10
|
+
|
11
|
+
has_attached_file(:attachment_on_s3,
|
12
|
+
Pageflow.config.paperclip_s3_default_options
|
13
|
+
.merge(
|
14
|
+
default_url: lambda do |attachment|
|
15
|
+
attachment.instance.attachment_default_url
|
16
|
+
end,
|
17
|
+
styles: lambda do |attachment|
|
18
|
+
attachment.instance.attachment_styles(attachment)
|
19
|
+
end
|
20
|
+
))
|
21
|
+
|
22
|
+
validates_attachment_presence :attachment_on_s3
|
23
|
+
validates_attachment_file_name :attachment_on_s3, matches: %r{^[^\/\\]+\.[\w]{3,4}$}
|
24
|
+
do_not_validate_attachment_file_type :attachment_on_s3
|
25
|
+
|
26
|
+
state_machine initial: 'uploading' do
|
16
27
|
extend StateMachineJob::Macro
|
17
28
|
|
18
|
-
state '
|
19
|
-
state '
|
20
|
-
state '
|
21
|
-
state 'uploading_to_s3_failed'
|
29
|
+
state 'uploading'
|
30
|
+
state 'uploaded'
|
31
|
+
state 'uploading_failed'
|
22
32
|
|
23
33
|
event :publish do
|
24
|
-
transition '
|
25
|
-
end
|
26
|
-
|
27
|
-
event :retry do
|
28
|
-
transition 'uploading_to_s3_failed' => 'uploading_to_s3'
|
29
|
-
end
|
30
|
-
|
31
|
-
job UploadFileToS3Job do
|
32
|
-
on_enter 'uploading_to_s3'
|
33
|
-
result :pending, retry_after: 30.seconds
|
34
|
-
result :ok, state: 'uploaded_to_s3'
|
35
|
-
result :error, state: 'uploading_to_s3_failed'
|
34
|
+
transition 'uploading' => 'uploaded'
|
36
35
|
end
|
37
36
|
|
38
37
|
event :process
|
@@ -40,19 +39,31 @@ module Pageflow
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def attachment
|
43
|
-
attachment_on_s3
|
42
|
+
attachment_on_s3
|
44
43
|
end
|
45
44
|
|
46
45
|
def attachment=(value)
|
47
|
-
self.
|
46
|
+
self.attachment_on_s3 = value
|
47
|
+
end
|
48
|
+
|
49
|
+
def attachment_default_url
|
50
|
+
''
|
51
|
+
end
|
52
|
+
|
53
|
+
def attachment_styles(_attachment)
|
54
|
+
{}
|
55
|
+
end
|
56
|
+
|
57
|
+
def can_upload?
|
58
|
+
uploading?
|
48
59
|
end
|
49
60
|
|
50
61
|
def retryable?
|
51
|
-
|
62
|
+
false
|
52
63
|
end
|
53
64
|
|
54
65
|
def ready?
|
55
|
-
|
66
|
+
attachment.present?
|
56
67
|
end
|
57
68
|
|
58
69
|
def basename
|
@@ -60,7 +71,7 @@ module Pageflow
|
|
60
71
|
end
|
61
72
|
|
62
73
|
def url
|
63
|
-
if
|
74
|
+
if attachment.present?
|
64
75
|
attachment.url
|
65
76
|
end
|
66
77
|
end
|
@@ -74,9 +85,7 @@ module Pageflow
|
|
74
85
|
state_machine do
|
75
86
|
extend StateMachineJob::Macro
|
76
87
|
|
77
|
-
after_transition(any => '
|
78
|
-
hosted_file.process!
|
79
|
-
end
|
88
|
+
after_transition(any => 'uploaded', &:process!)
|
80
89
|
|
81
90
|
instance_eval(&block)
|
82
91
|
end
|
@@ -55,5 +55,15 @@ module Pageflow
|
|
55
55
|
# prevent caching outdated information.
|
56
56
|
"#{super}-#{state}"
|
57
57
|
end
|
58
|
+
|
59
|
+
def can_upload?
|
60
|
+
# Overwritten in HostedFile based on initial state_machine-state.
|
61
|
+
# Only true directly after creation.
|
62
|
+
false
|
63
|
+
end
|
64
|
+
|
65
|
+
def direct_upload_config
|
66
|
+
Pageflow.config.paperclip_direct_upload_options.call(attachment)
|
67
|
+
end
|
58
68
|
end
|
59
69
|
end
|
@@ -1,84 +1,70 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class ImageFile < ApplicationRecord
|
3
|
-
include
|
4
|
-
include
|
3
|
+
include HostedFile
|
4
|
+
include ProcessedFileStateMachine
|
5
5
|
|
6
|
-
|
6
|
+
def attachment_styles(attachment)
|
7
7
|
panorama_format = File.extname(attachment.original_filename) == '.png' ? :PNG : :JPG
|
8
8
|
|
9
9
|
Pageflow
|
10
10
|
.config.thumbnail_styles
|
11
|
-
.merge(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
.merge(
|
12
|
+
print: {geometry: '300x300>',
|
13
|
+
format: :JPG,
|
14
|
+
convert_options: '-quality 10 -interlace Plane'},
|
15
|
+
medium: {geometry: '1024x1024>',
|
16
|
+
format: :JPG,
|
17
|
+
convert_options: '-quality 70 -interlace Plane'},
|
18
|
+
large: {geometry: '1920x1920>',
|
19
|
+
format: :JPG,
|
20
|
+
convert_options: '-quality 70 -interlace Plane'},
|
21
|
+
ultra: {geometry: '3840x3840>',
|
22
|
+
format: :JPG,
|
23
|
+
convert_options: '-quality 90 -interlace Plane'},
|
24
|
+
panorama_medium: {geometry: '1024x1024^',
|
25
|
+
format: panorama_format,
|
26
|
+
convert_options: '-quality 90 -interlace Plane'},
|
27
|
+
panorama_large: {geometry: '1920x1080^',
|
28
|
+
format: panorama_format,
|
29
|
+
convert_options: '-quality 90 -interlace Plane'}
|
30
|
+
)
|
17
31
|
end
|
18
32
|
|
19
|
-
|
20
|
-
|
21
|
-
medium: '-quality 70 -interlace Plane',
|
22
|
-
large: '-quality 70 -interlace Plane',
|
23
|
-
ultra: '-quality 90 -interlace Plane',
|
24
|
-
panorama_medium: '-quality 90 -interlace Plane',
|
25
|
-
panorama_large: '-quality 90 -interlace Plane'
|
26
|
-
}.freeze
|
27
|
-
|
28
|
-
has_attached_file(:unprocessed_attachment,
|
29
|
-
Pageflow.config.paperclip_s3_default_options)
|
30
|
-
|
31
|
-
has_attached_file(:processed_attachment,
|
32
|
-
Pageflow.config.paperclip_s3_default_options
|
33
|
-
.merge(default_url: ':pageflow_placeholder',
|
34
|
-
styles: STYLES,
|
35
|
-
convert_options: CONVERT_OPTIONS))
|
36
|
-
|
37
|
-
validates :attachment, presence: true
|
38
|
-
|
39
|
-
do_not_validate_attachment_file_type(:unprocessed_attachment)
|
40
|
-
do_not_validate_attachment_file_type(:processed_attachment)
|
41
|
-
|
42
|
-
after_unprocessed_attachment_post_process :save_image_dimensions
|
43
|
-
|
44
|
-
def attachment
|
45
|
-
processed_attachment.present? ? processed_attachment : unprocessed_attachment
|
33
|
+
def attachment_default_url
|
34
|
+
':pageflow_placeholder'
|
46
35
|
end
|
47
36
|
|
48
|
-
|
49
|
-
|
37
|
+
# used in paperclip initializer to interpolate the storage path
|
38
|
+
# needs to be "processed_attachments" for images for legacy reasons
|
39
|
+
def attachments_path_name
|
40
|
+
'processed_attachments'
|
50
41
|
end
|
51
42
|
|
52
|
-
|
53
|
-
File.basename(attachment.original_filename, '.*')
|
54
|
-
end
|
43
|
+
after_attachment_on_s3_post_process :save_image_dimensions
|
55
44
|
|
56
45
|
def thumbnail_url(*args)
|
57
|
-
|
46
|
+
unless ready?
|
47
|
+
return Pageflow::PaperclipInterpolations::Support.pageflow_placeholder(attachment, *args)
|
48
|
+
end
|
49
|
+
attachment.url(*args)
|
58
50
|
end
|
59
51
|
|
60
52
|
def url
|
61
|
-
if
|
62
|
-
attachment.url(:large)
|
63
|
-
end
|
53
|
+
attachment.url(:large) if ready?
|
64
54
|
end
|
65
55
|
|
66
56
|
def original_url
|
67
|
-
if
|
68
|
-
attachment.url
|
69
|
-
end
|
57
|
+
attachment.url if ready?
|
70
58
|
end
|
71
59
|
|
72
60
|
def panorama_url
|
73
|
-
if
|
74
|
-
attachment.url(:panorama_large)
|
75
|
-
end
|
61
|
+
attachment.url(:panorama_large) if ready?
|
76
62
|
end
|
77
63
|
|
78
64
|
private
|
79
65
|
|
80
66
|
def save_image_dimensions
|
81
|
-
geo = Paperclip::Geometry.from_file(
|
67
|
+
geo = Paperclip::Geometry.from_file(attachment.queued_for_write[:original])
|
82
68
|
self.width = geo.width
|
83
69
|
self.height = geo.height
|
84
70
|
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|