|
36 | 36 | <div class="card shadow mb-4"> |
37 | 37 | <div class="card-body"> |
38 | 38 |
|
39 | | - <a href="{$NEW_FORUM_LINK}" class="btn btn-primary" {if count($FORUMS_ARRAY)} |
40 | | - style="margin-bottom: 15px;" {/if}>{$NEW_FORUM}</a> |
41 | | - {if !count($FORUMS_ARRAY)} |
42 | | - <hr /> |
| 39 | + <a href="{$NEW_CATEGORY_LINK}" class="btn btn-primary"> |
| 40 | + {$NEW_CATEGORY} |
| 41 | + </a> |
| 42 | + {if count($CATEGORIES_ARRAY)} |
| 43 | + <hr> |
43 | 44 | {/if} |
44 | 45 |
|
45 | 46 | <!-- Success and Error Alerts --> |
46 | 47 | {include file='includes/alerts.tpl'} |
47 | 48 |
|
48 | | - {if count($FORUMS_ARRAY)} |
49 | | - <div class="table-responsive"> |
50 | | - <table class="table"> |
51 | | - <tbody id="sortable"> |
52 | | - {foreach from=$FORUMS_ARRAY item=item name=forum_array} |
53 | | - <tr data-id="{$item.id}"> |
54 | | - <td {if $item.parent_forum} style="padding-left:{math equation="x * y" x=25 y=$item.parent_forum_count}px" {/if}> |
55 | | - <a href="{$item.edit_link}">{$item.title}</a>{if $item.parent_forum} |
56 | | - <small>| {$item.parent_forum}</small>{/if}<br />{$item.description} |
57 | | - </td> |
58 | | - <td width="10%"> |
59 | | - <div class="float-md-right"> |
60 | | - {if $item.up_link} |
61 | | - <form action="{$item.up_link}" method="post" |
62 | | - style="display: inline"> |
63 | | - <input type="hidden" name="token" value="{$TOKEN}" /> |
64 | | - <button class="btn btn-success btn-sm"><i |
65 | | - class="fas fa-chevron-up"></i></button> |
66 | | - </form> |
| 49 | + {if count($CATEGORIES_ARRAY)} |
| 50 | + {foreach from=$CATEGORIES_ARRAY item=category} |
| 51 | + <table class="table table-bordered table-sm"> |
| 52 | + <thead> |
| 53 | + <tr style="background-color: #ededed;" class="forumEditingRow"> |
| 54 | + <th style="width: 70%"> |
| 55 | + {$category.title} |
| 56 | + {if $category.description} |
| 57 | + <br> |
| 58 | + <small> |
| 59 | + {$category.description} |
| 60 | + </small> |
67 | 61 | {/if} |
68 | | - {if $item.down_link} |
69 | | - <form action="{$item.down_link}" method="post" |
70 | | - style="display: inline"> |
71 | | - <input type="hidden" name="token" value="{$TOKEN}" /> |
72 | | - <button class="btn btn-warning btn-sm"><i |
73 | | - class="fas fa-chevron-down"></i></button> |
74 | | - </form> |
| 62 | + </th> |
| 63 | + <th class="text-right align-middle"> |
| 64 | + <a class="btn btn-primary btn-sm" href="{$category.new_forum_link}"> |
| 65 | + {$NEW_FORUM} |
| 66 | + </a> |
| 67 | + <a class="btn btn-secondary btn-sm" href="{$category.edit_link}"> |
| 68 | + {$EDIT} |
| 69 | + </a> |
| 70 | + {if count($CATEGORIES_ARRAY) > 1} |
| 71 | + <button class="btn btn-secondary btn-sm"> |
| 72 | + <i class="fas fa-up-down-left-right"></i> |
| 73 | + </button> |
75 | 74 | {/if} |
76 | | - <a href="{$item.delete_link}" class="btn btn-danger btn-sm"><i |
77 | | - class="fas fa-trash"></i></a> |
78 | | - </div> |
79 | | - </td> |
80 | | - </tr> |
81 | | - {/foreach} |
82 | | - </tbody> |
83 | | - </table> |
84 | | - </div> |
| 75 | + <a class="btn btn-danger btn-sm" href="{$category.delete_link}"> |
| 76 | + <i class="fas fa-trash"></i> |
| 77 | + </a> |
| 78 | + </th> |
| 79 | + </tr> |
| 80 | + </thead> |
| 81 | + <tbody> |
| 82 | + {foreach from=$category.subforums item=subforum} |
| 83 | + <tr class="forumEditingRow"> |
| 84 | + <td style="width: 70%"> |
| 85 | + {$subforum.title} |
| 86 | + {if $subforum.description} |
| 87 | + <br> |
| 88 | + <small> |
| 89 | + {$subforum.description} |
| 90 | + </small> |
| 91 | + {/if} |
| 92 | + </td> |
| 93 | + <td class="text-right align-middle"> |
| 94 | + <a class="btn btn-secondary btn-sm" href="{$subforum.edit_link}"> |
| 95 | + Edit |
| 96 | + </a> |
| 97 | + {if count($category.subforums) > 1} |
| 98 | + <button class="btn btn-secondary btn-sm"> |
| 99 | + <i class="fas fa-up-down-left-right"></i> |
| 100 | + </button> |
| 101 | + {/if} |
| 102 | + <a class="btn btn-danger btn-sm" href="{$subforum.delete_link}"> |
| 103 | + <i class="fas fa-trash"></i> |
| 104 | + </a> |
| 105 | + </td> |
| 106 | + </tr> |
| 107 | + {/foreach} |
| 108 | + </tbody> |
| 109 | + </table> |
| 110 | + {/foreach} |
85 | 111 | {else} |
86 | | - <p>{$NO_FORUMS}</p> |
| 112 | + <p>{$NO_FORUMS}</p> |
87 | 113 | {/if} |
88 | 114 |
|
| 115 | +{* {if count($FORUMS_ARRAY)}*} |
| 116 | +{* <div class="table-responsive">*} |
| 117 | +{* <table class="table">*} |
| 118 | +{* <tbody id="sortable">*} |
| 119 | +{* {foreach from=$FORUMS_ARRAY item=item name=forum_array}*} |
| 120 | +{* <tr data-id="{$item.id}">*} |
| 121 | +{* <td {if $item.parent_forum} style="padding-left:{math equation="x * y" x=25 y=$item.parent_forum_count}px" {/if}>*} |
| 122 | +{* <a href="{$item.edit_link}">{$item.title}</a>{if $item.parent_forum}*} |
| 123 | +{* <small>| {$item.parent_forum}</small>{/if}<br />{$item.description}*} |
| 124 | +{* </td>*} |
| 125 | +{* <td width="10%">*} |
| 126 | +{* <div class="float-md-right">*} |
| 127 | +{* {if $item.up_link}*} |
| 128 | +{* <form action="{$item.up_link}" method="post"*} |
| 129 | +{* style="display: inline">*} |
| 130 | +{* <input type="hidden" name="token" value="{$TOKEN}" />*} |
| 131 | +{* <button class="btn btn-success btn-sm"><i*} |
| 132 | +{* class="fas fa-chevron-up"></i></button>*} |
| 133 | +{* </form>*} |
| 134 | +{* {/if}*} |
| 135 | +{* {if $item.down_link}*} |
| 136 | +{* <form action="{$item.down_link}" method="post"*} |
| 137 | +{* style="display: inline">*} |
| 138 | +{* <input type="hidden" name="token" value="{$TOKEN}" />*} |
| 139 | +{* <button class="btn btn-warning btn-sm"><i*} |
| 140 | +{* class="fas fa-chevron-down"></i></button>*} |
| 141 | +{* </form>*} |
| 142 | +{* {/if}*} |
| 143 | +{* <a href="{$item.delete_link}" class="btn btn-danger btn-sm"><i*} |
| 144 | +{* class="fas fa-trash"></i></a>*} |
| 145 | +{* </div>*} |
| 146 | +{* </td>*} |
| 147 | +{* </tr>*} |
| 148 | +{* {/foreach}*} |
| 149 | +{* </tbody>*} |
| 150 | +{* </table>*} |
| 151 | +{* </div>*} |
| 152 | +{* {else}*} |
| 153 | +{* <p>{$NO_FORUMS}</p>*} |
| 154 | +{* {/if}*} |
| 155 | + |
89 | 156 | </div> |
90 | 157 | </div> |
91 | 158 |
|
|
109 | 176 | {include file='scripts.tpl'} |
110 | 177 |
|
111 | 178 | <script type="text/javascript"> |
112 | | - $(document).ready(function () { |
113 | | - $("#sortable").sortable({ |
114 | | - start: function (event, ui) { |
115 | | - let start_pos = ui.item.index(); |
116 | | - ui.item.data('startPos', start_pos); |
117 | | - }, |
118 | | - update: function (event, ui) { |
119 | | - let forums = $("#sortable").children(); |
120 | | - let toSubmit = []; |
121 | | - forums.each(function () { |
122 | | - toSubmit.push($(this).data().id); |
123 | | - }); |
124 | | -
|
125 | | - $.ajax({ |
126 | | - url: "{$REORDER_DRAG_URL}", |
127 | | - type: "GET", |
128 | | - data: { |
129 | | - action: "order", |
130 | | - dir: "drag", |
131 | | - {literal}forums: JSON.stringify({"forums": toSubmit}){/literal} |
132 | | - }, |
133 | | - success: function (response) { |
134 | | - // Success |
135 | | - }, |
136 | | - error: function (xhr) { |
137 | | - // Error |
138 | | - console.log(xhr); |
139 | | - } |
140 | | - }); |
141 | | - } |
142 | | - }); |
143 | | - }); |
| 179 | + {*$(document).ready(function () {*} |
| 180 | + {* $("#sortable").sortable({*} |
| 181 | + {* start: function (event, ui) {*} |
| 182 | + {* let start_pos = ui.item.index();*} |
| 183 | + {* ui.item.data('startPos', start_pos);*} |
| 184 | + {* },*} |
| 185 | + {* update: function (event, ui) {*} |
| 186 | + {* let forums = $("#sortable").children();*} |
| 187 | + {* let toSubmit = [];*} |
| 188 | + {* forums.each(function () {*} |
| 189 | + {* toSubmit.push($(this).data().id);*} |
| 190 | + {* });*} |
| 191 | +
|
| 192 | + {* $.ajax({*} |
| 193 | + {* url: "{$REORDER_DRAG_URL}",*} |
| 194 | + {* type: "GET",*} |
| 195 | + {* data: {*} |
| 196 | + {* action: "order",*} |
| 197 | + {* dir: "drag",*} |
| 198 | + {* {literal}forums: JSON.stringify({"forums": toSubmit}){/literal}*} |
| 199 | + {* },*} |
| 200 | + {* success: function (response) {*} |
| 201 | + {* // Success*} |
| 202 | + {* },*} |
| 203 | + {* error: function (xhr) {*} |
| 204 | + {* // Error*} |
| 205 | + {* console.log(xhr);*} |
| 206 | + {* }*} |
| 207 | + {* });*} |
| 208 | + {* }*} |
| 209 | + {* });*} |
| 210 | + {*});*} |
144 | 211 | </script> |
145 | 212 |
|
146 | 213 | </body> |
|
0 commit comments