Skip to content
Snippets Groups Projects
index.js 1.42 KiB
Newer Older
import m from 'mithril';
import { OauthRedirect } from './auth';
import GroupList from './groups/list';
import GroupItem from './groups/item';
Hermann's avatar
Hermann committed
import { UserItem, UserTable } from './users/userTool';
Hermann's avatar
Hermann committed
import MembershipView from './membershipTool';
import EventTable from './events/table';
Hermann's avatar
Hermann committed
import EventItem from './events/item';
Hermann's avatar
Hermann committed
import JobTable from './jobs/table';
import JobItem from './jobs/item';
import StudydocTable from './studydocs/list';
import studydocItem from './studydocs/item';
import { Layout } from './layout';
const root = document.body;
function layoutWith(view) {
  return {
    view() {
      return m(Layout, m(view));
    },
  };
}

m.route.prefix('');
Hermann's avatar
Hermann committed
m.route(root, '/events', {
  '/users': layoutWith(UserTable),
Hermann's avatar
Hermann committed
  '/users/:id': layoutWith(UserItem),
  '/newuser': layoutWith(UserItem),
Hermann's avatar
Hermann committed
  '/groupmemberships/:id': layoutWith(MembershipView),
Hermann's avatar
Hermann committed
  '/events': layoutWith(EventTable),
Hermann's avatar
Hermann committed
  '/events/:id': layoutWith(EventItem),
  '/newevent': layoutWith(EventItem),
  '/proposeevent': layoutWith(EventItem),
  '/groups': layoutWith(GroupList),
  '/groups/:id': layoutWith(GroupItem),
  '/newgroup': layoutWith(GroupItem),
  '/oauthcallback': OauthRedirect,
Hermann's avatar
Hermann committed
  '/joboffers': layoutWith(JobTable),
  '/newjoboffer': layoutWith(JobItem),
  '/joboffers/:id': layoutWith(JobItem),
  '/studydocuments': layoutWith(StudydocTable),
  '/studydocuments/:id': layoutWith(studydocItem),
  '/newstudydocument': layoutWith(studydocItem),