mirror of
https://github.com/flarum/core.git
synced 2025-06-21 18:26:01 +02:00
See https://github.com/flarum/core/pull/1367 * Replace gulp with webpack and npm scripts for JS compilation * Set up Travis CI to commit compiled JS * Restructure `js` directory; only one instance of npm, forum/admin are "submodules" * Restructure `less` directory
28 lines
787 B
JavaScript
28 lines
787 B
JavaScript
import app from 'flarum/app';
|
|
import Model from 'flarum/Model';
|
|
|
|
import Flag from './models/Flag';
|
|
import FlagsPage from './components/FlagsPage';
|
|
import addFlagControl from './addFlagControl';
|
|
import addFlagsDropdown from './addFlagsDropdown';
|
|
import addFlagsToPosts from './addFlagsToPosts';
|
|
|
|
app.initializers.add('flarum-flags', () => {
|
|
app.store.models.posts.prototype.flags = Model.hasMany('flags');
|
|
app.store.models.posts.prototype.canFlag = Model.attribute('canFlag');
|
|
|
|
app.store.models.flags = Flag;
|
|
|
|
app.routes.flags = {path: '/flags', component: <FlagsPage/>};
|
|
|
|
addFlagControl();
|
|
addFlagsDropdown();
|
|
addFlagsToPosts();
|
|
});
|
|
|
|
// Expose compat API
|
|
import flagsCompat from './compat';
|
|
import { compat } from '@flarum/core/forum';
|
|
|
|
Object.assign(compat, flagsCompat);
|