VRFS-2351 : JamTracks admin - merge from feature/jam_tracks_merge.

This commit is contained in:
Steven Miers 2014-11-16 16:24:00 -06:00
parent b01b3ecd7d
commit 497ac657ad
9 changed files with 224 additions and 0 deletions

7
admin/.rakeTasks Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>

View File

@ -0,0 +1,8 @@
ActiveAdmin.register JamRuby::JamTrackLicensor, :as => 'JamTrack Licensors' do
menu :label => 'JamTrack Licensors', :parent => 'JamTracks'
config.sort_order = 'name_asc'
config.batch_actions = false
end

View File

@ -0,0 +1,57 @@
ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
menu :label => 'JamTracks', :parent => 'JamTracks'
config.sort_order = 'name_asc'
config.batch_actions = false
filter :genre
filter :status, :as => :select, collection: JamRuby::JamTrack::STATUS
form :partial => 'form'
index do
column :id
column :name
column :description
column :bpm
column :time_signature
column :status
column :recording_type
column :original_artist
column :songwriter
column :publisher
column :licensor
column :pro
column :genre
column :sales_region
column :price
column :reproduction_royalty
column :public_performance_royalty
column :reproduction_royalty_amount
column :licensor_royalty_amount
column :pro_royalty_amount
column :url
column :created_at
column :jam_track_tracks do |jam_track|
table_for jam_track.jam_track_tracks.order('position ASC') do
column :id
column :track_type
column :instrument
column :part
column :track do |track|
link_to 'Play', '#'
end
end
end
# default_actions # use this for all view/edit/delete links
column "Actions" do |jam_track|
links = ''.html_safe
links << link_to("Show Tracks", '#', :class => "member_link view_link show_tracks")
links << link_to("Update", edit_resource_path(jam_track), :class => "member_link edit_link")
links
end
end
end

View File

@ -0,0 +1,43 @@
$(document).ready(function() {
$("th.jam_track_tracks").css('display', 'none');
$("td.jam_track_tracks").css('display', 'none');
$(".show_tracks").click(function(e) {
e.preventDefault();
var $rowJamTrack = $(this).parents('tr');
var $jamTrackTracks = $($rowJamTrack).find("td.jam_track_tracks");
var count = $jamTrackTracks.find("table tbody tr").length;
if ($rowJamTrack.next().attr('id') == "jam_track_tracks_detail") {
$(this).html("Show Tracks");
$rowJamTrack.next().remove();
}
else {
$(this).html('Hide Tracks');
if (count == 0) {
$rowJamTrack.after(
$("<tr id=\"jam_track_tracks_detail\"></tr>").html(
$("<td colspan=\"18\"></td>")
).append(
$("<td colspan=\"4\"></td>").html(
"No Tracks"
)
)
);
}
else {
$rowJamTrack.after(
$("<tr id=\"jam_track_tracks_detail\"></tr>").html(
$("<td colspan=\"18\"></td>")
).append(
$("<td colspan=\"4\"></td>").html(
$jamTrackTracks.html()
)
)
);
}
}
})
});

View File

@ -0,0 +1,31 @@
= semantic_form_for([:admin, resource], :html => {:multipart => true}, :url => resource.new_record? ? admin_jam_tracks_path : "#{ENV['RAILS_RELATIVE_URL_ROOT']}/admin/jam_tracks/#{resource.id}") do |f|
= f.semantic_errors *f.object.errors.keys
= f.inputs name: 'JamTrack fields' do
= f.input :name
= f.input :description
= f.input :bpm
= f.input :time_signature, collection: JamRuby::JamTrack::TIME_SIGNATURES
= f.input :status, collection: JamRuby::JamTrack::STATUS
= f.input :recording_type, collection: JamRuby::JamTrack::RECORDING_TYPE
= f.input :original_artist
= f.input :songwriter
= f.input :publisher
= f.input :licensor, collection: JamRuby::JamTrackLicensor.all
= f.input :pro, collection: JamRuby::JamTrack::PRO
= f.input :genre, collection: JamRuby::Genre.all
= f.input :sales_region, collection: JamRuby::JamTrack::SALES_REGION
= f.input :price
= f.input :reproduction_royalty, :label => 'Reproduction Royalty'
= f.input :public_performance_royalty, :label => 'Public Performance Royalty'
= f.input :reproduction_royalty_amount
= f.input :licensor_royalty_amount
= f.input :pro_royalty_amount
= f.input :url, :as => :file, :label => 'Audio File'
= f.semantic_fields_for :jam_track_tracks do |track|
= render 'jam_track_track_fields', f: track
.links
= link_to_add_association 'Add Track', f, :jam_track_tracks, class: 'button', style: 'margin:20px;padding:10px 20px'
= f.actions

View File

@ -0,0 +1,18 @@
= f.inputs name: 'Track fields' do
%ol.nested-fields
= f.input :track_type, :as => :select, collection: JamRuby::JamTrackTrack::TRACK_TYPE
= f.input :instrument, collection: Instrument.all
= f.input :part
= f.input :position
- if f.object.new_record?
%p{style: 'margin-left:10px'}
%i before you can upload, you must select 'Update JamTrack'
- else
= f.input :url, :as => :file, :label => 'Track file'
- unless f.object.nil? || f.object[:url].nil?
.current_file_holder{style: 'margin-bottom:10px'}
%a{href: f.object.sign_url(3600), style: 'padding:0 0 0 20px'} Download
= link_to_remove_association "Delete Track", f, class: 'button', style: 'margin-left:10px'

View File

@ -134,5 +134,10 @@ module JamAdmin
# recording upload/download configs
config.max_track_upload_failures = 10
config.max_track_part_upload_failures = 3
# Use Private API Keys to communicate with Recurly's API v2. See https://docs.recurly.com/api/basics/authentication to learn more.
config.recurly_private_api_key = '7d623daabfc2434fa2a893bb008eb3e6'
# Use Public Keys to identify your site when using Recurly.js. See https://docs.recurly.com/js/#include to learn more.
config.recurly_public_api_key = 'sc-SZlO11shkeA1WMGuISLGg5'
end
end

View File

@ -42,4 +42,9 @@ JamAdmin::Application.configure do
config.twitter_app_secret = 'PfG1jAUMnyrimPcDooUVQaJrG1IuDjUyGg5KciOo'
config.redis_host = "localhost:6379:1" # go to another db to not cross pollute into dev/production redis dbs
# Use Private API Keys to communicate with Recurly's API v2. See https://docs.recurly.com/api/basics/authentication to learn more.
config.recurly_private_api_key = '4631527f203b41848523125b3ae51341'
# Use Public Keys to identify your site when using Recurly.js. See https://docs.recurly.com/js/#include to learn more.
config.recurly_public_api_key = 'sc-s6G2OA80Rwyvsb1RmS3mAE'
end

View File

@ -205,4 +205,54 @@ FactoryGirl.define do
latency_tester.save
end
end
factory :jam_track_licensor, :class => JamRuby::JamTrackLicensor do
sequence(:name) { |n| "licensor-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:attention) { |n| "attention-#{n}" }
sequence(:address_line_1) { |n| "address1-#{n}" }
sequence(:address_line_2) { |n| "address2-#{n}" }
sequence(:city) { |n| "city-#{n}" }
sequence(:state) { |n| "state-#{n}" }
sequence(:zip_code) { |n| "zipcode-#{n}" }
sequence(:contact) { |n| "contact-#{n}" }
sequence(:email) { |n| "email-#{n}" }
sequence(:phone) { |n| "phone-#{n}" }
end
factory :jam_track, :class => JamRuby::JamTrack do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
bpm 100.1
time_signature '4/4'
status 'Production'
recording_type 'Cover'
sequence(:original_artist) { |n| "original-artist-#{n}" }
sequence(:songwriter) { |n| "songwriter-#{n}" }
sequence(:publisher) { |n| "publisher-#{n}" }
pro 'ASCAP'
sales_region 'United States'
price 1.99
reproduction_royalty true
public_performance_royalty true
reproduction_royalty_amount 0.999
licensor_royalty_amount 0.999
pro_royalty_amount 0.999
genre JamRuby::Genre.first
association :licensor, factory: :jam_track_licensor
end
factory :jam_track_track, :class => JamRuby::JamTrackTrack do
position 1
part 'lead guitar'
track_type 'Track'
instrument JamRuby::Instrument.find('electric guitar')
association :jam_track, factory: :jam_track
end
factory :jam_track_right, :class => JamRuby::JamTrackRight do
association :jam_track, factory: :jam_track
association :user, factory: :user
end
end