diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-25 23:26:31 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-25 23:26:31 +0200 |
| commit | 1cfed2612fd1042a15d470a44ec87588c966dc12 (patch) | |
| tree | ba850f589194a21fd1587dd71dfcd056a242e4ac /public/assets/js/lib/router.js | |
| parent | ae311b71cccf5df9e0e19e276615cc32426d9de1 (diff) | |
hootstream... dark mode only
Diffstat (limited to 'public/assets/js/lib/router.js')
| -rw-r--r-- | public/assets/js/lib/router.js | 212 |
1 files changed, 109 insertions, 103 deletions
diff --git a/public/assets/js/lib/router.js b/public/assets/js/lib/router.js index ebdfa78..bedf0b9 100644 --- a/public/assets/js/lib/router.js +++ b/public/assets/js/lib/router.js @@ -1,133 +1,139 @@ var SiteRouter = Router.extend({ + el: "body", - el: "body", - - routes: { - "/": 'login', - "/index/:keyword": 'index', - "/index": 'index', - "/login": 'login', - "/logout": 'logout', - "/signup": 'signup', - "/details/:id": 'details', - "/details/:id/settings": 'threadSettings', - "/post": 'post', - "/post/:keyword": 'post', - "/comment/:id/edit": 'editComment', - "/keywords": 'keywords', - "/search": 'search', - "/mail": 'mailbox', - "/mail/:mailbox": 'mailbox', - "/mail/compose": 'compose', - "/mail/compose/:username": 'compose', - "/mail/read/:id": 'message', - "/mail/reply/:id": 'compose', - "/users": 'users', - "/users/all": 'usersAll', - "/profile": 'profile', - "/profile/:username": 'profile', - "/profile/:username/edit": 'editProfile', - "/adminz": 'adminz', - }, - - initialize: function(){ - $(".logout").click(() => this.logout()) + routes: { + "/": "login", + "/index/:keyword": "index", + "/index": "index", + "/stream": "stream", + "/login": "login", + "/logout": "logout", + "/signup": "signup", + "/details/:id": "details", + "/details/:id/settings": "threadSettings", + "/post": "post", + "/post/:keyword": "post", + "/comment/:id/edit": "editComment", + "/keywords": "keywords", + "/search": "search", + "/mail": "mailbox", + "/mail/:mailbox": "mailbox", + "/mail/compose": "compose", + "/mail/compose/:username": "compose", + "/mail/read/:id": "message", + "/mail/reply/:id": "compose", + "/users": "users", + "/users/all": "usersAll", + "/profile": "profile", + "/profile/:username": "profile", + "/profile/:username/edit": "editProfile", + "/adminz": "adminz", }, - - index: function(keyword){ - app.view = new IndexView () - app.view.load(keyword) + + initialize: function () { + $(".logout").click(() => this.logout()); }, - - login: function(){ - app.view = new LoginView () + + index: function (keyword) { + app.view = new IndexView(); + app.view.load(keyword); }, - - logout: function(){ - auth.log_out() - window.location.href = "/logout" + + stream: function (keyword) { + app.view = new StreamView(); + app.view.load(keyword); }, - - signup: function(){ - app.view = new SignupView () + + login: function () { + app.view = new LoginView(); }, - - details: function(id){ - app.view = new DetailsView () - app.view.load(id) + + logout: function () { + auth.log_out(); + window.location.href = "/logout"; }, - threadSettings: function(id){ - app.view = new DetailsView ({ settings: true }) - app.view.load(id) + signup: function () { + app.view = new SignupView(); }, - - editComment: function(id){ - app.view = new EditCommentForm () - app.view.load(id) + + details: function (id) { + app.view = new DetailsView(); + app.view.load(id); }, - keywords: function(){ - app.view = new KeywordsView () - app.view.load() + threadSettings: function (id) { + app.view = new DetailsView({ settings: true }); + app.view.load(id); }, - mailbox: function(box){ - app.view = new MailboxView () - app.view.load(box) + editComment: function (id) { + app.view = new EditCommentForm(); + app.view.load(id); }, - - message: function(id){ - app.view = new MessageView () - app.view.load(id) + + keywords: function () { + app.view = new KeywordsView(); + app.view.load(); }, - post: function(keyword){ - app.view = new ThreadForm () - app.view.load(keyword || "") + mailbox: function (box) { + app.view = new MailboxView(); + app.view.load(box); }, - - users: function(username){ - app.view = new UsersView () - app.view.load() + + message: function (id) { + app.view = new MessageView(); + app.view.load(id); }, - usersAll: function(username){ - app.view = new UsersView ({ all: true }) - app.view.load() + post: function (keyword) { + app.view = new ThreadForm(); + app.view.load(keyword || ""); }, - - profile: function(username){ - app.view = new ProfileView () - app.view.load(username || auth.user.username) + + users: function (username) { + app.view = new UsersView(); + app.view.load(); }, - - editProfile: function(username){ - app.view = new ProfileForm () - app.view.load(username || auth.user.username) + + usersAll: function (username) { + app.view = new UsersView({ all: true }); + app.view.load(); }, - - compose: function(username){ - app.view = new ComposeView () - app.view.load(username) + + profile: function (username) { + app.view = new ProfileView(); + app.view.load(username || auth.user.username); }, - search: function(){ - app.view = new SearchResults () - app.view.load() + editProfile: function (username) { + app.view = new ProfileForm(); + app.view.load(username || auth.user.username); }, - adminz: function(){ - app.view = new AdminView () - app.view.load() + compose: function (username) { + app.view = new ComposeView(); + app.view.load(username); }, - - error404: function(){ - $("content").hide() - $("#error_404").show() - $("h1").html("404 not found") - $("body").removeClass("loading") - $("#error_404").append('<a href="/"><img src="/assets/img/castro.jpg"></a>') + + search: function () { + app.view = new SearchResults(); + app.view.load(); }, -})
\ No newline at end of file + adminz: function () { + app.view = new AdminView(); + app.view.load(); + }, + + error404: function () { + $("content").hide(); + $("#error_404").show(); + $("h1").html("404 not found"); + $("body").removeClass("loading"); + $("#error_404").append( + '<a href="/"><img src="/assets/img/castro.jpg"></a>' + ); + }, +}); |
