7

Feature/fa icons for rules (#123)

Integrate font-awesome for the rule icons
This commit is contained in:
Jasper Berghoef
2017-06-02 14:53:41 +02:00
committed by Michael van Tellingen
parent 38620d916f
commit 0776d2300a
15 changed files with 43 additions and 119 deletions

View File

@ -17,6 +17,8 @@ from wagtail.wagtailadmin.edit_handlers import (
@python_2_unicode_compatible
class AbstractBaseRule(models.Model):
"""Base for creating rules to segment users with."""
icon = 'fa-circle-o'
segment = ParentalKey(
'wagtail_personalisation.Segment',
related_name="%(app_label)s_%(class)s_related",
@ -66,6 +68,8 @@ class TimeRule(AbstractBaseRule):
set start time and end time.
"""
icon = 'fa-clock-o'
start_time = models.TimeField(_("Starting time"))
end_time = models.TimeField(_("Ending time"))
@ -99,6 +103,8 @@ class DayRule(AbstractBaseRule):
set in the rule.
"""
icon = 'fa-calendar-check-o'
mon = models.BooleanField(_("Monday"), default=False)
tue = models.BooleanField(_("Tuesday"), default=False)
wed = models.BooleanField(_("Wednesday"), default=False)
@ -146,6 +152,8 @@ class ReferralRule(AbstractBaseRule):
the set regex test.
"""
icon = 'fa-globe'
regex_string = models.TextField(
_("Regular expression to match the referrer"))
@ -181,6 +189,8 @@ class VisitCountRule(AbstractBaseRule):
when visiting the set page.
"""
icon = 'fa-calculator'
OPERATOR_CHOICES = (
('more_than', _("More than")),
('less_than', _("Less than")),
@ -248,6 +258,8 @@ class QueryRule(AbstractBaseRule):
present in the request query.
"""
icon = 'fa-link-o'
parameter = models.SlugField(_("The query parameter to search for"),
max_length=20)
value = models.SlugField(_("The value of the parameter to match"),
@ -282,6 +294,8 @@ class DeviceRule(AbstractBaseRule):
in the request user agent headers.
"""
icon = 'fa-tablet'
mobile = models.BooleanField(_("Mobile phone"), default=False)
tablet = models.BooleanField(_("Tablet"), default=False)
desktop = models.BooleanField(_("Desktop"), default=False)
@ -315,6 +329,8 @@ class UserIsLoggedInRule(AbstractBaseRule):
Matches when the user is authenticated.
"""
icon = 'fa-user'
is_logged_in = models.BooleanField(default=False)
panels = [