-
-
Save syntruth/352f5a73dea904ed4a4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App.Views.SortCaret extends Backbone.View | |
tagName: 'span' | |
className: 'sort-caret-container' | |
downCaret: 'fa-caret-down' | |
upCaret: 'fa-caret-up' | |
constructor: (options = {}) -> | |
@downCaret = options.downCaret if options.downCaret | |
@upCaret = options.upCaret if options.upCaret | |
super(options) | |
render: () -> | |
this._insertIcon() | |
this.setDownCaret() | |
return this | |
setDownCaret: () -> this._setCaret @downCaret, @upCaret | |
setUpCaret: () -> this._setCaret @upCaret, @downCaret | |
_insertIcon: () -> | |
@icon = $('<i class="sort-caret fa" />') | |
this.$el.html @icon | |
return | |
_setCaret: (addCaret, removeCaret) -> | |
@icon.removeClass removeCaret | |
@icon.addClass addCaret | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment