-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize file seed data #686
Conversation
tf
commented
Dec 16, 2016
- Include file model type names in common seed
- Include file url templates in common seed
- Generate seed data for files
@@ -37,4 +41,5 @@ def json_response(options = {}) | |||
|
|||
RSpec.configure do |config| | |||
config.include(JsonResponseHelper, :type => :controller) | |||
config.include(JsonResponseHelper, :type => :helper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
[ | ||
{attribute: 'thumbnail_image_id', file_collection: 'image_files'}, | ||
{attribute: 'video_id', file_collection: 'video_files'} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent the right bracket the same as the start of the line where the left bracket is.
it 'includes thumbnail candidates of page types registered for entry' do | ||
thumbnail_candidates = | ||
[ | ||
{attribute: 'thumbnail_image_id', file_collection: 'image_files'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 spaces for indentation in an array, relative to the start of the line where the left square bracket is.
:'4k' => url_template(:mp4_4k), | ||
|
||
:'hls-playlist' => url_template(:hls_playlist), | ||
:'dash-playlist' => url_template(:dash_playlist), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
}, | ||
{ | ||
path: video_file.mp4_4k.url(host: :hls_origin, default_protocol: 'http'), | ||
bandwidth: 32000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate every 3 digits in the integer portion of a number with underscores(_).
} | ||
end | ||
|
||
def mp4_low_definition | ||
{ | ||
label: 'low', | ||
format: 'mp4', | ||
prepare_for_segmenting: ['hls', 'dash'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w or %W for an array of words.
} | ||
end | ||
|
||
def mp4_medium_definition | ||
{ | ||
label: 'medium', | ||
format: 'mp4', | ||
prepare_for_segmenting: ['hls', 'dash'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w or %W for an array of words.
@@ -100,59 +72,198 @@ def mp4_fullhd_definition | |||
def mp4_high_definition | |||
{ | |||
label: 'high', | |||
format: 'mp4', | |||
prepare_for_segmenting: ['hls', 'dash'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w or %W for an array of words.
Can be used to map file type collection names to model type names in client side code.
Let file types provide a hash of file url template strings. Url templates are created lazily to allow using an actual example record in the construction of the url without triggering eager loading of the model during initialization.
Add a common json partial that is used by both the `FilesHelper`, which renders seed data for the editor, and the `EntryJsonSeedHelper`, which renders seed data for published entries. Let file types specify a custom partial that is included in these representations. Add id, parent file and basename to file seed data.