Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upForum allow multiple categories for a thread #2083
Conversation
scopeInfinity
requested a review
from
andrewaikens87
Jun 4, 2018
scopeInfinity
added some commits
Jun 5, 2018
scopeInfinity
force-pushed the
forum_multiple_categories
branch
from
1aa7129
to
52cef29
Jun 7, 2018
scopeInfinity
changed the title
[WIP] Forum allow multiple categories for a thread
Forum allow multiple categories for a thread
Jun 8, 2018
This comment has been minimized.
This comment has been minimized.
scopeInfinity
referenced this pull request
Jun 8, 2018
Merged
Forum Edit Categories (Reordering) #2126
andrewaikens87
reviewed
Jun 9, 2018
}else if(!$this->isValidCategory($category_id)){ | ||
$this->core->addErrorMessage("You must select a valid category. Please re-submit your thread."); | ||
}else if(!$this->isValidCategories($categories_ids)){ | ||
$this->core->addErrorMessage("You must select valid categories. Please re-submit your thread."); |
This comment has been minimized.
This comment has been minimized.
andrewaikens87
Jun 9, 2018
•
Member
If the user has JavaScript disabled and selects no categories when posting the thread, it defaults to all categories for the thread. Seems it doesn't trigger this error message. To explain further, their isn't verification server sided that the user selected a category. If the user doesn't select a category with javascript disabled or by running these commands in the console
$("#create_thread_form").submit(function() { if($(this).find('.cat-selected').length == 0) { //alert("Atleast one category must be selected"); return true;//return false; } $(this).find('.cat-notselected *').prop("disabled","true"); });
document.getElementById("create_thread_form").submit();
it will bypass the client side check and submit the thread without having the user select a category. The behavior now is that all of the categories get selected by default in this case, the error checking exists on the server side but the data that is being sent to it is inconsistent (in this case specifically). If no category is selected and we submit, using the commands above, to the next page it should kick us back to the create thread page as no valid categories were selected.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The original design had the category drop down selection be able to filter on multiple categories (so similar to the way you have them selecting in the thread view you could add that into a dropdown). So for example a student could filter on both 'Question' and 'hw1' and see posts that only have both. |
andrewaikens87
requested changes
Jun 9, 2018
<script type="text/javascript"> | ||
$(function() { | ||
$(".cat-buttons").click(function() { | ||
console.log($(this)); |
This comment has been minimized.
This comment has been minimized.
}); | ||
$("#create_thread_form").submit(function() { | ||
if($(this).find('.cat-selected').length == 0) { | ||
alert("Atleast one category must be selected"); |
This comment has been minimized.
This comment has been minimized.
HTML; | ||
for($i = 0; $i < count($categories); $i++){ | ||
$return .= <<<HTML | ||
<a class="btn cat-buttons cat-notselected" style="color: green;border-color: green;">{$categories[$i]['category_desc']} |
This comment has been minimized.
This comment has been minimized.
andrewaikens87
Jun 9, 2018
Member
For interface colors refer to http://submitty.org/developer/interface_design_style_guide, please change to blue.
This comment has been minimized.
This comment has been minimized.
When creating a new category it pops up saying that it has been created but the page has to be refreshed to use it with the new toggle buttons. Prior to the toggle buttons the dropdown list would be auto-populated when the new category was created. Can we have the new category auto-populate to a toggle button? We can discuss this more on Slack if it is unclear. |
scopeInfinity
and others
added some commits
Jun 9, 2018
KevinMackenzie
self-requested a review
Jun 11, 2018
This comment has been minimized.
This comment has been minimized.
When adding a category, the green banner that gets displayed shows the url-encoded string, but it would probably be better to display the unencoded string in quotes instead. The other changes I would request you seem to have already fixed based on the demonstration you gave in the meeting yesterday (and have already been pointed out by @andrewaikens87 ) |
This comment has been minimized.
This comment has been minimized.
Thanks @KevinMackenzie |
This comment has been minimized.
This comment has been minimized.
yea that's fine, it will be much less of a nightmare to merge that way. |
scopeInfinity commentedJun 4, 2018
•
edited
Additional LibraryChosen (JS)https://github.com/harvesthq/chosen