mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
fix flash on untranslated content
This commit is contained in:
parent
0ebbbac9a6
commit
311b42ad25
@ -350,9 +350,15 @@ angular.module('docs',
|
||||
'en_*': 'en',
|
||||
'fr_*': 'fr',
|
||||
'*': 'en'
|
||||
})
|
||||
.determinePreferredLanguage()
|
||||
.fallbackLanguage('en');
|
||||
});
|
||||
|
||||
if (!_.isUndefined(localStorage.overrideLang)) {
|
||||
// Set the current language if an override is saved in local storage
|
||||
$translateProvider.use(localStorage.overrideLang);
|
||||
} else {
|
||||
// Or else determine the language based on the user's browser
|
||||
$translateProvider.determinePreferredLanguage();
|
||||
}
|
||||
|
||||
// Configuring Timago
|
||||
timeAgoSettings.overrideLang = $translateProvider.preferredLanguage();
|
||||
|
@ -3,24 +3,21 @@
|
||||
/**
|
||||
* Footer controller.
|
||||
*/
|
||||
angular.module('docs').controller('Footer', function($scope, Restangular, $translate, timeAgoSettings) {
|
||||
angular.module('docs').controller('Footer', function($scope, $rootScope, Restangular, $translate, timeAgoSettings) {
|
||||
// Load app data
|
||||
Restangular.one('app').get().then(function(data) {
|
||||
$scope.app = data;
|
||||
});
|
||||
|
||||
$scope.currentLang = $translate.use();
|
||||
// Save the current language to local storage
|
||||
$rootScope.$on('$translateChangeSuccess', function() {
|
||||
$scope.currentLang = $translate.use();
|
||||
timeAgoSettings.overrideLang = $scope.currentLang;
|
||||
localStorage.overrideLang = $scope.currentLang;
|
||||
});
|
||||
|
||||
// Change the current language and save it to local storage
|
||||
// Change the current language
|
||||
$scope.changeLanguage = function(lang) {
|
||||
$translate.use(lang);
|
||||
timeAgoSettings.overrideLang = lang;
|
||||
localStorage.overrideLang = lang;
|
||||
$scope.currentLang = lang;
|
||||
};
|
||||
|
||||
// Set the current language if an override is saved in local storage
|
||||
if (!_.isUndefined(localStorage.overrideLang)) {
|
||||
$scope.changeLanguage(localStorage.overrideLang);
|
||||
}
|
||||
});
|
@ -30,6 +30,7 @@
|
||||
<script src="lib/colorpicker.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.translate.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.translate-loader-static-files.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.sanitize.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.touch.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-router.js" type="text/javascript"></script>
|
||||
@ -88,7 +89,7 @@
|
||||
<script src="app/docs/directive/AclEdit.js" type="text/javascript"></script>
|
||||
<!-- endref -->
|
||||
</head>
|
||||
<body>
|
||||
<body translate-cloak>
|
||||
<nav class="navbar navbar-inverse" role="navigation" ng-controller="Navigation">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle"
|
||||
|
@ -0,0 +1,112 @@
|
||||
/*!
|
||||
* angular-translate - v2.16.0 - 2017-11-01
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateStaticFilesLoader.$inject = ['$q', '$http'];
|
||||
angular.module('pascalprecht.translate')
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateStaticFilesLoader
|
||||
* @requires $q
|
||||
* @requires $http
|
||||
*
|
||||
* @description
|
||||
* Creates a loading function for a typical static file url pattern:
|
||||
* "lang-en_US.json", "lang-de_DE.json", etc. Using this builder,
|
||||
* the response of these urls must be an object of key-value pairs.
|
||||
*
|
||||
* @param {object} options Options object, which gets prefix, suffix, key, and fileMap
|
||||
*/
|
||||
.factory('$translateStaticFilesLoader', $translateStaticFilesLoader);
|
||||
|
||||
function $translateStaticFilesLoader($q, $http) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (!options || (!angular.isArray(options.files) && (!angular.isString(options.prefix) || !angular.isString(options.suffix)))) {
|
||||
throw new Error('Couldn\'t load static files, no files and prefix or suffix specified!');
|
||||
}
|
||||
|
||||
if (!options.files) {
|
||||
options.files = [{
|
||||
prefix: options.prefix,
|
||||
suffix: options.suffix
|
||||
}];
|
||||
}
|
||||
|
||||
var load = function (file) {
|
||||
if (!file || (!angular.isString(file.prefix) || !angular.isString(file.suffix))) {
|
||||
throw new Error('Couldn\'t load static file, no prefix or suffix specified!');
|
||||
}
|
||||
|
||||
var fileUrl = [
|
||||
file.prefix,
|
||||
options.key,
|
||||
file.suffix
|
||||
].join('');
|
||||
|
||||
if (angular.isObject(options.fileMap) && options.fileMap[fileUrl]) {
|
||||
fileUrl = options.fileMap[fileUrl];
|
||||
}
|
||||
|
||||
return $http(angular.extend({
|
||||
url: fileUrl,
|
||||
method: 'GET'
|
||||
}, options.$http))
|
||||
.then(function(result) {
|
||||
return result.data;
|
||||
}, function () {
|
||||
return $q.reject(options.key);
|
||||
});
|
||||
};
|
||||
|
||||
var promises = [],
|
||||
length = options.files.length;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
promises.push(load({
|
||||
prefix: options.files[i].prefix,
|
||||
key: options.key,
|
||||
suffix: options.files[i].suffix
|
||||
}));
|
||||
}
|
||||
|
||||
return $q.all(promises)
|
||||
.then(function (data) {
|
||||
var length = data.length,
|
||||
mergedData = {};
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
for (var key in data[i]) {
|
||||
mergedData[key] = data[i][key];
|
||||
}
|
||||
}
|
||||
|
||||
return mergedData;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$translateStaticFilesLoader.displayName = '$translateStaticFilesLoader';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
File diff suppressed because it is too large
Load Diff
@ -1794,6 +1794,20 @@ angular.module('ui.bootstrap.pagination', [])
|
||||
});
|
||||
}
|
||||
|
||||
if (attrs.nextText) {
|
||||
attrs.$observe('nextText', function(value) {
|
||||
nextText = paginationCtrl.getAttributeValue(value, config.nextText, true);
|
||||
paginationCtrl.render();
|
||||
});
|
||||
}
|
||||
|
||||
if (attrs.previousText) {
|
||||
attrs.$observe('previousText', function(value) {
|
||||
previousText = paginationCtrl.getAttributeValue(value, config.previousText, true);
|
||||
paginationCtrl.render();
|
||||
});
|
||||
}
|
||||
|
||||
// Create page object used in template
|
||||
function makePage(number, text, isActive, isDisabled) {
|
||||
return {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<img src="img/loader.gif" ng-show="!logs" />
|
||||
|
||||
<div ng-show="logs">
|
||||
<div>
|
||||
<div class="well drop-zone">
|
||||
<h3><span class="glyphicon glyphicon-cloud-upload"></span> {{ 'document.default.quick_upload' | translate }}</h3>
|
||||
<div class="row upload-zone" ng-model="dropFiles" ng-file-drop drag-over-class="bg-success"
|
||||
@ -55,6 +55,8 @@
|
||||
|
||||
<div ui-view="file"></div>
|
||||
|
||||
<h3><span class="glyphicon glyphicon-tasks"></span> {{ 'document.default.latest_activity' | translate }}</h3>
|
||||
<audit-log logs="logs" />
|
||||
<div ng-show="logs.length > 0">
|
||||
<h3><span class="glyphicon glyphicon-tasks"></span> {{ 'document.default.latest_activity' | translate }}</h3>
|
||||
<audit-log logs="logs" />
|
||||
</div>
|
||||
</div>
|
@ -335,6 +335,11 @@ input[readonly].share-link {
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
// Translate
|
||||
.translate-cloak {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// Heart
|
||||
.glyphicon-heart {
|
||||
&:hover {
|
||||
|
Loading…
Reference in New Issue
Block a user