-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f30657
commit 1dd5820
Showing
11 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.15 on 2024-09-06 11:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('indigo_api', '0042_backfill_task_comment_code'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='QuickLink', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255, verbose_name='name')), | ||
('scope', models.CharField(choices=[('tasks', 'Tasks'), ('works', 'Works')], verbose_name='scope')), | ||
('querystring', models.CharField(max_length=2048, verbose_name='querystring')), | ||
], | ||
options={ | ||
'verbose_name': 'quick link', | ||
'verbose_name_plural': 'quick links', | ||
'ordering': ['name'], | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class QuickLink(models.Model): | ||
SCOPES = { | ||
"tasks": _("Tasks"), | ||
"works": _("Works"), | ||
} | ||
|
||
name = models.CharField(_("name"), max_length=255) | ||
scope = models.CharField(_("scope"), choices=SCOPES.items()) | ||
querystring = models.CharField(_("querystring"), max_length=2048) | ||
|
||
class Meta: | ||
verbose_name = _("quick link") | ||
verbose_name_plural = _("quick links") | ||
ordering = ["name"] | ||
|
||
def save(self, *args, **kwargs): | ||
if self.querystring.startswith("http"): | ||
# just keep the querystring bit | ||
if '?' in self.querystring: | ||
self.querystring = self.querystring.split("?", 1)[1] | ||
else: | ||
self.querystring = "?" | ||
if not self.querystring.startswith("?"): | ||
self.querystring = "?" + self.querystring | ||
|
||
super().save(*args, **kwargs) | ||
|
||
def __str__(self): | ||
return f"QuickLink<{self.name}: {self.SCOPES[self.scope]} - {self.querystring}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% load i18n %} | ||
<div class="dropdown"> | ||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown"> | ||
{% trans "Saved searches" %} | ||
</button> | ||
<ul class="dropdown-menu"> | ||
{% for link in quick_links %} | ||
<li><a class="dropdown-item" href="{{ link.querystring }}">{{ link.name }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters