diff --git a/apps/api/serializers.py b/apps/api/serializers.py index 2e2338b..fc8193a 100644 --- a/apps/api/serializers.py +++ b/apps/api/serializers.py @@ -172,7 +172,7 @@ class SavedGuildSerializer(DynamicModelSerializer): class Meta: model = SavedGuilds - fields = ("id", "guild_id", "name", "icon", "added_by", "permissions", "owner") + fields = ("id", "guild_id", "name", "icon", "added_by", "permissions", "default_embed_colour", "owner") class TrackedContentSerializer_GET(DynamicModelSerializer): diff --git a/apps/home/migrations/0019_savedguilds_default_embed_colour.py b/apps/home/migrations/0019_savedguilds_default_embed_colour.py new file mode 100644 index 0000000..50c68df --- /dev/null +++ b/apps/home/migrations/0019_savedguilds_default_embed_colour.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.4 on 2024-07-23 14:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0018_subchannel_channel_name'), + ] + + operations = [ + migrations.AddField( + model_name='savedguilds', + name='default_embed_colour', + field=models.CharField(blank=True, default='3498db', max_length=6), + ), + ] diff --git a/apps/home/models.py b/apps/home/models.py index 4ca2f96..2df91d4 100644 --- a/apps/home/models.py +++ b/apps/home/models.py @@ -56,6 +56,12 @@ class SavedGuilds(models.Model): help_text=_("Does the 'added by' user own this guild?") ) + default_embed_colour = models.CharField( + max_length=6, + default="3498db", + blank=True + ) + class Meta: """ Metadata for the SavedGuilds Model. diff --git a/apps/static/css/home/index.css b/apps/static/css/home/index.css index c2b6902..43ae859 100644 --- a/apps/static/css/home/index.css +++ b/apps/static/css/home/index.css @@ -70,3 +70,7 @@ td { height: 100%; } } + +#serverTabs .nav-link { + border-radius: 0; +} \ No newline at end of file diff --git a/apps/static/js/home/index.js b/apps/static/js/home/index.js index 7f16f3c..f8adeda 100644 --- a/apps/static/js/home/index.js +++ b/apps/static/js/home/index.js @@ -11,11 +11,11 @@ $(document).ready(async function() { handleDiscordChannelNames(); }); -$('#serverTabs [data-bs-toggle="tab"]').on("show.bs.tab", function(event) { - const activeTab = $(event.target); - $(".tab-pane-buttons .tab-pane-buttons-item").hide(); - $(`.tab-pane-buttons .tab-pane-buttons-item[data-tab="${activeTab.attr("id")}"]`).show(); -}); +// $('#serverTabs [data-bs-toggle="tab"]').on("show.bs.tab", function(event) { +// const activeTab = $(event.target); +// $(".tab-pane-buttons .tab-pane-buttons-item").hide(); +// $(`.tab-pane-buttons .tab-pane-buttons-item[data-tab="${activeTab.attr("id")}"]`).show(); +// }); $(document).on("selectedServerChange", function() { $("#subscriptionsTab").click(); @@ -63,4 +63,63 @@ function genHexString(len) { output += (Math.floor(Math.random() * 16)).toString(16); } return output; -} \ No newline at end of file +} + +// #region Colour Controls +$(".colour-control-picker").on("change", function() { + $(this).closest(".colour-control-group").find(".colour-control-text").val($(this).val()); +}); + +$(".colour-control-text").on("change", function() { + $(this).closest(".colour-control-group").find(".colour-control-picker").val($(this).val()); +}); + +function updateColourInput(id, hexString) { + hexString = hexString.toUpperCase(); + $(`#${id} .colour-picker`).val(hexString); + $(`#${id} .colour-text`).val(hexString); +} + +$(document).ready(function() { + $(".colour-input").each(function() { + let id = $(this).attr("data-id") + label = $(this).attr("data-label"); + helpText = $(this).attr("data-helptext"); + defaultColour = $(this).attr("data-defaultcolour"); + defaultColour = defaultColour ? defaultColour : "#3498db" + + $(this).replaceWith(` + +