Add tile delete button
This commit is contained in:
parent
735fbd3abe
commit
c580cbdc11
@ -120,6 +120,14 @@ switch ($VARS['action']) {
|
|||||||
$database->insert('tiles', $data);
|
$database->insert('tiles', $data);
|
||||||
}
|
}
|
||||||
exit(json_encode(["status" => "OK"]));
|
exit(json_encode(["status" => "OK"]));
|
||||||
|
case "deltile":
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
if (!$database->has('tiles', ['tileid' => $VARS['tileid']])) {
|
||||||
|
die(json_encode(["status" => "ERROR", "msg" => lang("invalid tileid", false)]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$database->delete('tiles', ["tileid" => $VARS['tileid']]);
|
||||||
|
exit(json_encode(["status" => "OK"]));
|
||||||
case "signout":
|
case "signout":
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header('Location: index.php');
|
header('Location: index.php');
|
||||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
@ -71,6 +71,7 @@ if ($pub === false) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-danger btn-xs" id="edit-tile-del-btn"><?php lang("delete"); ?></button>
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal"><?php lang("close"); ?></button>
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php lang("close"); ?></button>
|
||||||
<button type="button" class="btn btn-primary" id="edit-tile-save-btn" data-tile=""><?php lang("save"); ?></button>
|
<button type="button" class="btn btn-primary" id="edit-tile-save-btn" data-tile=""><?php lang("save"); ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
$("#new_tile_btn").click(function () {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".edit-btn").click(function () {
|
$(".edit-btn").click(function () {
|
||||||
var tileid = $(this).data("tile");
|
var tileid = $(this).data("tile");
|
||||||
$("#tile-" + tileid + "-content .tile-html").summernote({
|
$("#tile-" + tileid + "-content .tile-html").summernote({
|
||||||
@ -117,6 +113,18 @@ $("#edit-tile-save-btn").click(function () {
|
|||||||
$("#tile-options-modal").modal('hide');
|
$("#tile-options-modal").modal('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#edit-tile-del-btn").click(function () {
|
||||||
|
var tileid = $("#edit-tile-save-btn").data("tile");
|
||||||
|
$("#tile-" + tileid).css("display", "none");
|
||||||
|
$.post("action.php", {
|
||||||
|
action: "deltile",
|
||||||
|
tileid: tileid
|
||||||
|
}, function (d) {
|
||||||
|
safeReload();
|
||||||
|
});
|
||||||
|
$("#tile-options-modal").modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
$("#new-tile-save-btn").click(function () {
|
$("#new-tile-save-btn").click(function () {
|
||||||
var style = $("#newstyle").val();
|
var style = $("#newstyle").val();
|
||||||
var width = $("#newwidth").val();
|
var width = $("#newwidth").val();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user