Fixed posting on group pages.
This commit is contained in:
@@ -34,6 +34,9 @@ include("../views/group.php");
|
|||||||
include("../views/footer.php");
|
include("../views/footer.php");
|
||||||
|
|
||||||
$masonry_mode = 0;
|
$masonry_mode = 0;
|
||||||
|
if ($group["role"] == "mod" OR $group["role"] == "admin") {
|
||||||
|
$masonry_mode = 2;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script src="js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
|
|||||||
@@ -23,6 +23,28 @@ function requestPost(postID) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function postPost() {
|
||||||
|
title = $("input.newpost[name='title']").val();
|
||||||
|
content = $("textarea.newpost[name='content']").val();
|
||||||
|
|
||||||
|
if (masonryMode == 2) {
|
||||||
|
$.post("API/postPost.php", { title: title,
|
||||||
|
content : content,
|
||||||
|
group : groupID })
|
||||||
|
.done(function() {
|
||||||
|
masonry(masonryMode);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.post("API/postPost.php", { title: title,
|
||||||
|
content : content })
|
||||||
|
.done(function() {
|
||||||
|
masonry(masonryMode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
$(".modal-close").click(function () {
|
$(".modal-close").click(function () {
|
||||||
$(".modal").hide();
|
$(".modal").hide();
|
||||||
@@ -64,13 +86,17 @@ function masonry(mode) {
|
|||||||
columns[i] = [0, $column];
|
columns[i] = [0, $column];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == 1) {
|
if(mode > 0) {
|
||||||
$postInput = $("<div class=\"post platform\">");
|
$postInput = $("<div class=\"post platform\">");
|
||||||
$form = $("<form action=\"API/postPost.php\" method=\"post\">");
|
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
|
||||||
$postInput.append($form);
|
$postInput.append($form);
|
||||||
|
|
||||||
$form.append($("<input class=\"newpost\" name=\"newpost-title\" placeholder=\"Titel\" type=\"text\">"));
|
if(mode == 2) {
|
||||||
$form.append($("<textarea class=\"newpost\" name=\"newpost-content\" placeholder=\"Schrijf een berichtje...\">"));
|
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
|
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\">"));
|
||||||
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
columns[0][1].append($postInput);
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left group-picture" src="<?= $group['picture'] ?>">
|
<img class="left main-picture" src="<?= $group['picture'] ?>">
|
||||||
<div class="profile-button">
|
<div class="profile-button">
|
||||||
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
<p><img src="img/leave-group.png"> Groep verlaten</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user