Sha256: 5e2c534c73b04ca2f80d2b1dcadcec70c50cbabe8ba997a82e34a391da04a3fc
Contents?: true
Size: 653 Bytes
Versions: 6
Compression:
Stored size: 653 Bytes
Contents
class Admin.Views.Counter extends Backbone.View el: 'body' initialize: (options) => @max = options.max @target = "##{options.target}" @setupCounter() @updateCounter() $(@target).keyup => @updateCounter() setupCounter: => $(@target).siblings('label').append """ (<span class="maxlength">#{@max}</span>) """ @counter = $(@target).siblings('label').children('.maxlength') updateCounter: => charsRemaining = @max - $(@target).val().length $(@counter).html charsRemaining if charsRemaining > 10 $(@counter).removeClass('warning') else $(@counter).addClass('warning')
Version data entries
6 entries across 6 versions & 1 rubygems