Commit fbdfaa14 authored by Tino Goratsch's avatar Tino Goratsch

slightly reworked the form handling

parent 273b43cf
<br/>
{if isset($error_msg)}
{if !empty($error_msg)}
{$error_msg}
{/if}
<form action="{$REQUEST_URI}#comments" method="post" accept-charset="UTF-8" class="form-horizontal" data-ajax-form="true" data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true maxlength=20 readonly=$form.name_disabled label={lang t="system|name"}}
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{event name="captcha.event.display_captcha"}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token}
</form>
{javascripts}
{else}
<form action="{$REQUEST_URI}#comments"
method="post"
accept-charset="UTF-8"
class="form-horizontal"
data-ajax-form="true"
data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true maxlength=20 readonly=$form.name_disabled label={lang t="system|name"}}
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{event name="captcha.event.display_captcha"}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token}
</form>
{javascripts}
{include_js module="system" file="ajax-form"}
{/javascripts}
{/javascripts}
{/if}
<section>
<section id="comments">
<h3 class="text-center">{lang t="comments|comments"}</h3>
{redirect_message}
{if !empty($comments)}
......
......@@ -27,7 +27,7 @@
</div>
</section>
{if $comments_allowed === true}
<section id="comments">
<section>
{load_module module="frontend/comments" args=['module' => 'files', 'entryId' => $file.id]}
{load_module module="frontend/comments/index/create" args=['module' => 'files', 'entryId' => $file.id, 'redirectUrl' => base64_encode("files/index/details/id_`$file.id`")]}
</section>
......
......@@ -62,7 +62,7 @@
</footer>
</section>
{if $comments_allowed === true}
<section id="comments">
<section>
{load_module module="frontend/comments" args=['module' => 'gallery', 'entryId' => $picture.id]}
{load_module module="frontend/comments/index/create" args=['module' => 'gallery', 'entryId' => $picture.id, 'redirectUrl' => base64_encode("gallery/index/details/id_`$picture.id`")]}
</section>
......
......@@ -4,22 +4,23 @@
{block CONTENT_AJAX_FORM}
<div class="modal-body">
{if isset($error_msg)}
{if !empty($error_msg)}
{$error_msg}
{/if}
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true readonly=$form.name_disabled maxlength=20 label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
{include file="asset:System/Partials/form_group.input_url.tpl" name="website" value=$form.website readonly=$form.website_disabled maxlength=120 label={lang t="system|website"}}
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{if isset($subscribe_newsletter)}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$subscribe_newsletter}
{include file="asset:System/Partials/form_group.input_text.tpl" name="name" value=$form.name required=true readonly=$form.name_disabled maxlength=20 label={lang t="system|name"}}
{include file="asset:System/Partials/form_group.input_email.tpl" name="mail" value=$form.mail readonly=$form.mail_disabled maxlength=120 label={lang t="system|email_address"}}
{include file="asset:System/Partials/form_group.input_url.tpl" name="website" value=$form.website readonly=$form.website_disabled maxlength=120 label={lang t="system|website"}}
{if $can_use_emoticons}
{$before_textarea={event name="emoticons.render_emoticons_list"}}
{else}
{$before_textarea=''}
{/if}
{include file="asset:System/Partials/form_group.textarea.tpl" name="message" value=$form.message required=true label={lang t="system|message"} before_textarea=$before_textarea}
{if isset($subscribe_newsletter)}
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$subscribe_newsletter}
{/if}
{event name="captcha.event.display_captcha"}
{/if}
{event name="captcha.event.display_captcha"}
</div>
<div class="modal-footer">
<button type="submit" name="submit" class="btn btn-primary">{lang t="system|submit"}</button>
......
......@@ -23,7 +23,7 @@
{event name="news.event.news_details_after" id=$news.id title=$news.title}
</section>
{if $comments_allowed === true}
<section id="comments">
<section>
{load_module module="frontend/comments" args=['module' => 'news', 'entryId' => $news.id]}
{load_module module="frontend/comments/index/create" args=['module' => 'news', 'entryId' => $news.id, 'redirectUrl' => base64_encode("news/index/details/id_`$news.id`")]}
</section>
......
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
{if !empty($error_msg)}
{$error_msg}
{/if}
<form action="{$REQUEST_URI}"
method="post"
accept-charset="UTF-8"
class="form-horizontal"
id="polls-create-form"
data-ajax-form="true"
data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-1" data-toggle="tab">{lang t="system|publication_period"}</a></li>
<li><a href="#tab-2" data-toggle="tab">{lang t="polls|poll"}</a></li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
{include file="asset:System/Partials/form_group.input_text.tpl" name="title" value=$form.title required=true maxlength=120 label={lang t="polls|question"}}
{foreach $answers as $row}
<div class="form-group">
<label for="answer-{$row@index}" class="col-sm-2 control-label">{lang t="polls|answer_x" args=['%number%' => $row@index+1]}</label>
{else}
<form action="{$REQUEST_URI}"
method="post"
accept-charset="UTF-8"
class="form-horizontal"
id="polls-create-form"
data-ajax-form="true"
data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-1" data-toggle="tab">{lang t="system|publication_period"}</a></li>
<li><a href="#tab-2" data-toggle="tab">{lang t="polls|poll"}</a></li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{datepicker name=['start', 'end'] value=[$form.start, $form.end]}
</div>
<div id="tab-2" class="tab-pane fade">
{include file="asset:System/Partials/form_group.input_text.tpl" name="title" value=$form.title required=true maxlength=120 label={lang t="polls|question"}}
{foreach $answers as $row}
<div class="form-group">
<label for="answer-{$row@index}" class="col-sm-2 control-label">{lang t="polls|answer_x" args=['%number%' => $row@index+1]}</label>
<div class="col-sm-10">
{if isset($row.id)}
<div class="input-group">
<input class="form-control" type="text" name="answers[{$row@index}][text]" id="answer-{$row@index}" value="{$row.text}" maxlength="120">
<div class="input-group-addon">
<input type="checkbox" name="answers[{$row@index}][delete]" value="1">
<div class="col-sm-10">
{if isset($row.id)}
<div class="input-group">
<input class="form-control" type="text" name="answers[{$row@index}][text]" id="answer-{$row@index}" value="{$row.text}" maxlength="120">
<div class="input-group-addon">
<input type="checkbox" name="answers[{$row@index}][delete]" value="1">
</div>
</div>
</div>
<input type="hidden" name="answers[{$row@index}][id]" value="{$row.id}" style="display:none">
{else}
<input class="form-control" type="text" name="answers[{$row@index}][text]" id="answer-{$row@index}" value="{$row.text}" maxlength="120">
{/if}
<input type="hidden" name="answers[{$row@index}][id]" value="{$row.id}" style="display:none">
{else}
<input class="form-control" type="text" name="answers[{$row@index}][text]" id="answer-{$row@index}" value="{$row.text}" maxlength="120">
{/if}
</div>
</div>
{/foreach}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="add_answer" class="btn btn-default" data-hash-change="#tab-2">
{lang t="polls|add_answer"}
</button>
</div>
</div>
{/foreach}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="add_answer" class="btn btn-default" data-hash-change="#tab-2">
{lang t="polls|add_answer"}
</button>
</div>
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$options label={lang t="system|options"}}
</div>
{include file="asset:System/Partials/form_group.checkbox.tpl" options=$options label={lang t="system|options"}}
</div>
</div>
</div>
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token back_url={uri args="acp/polls"}}
</form>
{javascripts}
{include_js module="system" file="ajax-form"}
{include_js module="system" file="hash-change"}
{/javascripts}
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token back_url={uri args="acp/polls"}}
</form>
{javascripts}
{include_js module="system" file="ajax-form"}
{include_js module="system" file="hash-change"}
{/javascripts}
{/if}
{/block}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment