Skip to content

Commit

Permalink
Merge pull request #45 from erz-mba-fbi/develop
Browse files Browse the repository at this point in the history
Patch Review v3.0.1
  • Loading branch information
schefbi authored May 22, 2019
2 parents 8d841ee + 01d4ce7 commit 1fb3835
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# kursausschreibung 3.0.0
# kursausschreibung 3.0.1

[![Build Status](https://travis-ci.org/erz-mba-fbi/kursausschreibung.svg?branch=master)](https://travis-ci.org/erz-mba-fbi/kursausschreibung)

Expand Down
8 changes: 8 additions & 0 deletions app/framework/date-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,11 @@ export function getDMY(dateString) {
export function getYMD(dateString) {
return isDMY(dateString) ? dateString.split('.').reverse().join('-') : format(dateString, 'YYYY-MM-DD');
}

/**
* returns dateString in from format yyyy-mm-ddThh:mm:ss to yyyy\mm\dd hh:mm:ss
* @param {string} dateString the date to convert
*/
export function getDateTimeForIcs(dateString) {
return dateString.replace(new RegExp('-', 'g'), '/').replace(new RegExp('T', 'g'), ' ');
}
8 changes: 6 additions & 2 deletions app/framework/ics-file.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion app/framework/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ObjectProxy from '@ember/object/proxy';
import { formatDate, combineDate, isInSubscriptionRange, removeMinutes } from './date-helpers';
import { all } from 'rsvp';
import settings from './settings';
import { getLanguage } from './translate';
import { getLanguage, getString } from './translate';

let initialized = false;

Expand Down Expand Up @@ -203,7 +203,9 @@ function filterEvents(events, language) {
// filter out events with non-matching LanguageOfInstruction
if (settings.languageOfInstructionFilter) {
events = events.filter(event => event.LanguageOfInstruction === 'Bilingue' ||
(event.LanguageOfInstruction === "1" && language === 'de-CH') ||
(event.LanguageOfInstruction === 'Deutsch' && language === 'de-CH') ||
(event.LanguageOfInstruction === "2" && language === 'en-US') ||
(event.LanguageOfInstruction === 'Französisch' && language === 'en-US'));
}

Expand All @@ -221,6 +223,9 @@ function prepareEvent(event) {
// add properties to the events
addPropertiesToEvent(event);

// set LanguageOfInstruction, if int to string translate value
setLanguageEventFromIntToString(event);

// create proxy for human-readable values
addDisplayData(event);

Expand Down Expand Up @@ -362,3 +367,22 @@ function addPropertiesToEvent(event) {
}
}

/**
* if LanguageOfInstruction is number translate it
* @param {object} event event returned by the API
*/
function setLanguageEventFromIntToString(event){

if (event.LanguageOfInstruction === '2') {
event.LanguageOfInstruction = getString('french');
} else if (event.LanguageOfInstruction === '1') {
event.LanguageOfInstruction = getString('german');
} else if (event.LanguageOfInstruction === '133') {
event.LanguageOfInstruction = getString('english');
} else if (event.LanguageOfInstruction === '284') {
event.LanguageOfInstruction = getString('italian');
} else if (event.LanguageOfInstruction === '285') {
event.LanguageOfInstruction = getString('spain');
}

}
3 changes: 3 additions & 0 deletions app/templates/list/category/event/confirmation-loading.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
<span data-uk-spinner></span> <span class="uk-padding-small">{{translate "sendingData"}}</span>
</div>
</div>
<script>
document.getElementById("kursausschreibung-root").scrollIntoView({behavior:'smooth'});
</script>
1 change: 1 addition & 0 deletions public/locale/de-CH.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ window.kursausschreibung.locale["de-CH"] = {

// properties of an event
"subscriptionFrom": "Start",
"subscriptionDateTo":"Anmeldefrist",
"location": "Ort",
"price": "Preis",
"buildingAddress": "Adresse",
Expand Down

0 comments on commit 1fb3835

Please sign in to comment.