VRFS-1194 changed recording/session drop-down list selection to unique ID text input

This commit is contained in:
Jonathan Kolyer 2014-02-20 10:01:25 -06:00
parent b281349bec
commit e0ae2e378e
4 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,7 @@ ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do
def create
promo = PromoLatest.create_with_params(params[:jam_ruby_promo_latest])
redirect_to('/admin/latests')
redirect_to admin_latests_path
end
def edit
@ -48,7 +48,7 @@ ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do
def update
resource.update_with_params(params[:jam_ruby_promo_latest]).save!
redirect_to('/admin/latests')
redirect_to admin_latests_path
end
end

View File

@ -1,6 +1,7 @@
<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_latests_path : "/admin/latests/#{@promo.id}") do |f| %>
<%= f.inputs :name => "Recording or Session", :for => :latest do |latest_form| %>
<%= latest_form.input :id, :as => :select, :collection => @latests.collect { |ll| [ll[:name], ll[:id]] }, :label => "Latest", :required => true, :selected => @promo.latest.try(:id) %>
<%= f.input(:latest_id, :label => "Unique ID (Recording or Session)", :input_html => {:maxlength => 128}) %>
<% #= latest_form.input :id, :as => :select, :collection => @latests.collect { |ll| [ll[:name], ll[:id]] }, :label => "Latest", :required => true, :selected => @promo.latest.try(:id) %>
<% end %>
<%= f.inputs do %>
<%= f.input(:position, :label => "Position", :input_html => {:maxlength => 4}) %>

View File

@ -107,7 +107,7 @@ class JamRuby::PromoLatest < JamRuby::Promotional
end
def update_with_params(params)
if (latest_id = params[:latest][:id]).present?
if (latest_id = params[:latest_id]).present?
self.latest = Recording.where(:id => latest_id).limit(1).all[0] ||
MusicSession.where(:id => latest_id).limit(1).all[0]
end

View File

@ -32,6 +32,7 @@ namespace :db do
end
task populate: :environment do
make_users(10) if 14 > User.count
make_friends
make_bands
make_band_members