Skip to content

Commit

Permalink
[bvl_feedback] Edit comment section (aces#8790)
Browse files Browse the repository at this point in the history
Fix display of bvl_feedback on mobile devices.

- Switched Add Comment button from Pencil to a Comment (Original was confusing)
- Set threads to be shown automatically for open threads as having them hidden made the UI confusing.
- Added an Edit and Delete button for comments of which the author is the user viewing them
- Flipped the order of comments around so that the newer comments show up below. Makes more sense when reading the comments
- Made New Comment TextArea section show up below the thread, as that is where the new comment will appear
- Changed panel width to work on mobile devices
  • Loading branch information
skarya22 authored and kongtiaowang committed Nov 29, 2023
1 parent 76f2161 commit 8666064
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 63 deletions.
3 changes: 2 additions & 1 deletion modules/bvl_feedback/ajax/close_bvl_feedback_thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
exit;
}

header("HTTP/1.1 204 No Content");
header("content-type:application/json");
echo json_encode(['success' => true]);
exit;


26 changes: 26 additions & 0 deletions modules/bvl_feedback/ajax/delete_thread_comment_bvl_feedback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Used to delete an entry on a specific thread via the bvl feedback
* panel.
*
* PHP version 5
*
* @category Behavioural
* @package Main
* @author Saagar Arya <saagar.arya@mcin.ca>
* @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.en.html>
* @link https://github.com/aces/Loris/
*/
header("content-type:application/json");
ini_set('default_charset', 'utf-8');

require "bvl_panel_ajax.php";

$db =& NDB_Factory::singleton()->database();

// DELETE the thread entries
$db->delete('feedback_bvl_entry', ["ID" => $_POST['entryID']]);

print json_encode('success');

exit();
8 changes: 8 additions & 0 deletions modules/bvl_feedback/ajax/get_thread_entry_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
header("content-type:application/json");
require "bvl_panel_ajax.php";

$user =& User::singleton();
$username = $user->getUsername();

if (isset($_GET['feedbackID']) && !Empty($_GET['feedbackID'])) {
$threadEntries = NDB_BVL_Feedback::getThreadEntries($_GET['feedbackID']);
// add username to threadentries
foreach ($threadEntries as $key => $value) {
$threadEntries[$key]['current_user'] = $username;
$threadEntries[$key]['editComment'] = false;
}
print json_encode($threadEntries);
}

Expand Down
3 changes: 2 additions & 1 deletion modules/bvl_feedback/ajax/open_bvl_feedback_thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
exit;
}

header("HTTP/1.1 204 No Content");
header("content-type:application/json");
echo json_encode(['success' => true]);
exit;

37 changes: 37 additions & 0 deletions modules/bvl_feedback/ajax/update_thread_comment_bvl_feedback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Used to create a new entry on a specific thread via the bvl feedback
* panel.
*
* PHP version 5
*
* @category Behavioural
* @package Main
* @author Evan McIlroy <evanmcilroy@gmail.com>
* @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.en.html>
* @link https://github.com/aces/Loris-Trunk/
*/
header("content-type:application/json");
ini_set('default_charset', 'utf-8');

require "bvl_panel_ajax.php";

if (isset($_POST['entryID']) && isset($_POST['newComment'])) {
$db =& NDB_Factory::singleton()->database();

$db->update(
'feedback_bvl_entry',
[
'Comment' => $_POST['newComment'],
'TestDate' => $_POST['date']
],
['ID' => $_POST['entryID']]
);

print json_encode('success');
} else {
print json_encode('error');
exit();
}

exit();
53 changes: 53 additions & 0 deletions modules/bvl_feedback/css/bvl_feedback_panel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Based on "loris/htdocs/css/panel.css" */

#bvl_panel_wrapper .navmenu {
width: 800px;
position: fixed;
z-index: 1040;
top: 0;
bottom: 0;
}

#bvl_panel_wrapper .panel-wrapper {
margin-right: -800px;
right: 0;
width: 800px;
background: #F5F5F5;
height: 100%;
border-color: #064785;
border-left: 2px solid;
border-top: 2px solid;
overflow-y: scroll;
z-index: 998;
transition: all 0.4s ease 0s;
padding-bottom: 50px;
}

#bvl_panel_wrapper .bvl_panel {
padding-right: 800px;
transition: all 0.4s ease 0s;
}

#bvl_panel_wrapper .active_panel_footer {
padding-right: 800px;
}

#bvl_panel_wrapper .active_panel {
right: 800px;
}

@media (max-width: 884px) {
#bvl_panel_wrapper .panel-wrapper {
margin-right: -100%;
width: 100%;
}

#bvl_panel_wrapper .active_panel {
right: 100%;
}
}

#comment_author {
color: gray;
font-size: 12px
}
Loading

0 comments on commit 8666064

Please # to comment.