no negative votes and better scrolling in forms with number inputs (closes #3739)
This commit is contained in:
parent
7ab5611a50
commit
e4735b9437
@ -727,6 +727,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Yes'),
|
||||
type: 'number',
|
||||
min: -2,
|
||||
required: true
|
||||
},
|
||||
defaultValue: defaultValue.yes
|
||||
@ -737,6 +738,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('No'),
|
||||
type: 'number',
|
||||
min: -2,
|
||||
required: true
|
||||
},
|
||||
defaultValue: defaultValue.no
|
||||
@ -750,6 +752,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Abstain'),
|
||||
type: 'number',
|
||||
min: -2,
|
||||
required: true
|
||||
},
|
||||
defaultValue: defaultValue.abstain
|
||||
@ -759,17 +762,17 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
if (option.votes.length) {
|
||||
defaultValue = option.votes[0].weight;
|
||||
}
|
||||
$scope.formFields.push(
|
||||
{
|
||||
key: 'vote_' + option.candidate_id,
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
label: option.candidate.get_full_name(),
|
||||
type: 'number',
|
||||
required: true
|
||||
},
|
||||
defaultValue: defaultValue
|
||||
});
|
||||
$scope.formFields.push({
|
||||
key: 'vote_' + option.candidate_id,
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
label: option.candidate.get_full_name(),
|
||||
type: 'number',
|
||||
min: -2,
|
||||
required: true,
|
||||
},
|
||||
defaultValue: defaultValue
|
||||
});
|
||||
}
|
||||
});
|
||||
// add general form fields
|
||||
@ -779,7 +782,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Valid ballots'),
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
min: -2,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -787,7 +791,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Invalid ballots'),
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
min: -2,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -795,7 +800,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
||||
type: 'input',
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Casted ballots'),
|
||||
type: 'number'
|
||||
type: 'number',
|
||||
min: -2,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1112,6 +1112,17 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
}
|
||||
])
|
||||
|
||||
// Prevent scrolling in number inputs. Instead of changing the number, the input
|
||||
// is blurred and the window is scrolled. This is very important for our dialog
|
||||
// forms, so a user didn't change a value, when he wants to scroll the form.
|
||||
.run(function () {
|
||||
$('body').on('mousewheel', function (e) {
|
||||
if (e.target.nodeName === 'INPUT' && e.target.type === 'number') {
|
||||
$(e.target).blur();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// Projector Sidebar Controller
|
||||
.controller('ProjectorSidebarCtrl', [
|
||||
'$scope',
|
||||
|
Loading…
Reference in New Issue
Block a user