本文整理汇总了TypeScript中entcore.idiom类的典型用法代码示例。如果您正苦于以下问题:TypeScript idiom类的具体用法?TypeScript idiom怎么用?TypeScript idiom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了idiom类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
link:(scope:any) => {
scope.addAnswer = function(text_left = '', text_right = '') {
var newAnswer = {
text_left : text_left,
text_right : text_right
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (!scope.grain.grain_data.custom_data) {
scope.grain.grain_data.custom_data = new AssociationCustomData();
scope.addAnswer(idiom.translate('exercizer.grain.asso.left.response'), idiom.translate('exercizer.grain.asso.right.response'));
}
scope.deleteAnswer = function(answer){
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if(index !== -1){
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例2: function
link:(scope:any) => {
scope.addAnswer = function(isChecked = false, text = '') {
var newAnswer = {
isChecked : isChecked,
text : text
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (angular.isUndefined(scope.grain.grain_data.custom_data)) {
scope.grain.grain_data.custom_data = new QcmCustomData();
scope.addAnswer(true, idiom.translate('exercizer.grain.qcm.default1'));
scope.addAnswer(false, idiom.translate('exercizer.grain.qcm.default2'));
}
scope.deleteAnswer = function(answer){
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if (index !== -1) {
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例3: function
link:(scope:any) => {
scope.addAnswer = function(text = ''){
var newOrder = (window as any).parseFloat(getLastOrder()) + 1;
var newAnswer = {
order_by : newOrder,
index : newOrder - 1,
text : text
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (angular.isUndefined(scope.grain.grain_data.custom_data)) {
scope.grain.grain_data.custom_data = new OrderCustomData();
scope.addAnswer( idiom.translate('exercizer.grain.order.default1'));
scope.addAnswer( idiom.translate('exercizer.grain.order.default2'));
}
scope.deleteAnswer = function(answer){
var indexDeleted = answer.index;
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if(index !== -1){
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(value.index > indexDeleted){
value.index = parseFloat(value.index) - 1;
}
});
scope.reOrder();
};
function getLastOrder(){
var maxOrder = null;
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(maxOrder === null || value.order_by > maxOrder){
maxOrder = value.order_by;
}
});
if(maxOrder === null){
return 0;
}
return maxOrder;
}
scope.reOrder = function(){
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(value.order_by != parseFloat(value.index) + 1){
value.order_by = parseFloat(value.index) + 1;
}
});
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例4:
$scope.searchGroups = (item: Group) => {
let found = $scope.display.searchGroups && idiom.removeAccents(item.name.toLowerCase()).indexOf(
idiom.removeAccents($scope.display.searchGroups).toLowerCase()
) !== -1;
for (let structureId in $scope.website.published) {
found = found && _.findWhere($scope.website.published[structureId].groups, { id: item.id }) === undefined;
}
return found;
};
示例5: function
scope.getTab = function(){
switch (scope.currentTab){
case 'mySubjects':
return idiom.translate("exercizer.dashboard.instructer.tab1");
case 'correction':
return idiom.translate("exercizer.dashboard.instructer.tab2");
case 'library':
return idiom.translate("exercizer.dashboard.instructer.tab3");
default :
throw "tab "+scope.currentTab+" missing"
}
};
示例6: function
$scope.translateComplexity = function(password){
var score = $scope.passwordComplexity(password)
if(score < 12){
return lang.translate("weak")
}
if(score < 20)
return lang.translate("moderate")
return lang.translate("strong")
}
示例7: function
$scope.showConversationHistory = function () {
if ($scope.isSlided) {
$scope.messageHistory = lang.translate('message.history.show');
}
else {
$scope.messageHistory = lang.translate('message.history.hide');
}
$scope.isSlided = !$scope.isSlided;
}
示例8: function
$scope.displayCode = function (user) {
if (user.blocked) {
return lang.translate("directory.blocked.label");
} else if (user.activationCode) {
return user.activationCode;
} else if (user.resetCode) {
return lang.translate("directory.resetted.label").replace("[[resetCode]]", user.resetCode).replace("[[resetCodeDate]]", user.resetCodeDate)
} else {
return lang.translate("directory.activated");
}
}
示例9: function
$scope.classnameForDuplicateUser = function (user) {
const classes: string[] = user.classNames;
if (classes.length === 0) {
return lang.translate("classAdmin.duplicate.label.none");
}
if (classes.length === 1) {
return lang.translate("classAdmin.duplicate.label.one").replace("[[className]]", classes[0]);
}
// There are at least two classes
return lang.translate("classAdmin.duplicate.label.several").replace("[[classNames]]", classes.join(", "));
}
示例10: function
$scope.userExportInfo = function () {
if ($scope.userExport.onlySelected) {
return (lang.translate("classAdmin.export.count") as string).replace("[[count]]", _selected.length + "");
} else {
let len = $scope.userExport.profiles.length;
let info: string = lang.translate(`classAdmin.export.create.profil${len}`);
let index = 0;
for (let profile of $scope.userExport.profiles) {
const key = `directory.${profile}s`.toLowerCase();
const value = (lang.translate(key) as string).toLowerCase();
info = info.replace(`[[profile${++index}]]`, value);
}
return info;
}
}