diff --git a/admin/app/admin/promo_buzz.rb b/admin/app/admin/promo_buzz.rb index e87d85e33..e3d0035b1 100644 --- a/admin/app/admin/promo_buzz.rb +++ b/admin/app/admin/promo_buzz.rb @@ -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 diff --git a/admin/app/admin/user_progression.rb b/admin/app/admin/user_progression.rb index 0ae1413c2..ab8f73c84 100644 --- a/admin/app/admin/user_progression.rb +++ b/admin/app/admin/user_progression.rb @@ -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' diff --git a/admin/app/views/admin/buzzs/_form.html.erb b/admin/app/views/admin/buzzs/_form.html.erb index cffb5c38e..96d6b7b83 100644 --- a/admin/app/views/admin/buzzs/_form.html.erb +++ b/admin/app/views/admin/buzzs/_form.html.erb @@ -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| %> +
<%= f.file_field :image %>
+<%= f.submit "Upload Image" %>
+ <% 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') %> -File: <%= @promo.image_name %>
+ 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| %> -<%= f.file_field :image %>
-<%= f.submit "Upload Image" %>
+ <% if @promo.image_name.present? %> + <%= f.actions %> + <% end %> <% end %> diff --git a/admin/config/application.rb b/admin/config/application.rb index 75bebc077..f3b218211 100644 --- a/admin/config/application.rb +++ b/admin/config/application.rb @@ -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 diff --git a/ruby/Gemfile b/ruby/Gemfile index 768695548..19c5f3743 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -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' diff --git a/web/Gemfile b/web/Gemfile index 422ed0da6..0f5f3066e 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -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' diff --git a/web/config/application.rb b/web/config/application.rb index 6d5e6d5ec..48f2807c5 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -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'] diff --git a/websocket-gateway/Gemfile b/websocket-gateway/Gemfile index 33f9f524f..301837131 100644 --- a/websocket-gateway/Gemfile +++ b/websocket-gateway/Gemfile @@ -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'