Sha256: abe2dc43e670196d253d3827f6f020a3ca6ac363fd32fd0d4614ca46c5737ec2
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
#= require partystreusel/base class Readmore extends Partystreusel.Base @className = 'Readmore' constructor: (el) -> super @contentDiv = $('<div/>') .append(@$el.contents()) .addClass('hide') @$el.append(@contentDiv) return if @contentDiv.text().trim() == '' @button = @renderButton('open') $(@button).bind 'click', @toggle @$el.append(@button) toggle: (event) => @button.toggleClass('open close') @button.text(@buttonText()) @contentDiv.slideToggle => @contentDiv.toggleClass('hide') @contentDiv.css('display', "") @contentDiv.removeAttr('style') if @contentDiv.attr('style') == '' return false buttonState: -> classes = @button.attr('class').split(' ') classes = classes.filter (v) -> v != 'button' classes[0] buttonText: (state = @buttonState()) -> I18n.t("readmore.button_text.#{state}") renderButton: (state) => text = @buttonText(state) $('<a></a>') .addClass(state + ' button') .attr('href', '#') .html(text) Partystreusel.Readmore = Readmore
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
partystreusel-1.0.7 | app/assets/javascripts/partystreusel/readmore.js.coffee |