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.
Files changed (39) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/assets/index.css +3 -3
  3. package/dist/assets/js/components/voting/js/votingDs.feature.js +6 -1
  4. package/dist/views/components/voting/voting.hbs +18 -16
  5. package/dist/views/components/voting/voting_result.hbs +19 -20
  6. package/dist/views/components/voting/voting_result_2F.hbs +1 -1
  7. package/dist/views_static/components/voting/voting.hbs +18 -16
  8. package/dist/views_static/components/voting/voting_result.hbs +19 -20
  9. package/dist/views_static/components/voting/voting_result_2F.hbs +1 -1
  10. package/package.json +1 -1
  11. package/src/assets/fixtures/voting/voting.inc.json +3 -3
  12. package/src/assets/fixtures/voting/voting_email.json +4 -44
  13. package/src/stories/views/components/voting/fixtures/voting.json +1 -1
  14. package/src/stories/views/components/voting/fixtures/voting_email.json +1 -1
  15. package/src/stories/views/components/voting/fixtures/voting_error.json +1 -1
  16. package/src/stories/views/components/voting/fixtures/voting_media.json +1 -1
  17. package/src/stories/views/components/voting/fixtures/voting_multiple_choice.json +1 -1
  18. package/src/stories/views/components/voting/fixtures/voting_over.json +1 -1
  19. package/src/stories/views/components/voting/fixtures/voting_result_absolute.json +1 -1
  20. package/src/stories/views/components/voting/js/votingDs.feature.js +6 -1
  21. package/src/stories/views/components/voting/voting.hbs +18 -16
  22. package/src/stories/views/components/voting/voting.stories.js +17 -5
  23. package/src/stories/views/components/voting/voting_result.hbs +19 -20
  24. package/src/stories/views/components/voting/{voting_success.stories.js → voting_result.stories.js} +8 -2
  25. package/src/stories/views/components/voting/voting_result_2F.hbs +1 -1
  26. package/dist/views/components/voting/voting_error.hbs +0 -10
  27. package/dist/views/components/voting/voting_success.hbs +0 -27
  28. package/dist/views/components/voting/voting_success_2F.hbs +0 -7
  29. package/dist/views_static/components/voting/voting_error.hbs +0 -10
  30. package/dist/views_static/components/voting/voting_success.hbs +0 -27
  31. package/dist/views_static/components/voting/voting_success_2F.hbs +0 -7
  32. package/src/stories/views/components/voting/js/voteValidatorDs.js +0 -195
  33. package/src/stories/views/components/voting/js/votingCookieCheckerDs.js +0 -31
  34. package/src/stories/views/components/voting/js/votingDs.js +0 -198
  35. package/src/stories/views/components/voting/voting_error.hbs +0 -10
  36. package/src/stories/views/components/voting/voting_error.stories.js +0 -35
  37. package/src/stories/views/components/voting/voting_success.hbs +0 -27
  38. package/src/stories/views/components/voting/voting_success_2F.hbs +0 -7
  39. package/src/stories/views/components/voting/voting_success_2F.stories.js +0 -35
@@ -1,198 +0,0 @@
1
- var Voting =
2
- Voting ||
3
- function (options) {
4
- 'use strict'
5
-
6
- var element = hr$(options.selector)[0],
7
- settings = options.data ? JSON.parse(options.data) : {},
8
- jsonURL = settings.jsonURL,
9
- votingWrapper = hr$('.js-voting-wrapper', element)[0],
10
- votingTmpl = votingWrapper.innerHTML,
11
- votingForm = hr$('.js-votingForm', element)[0],
12
- actionUrl = votingForm && votingForm.getAttribute('action'),
13
- ajaxOptions,
14
- ajaxTimeout = 60 * 1000,
15
- responseFormatParam = 'rf=inline',
16
- isPosting = false,
17
- preloadIcon,
18
- loadingIcon,
19
- validationErrors,
20
- responseStatus,
21
- checkForJsonURL = function () {
22
- if (jsonURL) {
23
- actionUrl = jsonURL
24
- }
25
- },
26
- handleSubmit = function (event) {
27
- event.preventDefault()
28
-
29
- if (isPosting) {
30
- return
31
- } else {
32
- isPosting = true
33
- }
34
-
35
- //jedes mal neu holen,
36
- //da das DOM mit innerHTML ersetzt wird
37
- votingForm = hr$('.js-votingForm', element)[0]
38
-
39
- // preloadIcon = hr$('.js-preloadIcon', formWrapper)[0];
40
- // loadingIcon = hr$('.js-loadingIcon', formWrapper)[0];
41
- //
42
- // preloadIcon.classList.add('-isHidden');
43
- // loadingIcon.classList.remove('-isHidden');
44
-
45
- console.log('DATA: ' + $(votingForm).serialize())
46
- ajaxOptions = {}
47
- ajaxOptions.timeout = ajaxTimeout
48
-
49
- ajaxOptions.type = 'POST'
50
- ajaxOptions.url = actionUrl + '?' + responseFormatParam
51
- ajaxOptions.data = $(votingForm).serialize()
52
- ajaxOptions.contentType = 'application/x-www-form-urlencoded; charset=UTF-8'
53
- ajaxOptions.dataType = ''
54
-
55
- $.ajax(ajaxOptions)
56
-
57
- //Add handlers to be called when the Deferred object is resolved.
58
- .done(function (data, status, xhr) {
59
- console.log('Done')
60
- console.log(data)
61
-
62
- if (settings.jsonURL) {
63
- responseStatus = JSON.parse(data).status
64
- switch (responseStatus) {
65
- case 'VALIDATION_ERROR':
66
- console.log('Validation Error')
67
- validationErrors = JSON.parse(data).errors
68
- handleValidationErrors(validationErrors)
69
- break
70
- case 'SERVER_ERROR':
71
- hr$.replaceAnimated(
72
- votingWrapper,
73
- hr$('.js-errorMessage', element)[0].innerHTML,
74
- true,
75
- scrollIntoVoting()
76
- )
77
- break
78
- case 'OK':
79
- hr$.replaceAnimated(
80
- votingWrapper,
81
- hr$('.js-successMessage', element)[0].innerHTML,
82
- true,
83
- scrollIntoVoting()
84
- )
85
- break
86
- default:
87
- hr$.replaceAnimated(
88
- votingWrapper,
89
- hr$('.js-errorMessage', element)[0].innerHTML,
90
- true,
91
- scrollIntoVoting()
92
- )
93
- break
94
- }
95
- } else {
96
- hr$.replaceAnimated(formWrapper, data, true)
97
- scrollIntoVoting()
98
- }
99
- })
100
-
101
- //Add handlers to be called when the Deferred object is rejected.
102
- .fail(function (xhr, errorType, error) {
103
- //anzeige irgendetwas hat nicht geklappt
104
- console.log('Fail ' + errorType)
105
- hr$.replaceAnimated(
106
- votingWrapper,
107
- hr$('.js-errorMessage', element)[0].innerHTML,
108
- true,
109
- setTimeout(function () {
110
- scrollIntoVoting()
111
- }, 850)
112
- )
113
- })
114
-
115
- //Add handlers to be called when the Deferred object is either resolved or rejected.
116
- .always(function () {
117
- //aufräumen wenn bedarf besteht.
118
- console.log('Always')
119
-
120
- isPosting = false
121
- })
122
- },
123
- scrollIntoVoting = function (vertical) {
124
- setTimeout(function () {
125
- element.scrollIntoView({
126
- behavior: 'smooth',
127
- block: 'center',
128
- })
129
- }, 850)
130
- },
131
- handleFormReload = function (event) {
132
- event.preventDefault()
133
- hr$.replaceAnimated(votingWrapper, votingTmpl, false, reinitiateVotingForm)
134
- scrollIntoVoting()
135
- //hr$.ux('forms', 'formReload');
136
- },
137
- setValidationErrors = function (errors) {
138
- var wrapperElement, errorElement, prop, InvalidFields
139
-
140
- for (prop in errors) {
141
- wrapperElement = element.getElementsByClassName('js-wrapper-' + prop)[0]
142
- errorElement = document.createElement('p')
143
-
144
- InvalidFields = document.getElementsByName(prop)
145
- for (var i = 0; i < InvalidFields.length; i++) {
146
- if (wrapperElement.contains(InvalidFields[i])) {
147
- InvalidFields[i].classList.add('is-invalid')
148
- }
149
- }
150
-
151
- errorElement.innerHTML = settings.errorMessages[errors[prop]]
152
- errorElement.classList.add('c-form__errorMessage')
153
-
154
- wrapperElement.insertBefore(errorElement, wrapperElement.firstChild)
155
- }
156
- },
157
- resetValidationErrors = function () {
158
- var oldInvalidFields = hr$('.is-invalid', element),
159
- oldErrorMessages = hr$('.c-form__errorMessage', element)
160
-
161
- for (var i = 0; i < oldInvalidFields.length; i++) {
162
- oldInvalidFields[i].classList.remove('is-invalid')
163
- oldErrorMessages[i].parentNode.removeChild(oldErrorMessages[i])
164
- }
165
- },
166
- handleValidationErrors = function (errors) {
167
- resetValidationErrors()
168
- setValidationErrors(errors)
169
- },
170
- isFormAvailable = function () {
171
- return !!votingForm
172
- },
173
- reinitiateVotingForm = function () {
174
- hrScriptLoad.rescanForModulesAndVariants(element.parentElement)
175
- }
176
-
177
- if (!isFormAvailable()) {
178
- //skip code execution
179
- return
180
- }
181
-
182
- //init
183
- votingWrapper.style.WebkitTransition = 'opacity 0.8s ease-in-out'
184
- votingWrapper.style.MozTransition = 'opacity 0.8s ease-in-out'
185
- votingWrapper.style.transition = 'opacity 0.8s ease-in-out'
186
-
187
- checkForJsonURL()
188
-
189
- $(element).on('submit', '.js-votingForm', handleSubmit)
190
- $(element).on('click', '.js-formReload', handleFormReload)
191
- $(element).on('keydown', '.js-form-email', function (e) {
192
- e.stopPropagation()
193
- })
194
- }
195
-
196
- hrScriptLoad.load('voting', ['hrQueryOld', 'zepto'], function (options) {
197
- new Voting(options)
198
- })
@@ -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,35 +0,0 @@
1
- import votingErrorJson from './fixtures/voting_error.json'
2
-
3
- const handlebars = require('hrHandlebars')
4
-
5
- export default {
6
- title: 'Komponenten/Voting',
7
- decorators: [
8
- (Story) => {
9
- return `<div class="grid grid-page">
10
- <div class="grid bg-white grid-article">
11
- ${Story()}
12
- </div>
13
- </div>`
14
- },
15
- ],
16
- parameters: {
17
- layout: 'fullscreen',
18
- chromatic: { disableSnapshot: true }
19
- }
20
- }
21
-
22
- const Template = (args) => {
23
- let hbsTemplate = handlebars.compile(`
24
- {{#>components/forms/components/backgroundBox }}
25
- {{> components/voting/voting_error _title=this.title _topline=this.topline}}
26
- {{/components/forms/components/backgroundBox }}
27
- `)
28
- return hbsTemplate({ ...args })
29
- }
30
-
31
- export const Voting_Error = {
32
- render: Template.bind({}),
33
- name: 'Fehlermeldung',
34
- args: votingErrorJson,
35
- }
@@ -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,7 +0,0 @@
1
- {{> components/voting/voting_result_2F
2
- _title=_title
3
- _topline=_topline
4
- _resultBoxMessageTitle=(loca "votingform2F_title_success")
5
- _resultBoxMessageText=(loca "votingform2F_text_success")
6
- _isInline=_isInline
7
- }}
@@ -1,35 +0,0 @@
1
- import votingJson from './fixtures/voting.json'
2
-
3
- const handlebars = require('hrHandlebars')
4
-
5
- export default {
6
- title: 'Komponenten/Voting',
7
- decorators: [
8
- (Story) => {
9
- return `<div class="grid grid-page">
10
- <div class="grid bg-white grid-article">
11
- ${Story()}
12
- </div>
13
- </div>`
14
- },
15
- ],
16
- parameters: {
17
- layout: 'fullscreen',
18
- chromatic: { disableSnapshot: true }
19
- }
20
- }
21
-
22
- const Template = (args) => {
23
- let hbsTemplate = handlebars.compile(`
24
- {{#>components/forms/components/backgroundBox }}
25
- {{> components/voting/voting_success_2F _title=this.title _topline=this.topline}}
26
- {{/components/forms/components/backgroundBox }}
27
- `)
28
- return hbsTemplate({ ...args })
29
- }
30
-
31
- export const Voting_Success_2F = {
32
- render: Template.bind({}),
33
- name: 'Successmeldung',
34
- args: votingJson,
35
- }