Skip to content

Commit

Permalink
Merge pull request #184 from bkd-mba-fbi/develop
Browse files Browse the repository at this point in the history
Langenthal 3.5.0
  • Loading branch information
schefbi authored Aug 30, 2024
2 parents 385bc03 + 4c9caec commit b568693
Show file tree
Hide file tree
Showing 74 changed files with 24,529 additions and 11,193 deletions.
50 changes: 34 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: [
'ember'
],
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true
browser: true,
},
rules: {
'semi': 'error',
Expand All @@ -22,19 +24,35 @@ module.exports = {
// node files
{
files: [
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'lib/*/index.js'
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
env: {
browser: false,
node: true
}
}
]
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off',
},
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/buildDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [10.x]
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# misc
/.vscode
/.sass-cache
/.eslintcache
/connect.lock
/coverage/*
/libpeerconnection.log
Expand Down
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
};
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- "10"
- "12"

sudo: false
dist: trusty
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# kursausschreibung 3.4.1
# kursausschreibung 3.5.0
[![Build 🏭🚀](https://github.com/bkd-mba-fbi/kursausschreibung/actions/workflows/buildDeploy.yml/badge.svg)](https://github.com/bkd-mba-fbi/kursausschreibung/actions/workflows/buildDeploy.yml)

# Documentation
Expand Down Expand Up @@ -64,8 +64,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Linting

* `npm run lint:js`
* `npm run lint:js -- --fix`
* `npm run lint`
* `npm run lint:fix`

### Building

Expand Down
12 changes: 8 additions & 4 deletions app/components/event-list-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { setParameterByName, getParameterByName } from 'kursausschreibung/framew
import { sortAs } from '../framework/gui-helpers';
import { getSortAs } from '../framework/storage';
import settings from '../framework/settings';
import { getString } from '../framework/translate';
import { htmlSafe } from '@ember/string';

// tests if a query matches a value
function match(value, query) {
Expand Down Expand Up @@ -32,15 +34,15 @@ export default Component.extend({
this.send('queryChanged');
}

let sortOptions = [];
let options = '';
if(settings.sortOptions === undefined) {
sortOptions.push({key:'error', value:'configure key sortoptions array in settings'});
options = '<option value=error>configure key sortoptions array in settings</option>';
} else {
settings.sortOptions.forEach(option => {
sortOptions.push({key:option, value:"sort"+option});
options = options + '<option value='+option+'>'+getString("sort"+option)+'</option>';
});
}
this.set('sortOptions',sortOptions);
this.set('sortOptions',htmlSafe(options));
},

didRender() {
Expand All @@ -50,7 +52,9 @@ export default Component.extend({
filteredEvents: oneWay('events'),

keyUp(){
this.set('query',document.getElementById('searchEvents').value)
setParameterByName('search',this.get('query'));
this.send('queryChanged');
},

actions: {
Expand Down
12 changes: 12 additions & 0 deletions app/components/input/input-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import Component from '@ember/component';
import { vssDependency } from 'kursausschreibung/framework/form-helpers';
import { htmlSafe } from '@ember/string';

export default Component.extend({
willRender() {
let options = this.get('field.options.options');
let dropdownOptions = '';
options.forEach(option => {
dropdownOptions = dropdownOptions + '<option value='+option.Key+'>'+option.Value+'</option>';
});
this.set('dropdownOptions',htmlSafe(dropdownOptions));
},

change(){
let field = this.get('field');
let currentValue = null;

document.getElementById(this.elementId).children[0].classList.remove('required');

document.getElementsByName(field.id).forEach(input => {
if(field.options.showAsRadioButtons) {
Expand Down
3 changes: 2 additions & 1 deletion app/components/input/input-email.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Component from '@ember/component';
import { formFieldError } from 'kursausschreibung/framework/form-helpers';
import jQuery from 'jquery';

export default Component.extend({
change() {
// show an error message for duplicate e-mails
const emailFields = this.$().closest('form').find('input[type="email"]').toArray();
const emailFields = jQuery('#subscriptionForm').closest('form').find('input[type="email"]').toArray();
const emailFieldValues = emailFields.map(field => field.value);

emailFields.forEach((field, fieldIndex) => {
Expand Down
5 changes: 3 additions & 2 deletions app/components/input/input-freeform-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Component from '@ember/component';
import { vssDependency } from 'kursausschreibung/framework/form-helpers';
import jQuery from 'jquery';

export default Component.extend({
didInsertElement() {
this._super(...arguments);

let options = this.get('field.options').options.map(option => option.Value);

this.$('.typeahead').typeahead(
jQuery('.typeahead').typeahead(
{
hint: true,
highlight: true,
Expand All @@ -26,7 +27,7 @@ export default Component.extend({
},

willDestroyElement() {
this.$('.typeahead').typeahead('destroy');
jQuery('.typeahead').typeahead('destroy');
this._super(...arguments);
},

Expand Down
8 changes: 5 additions & 3 deletions app/components/input/input-postal-code.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Component from '@ember/component';
import { debounce } from '@ember/runloop';
import { getPostalCodes } from 'kursausschreibung/framework/api';
import jQuery from 'jquery';


export default Component.extend({
Expand All @@ -11,8 +12,9 @@ export default Component.extend({
getPostalCodes(query).then(response => asyncResults(response));
};

let $typeahead = this.$('.typeahead');
let $locationFields = this.$().closest('fieldset').find('input[name="Location"]');
let elementId = '#'+this.elementId
let $typeahead = jQuery(elementId).children(0);
let $locationFields = jQuery(elementId).closest('fieldset').find('input[name="Location"]');

$typeahead.typeahead(
{
Expand All @@ -38,7 +40,7 @@ export default Component.extend({
},

willDestroyElement() {
this.$('.typeahead').typeahead('destroy');
jQuery('.typeaheadZip').typeahead('destroy');
this._super(...arguments);
}
});
12 changes: 10 additions & 2 deletions app/components/subscription-form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import $ from 'jquery';
import jQuery from 'jquery';
import { formatDate, getDMY, getYMD } from 'kursausschreibung/framework/date-helpers';
import { setDataToSubmit } from 'kursausschreibung/framework/storage';
import { getString } from 'kursausschreibung/framework/translate';
Expand Down Expand Up @@ -30,10 +30,18 @@ export default Component.extend({
submit(event) {
event.preventDefault();

subscribe(this.$('form'), this);
subscribe(jQuery('form'), this);
this.get('subscribe')();
},

useCompanyAddress(){
var value = this.get('useCompanyAddress');
if(value){
this.set('useCompanyAddress',false);
} else {
this.set('useCompanyAddress',true);
}
},
addPerson() {
if (this.get('event.FreeSeats') - 1 - this.get('additionalPeopleCount') <= 0) {
uikit.modal.alert(getString('noSeatsAvailable'));
Expand Down
8 changes: 1 addition & 7 deletions app/controllers/list/category/event/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import Controller from '@ember/controller';
import settings from 'kursausschreibung/framework/settings';
import LinkComponent from '@ember/routing/link-component';

let badgeFreeSeatsEnabled = typeof settings.badgeFreeSeats === 'object' && settings.badgeFreeSeats.enabled === true;

export default Controller.extend({
showBreadcrumbs: settings.showBreadcrumbs,
badgeFreeSeatsEnabled
});

// bindings for tooltip and disabled attributes
LinkComponent.reopen({
attributeBindings: ['data-uk-tooltip', 'disabled']
});
});
14 changes: 8 additions & 6 deletions app/controllers/list/category/event/subscribe.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default Controller.extend({
actions: {
subscribe() {
this.transitionToRoute('list.category.event.confirmation');
export default class subscribeController extends Controller {
@service router;
@action
subscribe() {
this.router.transitionTo('list.category.event.confirmation');
}
}
});
};
2 changes: 1 addition & 1 deletion app/framework/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function ajax(method, relativeUrl, readableError = true, data = null, file = fal
dataFilter: data => data === '' ? 'null' : data,

headers: {
'CLX-Authorization': `token_type=${appConfig.tokenType}, access_token=${accessToken}`
'Authorization': `Bearer ${accessToken}`
}
});

Expand Down
2 changes: 1 addition & 1 deletion app/framework/form-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ if(field.options.dependencyItems !== undefined) {

if(vssDependencyCheck(formValue,operator,values)) {
hidden.classList.remove(hiddenClass);
requiredElement.required = true;
requiredElement.required = element.required;
} else {
hidden.classList.add(hiddenClass);
requiredElement.required = false;
Expand Down
1 change: 1 addition & 0 deletions app/framework/gui-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function displayAsGrid(bool) {
var list = document.getElementById('list-cards');
var btGrid = document.getElementById('bt-grid');
var btList = document.getElementById('bt-list');
var bool = (String(bool).toLowerCase() === 'true');

if (typeof bool === "boolean") {
setListViewGrid(bool);
Expand Down
Loading

0 comments on commit b568693

Please sign in to comment.