vrfs-927: buzz admin fixes

This commit is contained in:
Jonathan Kolyer 2014-01-08 18:00:22 -06:00
parent bb2024fe19
commit 4b85863a33
8 changed files with 41 additions and 94 deletions

View File

@ -2,96 +2,35 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do
menu :label => 'Home Page Buzz'
config.sort_order = 'position ASC aasm_state DESC created_at DESC'
config.sort_order = 'position ASC aasm_state DESC updated_at DESC'
config.batch_actions = false
# config.clear_action_items!
config.filters = false
form :partial => 'form'
# index do
# column :email do |user| link_to(truncate(user.email, {:length => 12}), resource_path(user), {:title => "#{user.first_name} #{user.last_name} (#{user.email})"}) end
# column :updated_at do |uu| uu.updated_at.strftime(DATE_FORMAT) end
# column :created_at do |uu| uu.created_at.strftime(DATE_FORMAT) end
# column :city
# column :musician
# column 'Client DL' do |uu|
# if dd = uu.first_downloaded_client_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Client Run' do |uu|
# if dd = uu.first_ran_client_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Certified Gear' do |uu|
# if dd = uu.first_certified_gear_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Any Session' do |uu|
# if dd = uu.first_music_session_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Real Session' do |uu|
# if dd = uu.first_real_music_session_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Good Session' do |uu|
# if dd = uu.first_good_music_session_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Invited' do |uu|
# if dd = uu.first_invited_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Friended' do |uu|
# if dd = uu.first_friended_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Promoted' do |uu|
# if dd = uu.first_social_promoted_at
# dd.strftime(DATE_FORMAT)
# else
# ''
# end
# end
# column 'Recorded' do |uu|
# uu.first_recording_at
# end
# end
index do
column 'Short Text' do |pp| pp.text_short end
column 'Image' do |pp|
image_tag(pp.image_url, :size => '50x50')
end
column 'Long Text' do |pp| pp.text_long[0..256] end
column 'State' do |pp| pp.aasm_state end
column 'Position' do |pp| pp.position end
column 'Updated' do |pp| pp.updated_at end
default_actions
end
show do
attributes_table do
row :text_short
row :text_long
row 'Status' do |obj| obj.aasm_state end
# row :image do
# image_tag(ad.image.url)
# end
row :image do |obj|
image_tag(obj.image_url, :size => '50x50')
end
row 'State' do |obj| obj.aasm_state end
row 'Position' do |obj| obj.position end
row 'Updated' do |obj| obj.updated_at end
end
end
@ -113,6 +52,9 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do
def edit
@promo = resource
@promo.key = params[:key] if params[:key].present? && params[:key] != @promo.key
@uploader = @promo.image
@uploader.success_action_redirect = edit_admin_buzz_url(@promo)
super
end

View File

@ -1,5 +1,5 @@
ActiveAdmin.register JamRuby::User, :as => 'User Progression' do
PROGRESSION_DATE = '%Y-%m-%d %H:%M'
PROGRESSION_DATE = '%Y-%m-%d %H:%M' unless defined?(PROGRESSION_DATE)
menu :label => 'User Progression'

View File

@ -1,16 +1,20 @@
<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_buzzs_path : admin_buzzs_path(@promo)) do |f| %>
<% unless @promo.image_name.present? %>
<%= direct_upload_form_for @uploader do |f| %>
<p><%= f.file_field :image %></p>
<p><%= f.submit "Upload Image" %></p>
<% end %>
<% end %>
<%= semantic_form_for([:admin, @promo], :html => {:multipart => true}, :url => @promo.new_record? ? admin_buzzs_path : "/admin/buzzs/#{@promo.id}") do |f| %>
<%= f.inputs do %>
<%= hidden_field_tag :referring_url, URI::encode(request.referrer) %>
<%= f.input(:text_short, :label => "Short Text", :input_html => {:maxlength => 512}) %>
<%= f.input(:text_long, :label => "Long Text", :input_html => {:rows => 3, :maxlength => 4096}) %>
<%= f.input(:position, :label => "Position", :input_html => {:maxlength => 4}) %>
<%= f.input(:aasm_state, :as => :select, :collection => Promotional::STATES, :label => 'Status') %>
<p>File: <%= @promo.image_name %></p>
Image File: <%= @promo.image_name %>
<%= f.hidden_field :key %>
<% # = f.input(:photo, :as => :file, :hint => f.template.image_tag(@promo.image_url(:thumb), :size => '50x50')) if @promo.new_record? %>
<% end %>
<%= f.actions %>
<% end %>
<%= direct_upload_form_for @uploader do |f| %>
<p><%= f.file_field :image %></p>
<p><%= f.submit "Upload Image" %></p>
<% if @promo.image_name.present? %>
<%= f.actions %>
<% end %>
<% end %>

View File

@ -86,5 +86,8 @@ module JamAdmin
config.aws_artifact_bucket_public = 'jamkazam-dev-public'
config.aws_artifact_bucket = 'jamkazam-dev'
config.aws_artifact_cache = '315576000'
# for carrierwave_direct
config.action_controller.allow_forgery_protection = false
end
end

View File

@ -20,7 +20,6 @@ gem 'actionmailer', '3.2.13'
gem 'sendgrid'
gem 'aws-sdk', '1.29.1'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'aasm', '3.0.16'
gem 'devise', '>= 1.1.2'
gem 'postgres-copy'

View File

@ -46,7 +46,6 @@ gem 'filepicker-rails', '0.1.0'
gem 'aws-sdk', '1.29.1'
gem 'aasm', '3.0.16'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'fog'
gem 'unf' #optional fog dependency
gem 'devise', '>= 1.1.2'

View File

@ -105,8 +105,8 @@ if defined?(Bundler)
config.websocket_gateway_connect_time_stale = 2
config.websocket_gateway_connect_time_expire = 5
else
config.websocket_gateway_connect_time_stale = 6
config.websocket_gateway_connect_time_expire = 10
config.websocket_gateway_connect_time_stale = 300
config.websocket_gateway_connect_time_expire = 6000
end
config.websocket_gateway_internal_debug = false
config.websocket_gateway_port = 6767
@ -116,7 +116,8 @@ if defined?(Bundler)
# set this to false if you want to disable signups (lock down public user creation)
config.signup_enabled = true
config.storage_type = :file # or :fog, if using AWS
config.storage_type = :fog
# config.storage_type = :file # or :fog, if using AWS
# these only used if storage_type = :fog
config.aws_access_key_id = ENV['AWS_KEY']

View File

@ -31,7 +31,6 @@ gem 'sendgrid'
gem 'rb-readline'
gem 'aasm', '3.0.16'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'devise'
gem 'postgres-copy'
gem 'aws-sdk', '1.29.1'