spec/dummy/tmp/cache/assets/D68/190/sprockets%2F55c22d0f17a0ed195dd81cbe88606be2 in woople-theme-0.6.20 vs spec/dummy/tmp/cache/assets/D68/190/sprockets%2F55c22d0f17a0ed195dd81cbe88606be2 in woople-theme-0.6.21

- old
+ new

@@ -1,8 +1,8 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1351005716.3351538: @value",“{I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1351029485.663071: @value"Ë”{I" class:EFI"BundledAsset;FI"logical_path;FI".organization_dashboard_controller_spec.js;FI" pathname;FI"e/Users/paul/Sites/woople-theme/spec/javascripts/organization_dashboard_controller_spec.js.coffee;FI"content_type;FI"application/javascript;FI" -mtime;FI"2012-10-23T11:21:44-04:00;FI" length;Fi+‘I" digest;F"%e56f6271e2df131495aa8d73a3171e6cI" source;FI"+‘/*! +mtime;FI"2012-10-23T17:56:09-04:00;FI" length;FiÊ’I" digest;F"%64fc11207e45198e8be5881eee0b4e44I" source;FI"Ê’/*! * jQuery JavaScript Library v1.8.2 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ @@ -14051,47 +14051,51 @@ this.log('fire reminder callback'); this.sendReminder(reminderPath, button); }; var clickBinder = function(button){ - var reminderPath = $(button).data('reminderPath'); - $(button).click(_.bind(reminderClick, this, reminderPath, button)); + var reminderPath = $(button).data('reminderPath'); + var debouncedClickHandler = _.debounce(reminderClick, 300); // avoid button click spamming. + var boundClickHandler = _.bind(debouncedClickHandler, this, reminderPath, button); + $(button).click(boundClickHandler); }; var buttons = $('#organization-accounts .remind-column .btn'); _.each(buttons, clickBinder , this); }; OrganizationDashboardController.prototype.sendReminder = function(reminderPath, button) { + $(button).prop('disabled', true); $.ajax({ type : 'POST', url : reminderPath, context : button, success : this.changeButton, error : this.remindError }); }; OrganizationDashboardController.prototype.changeButton = function(data, textStatus, jqXHR) { - $(this).addClass('btn-success sent').prop('disabled', true); + $(this).addClass('btn-success sent'); }; OrganizationDashboardController.prototype.remindError = function(jqXHR, textStatus, errorThrown) { alert($(this).data('errorMessage')); + $(this).prop('disabled', false); }; OrganizationDashboardController.prototype.log = function(message) { if (!this.debugMode) return; console.log("[OrganizationDashboardController]", message); }; OrganizationDashboardController.prototype.isPhone = function() { - return this.windowWidth() <= 480 ? true : false; + return this.windowWidth() <= 480 ? true : false; }; OrganizationDashboardController.prototype.windowWidth = function() { - $(window).width(); + return $(window).width(); }; this.OrganizationDashboardController = OrganizationDashboardController; })(this); @@ -14138,16 +14142,23 @@ this.sut.mobileSetup(); return expect($('#organization-accounts button').hasClass('btn-large')).to.be["false"]; }); }); describe('bindReminderButtons', function() { + before(function() { + return this.clock = sinon.useFakeTimers(); + }); + after(function() { + return this.clock.restore(); + }); return it('binds the callback to the click event', function() { var callbackStub; sinon.stub(this.sut, 'createPopover'); this.sut.init(); callbackStub = sinon.stub(this.sut, 'sendReminder'); $('#organization-accounts .remind-column .btn').first().click(); + this.clock.tick(300); return expect(callbackStub).to.have.been.calledOnce; }); }); describe('sendReminder', function() { beforeEach(function() { @@ -14220,6 +14231,6 @@ }); }); }); }).call(this); -;TI"required_assets_digest;F"%273099343c7e2dfdc6089eecd4c1fe3eI" _version;F"%9f3b95dd7ea3030dc35985c0a8020862 +;TI"required_assets_digest;F"%cd8f70dbc954efc3427f1687949ba9a9I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862 \ No newline at end of file