Skip to content

Commit

Permalink
refactor: remove ember-crumbly (#651)
Browse files Browse the repository at this point in the history
* refactor: rename breadCrumb to breadcrumb in routes

* refactor: merge breadcrumb with route metadata

* fix: edit article title

* refactor: remove `ember-crumbly` and update BreadCrumbs component

* refactor: static-pages routes to new structure

static-pages.static-page.show doesn't work yet.

* refactor: change static-pages routes to new structure

* refactor(package): remove workerpool resolution

* fix: optional chain on controller in breadcrumb

* refactor: finishing touches on static pages controllers/routes

* fix: skip breadcrumb when model not loaded

* refactor: restructure activities controllers and routes

* refactor: restructure articles controllers and routes

* refactor: restructure books controllers and routes

* refactor: restructure groups controllers and routes

* Update changed controllers

* Update changed controllers

* refactor: restructure forum controllers and routes

* fix: make some routes extend AuthenticatedRoute again

* refactor: push changes

* refactor: restructure debit collections controllers and routes

* refactor: only import has-next in bundle

* refactor: change some ENV imports to absolute

* refactor: restructure debit mandates controllers and routes

* refactor: restructure debit transactions controllers and routes

* fix: transaction permission error

* feat: implement profile route

* refactor: restructure article and photo comments controllers and routes

* refactor: restructure photo-albums controllers and routes

* refactor: restructure users controllers and routes

* refactor: restructure polls controllers and routes

* refactor: restructure mail aliases controllers and routes

* refactor: restructure mail moderations controllers and routes

* refactor: restructure form responses controllers and routes

* refactor: restructure vacancies controllers and routes

* refactor: fix and implement missing tests

* fix: lint

* refactor: rename BreadCrumbs to Breadcrumbs

* chore: change mailalias to mail alias

* chore: reformat classes

* add a folder for mail-moderation. Tested the reachability of the pages that belong to these routes, which was initially broken.

* refactor: reorder params

* refactor: simplify getter

* fix: transaction-form title

* fix: post-form/collection-form title

---------

Co-authored-by: matteo <[email protected]>
  • Loading branch information
guidojw and DrumsnChocolate authored Jun 13, 2023
1 parent f7eda5c commit cd14eb8
Show file tree
Hide file tree
Showing 555 changed files with 3,344 additions and 1,753 deletions.
4 changes: 4 additions & 0 deletions app/abilities/article-comment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Ability } from 'ember-can';

export default class ArticleComment extends Ability {
get canShow() {
return this.session.hasPermission('article-comment.read');
}

get canCreate() {
return this.session.hasPermission('article-comment.create');
}
Expand Down
4 changes: 4 additions & 0 deletions app/abilities/debit/transaction.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Ability } from 'ember-can';

export default class Transaction extends Ability {
get canShow() {
return this.session.hasPermission('debit/transaction.read');
}

get canEdit() {
return this.session.hasPermission('debit/transaction.update');
}
Expand Down
2 changes: 1 addition & 1 deletion app/abilities/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class Photo extends Ability {
get canShowPhotoComments() {
return (
this.session.hasPermission('photo-comment.read') ||
this.model.photoAlbum.publiclyVisible
this.model.photoAlbum.get('publiclyVisible')
);
}
}
2 changes: 1 addition & 1 deletion app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import { underscore } from '@ember/string';
import { inject as service } from '@ember/service';
import ENV from '../config/environment';
import ENV from 'amber-ui/config/environment';

import { pluralize } from 'ember-inflector';

Expand Down
2 changes: 1 addition & 1 deletion app/authenticators/oauth2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import ENV from '../config/environment';
import ENV from 'amber-ui/config/environment';

export default class OAuth2Authenticator extends OAuth2PasswordGrant {
serverTokenEndpoint = `${ENV.api.hostname}/oauth/token`;
Expand Down
11 changes: 0 additions & 11 deletions app/components/bread-crumbs.hbs

This file was deleted.

3 changes: 0 additions & 3 deletions app/components/bread-crumbs.js

This file was deleted.

15 changes: 15 additions & 0 deletions app/components/breadcrumbs.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ol class='breadcrumb'>
<li class='breadcrumb-item'><LinkTo @route='index'>C.S.V. Alpha</LinkTo></li>

{{#each @routeInfos as |routeInfo|}}
<li class='breadcrumb-item'>
{{#if (has-next routeInfo @routeInfos)}}
<LinkTo @route={{routeInfo.name}}>
{{routeInfo.metadata.breadcrumb.title}}
</LinkTo>
{{else}}
{{routeInfo.metadata.breadcrumb.title}}
{{/if}}
</li>
{{/each}}
</ol>
4 changes: 2 additions & 2 deletions app/components/cards/activity-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
<span class='subtitle-author' data-test-activity-author>
{{#if activity.group}}
<LinkTo
@route='groups.show'
@route='groups.group'
@model={{activity.group.id}}
class='link-to card-subtitle-link'
>
{{activity.group.name}}
</LinkTo>
{{else}}
<LinkTo
@route='users.show'
@route='users.user'
@model={{activity.author.id}}
class='link-to card-subtitle-link'
>
Expand Down
8 changes: 4 additions & 4 deletions app/components/cards/article-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>

<div class='card-titles'>
<LinkTo @route='articles.show' @model={{article.id}}>
<LinkTo @route='articles.article' @model={{article.id}}>
<h2 class='card-title' itemprop='name headline'>
{{#if article.pinned}}<FaIcon @icon='thumbtack' />{{/if}}
{{article.title}}
Expand All @@ -32,7 +32,7 @@
<h3 class='card-subtitle'>
{{#if article.group}}
<LinkTo
@route='groups.show'
@route='groups.group'
@model={{article.group.id}}
class='link-to card-subtitle-link'
>
Expand All @@ -46,7 +46,7 @@
</LinkTo>
{{else}}
<LinkTo
@route='users.show'
@route='users.user'
@model={{article.author.id}}
class='link-to card-subtitle-link'
>
Expand Down Expand Up @@ -101,7 +101,7 @@
}}
</span>
{{#if useMaxHeight}}
<LinkTo @route='articles.show' @model={{article.id}} itemprop='url'>
<LinkTo @route='articles.article' @model={{article.id}} itemprop='url'>
<span class='float-md-end'> {{t 'tag.button.readMore'}} </span>
</LinkTo>
{{/if}}
Expand Down
6 changes: 3 additions & 3 deletions app/components/cards/frontpage-article-card.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<LinkTo @route='articles.show' @model={{article.id}}>
<LinkTo @route='articles.article' @model={{article.id}}>
<article
class={{if useMaxHeight 'd-flex'}}
itemscope
Expand All @@ -24,7 +24,7 @@
</h5>
{{#if article.group}}
<LinkTo
@route='groups.show'
@route='groups.group'
@model={{article.group.id}}
class='link-to card-subtitle-link'
>
Expand All @@ -39,7 +39,7 @@
</LinkTo>
{{else}}
<LinkTo
@route='users.show'
@route='users.user'
@model={{article.author.id}}
class='link-to card-subtitle-link'
>
Expand Down
2 changes: 1 addition & 1 deletion app/components/cards/privacy-preference.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{{#if (can 'edit user' model)}}
<LinkTo
@route='users.edit-privacy'
@route='users.user.edit.privacy'
@model={{model.id}}
class='btn btn-outline-info'
>
Expand Down
2 changes: 1 addition & 1 deletion app/components/form/response/response-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@inputLayout='vertical'
>
{{#if form.questions}}
<LinkTo @route='activities.index' class='btn btn-default'>
<LinkTo @route='activities' class='btn btn-default'>
Annuleren
</LinkTo>
Vragen met een * zijn verplicht
Expand Down
2 changes: 1 addition & 1 deletion app/components/form/response/response-completed-alert.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</span>
{{#if form.canRespond}}
<LinkTo
@route='form.responses.destroy'
@route='form.responses.response.destroy'
@model={{form.currentUserResponseId}}
class='btn btn-secondary'
>
Expand Down
4 changes: 2 additions & 2 deletions app/components/form/responses-table-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{#if (can 'destroy form/response')}}
{{#if response.form.canRespond}}
<LinkTo
@route='form.responses.destroy'
@route='form.responses.response.destroy'
@model={{response.id}}
class='no-print'
>
Expand All @@ -17,7 +17,7 @@
{{/if}}
{{/if}}

<LinkTo @route='users.show' @model={{response.user.id}}>
<LinkTo @route='users.user' @model={{response.user.id}}>
{{response.user.fullNameWithNickname}}
</LinkTo>
</td>
Expand Down
6 changes: 3 additions & 3 deletions app/components/forms/photo-album-form.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class='card'>
<div class='card-header'>
<h5>{{if @model.isNew 'Foto-album aanmaken' 'Foto-album wijzigen'}}</h5>
<h5>{{if @model.isNew 'Fotoalbum aanmaken' 'Fotoalbum wijzigen'}}</h5>
</div>
<div class='card-body'>
<form {{action @onSubmit on='submit'}}>
Expand All @@ -25,7 +25,7 @@
<div class="row">
<div class="col-sm-10 offset-sm-2">
<div class='alert alert-warning' role='alert'>
Een publiek foto-album verschijnt op de voorpagina, en is ook voor
Een publiek fotoalbum verschijnt op de voorpagina, en is ook voor
externen zichtbaar. Wees dus voorzichtig met wat je plaatst en zorg
dat je toestemming hebt. Zie het mediabeleid voor meer informatie.
</div>
Expand Down Expand Up @@ -86,7 +86,7 @@
@errors={{@model.errors}}
@errorMessage={{@errorMessage}}
>
<button {{action @onCancel}} type="button" class='btn btn-default'>
<button {{action @onCancel}} type='button' class='btn btn-default'>
Annuleren
</button>
</ModelForm::FormActions>
Expand Down
2 changes: 1 addition & 1 deletion app/components/forms/post-form.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class='card'>
<div class='card-header'>
<h5>Forumpost bewerken</h5>
<h5>{{if @model.isNew 'Forumbericht aanmaken' 'Forumbericht wijzigen'}}</h5>
</div>
<div class='card-body'>
<form {{action @onSubmit on='submit'}}>
Expand Down
2 changes: 1 addition & 1 deletion app/components/forms/transaction-form.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class='card'>
<div class='card-header'>
<h5>Transactie aanmaken</h5>
<h5>{{if @model.isNew 'Transactie aanmaken' 'Transactie wijzigen'}}</h5>
</div>
<div class='card-body'>
<form {{action @onSubmit on='submit'}}>
Expand Down
8 changes: 4 additions & 4 deletions app/components/forum/forum-post.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div class='card-body'>
<div class='row'>
<div class='col-md-3 forum-post-author-info'>
<LinkTo @route='users.show' @model={{post.author.id}}>
<LinkTo @route='users.user' @model={{post.author.id}}>
<img
src='{{post.author.avatarThumbUrlOrDefault}}'
alt='avatar'
class='profile-picture profile-picture-large'
/>
</LinkTo>
<LinkTo @route='users.show' @model={{post.author.id}}>
<LinkTo @route='users.user' @model={{post.author.id}}>
<p class="mt-1"> <strong> {{post.author.fullNameWithNickname}} </strong> </p>
</LinkTo>
</div>
Expand Down Expand Up @@ -52,7 +52,7 @@
<span class='text-muted pe-1 w-auto'>
{{#if (can 'destroy forum/posts')}}
<LinkTo
@route='forum.categories.category.threads.thread.posts.destroy'
@route='forum.categories.category.threads.thread.posts.post.destroy'
@model={{post.id}}
class='link-highlight px-2'
>
Expand All @@ -62,7 +62,7 @@

{{#if (can 'edit forum/post' post)}}
<LinkTo
@route='forum.categories.category.threads.thread.posts.edit'
@route='forum.categories.category.threads.thread.posts.post.edit'
@model={{post.id}}
class='link-highlight px-2'
>
Expand Down
22 changes: 15 additions & 7 deletions app/components/header-nav.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<nav class='navbar pb-0 pt-0' aria-label='breadcrumb'>
<div class="container-fluid d-flex justify-content-between">
<span class='left-sidebar-toggle d-block d-md-none link' {{action 'toggleLeftSidebar'}}>
<span
class='left-sidebar-toggle d-block d-md-none link'
{{action 'toggleLeftSidebar'}}
>
</span>

Expand All @@ -12,14 +15,16 @@
<div class='navbar-overflow-wrapper'>
<div class='navbar-nav col d-flex flex-row'>
{{#if (or session.isAuthenticated media.isMobile)}}
<BreadCrumbs @crumbClass='breadcrumb-item' />
<Breadcrumbs @routeInfos={{@routeInfos}} />
{{else}}
<BsDropdown as |dd| {{did-insert (action 'setAvailableStaticPages')}}>
<dd.button @type="primary">{{t "component.headerNav.aboutUs"}}</dd.button>
<BsDropdown {{did-insert (action 'setAvailableStaticPages')}} as |dd|>
<dd.button @type="primary">
{{t "component.headerNav.aboutUs"}}
</dd.button>
<dd.menu @renderInPlace={{false}} as |ddm|>
{{#each-in staticPagesForDropdown as |id title|}}
<ddm.item>
<ddm.linkTo @route='static-pages.show' @model={{id}}>
<ddm.linkTo @route='static-pages.static-page' @model={{id}}>
{{title}}
</ddm.linkTo>
</ddm.item>
Expand All @@ -42,8 +47,11 @@
</div>

{{#unless session.isAuthenticated}}
<button class='btn btn-locale btn-inverse-locale-{{intl.locale}}' title='{{t "component.headerNav.changeLocale"}}'
{{action 'toggleLocale'}} type='button'>
<button
class='btn btn-locale btn-inverse-locale-{{intl.locale}}'
title='{{t "component.headerNav.changeLocale"}}'
{{action 'toggleLocale'}}
type='button'>
</button>
{{/unless}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/header-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default Component.extend({
addStaticPageOption: function (list, id, localeName) {
if (this.availableStaticPages && this.availableStaticPages[id]) {
list.push({
link: 'static-pages.show',
link: 'static-pages.static-page',
linkArgument: id,
title: this.intl.t('component.headerNav.' + localeName),
icon: '',
Expand Down
2 changes: 1 addition & 1 deletion app/components/index/public/about-alpha.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</p>

<LinkTo
@route='static-pages.show'
@route='static-pages.static-page'
@model='c-s-v-alpha'
class='btn btn-lg btn-light me-3 mb-3'
>
Expand Down
2 changes: 1 addition & 1 deletion app/components/index/public/action-buttons.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{t 'component.index.public.actionButtons.memberButton'}}
</a>
<LinkTo
@route='static-pages.show'
@route='static-pages.static-page'
@model='word-lid'
class='btn btn-lg btn-primary frontpage-button mt-3'
>
Expand Down
2 changes: 1 addition & 1 deletion app/components/index/special-promo.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<em>{{date}}</em>
<p>{{text}}</p>
<LinkTo
@route='articles.show'
@route='articles.article'
@model={{123}}
class='btn frontpage-button btn-lg float-xs-end'
>
Expand Down
4 changes: 3 additions & 1 deletion app/components/index/sponsorkliks-alert.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
bij verschillende webshops verdient Alpha er ook nog wat aan. De uitgebreide
uitleg vind je
<b>
<LinkTo @route='static-pages.show' @model='alpha-deals'>hier</LinkTo>
<LinkTo @route='static-pages.static-page' @model='alpha-deals'>
hier
</LinkTo>
</b>.

<br />
Expand Down
4 changes: 2 additions & 2 deletions app/components/menu-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<div class='profile-menu {{if layoutManager.profileMenuOpen "open"}}'>
<MenuSidebarItem
@link='users.show'
@link='users.user'
@hasPermission={{can 'show activities'}}
@icon='user'
@title={{t 'mixin.menuItems.profile'}}
Expand All @@ -55,7 +55,7 @@
@link='mail-aliases'
@hasPermission={{can 'show mail-aliases'}}
@icon='envelope'
@title={{t 'mixin.menuItems.mailaliases'}}
@title={{t 'mixin.menuItems.mailAliases'}}
@minor={{true}}
/>
<MenuSidebarItem
Expand Down
2 changes: 1 addition & 1 deletion app/components/model-form/file-input.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed } from '@ember/object';
import EmberArray from '@ember/array';
import ENV from '../../config/environment';
import ENV from 'amber-ui/config/environment';
import ModelFormTextInputComponent from './text-input';

export default ModelFormTextInputComponent.extend({
Expand Down
Loading

0 comments on commit cd14eb8

Please sign in to comment.