Merge pull request #2906 from Raven24/fix-2770

fix for #2770
This commit is contained in:
Maxwell Salzberg 2012-03-06 22:36:53 -08:00
commit 76450f7882
4 changed files with 15 additions and 25 deletions

View file

@ -29,7 +29,7 @@
$('#file-upload').addClass("loading");
$('#publisher').find("input[type='submit']").attr('disabled','disabled');
$("#publisher textarea").addClass("with_attachments");
Publisher.wrapper().addClass("with_attachments");
$('#photodropzone').append(
"<li class='publisher_photo loading' style='position:relative;'>" +
"<img src='/images/ajax-loader2.gif' />" +
@ -43,7 +43,7 @@
url = responseJSON.data.photo.unprocessed_image.url,
currentPlaceholder = $('li.loading').first();
$("#publisher textarea").addClass("with_attachments");
Publisher.wrapper().addClass("with_attachments");
$('#new_status_message').append("<input type='hidden' value='" + id + "' name='photos[]' />");
// replace image placeholders
@ -68,10 +68,8 @@
success: function() {
photo.fadeOut(400, function(){
photo.remove();
textarea.css('paddingBottom', $("#photodropzone").height() + 10);
if ( $('.publisher_photo').length == 0){
textarea.removeClass("with_attachments");
textarea.css('paddingBottom', '');
Publisher.wrapper().removeClass("with_attachments");
}
});
}

View file

@ -8,7 +8,7 @@ app.views.Publisher = Backbone.View.extend({
events : {
"focus textarea" : "open",
"click #hide_publisher" : "close",
"click #hide_publisher" : "clear",
"submit form" : "createStatusMessage"
},
@ -48,10 +48,8 @@ app.views.Publisher = Backbone.View.extend({
},
clear : function() {
this.$('textarea')
.removeClass("with_attachments")
.css("paddingBottom", "")
.val("");
this.$('textarea').val("");
this.$('#publisher_textarea_wrapper').removeClass("with_attachments");
// remove photos
this.$("#photodropzone").find('li').remove();

View file

@ -15,6 +15,10 @@ var Publisher = {
return Publisher.cachedInput = Publisher.cachedInput || Publisher.form().find('#status_message_fake_text');
},
wrapper: function(){
return Publisher.cachedWrapper = Publisher.cachedWrapper || Publisher.form().find('#publisher_textarea_wrapper');
},
hiddenInput: function(){
return Publisher.cachedHiddenInput= Publisher.cachedHiddenInput || Publisher.form().find('#status_message_text');
},
@ -37,10 +41,8 @@ var Publisher = {
clear: function(){
$("#photodropzone").find('li').remove();
Publisher.input()
.removeClass("with_attachments")
.css('paddingBottom', '')
.mentionsInput("reset");
Publisher.input().mentionsInput("reset");
Publisher.wrapper().removeClass("with_attachments");
},
bindServiceIcons: function(){
@ -196,14 +198,6 @@ var Publisher = {
Publisher.bindServiceIcons();
Publisher.bindAspectToggles();
/* close text area */
Publisher.form().delegate("#hide_publisher", "click", function(){
$.each(Publisher.form().find("textarea"), function(idx, element){
$(element).val("");
});
Publisher.close();
});
Mentions.initialize(Publisher.input());
Publisher.input().bind("focus", function(){

View file

@ -839,9 +839,8 @@ form p.checkbox_select
:outline 0
:background transparent
&.with_attachments
:padding
:bottom 70px
&.with_attachments
:padding-bottom 38px
#photodropzone
:z-index 3
@ -856,6 +855,7 @@ form p.checkbox_select
:margin-right 4px
img
:width 50px
:max-height 55px
.circle
@include border-radius(20px)