Commit 07fc4d5c authored by Tino Goratsch's avatar Tino Goratsch

refactored some more templates

parent 2c569611
$(document).ready(function () {
var alias = $('#alias').parents('div.control-group');
var module = $('#module-container');
var hints = $('#link-hints');
var link = $('#link-container');
var articles = $('#articles-container');
var target = $('#target-container');
var articlesPattern = /^articles\/index\/details\/id_(\d+)\/$/;
jQuery(document).ready(function ($) {
var $alias = $('#alias').parents('div.control-group'),
$module = $('#module-container'),
$link = $('#link-container'),
$hints = $link.find('.help-block'),
$articles = $('#articles-container'),
$target = $('#target-container'),
articlesPattern = /^articles\/index\/details\/id_(\d+)\/$/;
// Wenn Menüpunkt nicht angezeigt werden soll, Linkziel verstecken
$('input[name="display"]').change(function () {
if ($(this).val() == 0) {
target.hide();
} else {
target.show();
}
$target.toggle(this.value == 1);
});
var $mode = $('#mode'),
currentMode = $mode.val();
// Seitentyp
$mode.change(function () {
var mode = $(this).val();
var mode = this.value;
if (mode == 1) {
alias.hide();
module.show();
hints.hide();
link.hide();
articles.hide();
$alias.hide();
$module.show();
$hints.hide();
$link.hide();
$articles.hide();
// Modul im Dropdown-Menü selektieren, falls zuvor als Modus eine dynamische Seite aktiv war
if (currentMode == 2) {
var $link = $('#link-uri'),
match = $link.val().match(/^([a-z\d_\-]+)\/([a-z\d_\-]+\/)+$/);
if (!$link.val().match(articlesPattern) && match[1] != null && $('#module').find('option[value="' + match[1] + '"]').length > 0) {
var $linkUri = $('#uri'),
match = $linkUri.val().match(/^([a-z\d_\-]+)\/([a-z\d_\-]+\/)+$/);
if (!$linkUri.val().match(articlesPattern) && match[1] != null && $('#module').find('option[value="' + match[1] + '"]').length > 0) {
$('#link-module').val(match[1]);
}
}
} else if (mode == 2) {
alias.show();
module.hide();
hints.show();
link.show();
articles.hide();
$alias.show();
$module.hide();
$hints.show();
$link.show();
$articles.hide();
} else if (mode == 3) {
module.hide();
hints.hide();
link.show();
articles.hide();
$module.hide();
$hints.hide();
$link.show();
$articles.hide();
} else if (mode == 4) {
alias.show();
module.hide();
hints.hide();
link.hide();
articles.show();
$alias.show();
$module.hide();
$hints.hide();
$link.hide();
$articles.show();
} else {
alias.hide();
module.hide();
hints.hide();
link.hide();
articles.hide();
$alias.hide();
$module.hide();
$hints.hide();
$link.hide();
$articles.hide();
}
currentMode = mode;
}).change();
$('#link-uri').blur(function () {
$('#uri').blur(function () {
var match = $(this).val().match(articlesPattern);
if (match[1] !== null && $('#articles').find('option[value="' + match[1] + '"]').length > 0) {
$('#mode').val(4).change();
......
......@@ -25,14 +25,8 @@
</select>
</div>
</div>
<div id="link-container" class="form-group">
<label for="link-uri" class="col-sm-2 control-label required">{lang t="menus|uri"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="uri" id="link-uri" value="{$form.uri}" maxlength="120">
<p id="link-hints" class="help-block">{lang t="menus|dynamic_page_hints"}</p>
</div>
<div id="link-container">
{include file="asset:System/Partials/form_group.input_text.tpl" name="uri" value=$form.uri labelRequired=true maxlength=120 label={lang t="menus|uri"} help={lang t="menus|dynamic_page_hints"}}
</div>
{if isset($articles)}
<div id="articles-container" class="form-group">
......@@ -56,6 +50,6 @@
</div>
{include file="asset:System/Partials/form_group.submit.tpl" form_token=$form_token back_url={uri args="acp/menus"}}
{javascripts}
{include_js module="menus" file="admin/acp"}
{include_js module="menus" file="admin/items.create"}
{/javascripts}
{/block}
$(document).ready(function () {
jQuery(document).ready(function ($) {
var $resourcesTable = $('#resources-table');
$resourcesTable.find('tbody tr:not(.sub-table-header)').hide();
......@@ -10,4 +10,4 @@ $(document).ready(function () {
$('#mark-all').prop('checked', allVisibleChecked);
});
});
\ No newline at end of file
});
{javascripts}
{include_js module="system" file="dataTables.bootstrap" depends="datatables"}
<script type="text/javascript">
$(document).ready(function () {
jQuery(document).ready(function ($) {
$('{$dt.element}').dataTable({
lengthMenu: [
[10, 15, 20, 25, 50, -1],
......
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