diff --git a/apps/home/static/home/js/tables.js b/apps/home/static/home/js/tables.js
index 451406b..b6bd107 100644
--- a/apps/home/static/home/js/tables.js
+++ b/apps/home/static/home/js/tables.js
@@ -565,6 +565,20 @@ function renderMutatorColumn(data) {
return $(`${data.name}`).prop("outerHTML");
}
+const renderLinkToStyleColumn = style => {
+ if (!style.is_embed) {
+ return "";
+ }
+
+ const hexWithHashtag = `#${style.colour}`.toUpperCase();
+
+ let icon = $("
");
+ icon.addClass("col-hex-icon js-openSubStyle");
+ icon.css("background-color", hexWithHashtag);
+
+ return $(`${icon.prop("outerHTML")}`).tooltip()[0];
+}
+
const renderPopoverBadgesColumn = (items, iconClass) => {
if (!items.length) {
return "";
diff --git a/apps/home/static/home/js/tabs/subs.js b/apps/home/static/home/js/tabs/subs.js
index 76b962f..7c40c04 100644
--- a/apps/home/static/home/js/tabs/subs.js
+++ b/apps/home/static/home/js/tabs/subs.js
@@ -43,7 +43,7 @@ function initSubscriptionsModule() {
title: "Style",
data: "message_style_detail",
className: "col-hex",
- render: data => renderHexColourColumn(data.colour, null, data)
+ render: renderLinkToStyleColumn
},
{
title: "Created At",
@@ -288,4 +288,17 @@ async function loadChannelOptions() {
})
$input.prop("disabled", false);
-}
\ No newline at end of file
+}
+
+
+// region Open Sub Style
+
+$(subTableId).on("click", ".js-openSubStyle", async event => {
+ const subTable = $(subTableId).DataTable();
+ const row = subTable.row($(event.currentTarget).closest("tr"));
+ const styleId = row.data().message_style
+
+ // Open styles tab and styles modal
+ $("#stylesTab").click();
+ await openDataModal(styleModalId, styleId);
+});