Skip to content

Commit

Permalink
Merge pull request #276 from SlateFoundation/features/SCHOOL-58-tag-b…
Browse files Browse the repository at this point in the history
…rowser

feat: add blog tag browsing for course sections [SCHOOL-58, SCHOOL-61]
  • Loading branch information
themightychris authored Feb 15, 2022
2 parents fb110ba + f55442c commit 3ca9ff1
Show file tree
Hide file tree
Showing 12 changed files with 546 additions and 113 deletions.
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

0 comments on commit 3ca9ff1

Please sign in to comment.