Commit 2c95853a authored by Nicolas Vetsch's avatar Nicolas Vetsch
Browse files

Updated teams and commissions

and the way they are displayed in the 'teams' view.
 More descriptive file naming/structure.
parent c9f7edc6
......@@ -2,14 +2,6 @@
// Markdown can be used to style the text.
const data = [
{
name: 'LIMES - Ladies in Mechanical and Electrical Studies',
description: {
en: 'Not a real description.',
},
website: 'https://limes.amiv.ethz.ch',
email: 'limes@amiv.ethz.ch',
},
{
name: 'Bastli',
description: {
......@@ -26,6 +18,78 @@ const data = [
website: 'https://blitz.ethz.ch',
email: 'info@blitz.ethz.ch',
},
{
name: 'Braukommission',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'Irrational Co.',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'EESTEC',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'Funkbude',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'LIMES - Ladies in Mechanical and Electrical Studies',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
website: 'https://limes.amiv.ethz.ch',
email: 'limes@amiv.ethz.ch',
},
{
name: 'RandomDudes',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'Kontakt',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'E=MC^2',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'MNS',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'BEEZ',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
];
export { data };
// Contains static information about our ressorts.
// Markdown can be used to style the text.
const data = [
{
name: 'Designteam',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'ER Team',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'IT Team',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
{
name: 'Kulturteam',
description: {
en: 'Not a real description.',
de: 'Keine echte Beschreibung',
},
},
];
export { data };
......@@ -17,7 +17,7 @@ import contact from './views/contact';
import about from './views/amiv/about';
import board from './views/amiv/board';
import minutes from './views/amiv/minutes';
import commissions from './views/amiv/commissions';
import teams from './views/amiv/teams';
import jobOfferList from './views/jobs/jobofferList';
import companyList from './views/companies/companyList';
import companyDetail from './views/companies/companyDetail';
......@@ -75,8 +75,8 @@ Raven.context(() => {
view: () => m(board),
},
{
url: '/:language/commissions',
view: () => m(commissions),
url: '/:language/teams',
view: () => m(teams),
},
{
url: '/:language/about',
......
......@@ -11,6 +11,8 @@
"About AMIV": "Über den AMIV",
"Board": "Vorstand",
"Commissions": "Kommissionen",
"Ressorts/Teams": "Ressorts",
"Commissions & Teams": "Kommissionen & Teams",
"Statutes": "Statuten",
"Minutes": "Protokolle",
"Events": "Events",
......
......@@ -11,6 +11,8 @@
"About AMIV": "About AMIV",
"Board": "Board",
"Commissions": "Commissions",
"Ressorts/Teams": "Teams",
"Commissions & Teams": "Commissions & Teams",
"Statutes": "Statutes",
"Minutes": "Minutes",
"Events": "Events",
......
......@@ -88,8 +88,8 @@ export const mainNavigation = new Navigation([
onupdate: m.route.link,
},
{
label: 'Commissions',
path: '/commissions',
label: 'Teams',
path: '/teams',
addLanguagePrefix: true,
onupdate: m.route.link,
},
......
@import './board.less';
@import './colors.less';
@import './commissions.less';
@import './teams.less';
@import './dimensions.less';
@import './errors.less';
@import './eventDetails.less';
......
@import './colors.less';
@import './images.less';
.commissions {
.teams {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 30px;
......@@ -19,7 +19,7 @@
}
}
.commission {
.team {
display: grid;
grid-template-rows: auto auto 1fr auto;
border: 1px solid @color-grey;
......
import m from 'mithril';
import marked from 'marked';
import escape from 'html-escape';
import { data } from '../../content/amiv/data/commissions';
import { data as data_ressorts } from '../../content/amiv/data/ressorts';
import { data as data_commissions } from '../../content/amiv/data/commissions';
import { i18n, currentLanguage } from '../../models/language';
import { TranslationUnavailable } from '../errors';
class Commission {
class Team {
static _parseMarkdownText(text) {
// replace leading spaces when using multi-line strings
return marked(escape(text.trim().replace(/\n[^\S\n]+/g, '\n')));
}
static view(vnode) {
const { commission } = vnode.attrs;
const { team } = vnode.attrs;
let image;
let description;
const contactInfo = [];
if (commission.image) {
image = m('div.image.ratio-16to9', m('img', { src: `/${commission.image}` }));
if (team.image) {
image = m('div.image.ratio-16to9', m('img', { src: `/${team.image}` }));
} else {
image = m('div.no-image.ratio-16to9', m('span', i18n('no image')));
}
// collect all avialable contact information
if (commission.website) {
contactInfo.push(m('a', { href: commission.website }, commission.website));
if (team.website) {
contactInfo.push(m('a', { href: team.website }, team.website));
}
if (commission.email) {
contactInfo.push(m('a', { href: `mailto:${commission.email}` }, commission.email));
if (team.email) {
contactInfo.push(m('a', { href: `mailto:${team.email}` }, team.email));
}
if (commission.phone) {
contactInfo.push(m('a', { href: `tel:${commission.phone}` }, commission.phone));
if (team.phone) {
contactInfo.push(m('a', { href: `tel:${team.phone}` }, team.phone));
}
if (commission.description && Object.keys(commission.description).length > 0) {
if (team.description && Object.keys(team.description).length > 0) {
// select translation in the following order:
// current language > english > first available language
if (commission.description[currentLanguage()]) {
description = m.trust(
Commission._parseMarkdownText(commission.description[currentLanguage()])
);
if (team.description[currentLanguage()]) {
description = m.trust(Team._parseMarkdownText(team.description[currentLanguage()]));
} else {
let language;
if (commission.description.en) {
if (team.description.en) {
language = 'en';
} else {
[language] = Object.keys(commission.description);
[language] = Object.keys(team.description);
}
description = [
m(TranslationUnavailable, { shown_language: language }),
m.trust(Commission._parseMarkdownText(commission.description[language])),
m.trust(Team._parseMarkdownText(team.description[language])),
];
}
} else {
description = m('');
}
return m('div.commission', [
return m('div.team', [
image,
m('h2', commission.name),
m('h2', team.name),
m('div.description', description),
m(
'div.contact',
......@@ -72,11 +71,17 @@ class Commission {
}
}
export default class Commissions {
export default class Teams {
static view() {
return m('div', [
m('div', [
m('h1.centered', i18n('Ressorts/Teams')),
m('div.teams', data_ressorts.map(ressort => m(Team, { team: ressort }))),
]),
m('div', [
m('h1.centered', i18n('Commissions')),
m('div.commissions', data.map(commission => m(Commission, { commission }))),
m('div.teams', data_commissions.map(commission => m(Team, { team: commission }))),
]),
]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment