Commit 213e9f1e authored by Sandro Lutz's avatar Sandro Lutz Committed by scmoritz
Browse files

Change company profile data storage

parent 29d2283b
......@@ -88,6 +88,13 @@
"events.searchfield": "Suchtext eingeben...",
"events.price": "Preis",
"events.free": "Gratis",
"events.small_fee": "Kleine Teilnahmegebühr"
"events.small_fee": "Kleine Teilnahmegebühr",
"companies.contact_information": "Kontakt-Informationen",
"companies.email": "Email",
"companies.phone": "Telefon",
"companies.website": "Webseite",
"companies.employees": "Mitarbeiter",
"companies.employees_worldwide": "Weltweit",
"companies.employees_Switzerland": "in der Schweiz"
}
}
......@@ -88,6 +88,13 @@
"events.searchfield": "Enter search text...",
"events.price": "Price",
"events.free": "Free",
"events.small_fee": "Small fee"
"events.small_fee": "Small fee",
"companies.contact_information": "Contact information",
"companies.email": "Email",
"companies.phone": "Phone",
"companies.website": "Website",
"companies.employees": "Employees",
"companies.employees_worldwide": "Worldwide",
"companies.employees_Switzerland": "in Switzerland"
}
}
import m from 'mithril';
import load from '../../models/companies';
import { data } from './data/companies';
import { Error404 } from '../errors';
import { i18n } from '../../models/language';
export default class companyDetail {
export default class CompanyDetails {
oninit(vnode) {
if (!data[vnode.attrs.companyId]) return;
this.company = data[vnode.attrs.companyId];
this.content = '';
load(vnode.attrs.companyId).then(response => {
this.content = response;
......@@ -10,6 +16,43 @@ export default class companyDetail {
}
view() {
return m.trust(this.content);
if (!this.company) {
return m(Error404);
}
return m('div', [
m('h1', this.company.name),
this.company.logo ? m('img', { src: `/${this.company.logo}` }) : m(''),
m('div', [
m('h2', i18n('companies.contact_information')),
this.company.address.map(item => m('div', item)),
this.company.email
? m('div', [
m('span', `${i18n('companies.email')} `),
m('a', { href: `mailto:${this.company.email}` }, this.company.email),
])
: m(''),
this.company.phone
? m('div', [
m('span', `${i18n('companies.phone')} `),
m('a', { href: `tel:${this.company.phone}` }, this.company.phone),
])
: m(''),
this.company.website
? m('div', [
m('span', `${i18n('companies.website')} `),
m('a', { href: this.company.website }, this.company.website),
])
: m(''),
]),
this.company.employees
? m('div', [
m('h2', i18n('companies.employees')),
Object.entries(this.company.employees).map(([key, employees]) =>
m('div', [m('span', `${i18n(`companies.employees_${key}`)}: `), m('span', employees)])
),
])
: m(''),
m('div', m.trust(this.content)),
]);
}
}
import m from 'mithril';
import load from '../../models/companies';
import marked from 'marked';
import { data } from './data/companies';
import { i18n, currentLanguage } from '../../models/language';
export default class companyList {
oninit() {
this.content = '';
load('list').then(response => {
this.content = response;
});
class CompanyItem {
static _parseMarkdownText(text) {
// replace leading spaces when using multi-line strings
return marked(text.trim().replace(/\n[^\S\n]+/g, '\n'));
}
view() {
return m.trust(this.content);
static view(vnode) {
return m(
'div',
m(
'a',
{ href: `/${currentLanguage()}/companies/${vnode.attrs.key}`, onupdate: m.route.link },
vnode.attrs.company.name
)
);
}
}
export default class CompanyList {
static view() {
return m('div', [
m('h1', i18n('Companies')),
Object.entries(data).map(([key, company]) => m(CompanyItem, { key, company })),
]);
}
}
// Contains static information about company profiles.
// Markdown can be used to style the text.
import abbLogo from '../logos/abb.png';
import mfLogo from '../logos/m-f.png';
const data = {
abb: {
name: 'ABB Schweiz AG',
logo: abbLogo,
address: ['ABB Schweiz AG', 'Herr Marcel Winkelmann', 'Brown Boveri Strasse 6', '5400 Baden'],
email: 'hrmarketing@ch.abb.com',
website: 'http://www.abb.ch/',
employees: {
worldwide: 145000,
Switzerland: 6800,
},
},
'm-f': {
name: 'M&F Engineering',
logo: mfLogo,
address: ['M&F Engineering', 'Rachel Blaser', 'Querstrasse 17', '8951 Fahrweid'],
email: 'rachel.blaser@m-f.ch',
phone: '+41 44 747 44 33',
website: 'http://www.m-f.ch/',
employees: {
worldwide: 25,
Switzerland: 25,
},
},
sensirion: {
name: 'Sensirion AG',
address: ['Marco Höhener'],
phone: '+41 44 927 11 96',
website: 'http://www.sensirion.com/',
},
};
export { data };
# ABB
Webseite: [ABB Website](http://www.abb.ch/)
Angestellte: 145'000 weltweit, 6'800 in der Schweiz
## Kontakt
ABB Schweiz AG
Herr Marcel Winkelmann
Brown Boveri Strasse 6
5400 Baden
hrmarketing@ch.abb.com
## Portrait
ABB ist weltweit führend in der Energie- und Automationstechnik. Das Unternehmen ermöglicht seinen Kunden in der Energieversorgung und der Industrie, ihre Leistung zu verbessern und gleichzeitig die Umweltbelastung zu reduzieren. ABB beschäftigt rund 130'000 Mitarbeitende in über 100 Länder.
......
# ABB
Website: [ABB Website](http://www.abb.ch/)
Angestellte: 145'000 weltweit, 6'800 in der Schweiz
## Contact
ABB Schweiz AG
Herr Marcel Winkelmann
Brown Boveri Strasse 6
5400 Baden
hrmarketing@ch.abb.com
## Portrait
ABB ist weltweit führend in der Energie- und Automationstechnik. Das Unternehmen ermöglicht seinen Kunden in der Energieversorgung und der Industrie, ihre Leistung zu verbessern und gleichzeitig die Umweltbelastung zu reduzieren. ABB beschäftigt rund 130'000 Mitarbeitende in über 100 Länder.
......
# Unsere Partner-Firmen
* [ABB](/de/companies/abb)
* [Sensirion](/de/companies/sensirion)
# Our partner companies
* [ABB](/en/companies/abb)
* [Sensirion](/en/companies/sensirion)
# Sensirion
## Kontakt
Marco Höhener
+41 44 927 11 96
www.xing.to/Marco_Hoehener
## Über uns
Die Sensirion AG ist ein aus der ETH Zürich hervorgegangenes, innovatives und international tätiges Hightech Unternehmen mit Sitz am Zürichsee mit über 500 Mitarbeitenden.
......
# Sensirion
## Contact
Marco Höhener
+41 44 927 11 96
www.xing.to/Marco_Hoehener
## Über uns
## About Us
Die Sensirion AG ist ein aus der ETH Zürich hervorgegangenes, innovatives und international tätiges Hightech Unternehmen mit Sitz am Zürichsee mit über 500 Mitarbeitenden.
......
......@@ -92,6 +92,19 @@ const config = {
},
],
},
{
test: /src\/views\/companies\/logos\/[-_a-zA-Z\d\/]+\.(png|jp(e*)g|svg)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'companies/',
publicPath: 'dist/companies/',
},
},
],
},
{
test: /src\/views\/images\/[a-zA-Z\d\/]+\.(png|jp(e*)g|svg)$/,
use: [
......
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