Skip to content

Commit

Permalink
Feature/fa icons for rules (#123)
Browse files Browse the repository at this point in the history
Integrate font-awesome for the rule icons
  • Loading branch information
jberghoef authored and mvantellingen committed Jun 2, 2017
1 parent 38620d9 commit 0776d23
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 119 deletions.
Binary file removed frontend/img/calendar_icon.png
Binary file not shown.
Binary file removed frontend/img/key_icon.png
Binary file not shown.
Binary file removed frontend/img/persistent_icon.png
Binary file not shown.
Binary file removed frontend/img/referral_icon.png
Binary file not shown.
Binary file removed frontend/img/rocket_icon.png
Binary file not shown.
Binary file removed frontend/img/ruler_icon.png
Binary file not shown.
Binary file removed frontend/img/time_icon.png
Binary file not shown.
Binary file removed frontend/img/visit_count_icon.png
Binary file not shown.
61 changes: 5 additions & 56 deletions frontend/scss/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
list-style: none;
}

.block_container .block span.icon::before {
margin-right: 0.3em;
vertical-align: bottom;
}

.block_container .block .inspect_container .inspect li {
display: inline-block;
margin-bottom: 5px;
Expand All @@ -101,42 +106,6 @@
overflow-wrap: break-word;
}

.block_container .block .inspect_container .inspect li span::before {
display: inline-block;
content: "";
width: 16px;
height: 16px;
margin-right: 5px;
background-size: contain;
background-image: url("../img/ruler_icon.png");
}

.block_container .block .inspect_container .segment_stats .visit_stat span::before {
background-image: url("../img/rocket_icon.png");
}
.block_container .block .inspect_container .segment_stats .days_stat span::before {
background-image: url("../img/calendar_icon.png");
}

.block_container .block .inspect_container .segment_rules .persistent_state span::before {
background-image: url("../img/persistent_icon.png");
}
.block_container .block .inspect_container .segment_rules .persistent_state.fleeting span::before {
transform: rotate(45deg) translateY(-2px);
}
.block_container .block .inspect_container .segment_rules .time-rule span::before {
background-image: url("../img/time_icon.png");
}
.block_container .block .inspect_container .segment_rules .visit-count-rule span::before {
background-image: url("../img/visit_count_icon.png");
}
.block_container .block .inspect_container .segment_rules .logged-in-rule span::before {
background-image: url("../img/key_icon.png");
}
.block_container .block .inspect_container .segment_rules .day-rule span::before {
background-image: url("../img/calendar_icon.png");
}

.block_container .block .inspect_container .inspect li pre {
position: relative;
box-sizing: border-box;
Expand All @@ -150,26 +119,6 @@
border-radius: 3px;
}

.block_container .block .inspect_container .inspect li pre::before {
display: inline-block;
position: absolute;
content: "";
left: -21px;
top: 6px;
width: 16px;
height: 16px;
margin-right: 5px;
background-size: contain;
background-image: url("../img/ruler_icon.png");
}

.block_container .block .inspect_container .segment_rules .referral-rule pre::before {
background-image: url("../img/referral_icon.png");
}
.block_container .block .inspect_container .segment_rules .query-rule pre::before {
background-image: url("../img/referral_icon.png");
}

.block_container .block.suggestion .suggestive_text {
display: block;
position: absolute;
Expand Down
16 changes: 16 additions & 0 deletions src/wagtail_personalisation/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
@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",
Expand Down Expand Up @@ -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"))

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -146,6 +152,8 @@ class ReferralRule(AbstractBaseRule):
the set regex test.
"""
icon = 'fa-globe'

regex_string = models.TextField(
_("Regular expression to match the referrer"))

Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -315,6 +329,8 @@ class UserIsLoggedInRule(AbstractBaseRule):
Matches when the user is authenticated.
"""
icon = 'fa-user'

is_logged_in = models.BooleanField(default=False)

panels = [
Expand Down
2 changes: 1 addition & 1 deletion src/wagtail_personalisation/static/css/dashboard.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0776d23

Please sign in to comment.