* VRFS-924 haml added
This commit is contained in:
parent
c60322aaf4
commit
652c56dafd
|
|
@ -52,6 +52,8 @@ gem 'postgres-copy', '0.6.0'
|
|||
gem 'aws-sdk', '1.29.1'
|
||||
gem 'bugsnag'
|
||||
gem 'gon'
|
||||
gem 'cocoon'
|
||||
gem 'haml-rails'
|
||||
gem 'resque'
|
||||
gem 'resque-retry'
|
||||
gem 'resque-failed-job-mailer'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
ActiveAdmin.register JamRuby::Band, :as => 'Band' do
|
||||
ActiveAdmin.register JamRuby::Band, :as => 'Band' do
|
||||
collection_action :autocomplete_band_name, :method => :get
|
||||
|
||||
controller do
|
||||
autocomplete :band, :name, :full => true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
||||
|
||||
|
||||
collection_action :autocomplete_user_email, :method => :get
|
||||
|
||||
menu :label => 'Users', :parent => 'Users'
|
||||
|
||||
config.sort_order = 'created_at DESC'
|
||||
|
|
@ -11,7 +14,8 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
filter :created_at
|
||||
filter :updated_at
|
||||
|
||||
form do |ff|
|
||||
|
||||
form do |ff|
|
||||
ff.inputs "Details" do
|
||||
ff.input :email
|
||||
ff.input :admin
|
||||
|
|
@ -95,6 +99,8 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
|
||||
controller do
|
||||
|
||||
autocomplete :user, :email, :full => true
|
||||
|
||||
def create
|
||||
@jam_ruby_user = JamRuby::User.new(params[:jam_ruby_user])
|
||||
@jam_ruby_user.administratively_created = true
|
||||
|
|
|
|||
|
|
@ -1,18 +1,56 @@
|
|||
ActiveAdmin.register JamRuby::Recording, :as => 'Recording' do
|
||||
|
||||
menu :label => 'Recordings', :parent => 'Recordings'
|
||||
menu :label => 'Recording', :parent => 'Recordings'
|
||||
|
||||
config.sort_order = 'DESC updated_at'
|
||||
config.batch_actions = false
|
||||
# config.clear_action_items!
|
||||
config.filters = false
|
||||
|
||||
#form :partial => 'form'
|
||||
|
||||
collection_action :autocomplete_user_email, :method => :get
|
||||
form :partial => 'form'
|
||||
|
||||
controller do
|
||||
autocomplete :user, :email
|
||||
def new
|
||||
@recording = JamRuby::Recording.new
|
||||
super
|
||||
end
|
||||
|
||||
def create
|
||||
owner = User.find_by_email!(params[:jam_ruby_recording][:owner])
|
||||
band = User.find_by_band!(params[:jam_ruby_recording][:band])
|
||||
recording = Recording.new
|
||||
recording.owner = owner
|
||||
recording.band = band
|
||||
recording.save
|
||||
redirect_to("/admin/recordings/#{recording.id}")
|
||||
end
|
||||
|
||||
def edit
|
||||
@recording = resource
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
owner = User.find_by_email!(params[:jam_ruby_recording][:owner])
|
||||
band = Band.find_by_name!(params[:jam_ruby_recording][:band])
|
||||
recorded_tracks = params[:jam_ruby_recording][:recorded_tracks]
|
||||
recorded_tracks.each do |recorded_track|
|
||||
track = RecordedTrack.new
|
||||
track.client_id ||= 'fake'
|
||||
track.track_id ||= 'fake'
|
||||
track.client_track_id ||= 'fake'
|
||||
track.sound ||= 'stereo'
|
||||
track.recording = resource
|
||||
track.user = User.find_by_email!(recorded_track[:user])
|
||||
track.instrument = Instrument.find_by_instrument!(recorded_track[:instrument])
|
||||
resource.recorded_tracks << track
|
||||
end
|
||||
resource.owner = owner
|
||||
resource.band = band
|
||||
resource.save
|
||||
redirect_to("/admin/recordings/#{resource.id}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
//= require jquery.ui.widget
|
||||
//= require jquery.ui.datepicker
|
||||
//= require jquery.ui.dialog
|
||||
//= require jquery.ui.autocomplete
|
||||
//= require cocoon
|
||||
//= require active_admin/application
|
||||
//= require autocomplete-rails
|
||||
//= require base
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<%= semantic_form_for([:admin, @recording], :html => {:multipart => true}, :url => @recording.new_record? ? admin_recordings_path : "/admin/recordings/#{@recording.id}") do |f| %>
|
||||
<%= f.semantic_errors *f.object.errors.keys %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :owner, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path %>
|
||||
<%= f.input :band, :as => :autocomplete, :url => autocomplete_band_name_admin_bands_path %>
|
||||
|
||||
<%= f.fields_for :recorded_tracks do |recorded_track| %>
|
||||
<%= render 'recorded_track', f: recorded_track %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to_add_association 'add track', f, :recorded_tracks %>
|
||||
|
||||
<% end %>
|
||||
<%= f.actions %>
|
||||
<% end %>
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path %>
|
||||
<%= f.input :instrument, :collection => Instrument.all %>
|
||||
<% end %>
|
||||
.nested-fields
|
||||
= f.inputs :name => "Track" do
|
||||
= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path
|
||||
= f.input :instrument, :collection => Instrument.all
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<li class="control-group nested-fields">
|
||||
<div class="controls">
|
||||
<%= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path %>
|
||||
<%= f.input :instrument, :collection => Instrument.all %>
|
||||
</div>
|
||||
</li>
|
||||
|
|
@ -16,6 +16,9 @@ end
|
|||
|
||||
include JamRuby
|
||||
|
||||
User = JamRuby::User
|
||||
Band = JamRuby::Band
|
||||
|
||||
|
||||
module JamAdmin
|
||||
class Application < Rails::Application
|
||||
|
|
|
|||
|
|
@ -165,4 +165,7 @@ ActiveAdmin.setup do |config|
|
|||
# config.csv_options = {}
|
||||
|
||||
config.view_factory.footer = Footer
|
||||
|
||||
config.register_javascript 'autocomplete-rails.js'
|
||||
config.register_stylesheet 'jquery.ui.theme.css'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,16 +9,33 @@ JamAdmin::Application.routes.draw do
|
|||
devise_for :users, :class_name => "JamRuby::User", :path_prefix => '/admin', :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'}
|
||||
|
||||
|
||||
|
||||
|
||||
scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
|
||||
root :to => "admin/dashboard#index"
|
||||
|
||||
namespace :admin do
|
||||
resources :users do
|
||||
get :autocomplete_user_email, :on => :collection
|
||||
end
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
resources :bands do
|
||||
get :autocomplete_band_name, :on => :collection
|
||||
end
|
||||
end
|
||||
|
||||
ActiveAdmin.routes(self)
|
||||
|
||||
|
||||
|
||||
match '/api/artifacts' => 'artifacts#update_artifacts', :via => :post
|
||||
match '/api/mix/:id/enqueue' => 'admin/mixes#mix_again', :via => :post
|
||||
|
||||
mount Resque::Server.new, :at => "/resque"
|
||||
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
# first created -> highest priority.
|
||||
|
||||
|
|
|
|||
|
|
@ -273,6 +273,10 @@ module JamRuby
|
|||
true
|
||||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
private
|
||||
def self.validate_genres(genres, is_nil_ok)
|
||||
if is_nil_ok && genres.nil?
|
||||
|
|
|
|||
|
|
@ -49,5 +49,9 @@ module JamRuby
|
|||
MAP_ICON_NAME[self.id]
|
||||
end
|
||||
|
||||
def to_s
|
||||
description
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ module JamRuby
|
|||
belongs_to :band, :class_name => "JamRuby::Band", :inverse_of => :recordings
|
||||
belongs_to :music_session, :class_name => "JamRuby::MusicSession", :inverse_of => :recordings
|
||||
|
||||
validates :music_session, :presence => true
|
||||
validate :not_already_recording, :on => :create
|
||||
validate :not_still_finalizing_previous, :on => :create
|
||||
validate :not_playback_recording, :on => :create
|
||||
|
|
@ -36,7 +35,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def not_already_recording
|
||||
if music_session.is_recording?
|
||||
if music_session && music_session.is_recording?
|
||||
errors.add(:music_session, ValidationMessages::ALREADY_BEING_RECORDED)
|
||||
end
|
||||
end
|
||||
|
|
@ -45,7 +44,7 @@ module JamRuby
|
|||
# after a recording is done, users need to keep or discard it.
|
||||
# this checks if the previous recording is still being finalized
|
||||
|
||||
unless music_session.is_recording?
|
||||
unless !music_session || music_session.is_recording?
|
||||
previous_recording = music_session.most_recent_recording
|
||||
if previous_recording
|
||||
previous_recording.recorded_tracks.each do |recorded_track|
|
||||
|
|
@ -64,7 +63,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def not_playback_recording
|
||||
if music_session.is_playing_recording?
|
||||
if music_session && music_session.is_playing_recording?
|
||||
errors.add(:music_session, ValidationMessages::ALREADY_PLAYBACK_RECORDING)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if defined?(Bundler)
|
|||
# Bundler.require(:default, :assets, Rails.env)
|
||||
end
|
||||
|
||||
include JamRuby
|
||||
include JamRuby
|
||||
# require "rails/test_unit/railtie"
|
||||
|
||||
module SampleApp
|
||||
|
|
|
|||
Loading…
Reference in New Issue