Improved issue #1591 - Improved js snipped for form channel (use div, not button for non modal forms).

This commit is contained in:
Martin Edenhofer 2017-12-04 15:14:56 +01:00
parent bb2537b49b
commit 84ed5ee451
2 changed files with 18 additions and 1 deletions

View file

@ -67,11 +67,15 @@ class App.ChannelForm extends App.ControllerSubContent
# rebuild preview # rebuild preview
params.test = true params.test = true
if params.modal if params.modal
@$('.js-modal').removeClass('hide')
@$('.js-inlineForm').addClass('hide')
@$('.js-formInline').addClass('hide') @$('.js-formInline').addClass('hide')
@$('.js-formBtn').removeClass('hide') @$('.js-formBtn').removeClass('hide')
@$('.js-formBtn').ZammadForm(params) @$('.js-formBtn').ZammadForm(params)
@$('.js-formBtn').text('Feedback') @$('.js-formBtn').text('Feedback')
else else
@$('.js-modal').addClass('hide')
@$('.js-inlineForm').removeClass('hide')
@$('.js-formBtn').addClass('hide') @$('.js-formBtn').addClass('hide')
@$('.js-formInline').removeClass('hide') @$('.js-formInline').removeClass('hide')
@$('.js-formInline').ZammadForm(params) @$('.js-formInline').ZammadForm(params)

View file

@ -132,7 +132,7 @@
<p><%- @T('You need to add the following Javascript code snippet to your web page') %>:</p> <p><%- @T('You need to add the following Javascript code snippet to your web page') %>:</p>
<pre><code class="language-html js-paramsBlock">&lt;button id="feedback-form"&gt;Feedback&lt;/button&gt; <pre class="js-modal"><code class="language-html js-code js-paramsBlock">&lt;button id="feedback-form"&gt;Feedback&lt;/button&gt;
&lt;script id="zammad_form_script" src="<%= @baseurl %>/assets/form/form.js"&gt;&lt;/script&gt; &lt;script id="zammad_form_script" src="<%= @baseurl %>/assets/form/form.js"&gt;&lt;/script&gt;
@ -144,3 +144,16 @@ $(function() {
}); });
&lt;/script&gt;</code></pre> &lt;/script&gt;</code></pre>
</div> </div>
<pre class="js-inlineForm"><code class="language-html js-code js-paramsBlock">&lt;div id="feedback-form"&gt;form will be placed in here&lt;/div&gt;
&lt;script id="zammad_form_script" src="<%= @baseurl %>/assets/form/form.js"&gt;&lt;/script&gt;
&lt;script&gt;
$(function() {
$('#feedback-form').ZammadForm({
<span class="js-modal-params"></span>
});
});
&lt;/script&gt;</code></pre>
</div>