Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add blog tag browsing for course sections [SCHOOL-58, SCHOOL-61] #276

Merged
merged 34 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0c65b2c
feat: improve course section sidebar styling and add tag browser mockup
ryon Mar 10, 2021
56a2ecb
feat: update Section obj to provide posts and tags
BillClinton Dec 14, 2021
2052d15
fix: add BlogPost class to imports
BillClinton Dec 14, 2021
06fea31
fix: correct tag counting
BillClinton Dec 14, 2021
7b33300
feat: implement tag links in section template
BillClinton Dec 14, 2021
a4b4c4f
fix: improve function name
BillClinton Dec 14, 2021
9071a2f
feat: move code from template to Class function
BillClinton Dec 14, 2021
952da6f
feat: update count variable to reflect new name
BillClinton Dec 23, 2021
27062fd
feat: update func to use TagItem::getTagsSummary
BillClinton Dec 23, 2021
3e5734a
feat: add browsing section blog posts by tag
BillClinton Dec 25, 2021
d2ecfce
feat: add fixture data to test tag browsing
BillClinton Dec 26, 2021
0d1e868
feat: Don't pin teacher post when tag browsing
BillClinton Dec 26, 2021
90986b8
fix: remove test code
BillClinton Dec 26, 2021
a028952
fix: clean up fixture files
BillClinton Dec 27, 2021
9bae2ae
temp: Override emergence-skeleton class
BillClinton Dec 28, 2021
75a3234
feat: move blog/tag logic to request handler
BillClinton Dec 28, 2021
1607123
fix: correct blog template path
Dec 28, 2021
de463c0
fix: add history tables to new fixtures
BillClinton Dec 28, 2021
9e86ee7
temp: fix: allow for empty subquery result
BillClinton Dec 28, 2021
4cdc3b1
fix: allow for zero results from subquery
BillClinton Dec 28, 2021
498370e
feat: hide blog tag box when empty and update name
BillClinton Dec 28, 2021
e7327fa
fix: send current blog tag with data for header
BillClinton Dec 28, 2021
be70cff
temp: fix: allow for empty subquery result
BillClinton Dec 28, 2021
fe22f6e
fix: changes have now been added to slate-skeleton
BillClinton Dec 30, 2021
2efa2dc
fix: escape text output
BillClinton Jan 18, 2022
98f3fd0
fix: use lowerhyphencase for query param
BillClinton Jan 18, 2022
f496e1b
fix: Error should be returned
BillClinton Jan 18, 2022
e9f51a1
fix: avoid undefined index error if no results
BillClinton Jan 18, 2022
bdf69e3
fix: no need to specify full path of class
BillClinton Jan 18, 2022
bede549
fix: catch both cases
BillClinton Jan 18, 2022
842203a
fix: use more appropriate method name
BillClinton Jan 18, 2022
dce8e5d
refactor: remove unnecessarily named args
BillClinton Jan 18, 2022
b20de13
fix: corrected url parameter name
BillClinton Feb 15, 2022
f55442c
style(blog): wrap tag in <code> tag
themightychris Feb 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions fixtures/content.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `content` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Emergence\\CMS\\Page','Emergence\\CMS\\BlogPost') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`ContextClass` varchar(255) DEFAULT NULL,
`ContextID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) NOT NULL,
`Handle` varchar(255) NOT NULL,
`AuthorID` int(10) unsigned NOT NULL,
`Status` enum('Draft','Published','Hidden','Deleted') NOT NULL DEFAULT 'Published',
`Published` timestamp NULL DEFAULT NULL,
`Visibility` enum('Public','Private') NOT NULL DEFAULT 'Public',
`Summary` text,
`LayoutClass` enum('OneColumn') DEFAULT 'OneColumn',
`LayoutConfig` json DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Handle` (`Handle`),
KEY `Published` (`Published`),
KEY `CONTEXT` (`ContextClass`,`ContextID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `content` VALUES (1,'Emergence\\CMS\\BlogPost','2021-12-26 02:44:15',3,'2021-12-26 02:44:39',3,'Slate\\Courses\\Section',2,'1st post from teacher','st_post_from_teacher',3,'Published','2021-12-26 02:44:00','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (2,'Emergence\\CMS\\BlogPost','2021-12-26 02:46:48',4,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student','post_from_student',4,'Published','2021-12-26 02:46:48','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (3,'Emergence\\CMS\\BlogPost','2021-12-26 02:47:16',4,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student','post_from_student-2',4,'Published','2021-12-26 02:47:17','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (4,'Emergence\\CMS\\BlogPost','2021-12-26 02:51:07',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2',6,'Published','2021-12-26 02:51:08','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (5,'Emergence\\CMS\\BlogPost','2021-12-26 02:51:52',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2-2',6,'Published','2021-12-26 02:51:52','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (6,'Emergence\\CMS\\BlogPost','2021-12-26 02:52:13',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2-3',6,'Published','2021-12-26 02:52:13','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (7,'Emergence\\CMS\\BlogPost','2021-12-26 02:53:36',4,'2021-12-26 02:53:45',4,'Slate\\Courses\\Section',2,'Post from student','post_from_student-3',4,'Published','2021-12-26 02:53:00','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (8,'Emergence\\CMS\\BlogPost','2021-12-26 02:54:13',4,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student','post_from_student-4',4,'Published','2021-12-26 02:54:13','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (9,'Emergence\\CMS\\BlogPost','2021-12-26 02:54:33',4,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student','post_from_student-5',4,'Published','2021-12-26 02:54:33','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (10,'Emergence\\CMS\\BlogPost','2021-12-26 02:55:49',3,'2021-12-26 02:56:51',3,'Slate\\Courses\\Section',2,'This is the 2nd post from teacher','this_is_the_2nd_post_from_teacher',3,'Published','2021-12-26 02:55:00','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (11,'Emergence\\CMS\\BlogPost','2021-12-26 02:56:24',3,'2021-12-26 02:57:01',3,'Slate\\Courses\\Section',2,'This is the 3rd post from teacher','this_is_the_3rd_post_from_teacher',3,'Published','2021-12-26 02:56:00','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (12,'Emergence\\CMS\\BlogPost','2021-12-26 02:57:56',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2-4',6,'Published','2021-12-26 02:57:57','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (13,'Emergence\\CMS\\BlogPost','2021-12-26 02:58:20',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2-5',6,'Published','2021-12-26 02:58:20','Public',NULL,'OneColumn',NULL);
INSERT INTO `content` VALUES (14,'Emergence\\CMS\\BlogPost','2021-12-26 02:58:47',6,NULL,NULL,'Slate\\Courses\\Section',2,'Post from student2','post_from_student2-6',6,'Published','2021-12-26 02:58:48','Public',NULL,'OneColumn',NULL);

CREATE TABLE `history_content` (
`RevisionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ID` int(10) unsigned NOT NULL,
`Class` enum('Emergence\\CMS\\Page','Emergence\\CMS\\BlogPost') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`ContextClass` varchar(255) DEFAULT NULL,
`ContextID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) NOT NULL,
`Handle` varchar(255) NOT NULL,
`AuthorID` int(10) unsigned NOT NULL,
`Status` enum('Draft','Published','Hidden','Deleted') NOT NULL DEFAULT 'Published',
`Published` timestamp NULL DEFAULT NULL,
`Visibility` enum('Public','Private') NOT NULL DEFAULT 'Public',
`Summary` text,
`LayoutClass` enum('OneColumn') DEFAULT 'OneColumn',
`LayoutConfig` json DEFAULT NULL,
PRIMARY KEY (`RevisionID`),
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `history_content` SELECT NULL AS RevisionID, `content`.* FROM `content`;
55 changes: 55 additions & 0 deletions fixtures/content_items.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `content_items` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Emergence\\CMS\\Item\\Album','Emergence\\CMS\\Item\\Embed','Emergence\\CMS\\Item\\Media','Emergence\\CMS\\Item\\RichText','Emergence\\CMS\\Item\\Text','Emergence\\CMS\\Item\\Markdown') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) DEFAULT NULL,
`ContentID` int(10) unsigned NOT NULL,
`AuthorID` int(10) unsigned NOT NULL,
`Status` enum('Draft','Published','Hidden','Deleted') NOT NULL DEFAULT 'Published',
`Order` int(10) unsigned DEFAULT NULL,
`Data` json NOT NULL,
PRIMARY KEY (`ID`),
KEY `ContentID` (`ContentID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `content_items` VALUES (1,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:44:15',3,'2021-12-26 02:44:39',3,NULL,1,3,'Deleted',1,'\"Here is some information about the course\\n - Lorem ipsum dolor sit amet\\n - consectetur adipiscing elit\"');
INSERT INTO `content_items` VALUES (2,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:44:39',3,NULL,NULL,NULL,1,3,'Published',1,'\"Here is some information about the course\\n - Lorem ipsum dolor sit amet\\n - consectetur adipiscing elit\"');
INSERT INTO `content_items` VALUES (3,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:46:48',4,NULL,NULL,NULL,2,4,'Published',1,'\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \"');
INSERT INTO `content_items` VALUES (4,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:47:16',4,NULL,NULL,NULL,3,4,'Published',1,'\"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"');
INSERT INTO `content_items` VALUES (5,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:51:07',6,NULL,NULL,NULL,4,6,'Published',1,'\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \"');
INSERT INTO `content_items` VALUES (6,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:51:52',6,NULL,NULL,NULL,5,6,'Published',1,'\"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\"');
INSERT INTO `content_items` VALUES (7,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:52:13',6,NULL,NULL,NULL,6,6,'Published',1,'\"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"');
INSERT INTO `content_items` VALUES (8,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:53:36',4,NULL,NULL,NULL,7,4,'Published',1,'\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"');
INSERT INTO `content_items` VALUES (9,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:54:13',4,NULL,NULL,NULL,8,4,'Published',1,'\"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\"');
INSERT INTO `content_items` VALUES (10,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:54:33',4,NULL,NULL,NULL,9,4,'Published',1,'\"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"');
INSERT INTO `content_items` VALUES (11,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:55:49',3,NULL,NULL,NULL,10,3,'Published',1,'\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \"');
INSERT INTO `content_items` VALUES (12,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:56:24',3,NULL,NULL,NULL,11,3,'Published',1,'\"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"');
INSERT INTO `content_items` VALUES (13,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:57:56',6,NULL,NULL,NULL,12,6,'Published',1,'\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \"');
INSERT INTO `content_items` VALUES (14,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:58:20',6,NULL,NULL,NULL,13,6,'Published',1,'\"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\"');
INSERT INTO `content_items` VALUES (15,'Emergence\\CMS\\Item\\Markdown','2021-12-26 02:58:47',6,NULL,NULL,NULL,14,6,'Published',1,'\"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"');

CREATE TABLE `history_content_items` (
`RevisionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ID` int(10) unsigned NOT NULL,
`Class` enum('Emergence\\CMS\\Item\\Album','Emergence\\CMS\\Item\\Embed','Emergence\\CMS\\Item\\Media','Emergence\\CMS\\Item\\RichText','Emergence\\CMS\\Item\\Text','Emergence\\CMS\\Item\\Markdown') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) DEFAULT NULL,
`ContentID` int(10) unsigned NOT NULL,
`AuthorID` int(10) unsigned NOT NULL,
`Status` enum('Draft','Published','Hidden','Deleted') NOT NULL DEFAULT 'Published',
`Order` int(10) unsigned DEFAULT NULL,
`Data` json NOT NULL,
PRIMARY KEY (`RevisionID`),
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `history_content_items` SELECT NULL AS RevisionID, `content_items`.* FROM `content_items`;
29 changes: 29 additions & 0 deletions fixtures/tag_items.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `tag_items` (
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`ContextClass` varchar(255) DEFAULT NULL,
`ContextID` int(11) DEFAULT NULL,
`TagID` int(11) NOT NULL,
UNIQUE KEY `TagItem` (`TagID`,`ContextClass`,`ContextID`),
KEY `CONTEXT` (`ContextClass`,`ContextID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `tag_items` VALUES ('2021-12-26 02:44:16',3,'Emergence\\CMS\\AbstractContent',1,1);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:56:51',3,'Emergence\\CMS\\AbstractContent',10,1);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:57:01',3,'Emergence\\CMS\\AbstractContent',11,1);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:46:48',4,'Emergence\\CMS\\AbstractContent',2,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:47:16',4,'Emergence\\CMS\\AbstractContent',3,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:51:07',6,'Emergence\\CMS\\AbstractContent',4,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:51:52',6,'Emergence\\CMS\\AbstractContent',5,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:52:13',6,'Emergence\\CMS\\AbstractContent',6,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:53:45',4,'Emergence\\CMS\\AbstractContent',7,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:54:13',4,'Emergence\\CMS\\AbstractContent',8,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:54:33',4,'Emergence\\CMS\\AbstractContent',9,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:56:51',3,'Emergence\\CMS\\AbstractContent',10,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:57:01',3,'Emergence\\CMS\\AbstractContent',11,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:57:56',6,'Emergence\\CMS\\AbstractContent',12,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:58:20',6,'Emergence\\CMS\\AbstractContent',13,2);
INSERT INTO `tag_items` VALUES ('2021-12-26 02:58:47',6,'Emergence\\CMS\\AbstractContent',14,2);
17 changes: 17 additions & 0 deletions fixtures/tags.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `tags` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Tag') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Title` varchar(255) NOT NULL,
`Handle` varchar(255) NOT NULL,
`Description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Handle` (`Handle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `tags` VALUES (1,'Tag','2021-12-26 02:44:16',3,'info','info',NULL);
INSERT INTO `tags` VALUES (2,'Tag','2021-12-26 02:46:48',4,'comment','comment',NULL);
Loading