From 0883ce1dbbb2d71f7ff349e4f01952b0d3d914d6 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 21 Mar 2012 12:09:03 -0700 Subject: [PATCH] fix a bunch of cukes. the disabled functionilty in rails helpers changed and we had to update out JS accordingly --- app/controllers/aspect_memberships_controller.rb | 3 ++- public/javascripts/publisher.js | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/aspect_memberships_controller.rb b/app/controllers/aspect_memberships_controller.rb index 89327f420..118ec33af 100644 --- a/app/controllers/aspect_memberships_controller.rb +++ b/app/controllers/aspect_memberships_controller.rb @@ -44,8 +44,9 @@ class AspectMembershipsController < ApplicationController def create @person = Person.find(params[:person_id]) @aspect = current_user.aspects.where(:id => params[:aspect_id]).first + @contact = current_user.share_with(@person, @aspect) - if @contact = current_user.share_with(@person, @aspect) + if @contact flash.now[:notice] = I18n.t('aspects.add_to_aspect.success') respond_with AspectMembership.where(:contact_id => @contact.id, :aspect_id => @aspect.id).first else diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js index cda29e862..44552f65b 100644 --- a/public/javascripts/publisher.js +++ b/public/javascripts/publisher.js @@ -24,7 +24,7 @@ var Publisher = { }, submit: function(){ - return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find('#status_message_submit'); + return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find("input[type='submit']"); }, determineSubmitAvailability: function(){ @@ -32,8 +32,8 @@ var Publisher = { isSubmitDisabled = Publisher.submit().attr('disabled'), isPhotoAttached = ($("#photodropzone").children().length > 0); - if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) { - Publisher.submit().attr('disabled', true); + if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) { + Publisher.submit().attr('disabled', 'disabled'); } else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) { Publisher.submit().removeAttr('disabled'); } @@ -43,6 +43,8 @@ var Publisher = { $("#photodropzone").find('li').remove(); Publisher.input().mentionsInput("reset"); Publisher.wrapper().removeClass("with_attachments"); + Publisher.hiddenInput().val(''); + Publisher.determineSubmitAvailability() }, bindServiceIcons: function(){