mirror of
https://github.com/claradex/nativegallery.git
synced 2025-02-13 09:43:14 +03:00
fix pin
This commit is contained in:
parent
82888d6e06
commit
558a5cb4c0
4 changed files with 21 additions and 24 deletions
|
@ -13,20 +13,13 @@ class Load
|
|||
public function __construct()
|
||||
{
|
||||
|
||||
$comments = DB::query('SELECT * FROM photos_comments WHERE photo_id=:pid', array(':pid' => explode('/', $_SERVER['REQUEST_URI'])[4]));
|
||||
$photo = new Photo(explode('/', $_SERVER['REQUEST_URI'])[4]);
|
||||
$comments = DB::query('SELECT * FROM photos_comments WHERE photo_id=:pid ORDER BY CASE WHEN id = :pinnedid THEN 0 ELSE 1 END, id ASC', array(':pid' => explode('/', $_SERVER['REQUEST_URI'])[4], ':pinnedid' => $photo->i('pinnedcomment_id')));
|
||||
$number = 1;
|
||||
if ((int)$photo->i('pinnedcomment_id') != 0) {
|
||||
$comm = new Comment(DB::query('SELECT * FROM photos_comments WHERE id=:id', array(':id'=>$photo->i('pinnedcomment_id')))[0]);
|
||||
$class = 's1';
|
||||
$comm->class($class);
|
||||
$number++;
|
||||
$comm->i();
|
||||
}
|
||||
foreach ($comments as $c) {
|
||||
$comm = new Comment($c);
|
||||
$photo = new Photo($c['photo_id']);
|
||||
if ($comm->content('deleted') != 'true' && (int)$photo->i('pinnedcomment_id') != (int)$c['id']) {
|
||||
if ($comm->content('deleted') != 'true') {
|
||||
if ($number % 2 == 0) {
|
||||
$class = 's11';
|
||||
} else {
|
||||
|
|
|
@ -79,7 +79,8 @@ const pinComment = (postId) => {
|
|||
|
||||
const url = window.location.pathname;
|
||||
const segments = url.split('/');
|
||||
const id = segments[segments.length - 1];
|
||||
const id = segments[2];
|
||||
console.log(segments);
|
||||
$.ajax({
|
||||
|
||||
|
||||
|
@ -121,7 +122,7 @@ const editComment = (postId, body, modalid) => {
|
|||
Notify.noty('success', 'Успешно отредактировано!');
|
||||
const url = window.location.pathname;
|
||||
const segments = url.split('/');
|
||||
const id = segments[segments.length - 1];
|
||||
const id = segments[2];
|
||||
$.ajax({
|
||||
|
||||
|
||||
|
|
|
@ -165,17 +165,20 @@ $(document).ready(function()
|
|||
|
||||
|
||||
|
||||
var placeElement = document.getElementById('place');
|
||||
if (placeElement) {
|
||||
$('#place').autocompleteHL({
|
||||
minLength: 3,
|
||||
source: function(request, response)
|
||||
{
|
||||
var cid = $('#search_cid').val();
|
||||
if (cid != 0)
|
||||
$.getJSON('/api/geodb/search', { place: request.term }, response).fail(function(jx) { alert(jx.responseText); });
|
||||
else response(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#place').autocompleteHL({
|
||||
minLength: 3,
|
||||
source: function(request, response)
|
||||
{
|
||||
var cid = $('#search_cid').val();
|
||||
if (cid != 0)
|
||||
$.getJSON('/api/geodb/search', { place: request.term }, response).fail(function(jx) { alert(jx.responseText); });
|
||||
else response(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#image').click(function()
|
||||
|
|
|
@ -587,7 +587,7 @@ if ($photo->i('id') !== null) {
|
|||
|
||||
<?php
|
||||
if ($photo->i('moderated') === 1) {
|
||||
$comments = DB::query('SELECT * FROM photos_comments WHERE photo_id=:pid', array(':pid' => $id));
|
||||
$comments = DB::query('SELECT * FROM photos_comments WHERE photo_id=:pid ORDER BY CASE WHEN id = :pinnedid THEN 0 ELSE 1 END, id ASC', array(':pid' => $id, ':pinnedid' => $photo->i('pinnedcomment_id')));
|
||||
$commcount = 0;
|
||||
foreach ($comments as $c) {
|
||||
if (json_decode($c['content'], true)['deleted'] != 'true') {
|
||||
|
|
Loading…
Reference in a new issue