Fixed coding style in some JS files. Fixed #1979.
This commit is contained in:
parent
e57a83f45b
commit
544b28cacf
@ -132,9 +132,6 @@ gulp.task('jshint', function () {
|
||||
return gulp.src([
|
||||
'gulpfile.js',
|
||||
path.join( 'openslides', '*', 'static', '**', '*.js' ),
|
||||
'!' + path.join( 'openslides', 'users', 'static', 'js', 'users', 'site.js' ),
|
||||
'!' + path.join( 'openslides', 'motions', 'static', 'js', 'motions', 'base.js' ),
|
||||
'!' + path.join( 'openslides', 'motions', 'static', 'js', 'motions', 'site.js' ),
|
||||
])
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('default'));
|
||||
|
@ -14,11 +14,11 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
||||
var states = [];
|
||||
_.forEach(this.next_states_id, function (stateId) {
|
||||
states.push(DS.get('motions/workflowstate', stateId));
|
||||
})
|
||||
});
|
||||
return states;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
])
|
||||
|
||||
@ -38,7 +38,7 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
])
|
||||
|
||||
@ -129,7 +129,7 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
||||
index = this.versions.length - 1;
|
||||
} else {
|
||||
index = _.findIndex(this.versions, function (element) {
|
||||
return element.id == versionId
|
||||
return element.id == versionId;
|
||||
});
|
||||
}
|
||||
return this.versions[index];
|
||||
@ -169,30 +169,44 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
||||
*/
|
||||
switch (action) {
|
||||
case 'see':
|
||||
return (operator.hasPerms('motions.can_see') &&
|
||||
(!this.state.required_permission_to_see ||
|
||||
operator.hasPerms(this.state.required_permission_to_see) ||
|
||||
(operator.user in this.submitters)));
|
||||
return (
|
||||
operator.hasPerms('motions.can_see') &&
|
||||
(
|
||||
!this.state.required_permission_to_see ||
|
||||
operator.hasPerms(this.state.required_permission_to_see) ||
|
||||
(operator.user in this.submitters)
|
||||
)
|
||||
);
|
||||
case 'update':
|
||||
return (operator.hasPerms('motions.can_manage') ||
|
||||
(($.inArray(operator.user, this.submitters) != -1) &&
|
||||
this.state.allow_submitter_edit));
|
||||
return (
|
||||
operator.hasPerms('motions.can_manage') ||
|
||||
(
|
||||
($.inArray(operator.user, this.submitters) != -1) &&
|
||||
this.state.allow_submitter_edit
|
||||
)
|
||||
);
|
||||
case 'quickedit':
|
||||
return operator.hasPerms('motions.can_manage');
|
||||
case 'delete':
|
||||
return operator.hasPerms('motions.can_manage');
|
||||
case 'create_poll':
|
||||
return (operator.hasPerms('motions.can_manage') &&
|
||||
this.state.allow_create_poll);
|
||||
return (
|
||||
operator.hasPerms('motions.can_manage') &&
|
||||
this.state.allow_create_poll
|
||||
);
|
||||
case 'support':
|
||||
return (operator.hasPerms('motions.can_support') &&
|
||||
this.state.allow_support &&
|
||||
Config.get('motions_min_supporters').value > 0 &&
|
||||
!($.inArray(operator.user, this.submitters) != -1) &&
|
||||
!($.inArray(operator.user, this.supporters) != -1));
|
||||
return (
|
||||
operator.hasPerms('motions.can_support') &&
|
||||
this.state.allow_support &&
|
||||
Config.get('motions_min_supporters').value > 0 &&
|
||||
($.inArray(operator.user, this.submitters) == -1) &&
|
||||
($.inArray(operator.user, this.supporters) == -1)
|
||||
);
|
||||
case 'unsupport':
|
||||
return (this.state.allow_support &&
|
||||
($.inArray(operator.user, this.supporters) != -1));
|
||||
return (
|
||||
this.state.allow_support &&
|
||||
($.inArray(operator.user, this.supporters) != -1)
|
||||
);
|
||||
case 'change_state':
|
||||
return operator.hasPerms('motions.can_manage');
|
||||
case 'reset_state':
|
||||
@ -272,35 +286,35 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
||||
'gettext',
|
||||
function (gettext) {
|
||||
// workflow 1
|
||||
gettext('Simple Workflow')
|
||||
gettext('submitted')
|
||||
gettext('accepted')
|
||||
gettext('Accept')
|
||||
gettext('rejected')
|
||||
gettext('Reject')
|
||||
gettext('not decided')
|
||||
gettext('Do not decide')
|
||||
gettext('Simple Workflow');
|
||||
gettext('submitted');
|
||||
gettext('accepted');
|
||||
gettext('Accept');
|
||||
gettext('rejected');
|
||||
gettext('Reject');
|
||||
gettext('not decided');
|
||||
gettext('Do not decide');
|
||||
// workflow 2
|
||||
gettext('Complex Workflow')
|
||||
gettext('published')
|
||||
gettext('permitted')
|
||||
gettext('Permit')
|
||||
gettext('accepted')
|
||||
gettext('Accept')
|
||||
gettext('rejected')
|
||||
gettext('Reject')
|
||||
gettext('withdrawed')
|
||||
gettext('Withdraw')
|
||||
gettext('adjourned')
|
||||
gettext('Adjourn')
|
||||
gettext('not concerned')
|
||||
gettext('Do not concern')
|
||||
gettext('commited a bill')
|
||||
gettext('Commit a bill')
|
||||
gettext('needs review')
|
||||
gettext('Needs review')
|
||||
gettext('rejected (not authorized)')
|
||||
gettext('Reject (not authorized)')
|
||||
gettext('Complex Workflow');
|
||||
gettext('published');
|
||||
gettext('permitted');
|
||||
gettext('Permit');
|
||||
gettext('accepted');
|
||||
gettext('Accept');
|
||||
gettext('rejected');
|
||||
gettext('Reject');
|
||||
gettext('withdrawed');
|
||||
gettext('Withdraw');
|
||||
gettext('adjourned');
|
||||
gettext('Adjourn');
|
||||
gettext('not concerned');
|
||||
gettext('Do not concern');
|
||||
gettext('commited a bill');
|
||||
gettext('Commit a bill');
|
||||
gettext('needs review');
|
||||
gettext('Needs review');
|
||||
gettext('rejected (not authorized)');
|
||||
gettext('Reject (not authorized)');
|
||||
}
|
||||
]);
|
||||
|
||||
|
@ -164,7 +164,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
return {
|
||||
// ngDialog for motion form
|
||||
getDialog: function (motion) {
|
||||
var resolve = {}
|
||||
var resolve = {};
|
||||
if (motion) {
|
||||
resolve = {
|
||||
motion: function() {
|
||||
@ -175,7 +175,9 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
}
|
||||
};
|
||||
}
|
||||
resolve.mediafiles = function(Mediafile) {return Mediafile.findAll();}
|
||||
resolve.mediafiles = function (Mediafile) {
|
||||
return Mediafile.findAll();
|
||||
};
|
||||
return {
|
||||
template: 'static/templates/motions/motion-form.html',
|
||||
controller: (motion) ? 'MotionUpdateCtrl' : 'MotionCreateCtrl',
|
||||
@ -183,7 +185,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
closeByEscape: false,
|
||||
closeByDocument: false,
|
||||
resolve: (resolve) ? resolve : null
|
||||
}
|
||||
};
|
||||
},
|
||||
// angular-formly fields for motion form
|
||||
getFormFields: function () {
|
||||
@ -341,7 +343,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
hideExpression: '!model.more',
|
||||
}];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
@ -404,7 +406,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
@ -439,22 +441,36 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
};
|
||||
// define custom search filter string
|
||||
$scope.getFilterString = function (motion) {
|
||||
var category = '';
|
||||
if (motion.category) {
|
||||
var category = motion.category.name;
|
||||
} else {
|
||||
var category = ''
|
||||
category = motion.category.name;
|
||||
}
|
||||
return [
|
||||
motion.identifier,
|
||||
motion.getTitle(),
|
||||
motion.getText(),
|
||||
motion.getReason(),
|
||||
_.map(motion.submitters, function (submitter) {return submitter.get_short_name()}).join(" "),
|
||||
_.map(motion.supporters, function (supporter) {return supporter.get_short_name()}).join(" "),
|
||||
_.map(motion.tags, function (tag) {return tag.name}).join(" "),
|
||||
category
|
||||
_.map(
|
||||
motion.submitters,
|
||||
function (submitter) {
|
||||
return submitter.get_short_name();
|
||||
}
|
||||
).join(" "),
|
||||
_.map(
|
||||
motion.supporters,
|
||||
function (supporter) {
|
||||
return supporter.get_short_name();
|
||||
}
|
||||
).join(" "),
|
||||
_.map(
|
||||
motion.tags,
|
||||
function (tag) {
|
||||
return tag.name;
|
||||
}
|
||||
).join(" "),
|
||||
category,
|
||||
].join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
// collect all states of all workflows
|
||||
// TODO: regard workflows only which are used by motions
|
||||
@ -462,7 +478,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
var workflows = Workflow.getAll();
|
||||
angular.forEach(workflows, function (workflow) {
|
||||
if (workflows.length > 1) {
|
||||
var wf = {}
|
||||
var wf = {};
|
||||
wf.name = workflow.name;
|
||||
wf.workflowSeparator = "-";
|
||||
$scope.states.push(wf);
|
||||
@ -565,23 +581,23 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
// support
|
||||
$scope.support = function () {
|
||||
$http.post('/rest/motions/motion/' + motion.id + '/support/');
|
||||
}
|
||||
};
|
||||
// unsupport
|
||||
$scope.unsupport = function () {
|
||||
$http.delete('/rest/motions/motion/' + motion.id + '/support/');
|
||||
}
|
||||
};
|
||||
// update state
|
||||
$scope.updateState = function (state_id) {
|
||||
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state_id});
|
||||
}
|
||||
};
|
||||
// reset state
|
||||
$scope.reset_state = function (state_id) {
|
||||
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {});
|
||||
}
|
||||
};
|
||||
// create poll
|
||||
$scope.create_poll = function () {
|
||||
$http.post('/rest/motions/motion/' + motion.id + '/create_poll/', {});
|
||||
}
|
||||
};
|
||||
// open poll update dialog
|
||||
$scope.openPollDialog = function (poll, voteNumber) {
|
||||
ngDialog.open({
|
||||
@ -603,11 +619,11 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
// delete poll
|
||||
$scope.delete_poll = function (poll) {
|
||||
poll.DSDestroy();
|
||||
}
|
||||
};
|
||||
// show specific version
|
||||
$scope.showVersion = function (version) {
|
||||
$scope.version = version.id;
|
||||
}
|
||||
};
|
||||
// permit specific version
|
||||
$scope.permitVersion = function (version) {
|
||||
$http.put('/rest/motions/motion/' + motion.id + '/manage_version/',
|
||||
@ -615,7 +631,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
.then(function(success) {
|
||||
$scope.version = version.id;
|
||||
});
|
||||
}
|
||||
};
|
||||
// delete specific version
|
||||
$scope.deleteVersion = function (version) {
|
||||
$http.delete('/rest/motions/motion/' + motion.id + '/manage_version/',
|
||||
@ -624,7 +640,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
.then(function(success) {
|
||||
$scope.version = motion.active_version;
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
@ -816,7 +832,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
'User',
|
||||
function($scope, gettext, Category, Motion, User) {
|
||||
// set initial data for csv import
|
||||
$scope.motions = []
|
||||
$scope.motions = [];
|
||||
$scope.separator = ',';
|
||||
$scope.encoding = 'UTF-8';
|
||||
$scope.encodingOptions = ['UTF-8', 'ISO-8859-1'];
|
||||
@ -845,7 +861,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
angular.forEach($scope.csv.result, function (motion) {
|
||||
if (motion.identifier) {
|
||||
motion.identifier = motion.identifier.replace(quotionRe, '$1');
|
||||
if (motion.identifier != '') {
|
||||
if (motion.identifier !== '') {
|
||||
// All motion objects are already loaded via the resolve statement from ui-router.
|
||||
var motions = Motion.getAll();
|
||||
if (_.find(motions, function (item) {
|
||||
@ -879,7 +895,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
// submitter
|
||||
if (motion.submitter) {
|
||||
motion.submitter = motion.submitter.replace(quotionRe, '$1');
|
||||
if (motion.submitter != '') {
|
||||
if (motion.submitter !== '') {
|
||||
// All user objects are already loaded via the resolve statement from ui-router.
|
||||
var users = User.getAll();
|
||||
angular.forEach(users, function (user) {
|
||||
@ -890,13 +906,13 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
});
|
||||
}
|
||||
}
|
||||
if (motion.submitter && motion.submitter != '' && !motion.submitters_id) {
|
||||
if (motion.submitter && motion.submitter !== '' && !motion.submitters_id) {
|
||||
motion.submitter_create = gettext('New participant will be created.');
|
||||
}
|
||||
// category
|
||||
if (motion.category) {
|
||||
motion.category = motion.category.replace(quotionRe, '$1');
|
||||
if (motion.category != '') {
|
||||
if (motion.category !== '') {
|
||||
// All categore objects are already loaded via the resolve statement from ui-router.
|
||||
var categories = Category.getAll();
|
||||
angular.forEach(categories, function (category) {
|
||||
@ -908,7 +924,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
});
|
||||
}
|
||||
}
|
||||
if (motion.category && motion.category != '' && !motion.category_id) {
|
||||
if (motion.category && motion.category !== '' && !motion.category_id) {
|
||||
motion.category_create = gettext('New category will be created.');
|
||||
}
|
||||
$scope.motions.push(motion);
|
||||
@ -927,7 +943,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
first_name: motion.submitter.substr(0, index),
|
||||
last_name: motion.submitter.substr(index+1),
|
||||
groups: []
|
||||
}
|
||||
};
|
||||
User.create(user).then(
|
||||
function(success) {
|
||||
// set new user id
|
||||
@ -940,7 +956,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
var category = {
|
||||
name: motion.category,
|
||||
prefix: motion.category.charAt(0)
|
||||
}
|
||||
};
|
||||
Category.create(category).then(
|
||||
function(success) {
|
||||
// set new category id
|
||||
@ -976,7 +992,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
||||
element.href = 'data:text/csv;charset=utf-8,' + csvString;
|
||||
element.download = 'motions-example.csv';
|
||||
element.target = '_blank';
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -242,8 +242,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
return {
|
||||
// ngDialog for user form
|
||||
getDialog: function (user) {
|
||||
var resolve;
|
||||
if (user) {
|
||||
var resolve = {
|
||||
resolve = {
|
||||
user: function(User) {return User.find(user.id);}
|
||||
};
|
||||
}
|
||||
@ -254,7 +255,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
closeByEscape: false,
|
||||
closeByDocument: false,
|
||||
resolve: (resolve) ? resolve : null
|
||||
}
|
||||
};
|
||||
},
|
||||
// angular-formly fields for user form
|
||||
getFormFields: function (hideOnCreateForm) {
|
||||
@ -372,7 +373,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
defaultValue: true
|
||||
}];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
@ -667,7 +668,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
|
||||
// *** csv import ***
|
||||
// set initial data for csv import
|
||||
$scope.users = []
|
||||
$scope.users = [];
|
||||
$scope.separator = ',';
|
||||
$scope.encoding = 'UTF-8';
|
||||
$scope.encodingOptions = ['UTF-8', 'ISO-8859-1'];
|
||||
@ -726,7 +727,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
var csvGroups = user.groups.replace(quotionRe, '$1').split(",");
|
||||
user.groups = [];
|
||||
user.groupnames = [];
|
||||
if (csvGroups != '') {
|
||||
if (csvGroups !== '') {
|
||||
// All group objects are already loaded via the resolve statement from ui-router.
|
||||
var allGroups = Group.getAll();
|
||||
csvGroups.forEach(function(csvGroup) {
|
||||
@ -793,7 +794,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
element.href = 'data:text/csv;charset=utf-8,' + csvString;
|
||||
element.download = 'users-example.csv';
|
||||
element.target = '_blank';
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
@ -893,7 +894,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
msg: data.info_text
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
// close alert function
|
||||
$scope.closeAlert = function(index) {
|
||||
$scope.alerts.splice(index, 1);
|
||||
@ -934,35 +935,35 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
||||
'gettext',
|
||||
function (gettext) {
|
||||
// agenda
|
||||
gettext('Can see agenda')
|
||||
gettext('Can manage agenda')
|
||||
gettext('Can see hidden items and time scheduling of agenda')
|
||||
gettext('Can put oneself on the list of speakers')
|
||||
gettext('Can see agenda');
|
||||
gettext('Can manage agenda');
|
||||
gettext('Can see hidden items and time scheduling of agenda');
|
||||
gettext('Can put oneself on the list of speakers');
|
||||
// assignments
|
||||
gettext('Can see elections')
|
||||
gettext('Can nominate another participant')
|
||||
gettext('Can nominate oneself')
|
||||
gettext('Can manage elections')
|
||||
gettext('Can see elections');
|
||||
gettext('Can nominate another participant');
|
||||
gettext('Can nominate oneself');
|
||||
gettext('Can manage elections');
|
||||
// core
|
||||
gettext('Can see the projector')
|
||||
gettext('Can manage the projector')
|
||||
gettext('Can see the front page')
|
||||
gettext('Can manage tags')
|
||||
gettext('Can manage configuration')
|
||||
gettext('Can use the chat')
|
||||
gettext('Can see the projector');
|
||||
gettext('Can manage the projector');
|
||||
gettext('Can see the front page');
|
||||
gettext('Can manage tags');
|
||||
gettext('Can manage configuration');
|
||||
gettext('Can use the chat');
|
||||
// mediafiles
|
||||
gettext('Can see the list of files')
|
||||
gettext('Can upload files')
|
||||
gettext('Can manage files')
|
||||
gettext('Can see the list of files');
|
||||
gettext('Can upload files');
|
||||
gettext('Can manage files');
|
||||
// motions
|
||||
gettext('Can see motions')
|
||||
gettext('Can create motions')
|
||||
gettext('Can support motions')
|
||||
gettext('Can manage motions')
|
||||
gettext('Can see motions');
|
||||
gettext('Can create motions');
|
||||
gettext('Can support motions');
|
||||
gettext('Can manage motions');
|
||||
// users
|
||||
gettext('Can see names of users')
|
||||
gettext('Can see extra data of users')
|
||||
gettext('Can manage users')
|
||||
gettext('Can see names of users');
|
||||
gettext('Can see extra data of users');
|
||||
gettext('Can manage users');
|
||||
}
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user