Created
February 6, 2012 21:34
-
-
Save rissajeanne/1755036 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
updateVersionDropdown : function() { | |
var versionsByLang = {}; | |
// Loop through the version model | |
_.each( | |
// Group versions by language, | |
// and sort the lang keys alphabetically. | |
_.groupBy(_.sortBy(this._versions.models, function (ver) { | |
return ver.get('lang'); | |
}), function (ver) { | |
return ver.get('lang'); | |
}), | |
// Sort the versions within each lang group | |
// and populate the new object | |
function(version, lang) { | |
versionsByLang[lang] = _.sortBy(version, function(ver) { | |
return ver.get('display_abbreviation'); | |
}); | |
} | |
); | |
var selectorHTML = ABS.jst.PassageVersionSelector({ | |
versionsByLang: versionsByLang, | |
current: this.collection.primaryModel.get('version') | |
}); | |
this.$('div.change-version').empty().append(selectorHTML); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment