position = models.IntegerField(default=0)
class Meta:
- ordering = ['name']
+ ordering = ('position', 'name',)
verbose_name, verbose_name_plural = _('button group'), _('button groups')
def __unicode__(self):
group = models.ManyToManyField(ButtonGroup)
class Meta:
- ordering = ['label']
+ ordering = ('position', 'label',)
verbose_name, verbose_name_plural = _('button'), _('buttons')
def __unicode__(self):
return self.label
+
--- /dev/null
+<div id="toolbar">
+ <ol id="toolbar-tabs">
+ {% for group in groups %}
+ <li p:button-list="{{ group.slug }}">{{ group.name }}</li>
+ {% endfor %}
+ </ol>
+ <div style="clear: both; height: 0; width: 0"> </div>
+ <div id="toolbar-buttons">
+ {% for group in groups %}
+ <ol id="{{ group.slug }}" style="display:none">
+ {% for button in group.button_set.all %}
+ <li p:tag="{{ button.slug }}" {% if button.key %}p:key="{{ button.key }}"{% endif %}>{{ button.label }}</li>
+ {% endfor %}
+ </ol>
+ {% endfor %}
+ <div style="clear: both; height: 0; width: 0"> </div>
+ </div>
+</div>
\ No newline at end of file
+from django import template
+
+from toolbar import models
+
+
+register = template.Library()
+
+
+@register.inclusion_tag('toolbar/toolbar.html')
+def toolbar():
+ groups = models.ButtonGroup.objects.all()
+ return {'groups': groups}
+