diff --git a/core/admin.py b/core/admin.py index 541838b..057adf8 100644 --- a/core/admin.py +++ b/core/admin.py @@ -122,5 +122,5 @@ class ChecklistAdmin(admin.ModelAdmin): @admin.register(ChecklistItem) class ChecklistItemAdmin(admin.ModelAdmin): list_filter = ['checklist__user', 'name'] - list_display = ['name', 'to_be_checked_on_matchdays', 'to_be_checked_on_matchday_pattern', 'to_be_checked_if_home_match_tomorrow'] + list_display = ['priority', 'name', 'to_be_checked_on_matchdays', 'to_be_checked_on_matchday_pattern', 'to_be_checked_if_home_match_tomorrow'] search_fields = ['checklist__user__username', 'name'] diff --git a/core/migrations/0006_auto_20161203_1953.py b/core/migrations/0006_auto_20161203_1953.py new file mode 100644 index 0000000..eea3480 --- /dev/null +++ b/core/migrations/0006_auto_20161203_1953.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-03 18:53 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0005_auto_20161203_1816'), + ] + + operations = [ + migrations.AlterModelOptions( + name='checklistitem', + options={'ordering': ['-priority']}, + ), + migrations.AddField( + model_name='checklistitem', + name='priority', + field=models.IntegerField(default=0), + ), + ] diff --git a/core/models.py b/core/models.py index cd6cb8d..e0d2126 100644 --- a/core/models.py +++ b/core/models.py @@ -794,8 +794,12 @@ class Checklist(models.Model): class ChecklistItem(models.Model): + class Meta: + ordering = ['priority'] + checklist = models.ForeignKey(Checklist) name = models.CharField(max_length=255) + priority = models.IntegerField(default=0) last_checked_on_matchday = models.ForeignKey(Matchday, default=None, blank=True, null=True) to_be_checked_on_matchdays = models.CharField(blank=True, null=True, max_length=255, validators=[validate_comma_separated_integer_list]) to_be_checked_on_matchday_pattern = models.IntegerField(blank=True, null=True) diff --git a/core/static/core/css/main.css b/core/static/core/css/main.css index c7bec9d..d0441e5 100644 --- a/core/static/core/css/main.css +++ b/core/static/core/css/main.css @@ -239,6 +239,7 @@ ul.nav-sub { padding-left: 10%; } width: 80%; margin: 5px 5px; } +.checklist_item_container { background-color: rgba(255, 255, 255, 0.5); } #add_checklist_item { margin: 5px; } .delete_checklist_item { cursor: default; @@ -247,35 +248,45 @@ ul.nav-sub { padding-left: 10%; } } .delete_checklist_item:hover { cursor: pointer; } +#checklist_items_priority_saved.invisible, .checklist_item_saved.invisible { opacity: 0; transition: opacity 300ms linear; } +#checklist_items_priority_saved, .checklist_item_saved { font-size: 1.5em; - top: 5px; - right: 35px; opacity: 1; + right: 35px; + top: 5px; transition: opacity 300ms linear; } +#checklist_items_priority_saved { right:0; } #checklist_items .dropdown { - margin: 0 15px 10px 25px; display: inline-flex; + margin: 0 15px 10px 25px; } #checklist_items .dropdown-menu>.active>a, .dropdown-menu>.active>a:focus, - .dropdown-menu>.active>a:hover - { background-color: #239123; } + .dropdown-menu>.active>a:hover { background-color: #239123; } .checklist_item_matchdays, .checklist_item_matchday_pattern { - width: 50px; display: inline-flex; margin-left: 15px; + width: 50px; } .checklist_item_matchdays { width: 200px; } +.checklist_item_priority { + color: #239123; + font-size: 1.3em; + vertical-align: middle; + width: 20px; +} + + #ChecklistBar { padding: 0; background-color: #eee; diff --git a/core/static/core/js/checklist_settings_handler.js b/core/static/core/js/checklist_settings_handler.js index 50daf1d..7564d88 100644 --- a/core/static/core/js/checklist_settings_handler.js +++ b/core/static/core/js/checklist_settings_handler.js @@ -2,6 +2,7 @@ $('document').ready( function (){ function addChecklistItem(item) { $('#checklist_items').append( "