From: Lukasz Rekucki Date: Wed, 19 Aug 2009 14:21:51 +0000 (+0200) Subject: Merge branch 'master' of git@stigma:platforma X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/d154270c884fe196fb56fa3123183c3408a45ecc?hp=d940e6b2345b50ffbd50bbe5f508f6d4ff4e0054 Merge branch 'master' of git@stigma:platforma --- diff --git a/apps/explorer/models.py b/apps/explorer/models.py index 3b5848b7..5fa93ad6 100644 --- a/apps/explorer/models.py +++ b/apps/explorer/models.py @@ -4,11 +4,11 @@ from django.conf import settings def get_image_folders(): - return [fn for fn in os.listdir(settings.IMAGE_DIR) if not fn.startswith('.')] + return [fn for fn in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR)) if not fn.startswith('.')] def get_images_from_folder(folder): - return ['/media/images/' + folder + '/' + fn for fn - in os.listdir(os.path.join(settings.IMAGE_DIR, folder)) + return [settings.MEDIA_URL + settings.IMAGE_DIR + '/' + folder + '/' + fn for fn + in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, folder)) if not fn.startswith('.')] diff --git a/apps/explorer/views.py b/apps/explorer/views.py index acbcd193..ac83c4ef 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -1,5 +1,6 @@ from librarian import html -import hg, urllib2, json +import hg, urllib2 +from django.utils import simplejson as json from django.views.generic.simple import direct_to_template from django.conf import settings diff --git a/apps/toolbar/__init__.py b/apps/toolbar/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/toolbar/admin.py b/apps/toolbar/admin.py new file mode 100644 index 00000000..2c8cd28c --- /dev/null +++ b/apps/toolbar/admin.py @@ -0,0 +1,25 @@ +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ + +from toolbar import models + + +class ButtonGroupAdmin(admin.ModelAdmin): + list_display = ('name', 'slug', 'position',) + search_fields = ('name', 'slug',) + prepopulated_fields = {'slug': ('name',)} + list_editable = ('position',) + +admin.site.register(models.ButtonGroup, ButtonGroupAdmin) + + +class ButtonAdmin(admin.ModelAdmin): + list_display = ('label', 'slug', 'tag', 'key', 'position',) + list_filter = ('group',) + search_fields = ('label', 'slug', 'tag', 'key',) + prepopulated_fields = {'slug': ('label',)} + filter_horizontal = ('group',) + list_editable = ('position',) + +admin.site.register(models.Button, ButtonAdmin) + diff --git a/apps/toolbar/models.py b/apps/toolbar/models.py new file mode 100644 index 00000000..8e2387dc --- /dev/null +++ b/apps/toolbar/models.py @@ -0,0 +1,33 @@ +from django.db import models +from django.utils.translation import ugettext_lazy as _ + + +class ButtonGroup(models.Model): + name = models.CharField(max_length=32) + slug = models.SlugField() + position = models.IntegerField(default=0) + + class Meta: + ordering = ('position', 'name',) + verbose_name, verbose_name_plural = _('button group'), _('button groups') + + def __unicode__(self): + return self.name + + +class Button(models.Model): + label = models.CharField(max_length=32) + slug = models.SlugField() + tag = models.CharField(max_length=128) + key = models.IntegerField(blank=True, null=True) + position = models.IntegerField(default=0) + + group = models.ManyToManyField(ButtonGroup) + + class Meta: + ordering = ('position', 'label',) + verbose_name, verbose_name_plural = _('button'), _('buttons') + + def __unicode__(self): + return self.label + diff --git a/apps/toolbar/templates/toolbar/toolbar.html b/apps/toolbar/templates/toolbar/toolbar.html new file mode 100644 index 00000000..2e612885 --- /dev/null +++ b/apps/toolbar/templates/toolbar/toolbar.html @@ -0,0 +1,18 @@ +
+
    + {% for group in groups %} +
  1. {{ group.name }}
  2. + {% endfor %} +
+
 
+
+ {% for group in groups %} + + {% endfor %} +
 
+
+
\ No newline at end of file diff --git a/apps/toolbar/templatetags/__init__.py b/apps/toolbar/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/toolbar/templatetags/toolbar_tags.py b/apps/toolbar/templatetags/toolbar_tags.py new file mode 100644 index 00000000..69b5b380 --- /dev/null +++ b/apps/toolbar/templatetags/toolbar_tags.py @@ -0,0 +1,13 @@ +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} + diff --git a/project/settings.py b/project/settings.py index aad5a882..c5b0c2db 100644 --- a/project/settings.py +++ b/project/settings.py @@ -101,11 +101,12 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.admindocs', - 'explorer' + 'explorer', + 'toolbar', ) REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' -IMAGE_DIR = '/Users/zuber/Projekty/platforma/files/images' +IMAGE_DIR = 'images' try: from localsettings import * diff --git a/project/static/css/master.css b/project/static/css/master.css index f699cd6d..03bcd210 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -1,6 +1,6 @@ body { margin: 0; - font: 100%/1.5 Georgia, Verdana, sans-serif; + font: 14px Helvetica, Verdana, sans-serif; overflow: hidden; } @@ -127,3 +127,61 @@ p { .image-box { border-top: 1px solid #DDD; } + +#toolbar, #toolbar ol { + display: block; + margin: 0; + padding: 0; + background-color: #CCC; + border-bottom: 1px solid #AAA; +} + +#toolbar { + overflow: hidden; + width: 400%; +} + +#toolbar-tabs li { + font-size: 14px; + display: block; + float: left; + margin: 4px 4px 0 0; + padding: 2px 10px 0 10px; + border-left: 1px solid #EEE; + border-right: 1px solid #AAA; + margin-bottom: -1px; + border: 1px solid #AAA; + border-radius-topleft: 8px; + border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + -moz-border-radius-topright: 8px; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} + +#toolbar-tabs li:hover, #toolbar-tabs li.active { + cursor: default; + background-color: #EEE; + border-bottom: 1px solid #EEE; +} + +#toolbar-buttons { + background-color: #EEE; +} + +#toolbar-buttons li { + display: block; + font-size: 12px; + padding: 1px 8px; + margin: 4px; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 8px; + float: left; +} + +#toolbar-buttons li:hover { + background-color: #777; + color: #FFF; + cursor: default; +} diff --git a/project/templates/base.html b/project/templates/base.html index 7ddfc180..6e9c389f 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -1,6 +1,6 @@ - + {% block title %}Platforma Redakcyjna{% endblock %} diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index c23ad41f..1f074fc0 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load toolbar_tags %} {% block extrahead %} @@ -8,7 +9,7 @@