MS DG form now works reasonably well. still need to limit number of photos

This commit is contained in:
maxwell 2010-11-19 15:21:40 -08:00 committed by danielvincent
parent fb0dc2db7e
commit 7f97b6f812
4 changed files with 19 additions and 19 deletions

View file

@ -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

View file

@ -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)

View file

@ -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();
});
};

View file

@ -775,6 +775,7 @@ label
:top 0
ul
:padding 0
>li
:display inline
:margin-right 2px