Permalink
Browse files

Preselect language specified from server

  • Loading branch information...
1 parent 425c181 commit ae842e330b77a7262c05ec96c8bbbdb9396340d8 @honza honza committed Dec 31, 2012
Showing with 18 additions and 4 deletions.
  1. +18 −4 media/src/js/subtitle-editor/controllers/subtitle-list.js
@@ -150,19 +150,33 @@
});
};
- $scope.languageSelectChanged = function() {
- var vers;
- vers =_.sortBy($scope.language.versions, function(item) {
+ $scope.languageSelectChanged = function(lang) {
+ var vers, language;
+
+ if (lang) {
+ language = lang;
+ } else {
+ language = $scope.language;
+ }
+
+ vers =_.sortBy(language.versions, function(item) {
return item.number;
});
$scope.versions = vers.reverse();
+ if (vers.length && vers.length > 0) {
+ $scope.version = $scope.versions[0];
+ }
};
SubtitleStorage.getLanguages(function(languages) {
$scope.languages = languages;
+ $scope.language = _.find(languages, function(item) {
+ return item.editingLanguage;
+ });
+ $scope.languageSelectChanged($scope.language);
});
- $scope.versionChanged = function(newVersion) {
+ $scope.versionChanged = function(newVersion, oldVersion) {
if (!newVersion) {
return;
}

0 comments on commit ae842e3

Please sign in to comment.