hr-design-system-handlebars 1.114.4 → 1.114.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/assets/index.css +3 -3
- package/dist/assets/js/components/voting/js/votingDs.feature.js +6 -1
- package/dist/views/components/voting/voting.hbs +18 -16
- package/dist/views/components/voting/voting_result.hbs +19 -20
- package/dist/views/components/voting/voting_result_2F.hbs +1 -1
- package/dist/views_static/components/voting/voting.hbs +18 -16
- package/dist/views_static/components/voting/voting_result.hbs +19 -20
- package/dist/views_static/components/voting/voting_result_2F.hbs +1 -1
- package/package.json +1 -1
- package/src/assets/fixtures/voting/voting.inc.json +3 -3
- package/src/assets/fixtures/voting/voting_email.json +4 -44
- package/src/stories/views/components/voting/fixtures/voting.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_email.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_error.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_media.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_multiple_choice.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_over.json +1 -1
- package/src/stories/views/components/voting/fixtures/voting_result_absolute.json +1 -1
- package/src/stories/views/components/voting/js/votingDs.feature.js +6 -1
- package/src/stories/views/components/voting/voting.hbs +18 -16
- package/src/stories/views/components/voting/voting.stories.js +17 -5
- package/src/stories/views/components/voting/voting_result.hbs +19 -20
- package/src/stories/views/components/voting/{voting_success.stories.js → voting_result.stories.js} +8 -2
- package/src/stories/views/components/voting/voting_result_2F.hbs +1 -1
- package/dist/views/components/voting/voting_error.hbs +0 -10
- package/dist/views/components/voting/voting_success.hbs +0 -27
- package/dist/views/components/voting/voting_success_2F.hbs +0 -7
- package/dist/views_static/components/voting/voting_error.hbs +0 -10
- package/dist/views_static/components/voting/voting_success.hbs +0 -27
- package/dist/views_static/components/voting/voting_success_2F.hbs +0 -7
- package/src/stories/views/components/voting/js/voteValidatorDs.js +0 -195
- package/src/stories/views/components/voting/js/votingCookieCheckerDs.js +0 -31
- package/src/stories/views/components/voting/js/votingDs.js +0 -198
- package/src/stories/views/components/voting/voting_error.hbs +0 -10
- package/src/stories/views/components/voting/voting_error.stories.js +0 -35
- package/src/stories/views/components/voting/voting_success.hbs +0 -27
- package/src/stories/views/components/voting/voting_success_2F.hbs +0 -7
- package/src/stories/views/components/voting/voting_success_2F.stories.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"teasersize":100,"realTeasersize":100,"topline":"Voting-Topline","toplineSize":"h3","title":"Wie finden Sie hessenschau.de?","backlink":"backlink-url","uuid":"UUID","headingSize":"h2","isVoting":true,"isMultiVote":true,"hasRedirect":
|
|
1
|
+
{"teasersize":100,"realTeasersize":100,"topline":"Voting-Topline","toplineSize":"h3","title":"Wie finden Sie hessenschau.de?","backlink":"backlink-url","uuid":"UUID","headingSize":"h2","isVoting":true,"isMultiVote":true,"hasRedirect":false,"isMultipleChoice":false,"maxAnswerCount":1,"votingSuccessText":{"richtext":"Danke für Ihre Abstimmung!"},"isSimpleSecured":false,"cookieLifetime":"12","sophoraId":"Sophora-Id","hasBarchart":true,"showAbsoluteResult":false,"showVoteResult":true,"summarizedResult":"666","votingResult":[{"label":"Gut, beste website ever","count":"27","percentageCount":"4,1","roundedPercentageCount":"4.0"},{"label":"Super, allerbeste website ever","count":"117","percentageCount":"17,6","roundedPercentageCount":"18.0"},{"label":"Mega, allerallerbeste website ever","count":"242","percentageCount":"36,3","roundedPercentageCount":"36.0"},{"label":"Hammer, allerallerbesteste website ever","count":"280","percentageCount":"42,0","roundedPercentageCount":"42.0","isWinner":true}],"form":{"shorttext":"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.","isVotingOver":true,"is2FSecured":false,"jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"{\"form_error_required\":\"Pflichtfeld\",\"form_error_max\":\"Zu viele Zeichen\",\"form_error_validurl\":\"Ungültige URL\",\"form_error_empty\":\"Darf nicht ausgefüllt werden\",\"form_error_constants_or_null\":\"Ungültiger Wert\",\"form_error_constants\":\"Ungültiger Wert\",\"form_error_max_multivalue\":\"Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten\",\"vote_error_identity_already_used\":\"Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.\",\"vote_error_token_request_count_exceeded\":\"Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.\",\"form_error_email\":\"Ungültige E-Mail-Adresse\"}","isSimpleSecured":false,"url":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","isHorizontalLayout":false,"hideVotingResult":false,"sophoraId":"Sophora-Id","fields":[{"type":{"isGroup":false,"isChoice":true,"asString":"radio"},"name":"multivoting","isGrouped":true,"isRequired":false,"options":[{"value":"1","label":"Gut, beste website ever","title":"Voting-Answer 1"},{"value":"2","label":"Super, allerbeste website ever","title":"Voting-Answer 2"},{"value":"3","label":"Mega, allerallerbeste website ever","title":"Voting-Answer 3"},{"value":"4","label":"Hammer, allerallerbesteste website ever","title":"Voting-Answer 4"}]}]}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"teasersize":100,"realTeasersize":100,"topline":"Voting-Topline","toplineSize":"h3","title":"Wie finden Sie hessenschau.de?","backlink":"backlink-url","uuid":"UUID","headingSize":"h2","isVoting":true,"isMultiVote":true,"hasRedirect":
|
|
1
|
+
{"teasersize":100,"realTeasersize":100,"topline":"Voting-Topline","toplineSize":"h3","title":"Wie finden Sie hessenschau.de?","backlink":"backlink-url","uuid":"UUID","headingSize":"h2","isVoting":true,"isMultiVote":true,"hasRedirect":false,"isMultipleChoice":false,"maxAnswerCount":1,"votingSuccessText":{"richtext":"Danke für Ihre Abstimmung!"},"isSimpleSecured":false,"cookieLifetime":"12","sophoraId":"Sophora-Id","hasBarchart":true,"showAbsoluteResult":true,"showVoteResult":true,"summarizedResult":"666","votingResult":[{"label":"Gut, beste website ever","count":"27","percentageCount":"4,1","roundedPercentageCount":"4.0"},{"label":"Super, allerbeste website ever","count":"117","percentageCount":"17,6","roundedPercentageCount":"18.0"},{"label":"Mega, allerallerbeste website ever","count":"242","percentageCount":"36,3","roundedPercentageCount":"36.0"},{"label":"Hammer, allerallerbesteste website ever","count":"280","percentageCount":"42,0","roundedPercentageCount":"42.0","isWinner":true}],"form":{"shorttext":"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.","isVotingOver":false,"is2FSecured":false,"jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"{\"form_error_required\":\"Pflichtfeld\",\"form_error_max\":\"Zu viele Zeichen\",\"form_error_validurl\":\"Ungültige URL\",\"form_error_empty\":\"Darf nicht ausgefüllt werden\",\"form_error_constants_or_null\":\"Ungültiger Wert\",\"form_error_constants\":\"Ungültiger Wert\",\"form_error_max_multivalue\":\"Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten\",\"vote_error_identity_already_used\":\"Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.\",\"vote_error_token_request_count_exceeded\":\"Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.\",\"form_error_email\":\"Ungültige E-Mail-Adresse\"}","isSimpleSecured":false,"url":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","isHorizontalLayout":false,"hideVotingResult":false,"sophoraId":"Sophora-Id","fields":[{"type":{"isGroup":false,"isChoice":true,"asString":"radio"},"name":"multivoting","isGrouped":true,"isRequired":false,"options":[{"value":"1","label":"Gut, beste website ever","title":"Voting-Answer 1"},{"value":"2","label":"Super, allerbeste website ever","title":"Voting-Answer 2"},{"value":"3","label":"Mega, allerallerbeste website ever","title":"Voting-Answer 3"},{"value":"4","label":"Hammer, allerallerbesteste website ever","title":"Voting-Answer 4"}]}]}}
|
|
@@ -54,7 +54,12 @@ const Voting = (context) => {
|
|
|
54
54
|
console.log(data)
|
|
55
55
|
|
|
56
56
|
if (jsonUrl) {
|
|
57
|
-
|
|
57
|
+
try {
|
|
58
|
+
responseStatus = JSON.parse(data).status
|
|
59
|
+
} catch (exceptionVar) {
|
|
60
|
+
//mockData already delivers a json-pbject!
|
|
61
|
+
responseStatus = data.status
|
|
62
|
+
}
|
|
58
63
|
switch (responseStatus) {
|
|
59
64
|
case 'VALIDATION_ERROR':
|
|
60
65
|
console.log('Validation Error')
|
|
@@ -58,30 +58,32 @@
|
|
|
58
58
|
</div>
|
|
59
59
|
<script type="text/html" class="js-successMessage">
|
|
60
60
|
{{#if this.is2FSecured}}
|
|
61
|
-
{{
|
|
61
|
+
{{> components/voting/voting_result_2F ../this
|
|
62
|
+
_isInline=true _statusDone=true
|
|
63
|
+
_resultBoxMessageTitle=(loca "votingform2F_title_success")
|
|
64
|
+
_resultBoxMessageText=(loca "votingform2F_text_success")
|
|
65
|
+
}}
|
|
62
66
|
{{else}}
|
|
63
|
-
{{
|
|
67
|
+
{{> components/voting/voting_result ../this
|
|
68
|
+
_isInline=true
|
|
69
|
+
_statusDone=true
|
|
70
|
+
_hideVotingResult=this.hideVotingResult
|
|
71
|
+
_resultBoxMessageTitle=(loca "votingform_title_success")
|
|
72
|
+
_resultBoxMessageText=../this.votingSuccessText.richtext
|
|
73
|
+
}}
|
|
64
74
|
{{/if}}
|
|
65
75
|
</script>
|
|
66
|
-
<script type="text/html" class="js-errorMessage">
|
|
67
|
-
|
|
68
|
-
{{{include "components/voting/voting_error" _isInline=true _statusDone=error _title=../this.title _topline=../this.topline}}}
|
|
69
|
-
{{else}}
|
|
70
|
-
{{{include "components/voting/voting_error" _isInline=true _statusDone=false _title=../this.title _topline=../this.topline}}}
|
|
71
|
-
{{/if}}
|
|
76
|
+
<script type="text/html" class="js-errorMessage">
|
|
77
|
+
{{> components/voting/voting_result ../this _isInline=true _statusDone=false _hideVotingResult=true _showBackButton=true _resultBoxMessageTitle=(loca "votingform_title_error") _resultBoxMessageText=(loca "votingform_text_error")}}
|
|
72
78
|
</script>
|
|
73
79
|
{{#unless this.hideVotingResult}}
|
|
74
80
|
<script type="text/html" class="js-result">
|
|
75
81
|
{{#unless this.is2FSecured}}
|
|
76
|
-
{{> components/voting/voting_result
|
|
77
|
-
_resultBoxMessageText=(loca "votingform_already_voted_cookie_hint")
|
|
78
|
-
_voteResults=../this.votingResult
|
|
79
|
-
_isResultOnRedirectPage=_isResultOnRedirectPage
|
|
80
|
-
_isSimpleSecured=../this.isSimpleSecured
|
|
82
|
+
{{> components/voting/voting_result ../this
|
|
83
|
+
_resultBoxMessageText=(loca "votingform_already_voted_cookie_hint")
|
|
81
84
|
_statusDone=true
|
|
82
85
|
_addClass=../_addClass
|
|
83
|
-
_hideVotingResult=this.hideVotingResult
|
|
84
|
-
_isVotingOver=this.isVotingOver
|
|
86
|
+
_hideVotingResult=this.hideVotingResult
|
|
85
87
|
}}
|
|
86
88
|
{{/unless}}
|
|
87
89
|
</script>
|
|
@@ -90,7 +92,7 @@
|
|
|
90
92
|
</div>
|
|
91
93
|
</div>
|
|
92
94
|
{{else}}
|
|
93
|
-
{{> components/voting/voting_result
|
|
95
|
+
{{> components/voting/voting_result ../this _hideVotingResult=this.hideVotingResult}}
|
|
94
96
|
{{/unless}}
|
|
95
97
|
{{/with}}
|
|
96
98
|
{{/components/forms/components/backgroundBox }}
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
parameters: {
|
|
24
24
|
mockData: [
|
|
25
25
|
{
|
|
26
|
-
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
26
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de/?rf=inline',
|
|
27
27
|
method: 'POST',
|
|
28
28
|
status: 200,
|
|
29
29
|
response: {
|
|
@@ -45,7 +45,7 @@ export const Default = {
|
|
|
45
45
|
parameters: {
|
|
46
46
|
mockData: [
|
|
47
47
|
{
|
|
48
|
-
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
48
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de/?rf=inline',
|
|
49
49
|
method: 'POST',
|
|
50
50
|
status: 200,
|
|
51
51
|
response: {
|
|
@@ -58,12 +58,12 @@ export const Default = {
|
|
|
58
58
|
|
|
59
59
|
export const Voting_Email = {
|
|
60
60
|
render: Template.bind({}),
|
|
61
|
-
name: 'Einfachauswahl mit E-Mail',
|
|
61
|
+
name: 'Einfachauswahl mit E-Mail und Successmeldung',
|
|
62
62
|
args: votingEmailJson,
|
|
63
63
|
parameters: {
|
|
64
64
|
mockData: [
|
|
65
65
|
{
|
|
66
|
-
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
66
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de/?rf=inline',
|
|
67
67
|
method: 'POST',
|
|
68
68
|
status: 200,
|
|
69
69
|
response: {
|
|
@@ -78,11 +78,23 @@ export const Voting_Media = {
|
|
|
78
78
|
render: Template.bind({}),
|
|
79
79
|
name: 'Einfachauswahl mit Bild, Audio, Video',
|
|
80
80
|
args: votingMediaJson,
|
|
81
|
+
parameters: {
|
|
82
|
+
mockData: [
|
|
83
|
+
{
|
|
84
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de/?rf=inline',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
status: 200,
|
|
87
|
+
response: {
|
|
88
|
+
"status":"OK"
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
]
|
|
92
|
+
}
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
export const Voting_Multiple_Choice = {
|
|
84
96
|
render: Template.bind({}),
|
|
85
|
-
name: 'Mehrfachauswahl',
|
|
97
|
+
name: 'Mehrfachauswahl mit Fehlermeldung',
|
|
86
98
|
args: votingMultipleChoiceJson,
|
|
87
99
|
}
|
|
88
100
|
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
<div class="{{#if this.isSimpleSecured}}js-load{{/if}}{{#if _addClass}} {{_addClass}}{{/if}}"
|
|
2
|
-
{{#unless
|
|
2
|
+
{{#unless this.form.isVotingOver}}
|
|
3
3
|
{{#if this.isSimpleSecured}}
|
|
4
4
|
data-hr-voting-result-cookie-ds='{"cookieLifetime":"{{this.cookieLifetime}}","votingId":"{{this.sophoraId}}"}'
|
|
5
5
|
{{/if}}
|
|
6
6
|
{{/unless}}
|
|
7
7
|
>
|
|
8
8
|
|
|
9
|
-
{{#unless
|
|
10
|
-
{{> components/voting/components/voting_header _title=
|
|
9
|
+
{{#unless this.hasRedirect}}
|
|
10
|
+
{{> components/voting/components/voting_header _title=this.title _topline=this.topline}}
|
|
11
11
|
{{/unless}}
|
|
12
12
|
|
|
13
13
|
{{#if _hideVotingResult}}
|
|
14
|
-
{{#if
|
|
15
|
-
<p class="mt-6
|
|
14
|
+
{{#if this.form.isVotingOver}}
|
|
15
|
+
<p class="mt-6 text-base font-bold sm:text-xl font-heading sm:mt-12">{{loca "votingform_voting_finished"}}</p>
|
|
16
16
|
{{else}}
|
|
17
|
-
{{~> components/base/image/icon _icon=(if _statusDone "status-done" "status-error") _iconmap="icons" _addClass=(if _statusDone "" "float-left w-6 h-6 text-error dark:text-error-dark fill-current mt-6 sm:mt-12")}}
|
|
18
|
-
<p class="mt-6 ml-8 text-base font-bold sm:ml-9
|
|
17
|
+
{{~> components/base/image/icon _icon=(if _statusDone "status-done" "status-error") _iconmap="icons" _addClass=(if _statusDone "float-left w-6 h-6 text-success dark:text-success-dark fill-current mt-6 sm:mt-12" "float-left w-6 h-6 text-error dark:text-error-dark fill-current mt-6 sm:mt-12")}}
|
|
18
|
+
<p class="{{#if _statusDone}}text-success dark:text-success-dark{{else}}text-error dark:text-error-dark{{/if}} mt-6 ml-8 text-base font-bold sm:ml-9 sm:text-xl font-heading sm:mt-12">{{{_resultBoxMessageText}}}</p>
|
|
19
19
|
{{/if}}
|
|
20
20
|
{{else}}
|
|
21
|
-
<p class="mt-6 text-base font-bold sm:text-xl font-heading sm:mt-12">{{{_resultBoxMessageText}}}</p>
|
|
22
21
|
|
|
23
|
-
{{#
|
|
22
|
+
<p class="mt-6 text-base font-bold sm:text-xl font-heading sm:mt-12 dark:text-text-dark">{{#if this.form.isVotingOver}}{{loca "votingform_voting_finished"}}{{else}}{{{_resultBoxMessageText}}}{{/if}}</p>
|
|
23
|
+
|
|
24
|
+
{{#each this.votingResult}}
|
|
24
25
|
<div class="flex">
|
|
25
26
|
<div class="grow">
|
|
26
27
|
<div class="{{#if @first}}mt-7 sm:mt-9{{else}}mt-3 sm:mt-4{{/if}} text-base sm:text-lg font-copy dark:text-text-dark">{{this.label}}</div>
|
|
@@ -53,18 +54,16 @@
|
|
|
53
54
|
{{/if}}
|
|
54
55
|
{{/if}}
|
|
55
56
|
|
|
56
|
-
{{#
|
|
57
|
-
<p class="mt-6 text-base font-bold sm:text-xl font-heading sm:mt-12 dark:text-text-dark">{{loca "votingform_voting_finished"}}</p>
|
|
58
|
-
{{/if}}
|
|
59
|
-
|
|
60
|
-
{{#unless _isResultOnRedirectPage}}
|
|
57
|
+
{{#unless this.hasRedirect}}
|
|
61
58
|
{{#unless this.isSimpleSecured}}
|
|
62
|
-
{{#unless
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
{{
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
{{#unless this.form.isVotingOver}}
|
|
60
|
+
{{#if _showBackButton}}
|
|
61
|
+
<div class="mt-6 sm:mt-12">
|
|
62
|
+
{{#> components/button/link_button _size="lg" _css="float-right"}}
|
|
63
|
+
{{> components/button/components/button_label _label=(loca "votingform_form_back")}}
|
|
64
|
+
{{/components/button/link_button}}
|
|
65
|
+
</div>
|
|
66
|
+
{{/if}}
|
|
68
67
|
{{/unless}}
|
|
69
68
|
{{/unless}}
|
|
70
69
|
{{/unless}}
|
package/src/stories/views/components/voting/{voting_success.stories.js → voting_result.stories.js}
RENAMED
|
@@ -23,13 +23,19 @@ export default {
|
|
|
23
23
|
const Template = (args) => {
|
|
24
24
|
let hbsTemplate = handlebars.compile(`
|
|
25
25
|
{{#>components/forms/components/backgroundBox }}
|
|
26
|
-
{{> components/voting/
|
|
26
|
+
{{> components/voting/voting_result this
|
|
27
|
+
_isInline=true
|
|
28
|
+
_statusDone=true
|
|
29
|
+
_hideVotingResult=this.form.hideVotingResult
|
|
30
|
+
_resultBoxMessageTitle="Danke für ihre Teilnahme!"
|
|
31
|
+
_resultBoxMessageText=this.votingSuccessText.richtext
|
|
32
|
+
}}
|
|
27
33
|
{{/components/forms/components/backgroundBox }}
|
|
28
34
|
`)
|
|
29
35
|
return hbsTemplate({ ...args })
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
export const
|
|
38
|
+
export const Voting_Result = {
|
|
33
39
|
render: Template.bind({}),
|
|
34
40
|
name: 'Ergebnis Barchart prozentual',
|
|
35
41
|
args: votingJson,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{{> components/voting/components/voting_header _title=
|
|
1
|
+
{{> components/voting/components/voting_header _title=this.title _topline=this.topline}}
|
|
2
2
|
|
|
3
3
|
{{~> components/base/image/icon _icon="status-done" _iconmap="icons" _addClass="float-left w-6 h-6 text-success fill-current mt-6 sm:mt-12"}}
|
|
4
4
|
<p class="mt-6 ml-8 text-base font-bold sm:ml-9 text-success sm:text-lg font-heading sm:mt-12">{{{_resultBoxMessageTitle}}}<br/>{{{_resultBoxMessageText}}}</p>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{{> components/voting/voting_result
|
|
2
|
-
_title=_title
|
|
3
|
-
_topline=_topline
|
|
4
|
-
_resultBoxMessageTitle=(loca "votingform_title_error")
|
|
5
|
-
_resultBoxMessageText=(loca "votingform_text_error")
|
|
6
|
-
_locaKeyText="votingform_text_error"
|
|
7
|
-
_isInline=_isInline
|
|
8
|
-
_hideVotingResult=true
|
|
9
|
-
_statusDone=false
|
|
10
|
-
}}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{{#if this.votingSuccessText}}
|
|
2
|
-
{{> components/voting/voting_result
|
|
3
|
-
_title=_title
|
|
4
|
-
_topline=_topline
|
|
5
|
-
_resultBoxMessageTitle=(loca "votingform_title_success")
|
|
6
|
-
_resultBoxMessageText=this.votingSuccessText.richtext
|
|
7
|
-
_isInline=_isInline
|
|
8
|
-
_voteResults=this.votingResult
|
|
9
|
-
_isResultOnRedirectPage=_isResultOnRedirectPage
|
|
10
|
-
_hideVotingResult=this.hideVotingResult
|
|
11
|
-
_statusDone=_statusDone
|
|
12
|
-
|
|
13
|
-
}}
|
|
14
|
-
{{else}}
|
|
15
|
-
{{> components/voting/voting_result
|
|
16
|
-
_title=_title
|
|
17
|
-
_topline=_topline
|
|
18
|
-
_resultBoxMessageTitle=(loca "votingform_title_success")
|
|
19
|
-
_resultBoxMessageText=(loca "votingform_text_success")
|
|
20
|
-
_isInline=_isInline
|
|
21
|
-
_voteResults=this.votingResult
|
|
22
|
-
_isResultOnRedirectPage=_isResultOnRedirectPage
|
|
23
|
-
_hideVotingResult=this.hideVotingResult
|
|
24
|
-
_statusDone=_statusDone
|
|
25
|
-
}}
|
|
26
|
-
{{/if}}
|
|
27
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{{> components/voting/voting_result
|
|
2
|
-
_title=_title
|
|
3
|
-
_topline=_topline
|
|
4
|
-
_resultBoxMessageTitle=(loca "votingform_title_error")
|
|
5
|
-
_resultBoxMessageText=(loca "votingform_text_error")
|
|
6
|
-
_locaKeyText="votingform_text_error"
|
|
7
|
-
_isInline=_isInline
|
|
8
|
-
_hideVotingResult=true
|
|
9
|
-
_statusDone=false
|
|
10
|
-
}}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{{#if this.votingSuccessText}}
|
|
2
|
-
{{> components/voting/voting_result
|
|
3
|
-
_title=_title
|
|
4
|
-
_topline=_topline
|
|
5
|
-
_resultBoxMessageTitle=(loca "votingform_title_success")
|
|
6
|
-
_resultBoxMessageText=this.votingSuccessText.richtext
|
|
7
|
-
_isInline=_isInline
|
|
8
|
-
_voteResults=this.votingResult
|
|
9
|
-
_isResultOnRedirectPage=_isResultOnRedirectPage
|
|
10
|
-
_hideVotingResult=this.hideVotingResult
|
|
11
|
-
_statusDone=_statusDone
|
|
12
|
-
|
|
13
|
-
}}
|
|
14
|
-
{{else}}
|
|
15
|
-
{{> components/voting/voting_result
|
|
16
|
-
_title=_title
|
|
17
|
-
_topline=_topline
|
|
18
|
-
_resultBoxMessageTitle=(loca "votingform_title_success")
|
|
19
|
-
_resultBoxMessageText=(loca "votingform_text_success")
|
|
20
|
-
_isInline=_isInline
|
|
21
|
-
_voteResults=this.votingResult
|
|
22
|
-
_isResultOnRedirectPage=_isResultOnRedirectPage
|
|
23
|
-
_hideVotingResult=this.hideVotingResult
|
|
24
|
-
_statusDone=_statusDone
|
|
25
|
-
}}
|
|
26
|
-
{{/if}}
|
|
27
|
-
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
var VoteValidator =
|
|
2
|
-
VoteValidator ||
|
|
3
|
-
function (options) {
|
|
4
|
-
'use strict'
|
|
5
|
-
|
|
6
|
-
// Production steps of ECMA-262, Edition 6, 22.1.2.1
|
|
7
|
-
if (!Array.from) {
|
|
8
|
-
Array.from = (function () {
|
|
9
|
-
var toStr = Object.prototype.toString
|
|
10
|
-
var isCallable = function (fn) {
|
|
11
|
-
return typeof fn === 'function' || toStr.call(fn) === '[object Function]'
|
|
12
|
-
}
|
|
13
|
-
var toInteger = function (value) {
|
|
14
|
-
var number = Number(value)
|
|
15
|
-
if (isNaN(number)) {
|
|
16
|
-
return 0
|
|
17
|
-
}
|
|
18
|
-
if (number === 0 || !isFinite(number)) {
|
|
19
|
-
return number
|
|
20
|
-
}
|
|
21
|
-
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number))
|
|
22
|
-
}
|
|
23
|
-
var maxSafeInteger = Math.pow(2, 53) - 1
|
|
24
|
-
var toLength = function (value) {
|
|
25
|
-
var len = toInteger(value)
|
|
26
|
-
return Math.min(Math.max(len, 0), maxSafeInteger)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The length property of the from method is 1.
|
|
30
|
-
return function from(arrayLike /*, mapFn, thisArg */) {
|
|
31
|
-
// 1. Let C be the this value.
|
|
32
|
-
var C = this
|
|
33
|
-
|
|
34
|
-
// 2. Let items be ToObject(arrayLike).
|
|
35
|
-
var items = Object(arrayLike)
|
|
36
|
-
|
|
37
|
-
// 3. ReturnIfAbrupt(items).
|
|
38
|
-
if (arrayLike == null) {
|
|
39
|
-
throw new TypeError(
|
|
40
|
-
'Array.from requires an array-like object - not null or undefined'
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 4. If mapfn is undefined, then let mapping be false.
|
|
45
|
-
var mapFn = arguments.length > 1 ? arguments[1] : void undefined
|
|
46
|
-
var T
|
|
47
|
-
if (typeof mapFn !== 'undefined') {
|
|
48
|
-
// 5. else
|
|
49
|
-
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
|
|
50
|
-
if (!isCallable(mapFn)) {
|
|
51
|
-
throw new TypeError(
|
|
52
|
-
'Array.from: when provided, the second argument must be a function'
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
|
57
|
-
if (arguments.length > 2) {
|
|
58
|
-
T = arguments[2]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 10. Let lenValue be Get(items, "length").
|
|
63
|
-
// 11. Let len be ToLength(lenValue).
|
|
64
|
-
var len = toLength(items.length)
|
|
65
|
-
|
|
66
|
-
// 13. If IsConstructor(C) is true, then
|
|
67
|
-
// 13. a. Let A be the result of calling the [[Construct]] internal method
|
|
68
|
-
// of C with an argument list containing the single item len.
|
|
69
|
-
// 14. a. Else, Let A be ArrayCreate(len).
|
|
70
|
-
var A = isCallable(C) ? Object(new C(len)) : new Array(len)
|
|
71
|
-
|
|
72
|
-
// 16. Let k be 0.
|
|
73
|
-
var k = 0
|
|
74
|
-
// 17. Repeat, while k < len… (also steps a - h)
|
|
75
|
-
var kValue
|
|
76
|
-
while (k < len) {
|
|
77
|
-
kValue = items[k]
|
|
78
|
-
if (mapFn) {
|
|
79
|
-
A[k] =
|
|
80
|
-
typeof T === 'undefined'
|
|
81
|
-
? mapFn(kValue, k)
|
|
82
|
-
: mapFn.call(T, kValue, k)
|
|
83
|
-
} else {
|
|
84
|
-
A[k] = kValue
|
|
85
|
-
}
|
|
86
|
-
k += 1
|
|
87
|
-
}
|
|
88
|
-
// 18. Let putStatus be Put(A, "length", len, true).
|
|
89
|
-
A.length = len
|
|
90
|
-
// 20. Return A.
|
|
91
|
-
return A
|
|
92
|
-
}
|
|
93
|
-
})()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var element = hr$(options.selector)[0],
|
|
97
|
-
settings = options.data ? JSON.parse(options.data) : {},
|
|
98
|
-
minAnswerCount = settings.minAnswerCount,
|
|
99
|
-
maxAnswerCount = settings.maxAnswerCount,
|
|
100
|
-
isMultipleChoice = settings.isMultipleChoice || false,
|
|
101
|
-
selectedCheckboxes = 0,
|
|
102
|
-
votingOptions = Array.from(hr$('input[name=multivoting]', element)),
|
|
103
|
-
counter = hr$('.js-voting-counter', element),
|
|
104
|
-
submit = hr$('input[type=submit]', element)[0],
|
|
105
|
-
submitLabel = hr$('.js-voting-submit-button', element)[0],
|
|
106
|
-
countSelectedCheckboxes = function (event) {
|
|
107
|
-
console.log(submitLabel)
|
|
108
|
-
if (countCheckedCheckboxes() != 0) {
|
|
109
|
-
submit.disabled = false
|
|
110
|
-
submitLabel.classList.remove('-inactive')
|
|
111
|
-
} else {
|
|
112
|
-
submit.disabled = true
|
|
113
|
-
submitLabel.classList.add('-inactive')
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (selectedCheckboxes < maxAnswerCount) {
|
|
117
|
-
countSelectedCheckBoxesIfMaxHasNotReached(event)
|
|
118
|
-
|
|
119
|
-
if (selectedCheckboxes == maxAnswerCount) {
|
|
120
|
-
disableCheckboxesIfMaxHasReached()
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
enableCheckboxesIfMaxHasUndershot()
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
isUnchecked = function (checkbox) {
|
|
127
|
-
return checkbox.checked == false
|
|
128
|
-
},
|
|
129
|
-
isDisabled = function (checkbox) {
|
|
130
|
-
return checkbox.disabled == true
|
|
131
|
-
},
|
|
132
|
-
isChecked = function (checkbox) {
|
|
133
|
-
return checkbox.checked == true
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function countCheckedCheckboxes() {
|
|
137
|
-
var checkedOptions = votingOptions.filter(isChecked)
|
|
138
|
-
return checkedOptions.length
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function countSelectedCheckBoxesIfMaxHasNotReached(event) {
|
|
142
|
-
if (event.target.checked == false) {
|
|
143
|
-
selectedCheckboxes = selectedCheckboxes - 1
|
|
144
|
-
counter.innerHTML = selectedCheckboxes + '/' + maxAnswerCount
|
|
145
|
-
} else {
|
|
146
|
-
selectedCheckboxes = selectedCheckboxes + 1
|
|
147
|
-
counter.innerHTML = selectedCheckboxes + '/' + maxAnswerCount
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function disableCheckboxesIfMaxHasReached() {
|
|
152
|
-
var uncheckedOptions = votingOptions.filter(isUnchecked)
|
|
153
|
-
uncheckedOptions.map(function (uncheckedOptions) {
|
|
154
|
-
uncheckedOptions.disabled = true
|
|
155
|
-
var label = hr$('label[for=' + uncheckedOptions.id + ']')
|
|
156
|
-
label = label.item(0)
|
|
157
|
-
label.classList.add('-inactive')
|
|
158
|
-
})
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function enableCheckboxesIfMaxHasUndershot() {
|
|
162
|
-
selectedCheckboxes = selectedCheckboxes - 1
|
|
163
|
-
counter.innerHTML = selectedCheckboxes + '/' + maxAnswerCount
|
|
164
|
-
var disabledCheckboxes = votingOptions.filter(isDisabled)
|
|
165
|
-
disabledCheckboxes.map(function (disabledCheckboxes) {
|
|
166
|
-
disabledCheckboxes.disabled = false
|
|
167
|
-
var label = hr$('label[for=' + disabledCheckboxes.id + ']')
|
|
168
|
-
label = label.item(0)
|
|
169
|
-
label.classList.remove('-inactive')
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function initVotingValidation() {
|
|
174
|
-
if (isMultipleChoice) {
|
|
175
|
-
counter = counter.item(0)
|
|
176
|
-
submit.disabled = true
|
|
177
|
-
|
|
178
|
-
// Uncheck all checkboxes if User was faster than JS loading
|
|
179
|
-
for (var i = 0; i < votingOptions.length; i++) {
|
|
180
|
-
votingOptions[i].checked = false
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
for (var i = 0; i < votingOptions.length; i++) {
|
|
184
|
-
votingOptions[i].disabled = false
|
|
185
|
-
hr$.listen('click', countSelectedCheckboxes, votingOptions[i])
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
initVotingValidation()
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
hrScriptLoad.load('voteValidator', ['hrQueryOld'], function (options) {
|
|
194
|
-
new VoteValidator(options)
|
|
195
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var VotingCookieChecker =
|
|
2
|
-
VotingCookieChecker ||
|
|
3
|
-
function (options) {
|
|
4
|
-
'use strict'
|
|
5
|
-
|
|
6
|
-
var settings = JSON.parse(options.data),
|
|
7
|
-
element = hr$(options.selector)[0],
|
|
8
|
-
votingId = settings.votingId,
|
|
9
|
-
cookie = '',
|
|
10
|
-
votingWrapper = hr$('.js-voting-wrapper', element)[0],
|
|
11
|
-
hideVotingResult = settings.hideVotingResult,
|
|
12
|
-
alreadyVotedTmpl = '<p>' + settings.alreadyVotedHintText + '<p>',
|
|
13
|
-
checkForVotingCookie = function () {
|
|
14
|
-
cookie = hr$.getJSONCookie(votingId)
|
|
15
|
-
if (cookie) {
|
|
16
|
-
var voting = hr$('#' + votingId)[0]
|
|
17
|
-
var votingText = voting.querySelector('.c-voting-form__bottomWrapper')
|
|
18
|
-
hideVotingResult
|
|
19
|
-
? hr$.replaceAnimated(votingText, alreadyVotedTmpl, true)
|
|
20
|
-
: hr$.replaceAnimated(
|
|
21
|
-
votingWrapper,
|
|
22
|
-
hr$('.js-result', element)[0].innerHTML,
|
|
23
|
-
true
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
checkForVotingCookie()
|
|
28
|
-
}
|
|
29
|
-
hrScriptLoad.load('votingCookieChecker', ['hrQueryOld'], function (options) {
|
|
30
|
-
new VotingCookieChecker(options)
|
|
31
|
-
})
|