-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from VSVverkeerskunde/feature/VSVGVQ-158
VSVGVQ-158 Alias and url info fields
- Loading branch information
Showing
7 changed files
with
86 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Make sure to init the URLs | ||
handleNlUrlState(); | ||
handleFrUrlState(); | ||
|
||
// Handle company name change => only when alias empty | ||
$("#form_companyName").focusout(function () { | ||
|
||
let slug = slugify($("#form_companyName").val()); | ||
|
||
if ($("#form_aliasNl").val().trim() === '') { | ||
$("#form_aliasNl").val(slug); | ||
handleNlUrlState(); | ||
} | ||
|
||
if ($("#form_aliasFr").val().trim() === '') { | ||
$("#form_aliasFr").val(slug); | ||
handleFrUrlState(); | ||
} | ||
}); | ||
|
||
// Handle NL alias changes => always update URL | ||
$("#form_aliasNl").focusout(function () { | ||
handleNlUrlState(); | ||
}); | ||
|
||
// Handle FR alias change => always change URL | ||
$("#form_aliasFr").focusout(function () { | ||
handleFrUrlState(); | ||
}); | ||
|
||
// Set the Nl URL | ||
function handleNlUrlState() { | ||
let aliasNl = $("#form_aliasNl").val().trim(); | ||
|
||
if (aliasNl !== '') { | ||
$("#form_alias_url_nl").text('www.degroteverkeersquiz.be/quiz/' + aliasNl); | ||
} else { | ||
$("#form_alias_url_nl").text(''); | ||
} | ||
} | ||
|
||
// Set the Fr URL | ||
function handleFrUrlState() { | ||
let aliasFr = $("#form_aliasFr").val().trim(); | ||
|
||
if (aliasFr !== '') { | ||
$("#form_alias_url_fr").text('www.quizdelaroute.be/quiz/' + aliasFr); | ||
} else { | ||
$("#form_alias_url_fr").text(''); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="form-group"> | ||
<div class="row"> | ||
<div class="col-sm-6"> | ||
<label for="form_aliasNl">{% trans %}Alias.dutch{% endtrans %}</label> | ||
{{ form_widget(form.aliasNl) }} | ||
{{ form_errors(form.aliasNl) }} | ||
<small id="form_alias_url_nl" class="form-text text-muted"></small> | ||
</div> | ||
<div class="col-sm-6"> | ||
<label for="form_aliasFr">{% trans %}Alias.french{% endtrans %}</label> | ||
{{ form_widget(form.aliasFr) }} | ||
{{ form_errors(form.aliasFr) }} | ||
<small id="form_alias_url_fr" class="form-text text-muted"></small> | ||
</div> | ||
</div> | ||
<small id="form_alias_info" class="form-text text-muted mt-3">{% trans %}Field.alias.info{% endtrans %}</small> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters