Merge pull request #3750 from FinnStutzenstein/assignmentPollInputs
no negative votes and better scrolling in forms with number inputs (c…
This commit is contained in:
commit
1b321fb680
@ -727,6 +727,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('Yes'),
|
label: gettextCatalog.getString('Yes'),
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
defaultValue: defaultValue.yes
|
defaultValue: defaultValue.yes
|
||||||
@ -737,6 +738,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('No'),
|
label: gettextCatalog.getString('No'),
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
defaultValue: defaultValue.no
|
defaultValue: defaultValue.no
|
||||||
@ -750,6 +752,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('Abstain'),
|
label: gettextCatalog.getString('Abstain'),
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
defaultValue: defaultValue.abstain
|
defaultValue: defaultValue.abstain
|
||||||
@ -759,17 +762,17 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
if (option.votes.length) {
|
if (option.votes.length) {
|
||||||
defaultValue = option.votes[0].weight;
|
defaultValue = option.votes[0].weight;
|
||||||
}
|
}
|
||||||
$scope.formFields.push(
|
$scope.formFields.push({
|
||||||
{
|
key: 'vote_' + option.candidate_id,
|
||||||
key: 'vote_' + option.candidate_id,
|
type: 'input',
|
||||||
type: 'input',
|
templateOptions: {
|
||||||
templateOptions: {
|
label: option.candidate.get_full_name(),
|
||||||
label: option.candidate.get_full_name(),
|
type: 'number',
|
||||||
type: 'number',
|
min: -2,
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
defaultValue: defaultValue
|
defaultValue: defaultValue
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// add general form fields
|
// add general form fields
|
||||||
@ -779,7 +782,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('Valid ballots'),
|
label: gettextCatalog.getString('Valid ballots'),
|
||||||
type: 'number'
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -787,7 +791,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('Invalid ballots'),
|
label: gettextCatalog.getString('Invalid ballots'),
|
||||||
type: 'number'
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -795,7 +800,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
templateOptions: {
|
templateOptions: {
|
||||||
label: gettextCatalog.getString('Casted ballots'),
|
label: gettextCatalog.getString('Casted ballots'),
|
||||||
type: 'number'
|
type: 'number',
|
||||||
|
min: -2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1121,6 +1121,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
|
// Projector Sidebar Controller
|
||||||
.controller('ProjectorSidebarCtrl', [
|
.controller('ProjectorSidebarCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
|
Loading…
Reference in New Issue
Block a user