Skip to content

Commit

Permalink
Deploying to gh-pages from @ 64472b1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
schefbi committed Dec 19, 2024
1 parent 4e9a9ac commit 3438dec
Show file tree
Hide file tree
Showing 745 changed files with 500,476 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
define([
'ember',
'application'
], function (ember, app) {
app.ApplicationController = ember.Controller.extend({
subscriptionDetails: null, // allow all Routes to access the subscriptionDetails
resetInputTextarea: false, // let the result Route reset the textArea when the details get sent
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
define([
'ember',
'application'
], function (ember, app) {

// Dependencies of the computed properties:
//
// +-------------+
// |TextareaValue|
// +-----+-------+
// |
// +-----v----------------+
// | strippedTextareaValue|
// +-----+-------------+--+
// | |
// +-----v---------+ +-v-----------------+
// |textareaIsEmpty| |subscriptionDetails|
// +-----+---------+ +-+-----------------+
// | |
// +-----v---+ |
// |showError<---------+
// +---------+
app.InputController = ember.Controller.extend({

// the content of the textarea
textareaValue: '',

// textareaValue without whitespace
strippedTextareaValue: ember.computed('textareaValue', function () {
var textareaValue = this.get('textareaValue');

// remove empty lines
textareaValue = textareaValue.replace(/(?:(?:^|\n)[\t ]*)+(?:$|\n)/g, '\n');

// remove first and last newline (if they exist)
textareaValue = textareaValue.replace(/^\n|\n$/g, '');

return textareaValue;
}),

// this property is true when the textarea is empty
textareaIsEmpty: ember.computed('strippedTextareaValue', function () {
return this.get('strippedTextareaValue') === '';
}),

// this property contains the parsed subscriptionDetails of the textarea
subscriptionDetails: ember.computed('strippedTextareaValue', function () {
var rows = this.get('strippedTextareaValue').split('\n');
var subscriptionDetails = [];

for (var i = 0; i < rows.length; i++) {
var result = rows[i].match(/^(\d+)\t(\d+)\t(\d+)\t([^\t]+)$/);

if (result === null) {
return null;
}

subscriptionDetails.push(ember.Object.create({
eventId: result[1],
personId: result[2],
subscriptionDetailId: result[3],
newValue: result[4]
}));
}

return subscriptionDetails;
}),

// the textarea is not empty and cannot be parsed
showError: ember.computed('textareaIsEmpty', 'subscriptionDetails', function () {
return this.get('textareaIsEmpty') === false && this.get('subscriptionDetails') === null;
}),

// it's not possible to go to the next step when no subscriptionDetail can be parsed
cannotContinue: ember.computed('subscriptionDetails', function () {
return this.get('subscriptionDetails') === null;
})
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
define([
'ember',
'application'
], function (ember, app) {
app.ValidationController = ember.Controller.extend({

cannotGoBack: ember.computed.not('model.everythingIsChecked'),

cannotContinue: ember.computed('model.everythingIsChecked', 'model.thereAreOnlyErrors', function () {
return !this.get('model.everythingIsChecked') || this.get('model.thereAreOnlyErrors');
}),
});
});
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="dialog readSubscriptionDetails">
{{outlet}}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="dialogBody">
{{outlet "navigation"}}
<div class="dialogBlockFixed">
<p>{{translate "readSubscriptionDetailsInfo"}}<br><pre>{{translate "readSubscriptionDetailsFields"}}</pre></p>
{{textarea value=textareaValue rows=27 spellcheck=false class=(if showError "textarea--error")}}
</div>
</div>
<div class="dialogFooter">
{{#if showError}}
<span class="text-danger">{{translate "incorrectFormat"}}</span>
{{/if}}
<div>
{{#link-to "validation" tagName="button" class="btn btn-primary float-right" disabledWhen=cannotContinue}}
<div>{{translate "validate"}}</div>
{{/link-to}}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="dialogBlockFixed">
<h2>
{{#link-to "input" disabled=true}}{{translate "input"}}{{/link-to}}
{{#link-to "validation" disabled=true}}{{translate "validation"}}{{/link-to}}
{{#link-to "result" disabled=true}}{{translate "result"}}{{/link-to}}
</h2>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<div class="dialogBody">
{{outlet "navigation"}}
<table class="borderTable">
<thead>
<tr>
<th>{{translate "event"}}</th>
<th>{{translate "name"}}</th>
<th>{{translate "subscriptionDetail"}}</th>
<th>{{translate "oldValue"}}</th>
<th>{{translate "newValue"}}</th>
<th>{{translate "status"}}</th>
<th>{{translate "fehler"}}</th>
</tr>
</thead>
<tbody>
{{#each model.subscriptionDetails as |subscriptionDetail|}}
{{#unless subscriptionDetail.error}}
<tr>
<td>{{subscriptionDetail.event}}</td>
<td>{{subscriptionDetail.name}}</td>
<td>{{subscriptionDetail.subscriptionDetail}}</td>
<td>{{subscriptionDetail.oldValue}}</td>
<td>{{subscriptionDetail.newValue}}</td>
<td>
<div>
{{#if subscriptionDetail.loading}}
<div class="spinner-border spinner-border-sm" role="status">
</div>
{{else}}
{{#if subscriptionDetail.uploaded}}
<i class="material-icons text-success">check_circle</i>
{{else}}
<i class="material-icons text-danger">cancel</i> <br>
{{/if}}
{{/if}}
</div>
</td>
<td>{{subscriptionDetail.errorUpload}}</td>
</tr>
{{/unless}}
{{/each}}
</tbody>
</table>
</div>
<div class="dialogFooter">
{{#if model.error}}
<span class="text-danger">
{{translate "goBackToStartError"}}
</span>
{{else}}
<div>
{{translate "goBackToStart"}}
</div>
{{/if}}
<div>
{{#link-to "input" tagName="button" class="btn btn-primary float-right" disabledWhen=(if model.everythingHasBeenSent false true)}}
<div>{{translate "input"}}</div>
{{/link-to}}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<div class="dialogBody">
{{outlet "navigation"}}
<table class="borderTable">
<thead>
<tr>
<th>{{translate "event"}}</th>
<th>{{translate "name"}}</th>
<th>{{translate "subscriptionDetail"}}</th>
<th>{{translate "oldValue"}}</th>
<th>{{translate "newValue"}}</th>
<th>{{translate "status"}}</th>
<th>{{translate "fehler"}}</th>
</tr>
</thead>
<tbody>
{{#each model.subscriptionDetails as |subscriptionDetail|}}
<tr>
{{#if subscriptionDetail.checked}}
<td>{{subscriptionDetail.event}}</td>
<td>{{subscriptionDetail.name}}</td>
<td>{{subscriptionDetail.subscriptionDetail}}</td>
<td>{{subscriptionDetail.oldValue}}</td>
<td>{{subscriptionDetail.newValue}}</td>
<td>
<div>
{{#if subscriptionDetail.error}}
<i class="material-icons text-danger">cancel</i>
{{else}}
<i class="material-icons text-success">check_circle</i>
{{/if}}
</div>
</td>
<td>{{subscriptionDetail.error}}</td>
{{else}}
{{! we don't yet know the values of the other fields }}
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="6">
<div class="spinner-border spinner-border-sm" role="status">
</div>
</td>
{{/if}}
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="dialogFooter">
<div class="">
{{#link-to "input" tagName="button" class="btn btn-outline-secondary" disabledWhen=cannotGoBack}}
<div>{{translate "correct"}}</div>
{{/link-to}}
</div>
<div>
{{translate "continueWithErrors"}}
</div>
<div>
{{#link-to "result" tagName="button" class="btn btn-primary" disabledWhen=cannotContinue}}
<div>{{translate "submit"}}</div>
{{/link-to}}
</div>
</div>
Binary file not shown.
12 changes: 12 additions & 0 deletions test/apps/EmberApps/AnmeldedetailsEinlesen/App/Routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
define([
'ember',
'application',
'translate'
], function (ember, app, translate) {
app.IndexRoute = ember.Route.extend({
beforeModel: function (transition) {
// always transition to input
this.transitionTo('input');
}
});
});
48 changes: 48 additions & 0 deletions test/apps/EmberApps/AnmeldedetailsEinlesen/App/Routes/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define([
'ember',
'application',
'translate',
'App/Templates/input',
'App/Controllers/input'
], function (ember, app, translate) {
app.InputRoute = ember.Route.extend({
renderTemplate: function () {
this.render();

// render the navigation
this.render('navigation', {
into: 'input',
outlet: 'navigation'
});
},

actions: {
didTransition: function () {
var applicationController = this.controllerFor('application');

if (applicationController.get('resetInputTextarea') === true) {
applicationController.set('resetInputTextarea', false);
this.controller.set('textareaValue', '');
}
},

willTransition: function (transition) {
if (transition.targetName === 'result') {
// it's not possible to go directly to the result route
transition.abort();
return;
}

if (this.controller.get('cannotContinue')) {
transition.abort();
return;
}

// put the subScriptiondetails to the application controller so it can be accessed
// by the other routes
var subscriptionDetails = this.controller.get('subscriptionDetails');
this.controllerFor('application').set('subscriptionDetails', subscriptionDetails);
}
}
});
});
Loading

0 comments on commit 3438dec

Please sign in to comment.