1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

linted JS files

This commit is contained in:
Sylvain 2021-07-01 11:23:58 +02:00
parent 58467aa7a8
commit a6043fe81e
24 changed files with 308 additions and 320 deletions

View File

@ -17,8 +17,8 @@
// list of supported authentication methods
const METHODS = {
'DatabaseProvider': 'local_database',
'OAuth2Provider': 'o_auth2'
DatabaseProvider: 'local_database',
OAuth2Provider: 'o_auth2'
};
/**
@ -38,7 +38,7 @@ const findIdxById = function (elements, id) {
* @returns {Boolean} true if the mapping is declared
*/
const check_oauth2_id_is_mapped = function (mappings) {
for (let mapping of Array.from(mappings)) {
for (const mapping of Array.from(mappings)) {
if ((mapping.local_model === 'user') && (mapping.local_field === 'uid') && !mapping._destroy) {
return true;
}
@ -78,9 +78,9 @@ class AuthenticationController {
/**
* Return a localized string for the provided method
*/
$scope.methodName = function(method) {
$scope.methodName = function (method) {
return _t('app.shared.authentication.' + METHODS[method]);
}
};
/**
* Open a modal allowing to specify the data mapping for the given field
@ -92,7 +92,7 @@ class AuthenticationController {
resolve: {
field () { return mapping; },
datatype () {
for (let field of Array.from($scope.mappingFields[mapping.local_model])) {
for (const field of Array.from($scope.mappingFields[mapping.local_model])) {
if (field[0] === mapping.local_field) {
return field[1];
}
@ -149,7 +149,7 @@ class AuthenticationController {
$scope.cancel = function () { $uibModalInstance.dismiss(); };
}]
})
.result['finally'](null).then(function (transfo_rules) { mapping.transformation = transfo_rules; });
.result.finally(null).then(function (transfo_rules) { mapping.transformation = transfo_rules; });
};
}
}
@ -247,7 +247,7 @@ Application.Controllers.controller('NewAuthenticationController', ['$scope', '$s
// === OAuth2Provider ===
if ($scope.provider.providable_type === 'OAuth2Provider') {
if (typeof $scope.provider.providable_attributes.o_auth2_mappings_attributes === 'undefined') {
return $scope.provider.providable_attributes['o_auth2_mappings_attributes'] = [];
return $scope.provider.providable_attributes.o_auth2_mappings_attributes = [];
}
}
};

View File

@ -328,15 +328,15 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
var getRankingLabel = function (key, typeKey) {
if ($scope.selectedIndex) {
if (typeKey === 'subType') {
for (let type of Array.from($scope.selectedIndex.types)) {
for (let subtype of Array.from(type.subtypes)) {
for (const type of Array.from($scope.selectedIndex.types)) {
for (const subtype of Array.from(type.subtypes)) {
if (subtype.key === key) {
return subtype.label;
}
}
}
} else {
for (let field of Array.from($scope.selectedIndex.additional_fields)) {
for (const field of Array.from($scope.selectedIndex.additional_fields)) {
if (field.key === typeKey) {
switch (field.data_type) {
case 'date': return moment(key).format('LL'); break;
@ -370,7 +370,7 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
if (index.graph.chart_type !== 'discreteBarChart') {
// list statistics types
const stat_types = [];
for (let t of Array.from(index.types)) {
for (const t of Array.from(index.types)) {
if (t.graph) {
stat_types.push(t.key);
}
@ -430,15 +430,15 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
// run query
return es.search({
'index': 'stats',
'type': esType,
'searchType': 'query_then_fetch',
'size': 0,
index: 'stats',
type: esType,
searchType: 'query_then_fetch',
size: 0,
'stat-type': statType,
'custom-query': '',
'start-date': moment($scope.datePickerStart.selected).format(),
'end-date': moment($scope.datePickerEnd.selected).format(),
'body': buildElasticAggregationsQuery(statType, $scope.display.interval, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
body: buildElasticAggregationsQuery(statType, $scope.display.interval, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
}
, function (error, response) {
if (error) {
@ -468,11 +468,11 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
// run query
return es.search({
'index': 'stats',
'type': esType,
'searchType': 'query_then_fetch',
'size': 0,
'body': buildElasticAggregationsRankingQuery(groupKey, sortKey, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
index: 'stats',
type: esType,
searchType: 'query_then_fetch',
size: 0,
body: buildElasticAggregationsRankingQuery(groupKey, sortKey, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
}
, function (error, response) {
if (error) {
@ -487,7 +487,7 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
* Parse a final elastic results bucket and return a D3 compatible object
* @param bucket {{key_as_string:{String}, key:{Number}, doc_count:{Number}, total:{{value:{Number}}}}} interval bucket
*/
const parseElasticBucket = bucket => [ bucket.key, bucket.total.value ];
const parseElasticBucket = bucket => [bucket.key, bucket.total.value];
/**
* Build an object representing the content of the REST-JSON query to elasticSearch, based on the parameters
@ -499,45 +499,45 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
*/
var buildElasticAggregationsQuery = function (type, interval, intervalBegin, intervalEnd) {
const q = {
'query': {
'bool': {
'must': [
query: {
bool: {
must: [
{
'match': {
'type': type
match: {
type: type
}
},
{
'range': {
'date': {
'gte': intervalBegin.format(),
'lte': intervalEnd.format()
range: {
date: {
gte: intervalBegin.format(),
lte: intervalEnd.format()
}
}
}
]
}
},
'aggregations': {
'subgroups': {
'terms': {
'field': 'subType'
aggregations: {
subgroups: {
terms: {
field: 'subType'
}, // TODO allow aggregate by custom field
'aggregations': {
'intervals': {
'date_histogram': {
'field': 'date',
'interval': interval,
'min_doc_count': 0,
'extended_bounds': {
'min': intervalBegin.valueOf(),
'max': intervalEnd.valueOf()
aggregations: {
intervals: {
date_histogram: {
field: 'date',
interval: interval,
min_doc_count: 0,
extended_bounds: {
min: intervalBegin.valueOf(),
max: intervalEnd.valueOf()
}
},
'aggregations': {
'total': {
'sum': {
'field': 'stat'
aggregations: {
total: {
sum: {
field: 'stat'
}
}
}
@ -549,11 +549,11 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
// scale weeks on sunday as nvd3 supports only these weeks
if (interval === 'week') {
q.aggregations.subgroups.aggregations.intervals.date_histogram['offset'] = '-1d';
q.aggregations.subgroups.aggregations.intervals.date_histogram.offset = '-1d';
// scale days to UTC time
} else if (interval === 'day') {
const offset = moment().utcOffset();
q.aggregations.subgroups.aggregations.intervals.date_histogram['offset'] = (-offset) + 'm';
q.aggregations.subgroups.aggregations.intervals.date_histogram.offset = (-offset) + 'm';
}
return q;
};
@ -568,46 +568,46 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
*/
var buildElasticAggregationsRankingQuery = function (groupKey, sortKey, intervalBegin, intervalEnd) {
const q = {
'query': {
'bool': {
'must': [
query: {
bool: {
must: [
{
'range': {
'date': {
'gte': intervalBegin.format(),
'lte': intervalEnd.format()
range: {
date: {
gte: intervalBegin.format(),
lte: intervalEnd.format()
}
}
},
{
'term': {
'type': 'booking'
term: {
type: 'booking'
}
}
]
}
},
'aggregations': {
'subgroups': {
'terms': {
'field': groupKey,
'size': 10,
'order': {
'total': 'desc'
aggregations: {
subgroups: {
terms: {
field: groupKey,
size: 10,
order: {
total: 'desc'
}
},
'aggregations': {
'top_events': {
'top_hits': {
'size': 1,
'sort': [
{ 'ca': 'desc' }
aggregations: {
top_events: {
top_hits: {
size: 1,
sort: [
{ ca: 'desc' }
]
}
},
'total': {
'sum': {
'field': 'stat'
total: {
sum: {
field: 'stat'
}
}
}
@ -716,12 +716,12 @@ Application.Controllers.controller('GraphsController', ['$scope', '$state', '$ro
values: []
}
];
for (let info of Array.from(data)) {
for (const info of Array.from(data)) {
if (info) {
newData[0].values.push({
'label': info.key,
'value': info.values[0].y,
'color': info.color
label: info.key,
value: info.values[0].y,
color: info.color
});
}
}

View File

@ -102,7 +102,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
`<div id="members">${_t('app.admin.settings.item_members')}</div>`,
`<div id="events">${_t('app.admin.settings.item_events')}</div>`
]
}
};
$scope.summernoteOptsHomePage.height = 400;
// codemirror editor
@ -110,15 +110,15 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
// Options for codemirror editor, used for custom css
$scope.codemirrorOpts = {
matchBrackets : true,
matchBrackets: true,
lineNumbers: true,
mode: 'sass'
}
};
// Show or hide advanced settings
$scope.advancedSettings = {
open: false
}
};
/**
* For use with 'ng-class', returns the CSS class name for the uploads previews.
@ -198,7 +198,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
} else {
$scope.privacyPolicy.version = null;
}
})
});
});
};
@ -212,7 +212,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
if ((content.custom_asset == null)) {
$scope.alerts = [];
return angular.forEach(content, function (v) {
angular.forEach(v, function(err) { growl.error(err); })
angular.forEach(v, function (err) { growl.error(err); });
});
} else {
growl.success(_t('app.admin.settings.file_successfully_updated'));
@ -251,7 +251,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
*/
$scope.addLoader = function (target) {
$scope.loader[target] = true;
}
};
/**
* Change the revision of the displayed privacy policy, from drafts history
@ -262,7 +262,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
return;
}
for (const draft of $scope.privacyDraftsHistory) {
if (draft.id == $scope.privacyPolicy.version) {
if (draft.id === $scope.privacyPolicy.version) {
$scope.privacyPolicy.bodyTemp = draft.content;
break;
}
@ -272,7 +272,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
/**
* Open a modal showing a sample of the collected data if FabAnalytics is enabled
*/
$scope.analyticsModal = function() {
$scope.analyticsModal = function () {
$uibModal.open({
templateUrl: '/admin/settings/analyticsModal.html',
controller: 'AnalyticsModalController',
@ -281,30 +281,30 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
analyticsData: ['FabAnalytics', function (FabAnalytics) { return FabAnalytics.data().$promise; }]
}
});
}
};
/**
* Reset the home page to its initial state (factory value)
*/
$scope.resetHomePage = function () {
dialogs.confirm({
resolve: {
object () {
return {
title: _t('app.admin.settings.confirmation_required'),
msg: _t('app.admin.settings.confirm_reset_home_page')
};
}
resolve: {
object () {
return {
title: _t('app.admin.settings.confirmation_required'),
msg: _t('app.admin.settings.confirm_reset_home_page')
};
}
}
, function () { // confirmed
Setting.reset({ name: 'home_content' }, function (data) {
$scope.homeContent.value = data.value;
growl.success(_t('app.admin.settings.home_content_reset'));
})
}
)
}
}
, function () { // confirmed
Setting.reset({ name: 'home_content' }, function (data) {
$scope.homeContent.value = data.value;
growl.success(_t('app.admin.settings.home_content_reset'));
});
}
);
};
/**
* Callback triggered when the codemirror editor is loaded into the DOM
@ -312,7 +312,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
*/
$scope.codemirrorLoaded = function (editor) {
$scope.codeMirrorEditor = editor;
}
};
/**
* Setup the feature-tour for the admin/settings page.
@ -336,7 +336,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
order: 1,
title: _t('app.admin.tour.settings.general.title'),
content: _t('app.admin.tour.settings.general.content'),
placement: 'bottom',
placement: 'bottom'
});
uitour.createStep({
selector: '.admin-settings .home-page-content h4',
@ -440,7 +440,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
if ($scope.allSettings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('settings') < 0) {
uitour.start();
}
}
};
/* PRIVATE SCOPE */
@ -491,7 +491,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
// refresh codemirror to display the fetched setting
$scope.$watch('advancedSettings.open', function (newValue) {
if (newValue) $scope.codeMirrorEditor.refresh();
})
});
// use the tours list, based on the selected value
$scope.$watch('allSettings.feature_tour_display', function (newValue, oldValue, scope) {
@ -513,7 +513,6 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
]);
/**
* Controller used in the invoice refunding modal window
*/
@ -550,13 +549,13 @@ Application.Controllers.controller('SavePolicyController', ['$scope', '$uibModal
* Controller used in the "what do we collect?" modal, about FabAnalytics
*/
Application.Controllers.controller('AnalyticsModalController', ['$scope', '$uibModalInstance', 'analyticsData',
function ($scope,$uibModalInstance, analyticsData) {
function ($scope, $uibModalInstance, analyticsData) {
// analytics data sample
$scope.data = analyticsData;
// callback to close the modal
$scope.close = function () {
$uibModalInstance.dismiss();
}
};
}
])
]);

View File

@ -81,7 +81,7 @@ class TrainingsController {
/**
* Controller used in the training creation page (admin)
*/
Application.Controllers.controller('NewTrainingController', [ '$scope', '$state', 'machinesPromise', 'CSRF',
Application.Controllers.controller('NewTrainingController', ['$scope', '$state', 'machinesPromise', 'CSRF',
function ($scope, $state, machinesPromise, CSRF) {
/* PUBLIC SCOPE */
@ -114,7 +114,7 @@ Application.Controllers.controller('NewTrainingController', [ '$scope', '$state'
/**
* Controller used in the training edition page (admin)
*/
Application.Controllers.controller('EditTrainingController', [ '$scope', '$state', '$stateParams', 'trainingPromise', 'machinesPromise', 'CSRF',
Application.Controllers.controller('EditTrainingController', ['$scope', '$state', '$stateParams', 'trainingPromise', 'machinesPromise', 'CSRF',
function ($scope, $state, $stateParams, trainingPromise, machinesPromise, CSRF) {
/* PUBLIC SCOPE */
@ -152,7 +152,6 @@ Application.Controllers.controller('EditTrainingController', [ '$scope', '$state
*/
Application.Controllers.controller('TrainingsAdminController', ['$scope', '$state', '$uibModal', 'Training', 'trainingsPromise', 'machinesPromise', '_t', 'growl', 'dialogs', 'Member', 'uiTourService', 'settingsPromise',
function ($scope, $state, $uibModal, Training, trainingsPromise, machinesPromise, _t, growl, dialogs, Member, uiTourService, settingsPromise) {
// list of trainings
$scope.trainings = trainingsPromise;
@ -262,7 +261,8 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
*/
return $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
}
] });
]
});
};
/**
@ -401,8 +401,7 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('trainings') < 0) {
uitour.start();
}
}
};
/* PRIVATE SCOPE */
@ -411,7 +410,6 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
*/
const initialize = function () {};
/**
* Group the trainings availabilities by trainings and by dates and return the resulting tree
* @param trainings {Array} $scope.trainings is expected here
@ -419,10 +417,10 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
*/
const groupAvailabilities = function (trainings) {
const tree = {};
for (let training of Array.from(trainings)) {
for (const training of Array.from(trainings)) {
tree[training.name] = {};
tree[training.name].training = training;
for (let availability of Array.from(training.availabilities)) {
for (const availability of Array.from(training.availabilities)) {
const start = moment(availability.start_at);
// init the tree structure

View File

@ -184,7 +184,7 @@ class ProjectsController {
// reindex the remaining steps
return (function () {
const result = [];
for (let s of Array.from($scope.project.project_steps_attributes)) {
for (const s of Array.from($scope.project.project_steps_attributes)) {
if (s.step_nb > step.step_nb) {
result.push(s.step_nb -= 1);
} else {
@ -205,7 +205,7 @@ class ProjectsController {
*/
$scope.changeStepIndex = function (event, step, newIdx) {
if (event) { event.preventDefault(); }
for (let s of Array.from($scope.project.project_steps_attributes)) {
for (const s of Array.from($scope.project.project_steps_attributes)) {
if (s.step_nb === newIdx) {
s.step_nb = step.step_nb;
step.step_nb = newIdx;
@ -259,7 +259,7 @@ class ProjectsController {
return _t('app.shared.project.save_as_draft');
}
return _t('app.shared.buttons.save');
}
};
}
}
@ -277,7 +277,7 @@ Application.Controllers.controller('ProjectsController', ['$scope', '$state', 'P
/* PUBLIC SCOPE */
// Fab-manager's instance ID in the openLab network
$scope.openlabAppId = settingsPromise.openlab_app_id
$scope.openlabAppId = settingsPromise.openlab_app_id;
// Is openLab enabled on the instance?
$scope.openlab = {
@ -505,12 +505,12 @@ Application.Controllers.controller('EditProjectController', ['$rootScope', '$sco
if ($scope.project.author_id !== $rootScope.currentUser.id && $scope.project.user_ids.indexOf($rootScope.currentUser.id) === -1 && $scope.currentUser.role !== 'admin') {
$state.go('app.public.projects_show', { id: $scope.project.slug });
console.error('[EditProjectController::initialize] user is not allowed')
console.error('[EditProjectController::initialize] user is not allowed');
}
// Using the ProjectsController
return new ProjectsController($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t);
}
};
// !!! MUST BE CALLED AT THE END of the controller
return initialize();

View File

@ -9,7 +9,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Application.Directives.directive('coupon', [ '$rootScope', 'Coupon', '_t', function ($rootScope, Coupon, _t) {
Application.Directives.directive('coupon', ['$rootScope', 'Coupon', '_t', function ($rootScope, Coupon, _t) {
return ({
restrict: 'E',
scope: {

View File

@ -11,7 +11,7 @@
*/
'use strict';
Application.Directives.directive('fileread', [ () =>
Application.Directives.directive('fileread', [() =>
({
scope: {
fileread: '='
@ -31,7 +31,7 @@ Application.Directives.directive('fileread', [ () =>
// image placeholder library.
//
// To use, simply define `bs-holder` on any element
Application.Directives.directive('bsHolder', [ () =>
Application.Directives.directive('bsHolder', [() =>
({
link (scope, element, attrs) {
Holder.addTheme('icon', { background: 'white', foreground: '#e9e9e9', size: 80, font: 'FontAwesome' })
@ -44,7 +44,7 @@ Application.Directives.directive('bsHolder', [ () =>
]);
Application.Directives.directive('match', [ () =>
Application.Directives.directive('match', [() =>
({
require: 'ngModel',
restrict: 'A',
@ -59,7 +59,7 @@ Application.Directives.directive('match', [ () =>
]);
Application.Directives.directive('publishProject', [ () =>
Application.Directives.directive('publishProject', [() =>
({
restrict: 'A',
link (scope, elem, attrs, ctrl) {
@ -94,7 +94,7 @@ Application.Directives.directive('disableAnimation', ['$animate', ($animate) =>
* Isolate a form's scope from its parent : no nested validation
* @see https://stackoverflow.com/a/37481846/1039377
*/
Application.Directives.directive('isolateForm', [ () =>
Application.Directives.directive('isolateForm', [() =>
({
restrict: 'A',
require: '?form',

View File

@ -8,7 +8,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Application.Directives.directive('fabUserAvatar', [ function () {
Application.Directives.directive('fabUserAvatar', [function () {
return ({
restrict: 'E',
scope: {

View File

@ -1,4 +1,4 @@
Application.Directives.directive('events', [ 'Event',
Application.Directives.directive('events', ['Event',
function (Event) {
return ({
restrict: 'E',
@ -12,15 +12,15 @@ Application.Directives.directive('events', [ 'Event',
* @param event {Object} single event from the $scope.upcomingEvents array
* @returns {boolean} false if the event runs on more that 1 day
*/
$scope.isOneDayEvent = function(event) {
$scope.isOneDayEvent = function (event) {
return moment(event.start_date).isSame(event.end_date, 'day');
}
};
// constructor
const initialize = function () {
Event.upcoming({ limit: 3 }, function (data) {
$scope.upcomingEvents = data;
})
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -1,4 +1,4 @@
Application.Directives.directive('news', [ 'Setting',
Application.Directives.directive('news', ['Setting',
function (Setting) {
return ({
restrict: 'E',
@ -11,7 +11,7 @@ Application.Directives.directive('news', [ 'Setting',
const initialize = function () {
Setting.get({ name: 'home_blogpost' }, function (data) {
$scope.homeBlogpost = data.setting.value;
})
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -1,4 +1,4 @@
Application.Directives.directive('projects', [ 'Project',
Application.Directives.directive('projects', ['Project',
function (Project) {
return ({
restrict: 'E',
@ -14,7 +14,7 @@ Application.Directives.directive('projects', [ 'Project',
const initialize = function () {
Project.lastPublished(function (data) {
$scope.lastProjects = data;
})
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -19,20 +19,20 @@ Application.Directives.directive('twitter', ['Setting',
$scope.twitterName = data.setting.value;
if ($scope.twitterName) {
const configProfile = {
'profile': { 'screenName': $scope.twitterName },
'domId': 'twitter',
'maxTweets': 1,
'enableLinks': true,
'showUser': false,
'showTime': true,
'showImages': false,
'showRetweet': true,
'showInteraction': false,
'lang': Fablab.locale
profile: { screenName: $scope.twitterName },
domId: 'twitter',
maxTweets: 1,
enableLinks: true,
showUser: false,
showTime: true,
showImages: false,
showRetweet: true,
showInteraction: false,
lang: Fablab.locale
};
twitterFetcher.fetch(configProfile);
}
})
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -1,4 +1,4 @@
Application.Directives.directive('members', [ 'Member',
Application.Directives.directive('members', ['Member',
function (Member) {
return ({
restrict: 'E',
@ -11,7 +11,7 @@ Application.Directives.directive('members', [ 'Member',
const initialize = function () {
Member.lastSubscribed({ limit: 4 }, function (data) {
$scope.lastMembers = data;
})
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -1,4 +1,4 @@
Application.Directives.directive('postRender', [ '$timeout',
Application.Directives.directive('postRender', ['$timeout',
function ($timeout) {
return ({
restrict: 'A',

View File

@ -8,12 +8,12 @@
* which have a valid running subscription or not.
* Usage: <select-member [subscription="false|true"]></select-member>
*/
Application.Directives.directive('selectMember', [ 'Diacritics', 'Member', function (Diacritics, Member) {
Application.Directives.directive('selectMember', ['Diacritics', 'Member', function (Diacritics, Member) {
return ({
restrict: 'E',
templateUrl: '/shared/_member_select.html',
link (scope, element, attributes) {
return scope.autoCompleteName = function (nameLookup) {
scope.autoCompleteName = function (nameLookup) {
if (!nameLookup) {
return;
}
@ -22,7 +22,7 @@ Application.Directives.directive('selectMember', [ 'Diacritics', 'Member', funct
const q = { query: asciiName };
if (attributes.subscription) {
q['subscription'] = attributes.subscription;
q.subscription = attributes.subscription;
}
Member.search(q, function (users) {

View File

@ -27,7 +27,7 @@ Application.Directives.directive('selectSetting', ['Setting', 'growl', '_t',
* @param setting {{value:*, name:string}} note that the value will be stringified
*/
$scope.save = function (setting) {
let { value } = setting;
const { value } = setting;
Setting.update(
{ name: setting.name },

View File

@ -38,7 +38,7 @@ Application.Directives.directive('textSetting', ['Setting', 'growl', '_t',
* @param setting {{value:*, name:string}} note that the value will be stringified
*/
$scope.save = function (setting) {
let { value } = setting;
const { value } = setting;
Setting.update(
{ name: setting.name },

View File

@ -9,7 +9,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Application.Directives.directive('socialLink', [ function () {
Application.Directives.directive('socialLink', [function () {
return ({
restrict: 'E',
scope: {
@ -19,10 +19,10 @@ Application.Directives.directive('socialLink', [ function () {
templateUrl: '/shared/_social_link.html',
link (scope, element, attributes) {
if (scope.network === 'dailymotion') {
scope.image = "social/dailymotion.png";
scope.image = 'social/dailymotion.png';
return scope.altText = 'd';
} else if (scope.network === 'echosciences') {
scope.image = "social/echosciences.png";
scope.image = 'social/echosciences.png';
return scope.altText = 'E)';
} else {
if (scope.network === 'website') {

View File

@ -12,7 +12,7 @@
*/
'use strict';
Application.Directives.directive('url', [ function () {
Application.Directives.directive('url', [function () {
const URL_REGEXP = /^(https?:\/\/)([\da-z\.-]+)\.([-a-z0-9\.]{2,30})([\/\w \.-]*)*\/?$/;
return {
require: 'ngModel',
@ -33,7 +33,7 @@ Application.Directives.directive('url', [ function () {
}
]);
Application.Directives.directive('endpoint', [ function () {
Application.Directives.directive('endpoint', [function () {
const ENDPOINT_REGEXP = /^\/?([-._~:?#\[\]@!$&'()*+,;=%\w]+\/?)*$/;
return {
require: 'ngModel',

View File

@ -9,60 +9,58 @@
*/
angular.module('angularUtils.directives.dirDisqus', [])
.directive('dirDisqus', ['$window', function($window) {
return {
restrict: 'E',
scope: {
disqus_shortname: '@disqusShortname',
disqus_identifier: '@disqusIdentifier',
disqus_title: '@disqusTitle',
disqus_url: '@disqusUrl',
disqus_category_id: '@disqusCategoryId',
disqus_disable_mobile: '@disqusDisableMobile',
readyToBind: "@"
},
template: '<div id="disqus_thread"></div><a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>',
link: function(scope) {
.directive('dirDisqus', ['$window', function ($window) {
return {
restrict: 'E',
scope: {
disqus_shortname: '@disqusShortname',
disqus_identifier: '@disqusIdentifier',
disqus_title: '@disqusTitle',
disqus_url: '@disqusUrl',
disqus_category_id: '@disqusCategoryId',
disqus_disable_mobile: '@disqusDisableMobile',
readyToBind: '@'
},
template: '<div id="disqus_thread"></div><a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>',
link: function (scope) {
// ensure that the disqus_identifier and disqus_url are both set, otherwise we will run in to identifier conflicts when using URLs with "#" in them
// see http://help.disqus.com/customer/portal/articles/662547-why-are-the-same-comments-showing-up-on-multiple-pages-
if (typeof scope.disqus_identifier === 'undefined' || typeof scope.disqus_url === 'undefined') {
throw new Error('Please ensure that the `disqus-identifier` and `disqus-url` attributes are both set.');
}
// ensure that the disqus_identifier and disqus_url are both set, otherwise we will run in to identifier conflicts when using URLs with "#" in them
// see http://help.disqus.com/customer/portal/articles/662547-why-are-the-same-comments-showing-up-on-multiple-pages-
if (typeof scope.disqus_identifier === 'undefined' || typeof scope.disqus_url === 'undefined') {
throw "Please ensure that the `disqus-identifier` and `disqus-url` attributes are both set.";
scope.$watch('readyToBind', function (isReady) {
// If the directive has been called without the 'ready-to-bind' attribute, we
// set the default to "true" so that Disqus will be loaded straight away.
if (!angular.isDefined(isReady)) {
isReady = 'true';
}
if (scope.$eval(isReady)) {
// put the config variables into separate global vars so that the Disqus script can see them
$window.disqus_shortname = scope.disqus_shortname;
$window.disqus_identifier = scope.disqus_identifier;
$window.disqus_title = scope.disqus_title;
$window.disqus_url = scope.disqus_url;
$window.disqus_category_id = scope.disqus_category_id;
$window.disqus_disable_mobile = scope.disqus_disable_mobile;
// get the remote Disqus script and insert it into the DOM, but only if it not already loaded (as that will cause warnings)
if (!$window.DISQUS) {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + scope.disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
} else {
$window.DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = scope.disqus_identifier;
this.page.url = scope.disqus_url;
this.page.title = scope.disqus_title;
}
scope.$watch("readyToBind", function(isReady) {
// If the directive has been called without the 'ready-to-bind' attribute, we
// set the default to "true" so that Disqus will be loaded straight away.
if ( !angular.isDefined( isReady ) ) {
isReady = "true";
}
if (scope.$eval(isReady)) {
// put the config variables into separate global vars so that the Disqus script can see them
$window.disqus_shortname = scope.disqus_shortname;
$window.disqus_identifier = scope.disqus_identifier;
$window.disqus_title = scope.disqus_title;
$window.disqus_url = scope.disqus_url;
$window.disqus_category_id = scope.disqus_category_id;
$window.disqus_disable_mobile = scope.disqus_disable_mobile;
// get the remote Disqus script and insert it into the DOM, but only if it not already loaded (as that will cause warnings)
if (!$window.DISQUS) {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + scope.disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
} else {
$window.DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = scope.disqus_identifier;
this.page.url = scope.disqus_url;
this.page.title = scope.disqus_title;
}
});
}
}
});
});
}
};
}]);
}
});
}
};
}]);

View File

@ -1,19 +1,19 @@
(function() {
(function () {
var Humanize, isArray, isFinite, isNaN, objectRef, timeFormats, toString;
objectRef = new function() {};
objectRef = new function () {}();
toString = objectRef.toString;
isNaN = function(value) {
return value !== value;
isNaN = function (value) {
return Number.isNaN(value);
};
isFinite = function(value) {
return ((typeof window !== "undefined" && window !== null ? window.isFinite : void 0) || global.isFinite)(value) && !isNaN(parseFloat(value));
isFinite = function (value) {
return ((typeof window !== 'undefined' && window !== null ? window.isFinite : undefined) || global.isFinite)(value) && !isNaN(parseFloat(value));
};
isArray = function(value) {
isArray = function (value) {
return toString.call(value) === '[object Array]';
};
@ -38,7 +38,7 @@
Humanize = {};
Humanize.intword = function(number, charWidth, decimals) {
Humanize.intword = function (number, charWidth, decimals) {
if (decimals == null) {
decimals = 2;
}
@ -50,24 +50,24 @@
return Humanize.compactInteger(number, decimals);
};
Humanize.compactInteger = function(input, decimals) {
Humanize.compactInteger = function (input, decimals) {
var bigNumPrefixes, decimalIndex, decimalPart, decimalPartArray, length, number, numberLength, numberLengths, output, outputNumber, signString, unsignedNumber, unsignedNumberCharacterArray, unsignedNumberString, wholePart, wholePartArray, _i, _len, _length;
if (decimals == null) {
decimals = 0;
}
decimals = Math.max(decimals, 0);
number = parseInt(input, 10);
signString = number < 0 ? "-" : "";
signString = number < 0 ? '-' : '';
unsignedNumber = Math.abs(number);
unsignedNumberString = "" + unsignedNumber;
unsignedNumberString = '' + unsignedNumber;
numberLength = unsignedNumberString.length;
numberLengths = [13, 10, 7, 4];
bigNumPrefixes = ['T', 'B', 'M', 'k'];
if (unsignedNumber < 1000) {
if (decimals > 0) {
unsignedNumberString += "." + (Array(decimals + 1).join('0'));
unsignedNumberString += '.' + (Array(decimals + 1).join('0'));
}
return "" + signString + unsignedNumberString;
return '' + signString + unsignedNumberString;
}
if (numberLength > numberLengths[0] + 3) {
return number.toExponential(decimals).replace('e+', 'x10^');
@ -80,81 +80,80 @@
}
}
decimalIndex = numberLength - length + 1;
unsignedNumberCharacterArray = unsignedNumberString.split("");
unsignedNumberCharacterArray = unsignedNumberString.split('');
wholePartArray = unsignedNumberCharacterArray.slice(0, decimalIndex);
decimalPartArray = unsignedNumberCharacterArray.slice(decimalIndex, decimalIndex + decimals + 1);
wholePart = wholePartArray.join("");
decimalPart = decimalPartArray.join("");
wholePart = wholePartArray.join('');
decimalPart = decimalPartArray.join('');
if (decimalPart.length < decimals) {
decimalPart += "" + (Array(decimals - decimalPart.length + 1).join('0'));
decimalPart += '' + (Array(decimals - decimalPart.length + 1).join('0'));
}
if (decimals === 0) {
output = "" + signString + wholePart + bigNumPrefixes[numberLengths.indexOf(length)];
output = '' + signString + wholePart + bigNumPrefixes[numberLengths.indexOf(length)];
} else {
outputNumber = (+("" + wholePart + "." + decimalPart)).toFixed(decimals);
output = "" + signString + outputNumber + bigNumPrefixes[numberLengths.indexOf(length)];
outputNumber = (+('' + wholePart + '.' + decimalPart)).toFixed(decimals);
output = '' + signString + outputNumber + bigNumPrefixes[numberLengths.indexOf(length)];
}
return output;
};
Humanize.intcomma = Humanize.intComma = function(number, decimals) {
Humanize.intcomma = Humanize.intComma = function (number, decimals) {
if (decimals == null) {
decimals = 0;
}
return Humanize.formatNumber(number, decimals);
};
Humanize.filesize = Humanize.fileSize = function(filesize) {
Humanize.filesize = Humanize.fileSize = function (filesize) {
var sizeStr;
if (filesize >= 1073741824) {
sizeStr = Humanize.formatNumber(filesize / 1073741824, 2, "") + " GB";
sizeStr = Humanize.formatNumber(filesize / 1073741824, 2, '') + ' GB';
} else if (filesize >= 1048576) {
sizeStr = Humanize.formatNumber(filesize / 1048576, 2, "") + " MB";
sizeStr = Humanize.formatNumber(filesize / 1048576, 2, '') + ' MB';
} else if (filesize >= 1024) {
sizeStr = Humanize.formatNumber(filesize / 1024, 0) + " KB";
sizeStr = Humanize.formatNumber(filesize / 1024, 0) + ' KB';
} else {
sizeStr = Humanize.formatNumber(filesize, 0) + Humanize.pluralize(filesize, " byte");
sizeStr = Humanize.formatNumber(filesize, 0) + Humanize.pluralize(filesize, ' byte');
}
return sizeStr;
};
Humanize.formatNumber = function(number, precision, thousand, decimal) {
var base, commas, decimals, firstComma, mod, negative, usePrecision,
_this = this;
Humanize.formatNumber = function (number, precision, thousand, decimal) {
var base; var commas; var decimals; var firstComma; var mod; var negative; var usePrecision;
if (precision == null) {
precision = 0;
}
if (thousand == null) {
thousand = ",";
thousand = ',';
}
if (decimal == null) {
decimal = ".";
decimal = '.';
}
firstComma = function(number, thousand, position) {
firstComma = function (number, thousand, position) {
if (position) {
return number.substr(0, position) + thousand;
} else {
return "";
return '';
}
};
commas = function(number, thousand, position) {
return number.substr(position).replace(/(\d{3})(?=\d)/g, "$1" + thousand);
commas = function (number, thousand, position) {
return number.substr(position).replace(/(\d{3})(?=\d)/g, '$1' + thousand);
};
decimals = function(number, decimal, usePrecision) {
decimals = function (number, decimal, usePrecision) {
if (usePrecision) {
return decimal + Humanize.toFixed(Math.abs(number), usePrecision).split(".")[1];
return decimal + Humanize.toFixed(Math.abs(number), usePrecision).split('.')[1];
} else {
return "";
return '';
}
};
usePrecision = Humanize.normalizePrecision(precision);
negative = number < 0 && "-" || "";
base = parseInt(Humanize.toFixed(Math.abs(number || 0), usePrecision), 10) + "";
negative = number < 0 ? '-' : '';
base = parseInt(Humanize.toFixed(Math.abs(number || 0), usePrecision), 10) + '';
mod = base.length > 3 ? base.length % 3 : 0;
return negative + firstComma(base, thousand, mod) + commas(base, thousand, mod) + decimals(number, decimal, usePrecision);
};
Humanize.toFixed = function(value, precision) {
Humanize.toFixed = function (value, precision) {
var power;
if (precision == null) {
precision = Humanize.normalizePrecision(precision, 0);
@ -163,7 +162,7 @@
return (Math.round(value * power) / power).toFixed(precision);
};
Humanize.normalizePrecision = function(value, base) {
Humanize.normalizePrecision = function (value, base) {
value = Math.round(Math.abs(value));
if (isNaN(value)) {
return base;
@ -172,7 +171,7 @@
}
};
Humanize.ordinal = function(value) {
Humanize.ordinal = function (value) {
var end, leastSignificant, number, specialCase;
number = parseInt(value, 10);
if (number === 0) {
@ -180,26 +179,26 @@
}
specialCase = number % 100;
if (specialCase === 11 || specialCase === 12 || specialCase === 13) {
return "" + number + "th";
return '' + number + 'th';
}
leastSignificant = number % 10;
switch (leastSignificant) {
case 1:
end = "st";
end = 'st';
break;
case 2:
end = "nd";
end = 'nd';
break;
case 3:
end = "rd";
end = 'rd';
break;
default:
end = "th";
end = 'th';
}
return "" + number + end;
return '' + number + end;
};
Humanize.times = function(value, overrides) {
Humanize.times = function (value, overrides) {
var number, smallTimes, _ref;
if (overrides == null) {
overrides = {};
@ -208,19 +207,19 @@
number = parseFloat(value);
smallTimes = ['never', 'once', 'twice'];
if (overrides[number] != null) {
return "" + overrides[number];
return '' + overrides[number];
} else {
return "" + (((_ref = smallTimes[number]) != null ? _ref.toString() : void 0) || number.toString() + ' times');
return '' + (((_ref = smallTimes[number]) != null ? _ref.toString() : undefined) || number.toString() + ' times');
}
}
};
Humanize.pluralize = function(number, singular, plural) {
Humanize.pluralize = function (number, singular, plural) {
if (!((number != null) && (singular != null))) {
return;
}
if (plural == null) {
plural = singular + "s";
plural = singular + 's';
}
if (parseInt(number, 10) === 1) {
return singular;
@ -229,7 +228,7 @@
}
};
Humanize.truncate = function(str, length, ending) {
Humanize.truncate = function (str, length, ending) {
if (length == null) {
length = 100;
}
@ -243,29 +242,29 @@
}
};
Humanize.truncatewords = Humanize.truncateWords = function(string, length) {
Humanize.truncatewords = Humanize.truncateWords = function (string, length) {
var array, i, result;
array = string.split(" ");
result = "";
array = string.split(' ');
result = '';
i = 0;
while (i < length) {
if (array[i] != null) {
result += "" + array[i] + " ";
result += '' + array[i] + ' ';
}
i++;
}
if (array.length > length) {
return result += "...";
return result + '...';
}
};
Humanize.truncatenumber = Humanize.boundedNumber = function(num, bound, ending) {
Humanize.truncatenumber = Humanize.boundedNumber = function (num, bound, ending) {
var result;
if (bound == null) {
bound = 100;
}
if (ending == null) {
ending = "+";
ending = '+';
}
result = null;
if (isFinite(num) && isFinite(bound)) {
@ -276,27 +275,27 @@
return (result || num).toString();
};
Humanize.oxford = function(items, limit, limitStr) {
Humanize.oxford = function (items, limit, limitStr) {
var extra, limitIndex, numItems;
numItems = items.length;
if (numItems < 2) {
return "" + items;
return '' + items;
} else if (numItems === 2) {
return items.join(' and ');
} else if ((limit != null) && numItems > limit) {
extra = numItems - limit;
limitIndex = limit;
if (limitStr == null) {
limitStr = ", and " + extra + " " + (Humanize.pluralize(extra, 'other'));
limitStr = ', and ' + extra + ' ' + (Humanize.pluralize(extra, 'other'));
}
} else {
limitIndex = -1;
limitStr = ", and " + items[numItems - 1];
limitStr = ', and ' + items[numItems - 1];
}
return items.slice(0, limitIndex).join(', ') + limitStr;
};
Humanize.dictionary = function(object, joiner, separator) {
Humanize.dictionary = function (object, joiner, separator) {
var defs, key, result, val;
if (joiner == null) {
joiner = ' is ';
@ -309,14 +308,14 @@
defs = [];
for (key in object) {
val = object[key];
defs.push("" + key + joiner + val);
defs.push('' + key + joiner + val);
}
result = defs.join(separator);
}
return result;
};
Humanize.frequency = function(list, verb) {
Humanize.frequency = function (list, verb) {
var len, str, times;
if (!isArray(list)) {
return;
@ -324,20 +323,20 @@
len = list.length;
times = Humanize.times(len);
if (len === 0) {
str = "" + times + " " + verb;
str = '' + times + ' ' + verb;
} else {
str = "" + verb + " " + times;
str = '' + verb + ' ' + times;
}
return str;
};
Humanize.pace = function(value, intervalMs, unit) {
Humanize.pace = function (value, intervalMs, unit) {
var f, prefix, rate, relativePace, roundedPace, timeUnit, _i, _len;
if (unit == null) {
unit = 'time';
}
if (value === 0 || intervalMs === 0) {
return "No " + (Humanize.pluralize(unit));
return 'No ' + (Humanize.pluralize(unit));
}
prefix = 'Approximately';
timeUnit = null;
@ -357,44 +356,43 @@
}
roundedPace = Math.round(relativePace);
unit = Humanize.pluralize(roundedPace, unit);
return "" + prefix + " " + roundedPace + " " + unit + " per " + timeUnit;
return '' + prefix + ' ' + roundedPace + ' ' + unit + ' per ' + timeUnit;
};
Humanize.nl2br = function(string, replacement) {
Humanize.nl2br = function (string, replacement) {
if (replacement == null) {
replacement = '<br/>';
}
return string.replace(/\n/g, replacement);
};
Humanize.br2nl = function(string, replacement) {
Humanize.br2nl = function (string, replacement) {
if (replacement == null) {
replacement = '\r\n';
}
return string.replace(/\<br\s*\/?\>/g, replacement);
return string.replace(/<br\s*\/?>/g, replacement);
};
Humanize.capitalize = function(string, downCaseTail) {
Humanize.capitalize = function (string, downCaseTail) {
if (downCaseTail == null) {
downCaseTail = false;
}
return "" + (string.charAt(0).toUpperCase()) + (downCaseTail ? string.slice(1).toLowerCase() : string.slice(1));
return '' + (string.charAt(0).toUpperCase()) + (downCaseTail ? string.slice(1).toLowerCase() : string.slice(1));
};
Humanize.capitalizeAll = function(string) {
return string.replace(/(?:^|\s)\S/g, function(a) {
Humanize.capitalizeAll = function (string) {
return string.replace(/(?:^|\s)\S/g, function (a) {
return a.toUpperCase();
});
};
Humanize.titlecase = Humanize.titleCase = function(string) {
var doTitleCase, internalCaps, smallWords, splitOnHyphensRegex, splitOnWhiteSpaceRegex,
_this = this;
Humanize.titlecase = Humanize.titleCase = function (string) {
var doTitleCase; var internalCaps; var smallWords; var splitOnHyphensRegex; var splitOnWhiteSpaceRegex;
smallWords = /\b(a|an|and|at|but|by|de|en|for|if|in|of|on|or|the|to|via|vs?\.?)\b/i;
internalCaps = /\S+[A-Z]+\S*/;
splitOnWhiteSpaceRegex = /\s+/;
splitOnHyphensRegex = /-/;
doTitleCase = function(_string, hyphenated, firstOrLast) {
doTitleCase = function (_string, hyphenated, firstOrLast) {
var index, stringArray, titleCasedArray, word, _i, _len;
if (hyphenated == null) {
hyphenated = false;
@ -429,8 +427,7 @@
this.Humanize = Humanize;
if (typeof module !== "undefined" && module !== null) {
if (typeof module !== 'undefined' && module !== null) {
module.exports = Humanize;
}
}).call(this);
}).call(this);

View File

@ -13,8 +13,6 @@
factory(window.jQuery);
}
}(function ($) {
$.extend($.summernote.options, {
nugget: {
list: []
@ -60,13 +58,13 @@
/**
* @param {Object} context - context object has status of editor.
*/
'nugget': function (context) {
nugget: function (context) {
// ui has renders to build ui elements.
// - you can create a button with `ui.button`
const ui = $.summernote.ui;
const options = context.options.nugget;
const context_options = context.options;
const lang = context_options.langInfo;
const contextOptions = context.options;
const lang = contextOptions.langInfo;
const defaultOptions = {
label: lang.nugget.Nugget,
tooltip: lang.nugget.Insert_nugget
@ -74,7 +72,7 @@
// Assign default values if not supplied
for (const propertyName in defaultOptions) {
if (options.hasOwnProperty(propertyName) === false) {
if (Object.prototype.hasOwnProperty.call(options, propertyName) === false) {
options[propertyName] = defaultOptions[propertyName];
}
}
@ -110,7 +108,6 @@
const node = document.createElement('div');
node.innerHTML = value.trim();
context.invoke('editor.insertNode', node.firstChild);
}
})
]);
@ -121,5 +118,4 @@
}
});
}));

View File

@ -3,11 +3,11 @@
Application.Services.factory('AuthService', ['Session', function (Session) {
const service = {};
service.isAuthenticated = function() {
service.isAuthenticated = function () {
return (Session.currentUser != null) && (Session.currentUser.id != null);
};
service.isAuthorized = function(authorizedRoles) {
service.isAuthorized = function (authorizedRoles) {
if (!angular.isArray(authorizedRoles)) {
authorizedRoles = [authorizedRoles];
}

View File

@ -22,7 +22,7 @@ Application.Services.factory('dialogs', ['$uibModal', function ($uibModal) {
};
if (angular.isObject(options)) { angular.extend(defaultOpts, options); }
return $uibModal.open(defaultOpts)
.result['finally'](null).then(function (info) {
.result.finally(null).then(function (info) {
if (angular.isFunction(success)) {
return success(info);
}