CSS fixes and tags autocomplete
This commit is contained in:
parent
c11141e74b
commit
63d7496f98
5 changed files with 71 additions and 24 deletions
|
@ -6,6 +6,7 @@ from cms.plugin_base import CMSPluginBase
|
||||||
from cms.plugin_pool import plugin_pool
|
from cms.plugin_pool import plugin_pool
|
||||||
|
|
||||||
from .models import AuthorEntriesPlugin, LatestPostsPlugin, Post
|
from .models import AuthorEntriesPlugin, LatestPostsPlugin, Post
|
||||||
|
from .forms import LatestEntriesForm
|
||||||
|
|
||||||
|
|
||||||
class BlogPlugin(CMSPluginBase):
|
class BlogPlugin(CMSPluginBase):
|
||||||
|
@ -18,6 +19,8 @@ class LatestEntriesPlugin(BlogPlugin):
|
||||||
render_template = 'djangocms_blog/plugins/latest_entries.html'
|
render_template = 'djangocms_blog/plugins/latest_entries.html'
|
||||||
name = _('Latest Blog Entries')
|
name = _('Latest Blog Entries')
|
||||||
model = LatestPostsPlugin
|
model = LatestPostsPlugin
|
||||||
|
form = LatestEntriesForm
|
||||||
|
filter_horizontal = ('categories',)
|
||||||
|
|
||||||
def render(self, context, instance, placeholder):
|
def render(self, context, instance, placeholder):
|
||||||
context['instance'] = instance
|
context['instance'] = instance
|
||||||
|
|
19
djangocms_blog/forms.py
Normal file
19
djangocms_blog/forms.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from django import forms
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
import django_select2
|
||||||
|
|
||||||
|
|
||||||
|
class LatestEntriesForm(forms.ModelForm):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
|
||||||
|
widgets = {
|
||||||
|
'tags': django_select2.Select2MultipleWidget
|
||||||
|
}
|
||||||
|
|
||||||
|
class Media:
|
||||||
|
css = {
|
||||||
|
'all': ('%s/css/%s' % (settings.STATIC_URL, "djangocms_blog_admin.css"),)
|
||||||
|
}
|
|
@ -119,6 +119,7 @@ class LatestPostsPlugin(CMSPlugin):
|
||||||
|
|
||||||
latest_posts = models.IntegerField(default=5, help_text=_('The number of latests posts to be displayed.'))
|
latest_posts = models.IntegerField(default=5, help_text=_('The number of latests posts to be displayed.'))
|
||||||
tags = models.ManyToManyField('taggit.Tag', blank=True, help_text=_('Show only the blog posts tagged with chosen tags.'))
|
tags = models.ManyToManyField('taggit.Tag', blank=True, help_text=_('Show only the blog posts tagged with chosen tags.'))
|
||||||
|
categories = models.ManyToManyField('BlogCategory', blank=True, help_text=_('Show only the blog posts tagged with chosen tags.'))
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s latest post by tag" % self.latest_posts
|
return u"%s latest post by tag" % self.latest_posts
|
||||||
|
|
46
djangocms_blog/static/css/djangocms_blog_admin.css
Normal file
46
djangocms_blog/static/css/djangocms_blog_admin.css
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
.select2-container-multi .select2-choices .select2-search-field input {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selector select[multiple] {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selector {
|
||||||
|
width: auto;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selector-available, .selector-chosen {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selector .selector-available input, .selector .selector-chosen input {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
form select {
|
||||||
|
max-width: 266px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.as-selections.vTextField {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.as-results ul.as-list {
|
||||||
|
margin-left:9em;
|
||||||
|
padding-left:0;
|
||||||
|
box-shadow: none !important;
|
||||||
|
border: 1px solid #888888 !important;
|
||||||
|
}
|
||||||
|
.as-results ul.as-list li {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
ul.as-selections.vTextField {
|
||||||
|
padding-left: 10px;
|
||||||
|
margin-left:9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.as-selections li {
|
||||||
|
list-style: none;
|
||||||
|
}
|
|
@ -1,29 +1,7 @@
|
||||||
{% extends "admin/hvad/change_form.html" %}
|
{% extends "admin/hvad/change_form.html" %}
|
||||||
{% load i18n admin_modify %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<style type="text/css">
|
<link href="{% static 'css/djangocms_blog_admin.css' %}" media="screen, projection" rel="stylesheet" type="text/css">
|
||||||
.as-selections.vTextField {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.as-results ul.as-list {
|
|
||||||
margin-left:9em;
|
|
||||||
padding-left:0;
|
|
||||||
box-shadow: none !important;
|
|
||||||
border: 1px solid #888888 !important;
|
|
||||||
}
|
|
||||||
.as-results ul.as-list li {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
ul.as-selections.vTextField {
|
|
||||||
padding-left: 10px;
|
|
||||||
margin-left:9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.as-selections li {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Add table
Reference in a new issue