Skip to content

Commit

Permalink
5.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Carrick Rogers committed Aug 2, 2016
2 parents 9f2295a + 255503a commit 28f5c64
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ GIT

GIT
remote: https://github.com/avalonmediasystem/media-element-add-to-playlist.git
revision: 05cfa851b556d5838f2404442172a9857b31b3d1
revision: af3644c432e8c61dc6d31a0c72ab4bf28c6ecbdd
branch: master
specs:
media_element_add_to_playlist (0.0.1)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

[![Build Status](https://travis-ci.org/avalonmediasystem/avalon.svg?branch=develop)](https://travis-ci.org/avalonmediasystem/avalon)

[![Stories in Ready](https://badge.waffle.io/avalonmediasystem/avalon.png?label=ready&title=Ready)](https://waffle.io/avalonmediasystem/avalon)

[![Coverage Status](https://coveralls.io/repos/avalonmediasystem/avalon/badge.svg?branch=master&service=github)](https://coveralls.io/github/avalonmediasystem/avalon?branch=master)

For more information and regular project updates visit the [Avalon blog](http://www.avalonmediasystem.org/blog).
Expand Down
5 changes: 2 additions & 3 deletions app/assets/javascripts/avalon_player.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ class AvalonPlayer
scrubber.css('position', 'relative')
$('.row.marker').each (i,value) ->
offset = $(this)[0].dataset['offset']
start_str = " ["+mejs.Utility.secondsToTimeCode(offset)+"]"
marker_id = $(this)[0].dataset['marker']
title = $(this).find('.marker_title')[0].text
title = String($(this).find('.marker_title')[0].text).replace(/"/g, '"') + " ["+mejs.Utility.secondsToTimeCode(offset)+"]";
offset_percent = Math.round(if isNaN(parseFloat(offset)) then 0 else (100*offset / duration))
scrubber.append('<span class="fa fa-chevron-up scrubber-marker" style="left: '+offset_percent+'%" title="'+title+start_str+'" data-marker="'+marker_id+'"></span>')
scrubber.append('<span class="fa fa-chevron-up scrubber-marker" style="left: '+offset_percent+'%" title="'+title+'" data-marker="'+marker_id+'"></span>')
@player.setCurrentTime initialTime

@player.options.playlistItemDefaultTitle = @stream_info.embed_title
Expand Down
16 changes: 8 additions & 8 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def playlist_item_permissions
can [:create, :update, :delete], PlaylistItem do |playlist_item|
can? :manage, playlist_item.playlist
end
can :read, PlaylistItem do |playlist_item|
(can? :read, playlist_item.playlist) &&
(can? :read, playlist_item.master_file)
end
end
can :read, PlaylistItem do |playlist_item|
(can? :read, playlist_item.playlist) &&
(can? :read, playlist_item.master_file)
end
end

Expand All @@ -172,10 +172,10 @@ def marker_permissions
can [:create, :update, :delete], AvalonMarker do |marker|
can? :manage, marker.playlist_item.playlist
end
can :read, AvalonMarker do |marker|
(can? :read, marker.playlist_item.playlist) &&
(can? :read, marker.playlist_item.master_file)
end
end
can :read, AvalonMarker do |marker|
(can? :read, marker.playlist_item.playlist) &&
(can? :read, marker.playlist_item.master_file)
end
end

Expand Down
42 changes: 23 additions & 19 deletions app/views/playlists/_markers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,30 @@ Unless required by applicable law or agreed to in writing, software distributed
<div class="col-xs-3 col-md-3 text-right">Actions</div>
</div>
<% @markers.sort_by(&:start_time).each do |marker| %>
<% if can? :read, marker.master_file %>
<% start = marker.start_time.to_f/1000 %>
<div class="row marker" id="marker_row_<%= marker.id %>" data-offset='<%= start %>' data-marker='<%= marker.id %>'>
<%= form_for(marker, remote: true) do |f| %>
<div class="col-xs-7 col-md-8">
<a class='marker_title' data-offset='<%= start %>'><%= marker.title %></a>
<% if can? :read, marker %>
<% start = marker.start_time.to_f/1000 %>
<div class="row marker" id="marker_row_<%= marker.id %>" data-offset='<%= start %>' data-marker='<%= marker.id %>'>
<%= form_for(marker, remote: true) do |f| %>
<div class="col-xs-7 col-md-8">
<a class='marker_title' data-offset='<%= start %>'><%= marker.title %></a>
</div>
<div class="col-xs-2 col-md-1">
<span class='marker_start_time'><%= pretty_time(marker.start_time) %></span>
</div>
<div class="col-xs-3 col-md-3 text-right">
<% if can? :edit, marker %>
<%= button_tag name: 'edit_marker', id: "edit_marker_#{marker.id}", class:'btn btn-default btn-xs edit_marker', type: 'button' do %>
<i class='fa fa-edit' title='Edit'></i> <span class='sm-hidden'>Edit</span>
<% end %>
<% end %>
<% if can? :delete, marker %>
<%= button_tag name: 'delete_marker', class:'btn btn-danger btn-xs btn-confirmation', form: "edit_avalon_marker_#{marker.id}", data: {placement: 'top'} do %>
<i class='fa fa-times' title='Delete'></i> <span class='sm-hidden'>Delete</span>
<% end %>
<% end %>
</div>
<% end %>
</div>
<div class="col-xs-2 col-md-1">
<span class='marker_start_time'><%= pretty_time(marker.start_time) %></span>
</div>
<div class="col-xs-3 col-md-3 text-right">
<%= button_tag name: 'edit_marker', id: "edit_marker_#{marker.id}", class:'btn btn-default btn-xs edit_marker', type: 'button' do %>
<i class='fa fa-edit' title='Edit'></i> <span class='sm-hidden'>Edit</span>
<% end %>
<%= button_tag name: 'delete_marker', class:'btn btn-danger btn-xs btn-confirmation', form: "edit_avalon_marker_#{marker.id}", data: {placement: 'top'} do %>
<i class='fa fa-times' title='Delete'></i> <span class='sm-hidden'>Delete</span>
<% end %>
</div>
<% end %>
</div>
<% end %>
<% end %>
</div>
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

module Avalon
VERSION = '5.1.0'
VERSION = '5.1.1'
class MissingUserId < Exception; end

class Application < Rails::Application
Expand Down
26 changes: 26 additions & 0 deletions db/migrate/20160801161257_convert_tables_to_utf8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class ConvertTablesToUtf8 < ActiveRecord::Migration
def change_encoding(encoding,collation)
connection = ActiveRecord::Base.connection
if connection.adapter_name == 'Mysql2'
tables = connection.tables
dbname = connection.current_database
execute <<-SQL
ALTER DATABASE #{dbname} CHARACTER SET #{encoding} COLLATE #{collation};
SQL
tables.each do |tablename|
execute <<-SQL
ALTER TABLE #{dbname}.#{tablename} CONVERT TO CHARACTER SET #{encoding} COLLATE #{collation};
SQL
end
end
end

def up
change_encoding('utf8','utf8_general_ci')
end

def down
raise ActiveRecord::IrreversibleMigration
#change_encoding('latin1','latin1_swedish_ci')
end
end
20 changes: 20 additions & 0 deletions spec/models/avalon_marker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,25 @@
it { is_expected.to be_able_to(:read, avalon_marker) }
end
end

context 'when not logged in' do
let(:ability) { Ability.new(nil) }
let(:playlist) { FactoryGirl.create(:playlist, visibility: Playlist::PUBLIC) }

it { is_expected.not_to be_able_to(:create, avalon_marker) }
it { is_expected.not_to be_able_to(:update, avalon_marker) }
it { is_expected.not_to be_able_to(:delete, avalon_marker) }

context 'when master file is NOT readable by public' do
it { is_expected.not_to be_able_to(:read, avalon_marker) }
end

context 'when master file is readable by public' do
let(:media_object) { FactoryGirl.create(:published_media_object, visibility: 'public') }
let(:master_file) { FactoryGirl.create(:master_file, mediaobject: media_object) }

it { is_expected.to be_able_to(:read, avalon_marker) }
end
end
end
end
20 changes: 20 additions & 0 deletions spec/models/playlist_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,25 @@
it{ is_expected.to be_able_to(:read, playlist_item) }
end
end

context 'when other user' do
let(:ability){ Ability.new(nil) }
let(:playlist) { FactoryGirl.create(:playlist, visibility: Playlist::PUBLIC) }

it{ is_expected.not_to be_able_to(:create, playlist_item) }
it{ is_expected.not_to be_able_to(:update, playlist_item) }
it{ is_expected.not_to be_able_to(:delete, playlist_item) }

context 'when master file is NOT readable by public' do
it{ is_expected.not_to be_able_to(:read, playlist_item) }
end

context 'when master file is readable by public' do
let(:media_object) { FactoryGirl.create(:published_media_object, visibility: 'public') }
let(:master_file) { FactoryGirl.create(:master_file, mediaobject: media_object) }

it{ is_expected.to be_able_to(:read, playlist_item) }
end
end
end
end

0 comments on commit 28f5c64

Please sign in to comment.