-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
336 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module Pageflow | ||
module OutputSource | ||
STATE_MAPPING = { | ||
true => 'finished', | ||
false => 'skipped' | ||
}.freeze | ||
|
||
extend ActiveSupport::Concern | ||
|
||
included do | ||
serialize :output_presences, JSON | ||
end | ||
|
||
def present_outputs | ||
present_outputs_label_state_array = output_presences.select do |output_label, _output_state| | ||
output_present?(output_label) == true | ||
end | ||
|
||
present_outputs_label_state_array.map { |output_label_state| output_label_state[0].to_sym } | ||
end | ||
|
||
def output_present?(type) | ||
output_presences[type.to_s] | ||
end | ||
|
||
def output_presences=(presences) | ||
boolean_presences = presences.stringify_keys.each_with_object({}) do |(key, value), result| | ||
if value == true || value == STATE_MAPPING[true] | ||
result[key] = true | ||
elsif value == false || value == STATE_MAPPING[false] | ||
result[key] = false | ||
elsif value.blank? | ||
result[key] = nil | ||
end | ||
end | ||
|
||
self[:output_presences] = output_presences | ||
.merge(boolean_presences) | ||
.reject { |_key, value| value.nil? } | ||
end | ||
|
||
def output_presences | ||
super || {} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
de: | ||
pageflow: | ||
highdef_video_encoding: | ||
feature_name: "Full HD und 4K Videos" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
en: | ||
pageflow: | ||
highdef_video_encoding: | ||
feature_name: "Full HD and 4K videos" |
5 changes: 5 additions & 0 deletions
5
db/migrate/20160707125400_add_output_presences_to_video_files.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddOutputPresencesToVideoFiles < ActiveRecord::Migration | ||
def change | ||
add_column :pageflow_video_files, :output_presences, :text | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.