2016-03-18 07:02:41 +08:00
|
|
|
'use strict';
|
2015-10-11 16:21:25 +08:00
|
|
|
|
2016-03-18 07:02:41 +08:00
|
|
|
System.register('flarum/flags/components/FlagsSettingsModal', ['flarum/components/SettingsModal'], function (_export, _context) {
|
2015-11-05 14:11:01 +08:00
|
|
|
var SettingsModal, FlagsSettingsModal;
|
|
|
|
return {
|
|
|
|
setters: [function (_flarumComponentsSettingsModal) {
|
2016-03-18 07:02:41 +08:00
|
|
|
SettingsModal = _flarumComponentsSettingsModal.default;
|
2015-11-05 14:11:01 +08:00
|
|
|
}],
|
|
|
|
execute: function () {
|
2016-03-18 07:02:41 +08:00
|
|
|
FlagsSettingsModal = function (_SettingsModal) {
|
2015-11-05 14:11:01 +08:00
|
|
|
babelHelpers.inherits(FlagsSettingsModal, _SettingsModal);
|
|
|
|
|
|
|
|
function FlagsSettingsModal() {
|
|
|
|
babelHelpers.classCallCheck(this, FlagsSettingsModal);
|
2016-03-18 07:02:41 +08:00
|
|
|
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(FlagsSettingsModal).apply(this, arguments));
|
2015-11-05 14:11:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
babelHelpers.createClass(FlagsSettingsModal, [{
|
|
|
|
key: 'className',
|
|
|
|
value: function className() {
|
|
|
|
return 'FlagsSettingsModal Modal--small';
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
key: 'title',
|
|
|
|
value: function title() {
|
|
|
|
return app.translator.trans('flarum-flags.admin.settings.title');
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
key: 'form',
|
|
|
|
value: function form() {
|
|
|
|
return [m(
|
|
|
|
'div',
|
|
|
|
{ className: 'Form-group' },
|
|
|
|
m(
|
|
|
|
'label',
|
|
|
|
null,
|
|
|
|
app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
|
|
|
|
),
|
|
|
|
m('input', { className: 'FormControl', bidi: this.setting('flarum-flags.guidelines_url') })
|
|
|
|
)];
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
return FlagsSettingsModal;
|
2016-03-18 07:02:41 +08:00
|
|
|
}(SettingsModal);
|
2015-11-05 14:11:01 +08:00
|
|
|
|
|
|
|
_export('default', FlagsSettingsModal);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});;
|
2016-03-18 07:02:41 +08:00
|
|
|
'use strict';
|
2015-11-05 14:11:01 +08:00
|
|
|
|
2016-03-18 07:02:41 +08:00
|
|
|
System.register('flarum/flags/main', ['flarum/extend', 'flarum/app', 'flarum/components/PermissionGrid', 'flarum/flags/components/FlagsSettingsModal'], function (_export, _context) {
|
2015-11-05 14:11:01 +08:00
|
|
|
var extend, app, PermissionGrid, FlagsSettingsModal;
|
2015-10-11 16:21:25 +08:00
|
|
|
return {
|
|
|
|
setters: [function (_flarumExtend) {
|
|
|
|
extend = _flarumExtend.extend;
|
|
|
|
}, function (_flarumApp) {
|
2016-03-18 07:02:41 +08:00
|
|
|
app = _flarumApp.default;
|
2015-10-11 16:21:25 +08:00
|
|
|
}, function (_flarumComponentsPermissionGrid) {
|
2016-03-18 07:02:41 +08:00
|
|
|
PermissionGrid = _flarumComponentsPermissionGrid.default;
|
2015-11-05 14:11:01 +08:00
|
|
|
}, function (_flarumFlagsComponentsFlagsSettingsModal) {
|
2016-03-18 07:02:41 +08:00
|
|
|
FlagsSettingsModal = _flarumFlagsComponentsFlagsSettingsModal.default;
|
2015-10-11 16:21:25 +08:00
|
|
|
}],
|
|
|
|
execute: function () {
|
|
|
|
|
|
|
|
app.initializers.add('flarum-flags', function () {
|
2015-11-05 14:11:01 +08:00
|
|
|
app.extensionSettings['flarum-flags'] = function () {
|
|
|
|
return app.modal.show(new FlagsSettingsModal());
|
|
|
|
};
|
|
|
|
|
2015-10-11 16:21:25 +08:00
|
|
|
extend(PermissionGrid.prototype, 'moderateItems', function (items) {
|
|
|
|
items.add('viewFlags', {
|
|
|
|
icon: 'flag',
|
2015-10-27 10:08:24 +08:00
|
|
|
label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
2015-10-11 16:21:25 +08:00
|
|
|
permission: 'discussion.viewFlags'
|
|
|
|
}, 65);
|
|
|
|
});
|
|
|
|
|
|
|
|
extend(PermissionGrid.prototype, 'replyItems', function (items) {
|
|
|
|
items.add('flagPosts', {
|
|
|
|
icon: 'flag',
|
2015-10-27 10:08:24 +08:00
|
|
|
label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),
|
2015-10-11 16:21:25 +08:00
|
|
|
permission: 'discussion.flagPosts'
|
|
|
|
}, 70);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|