diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index ced6548c9..764dcebb6 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -10,26 +10,22 @@ class StatusMessagesController < ApplicationController def create - - @photos = Photo.all(:id.in => params[:photos]) - - puts @photos.inspect - - - + photos = Photo.all(:id.in => [*params[:photos]]) public_flag = params[:status_message][:public] public_flag.to_s.match(/(true)/) ? public_flag = true : public_flag = false params[:status_message][:public] = public_flag + @status_message = current_user.build_post(:status_message, params[:status_message]) - status_message = current_user.build_post(:status_message, params[:status_message]) + @status_message.photos += photos unless photos.nil? - status_message.photos += @photos - if status_message.save(:safe => true) - raise 'MongoMapper failed to catch a failed save' unless status_message.id - current_user.dispatch_post(status_message, :to => params[:status_message][:to]) + puts "got it" + if @status_message.save(:safe => true) + raise 'MongoMapper failed to catch a failed save' unless @status_message.id + current_user.dispatch_post(@status_message, :to => params[:status_message][:to]) end - redirect_to :back + + render :nothing => true end diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index ceae0ebba..65e922a07 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -15,14 +15,15 @@ // $("#publisher .options_and_submit").fadeIn(50); //}); - //$("#publisher form").live("submit", function(evt){ - //$("#publisher .options_and_submit").hide(); - //}); + $("#publisher form").live("submit", function(evt){ + $("#photodropzone").find('li').remove(); + //$("#publisher").find("input[name='photos[]']").remove(); + }); #publisher = owner_image_link - = form_for StatusMessage.new, :html => {:multipart => true,}, :remote => true do |status| + = form_for(StatusMessage.new, :remote => true) do |status| %ul#photodropzone = status.error_messages #file-upload.button @@ -56,5 +57,5 @@ .fancybox_content #question_mark_pane = render 'shared/public_explain' - #publisher_photo_upload - = render 'photos/new_photo', :aspect_id => (aspect == :all ? aspect : aspect.id) +#publisher_photo_upload + = render 'photos/new_photo', :aspect_id => (aspect == :all ? aspect : aspect.id) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 2e0d51ae4..8638ad64e 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -101,6 +101,8 @@ $.fn.clearForm = function() { this.checked = false; else if (tag == 'select') this.selectedIndex = -1; + else if (this.name == 'photos[]') + this.value = ''; $(this).blur(); }); }; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 2ca8b504f..646601a24 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -775,6 +775,7 @@ label :top 0 ul + :padding 0 >li :display inline :margin-right 2px