Blog finished:
+ Added RedactorJS to the admin (with jquery 2.0 under libs) + Added custom styling for default images (centred) + Re-sorted less files (shit happens) + Added a js script to load redactor under .redactor-editor classname
This commit is contained in:
parent
ae7843f9c2
commit
a19b8501be
|
@ -57,7 +57,7 @@ REQUIREMENTS = [
|
|||
PREPROCESSORS = {
|
||||
'coffee': {
|
||||
'items': [
|
||||
#('shoes/static/coffee/usc.coffee', 'shoes/static/js/usc.big.js'),
|
||||
('blog/static/coffee/load_redactor.coffee', 'blog/static/js/load_redactor.big.js'),
|
||||
],
|
||||
'params': ''
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ PREPROCESSORS = {
|
|||
},
|
||||
'uglify': {
|
||||
'items': [
|
||||
#('shoes/static/js/usc.big.js', 'shoes/static/js/usc.js'),
|
||||
('blog/static/js/load_redactor.big.js', 'blog/static/js/load_redactor.js'),
|
||||
],
|
||||
'params': '-c warnings=false'
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.db import models
|
|||
from django.contrib import admin
|
||||
import datetime
|
||||
from django.utils.timezone import utc
|
||||
from django import forms
|
||||
|
||||
|
||||
# Create your models here.
|
||||
|
@ -25,10 +26,20 @@ class BlogEntryAdmin(admin.ModelAdmin):
|
|||
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
|
||||
formfield_overrides = {
|
||||
models.TextField: {
|
||||
'widget': forms.Textarea(attrs={'class': 'redactor-editor'})
|
||||
},
|
||||
}
|
||||
|
||||
class Media:
|
||||
css = {
|
||||
"all": ("lib/redactor.css",)
|
||||
}
|
||||
js = ("lib/redactor.js",)
|
||||
js = (
|
||||
"lib/jquery.2.0.0.js",
|
||||
"lib/redactor.8.2.5.js",
|
||||
"js/load_redactor.js",
|
||||
)
|
||||
|
||||
admin.site.register(BlogEntry, BlogEntryAdmin)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
window.onload = ->
|
||||
items = document.querySelectorAll '.redactor-editor'
|
||||
for item in items
|
||||
$(item).redactor()
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,10 +4,10 @@
|
|||
<h1>Blog</h1>
|
||||
{% for item in page.object_list %}
|
||||
<hr />
|
||||
<article>
|
||||
<article class="blog-entry">
|
||||
<h2><a href="/blog/{{ item.date.year }}/{{ item.date.month }}/{{ item.date.day }}/{{ item.slug }}">{{ item.title }}</a></h2>
|
||||
<div><i class="icon-calendar"></i> {{ item.date|dt('%B %e, %Y') }}</div>
|
||||
<p>{{ item.content|nl2br }}</p>
|
||||
<div class="content">{{ item.content|safe }}</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
{% if paginator.num_pages > 1 %}
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
{% block content %}
|
||||
<p><a href="{{ url('blog_list') }}"><i class="icon-arrow-left"></i> Go back</a></p>
|
||||
<article class="blog-entry">
|
||||
<h1>{{ item.title }}</h1>
|
||||
<div><i class="icon-calendar"></i> {{ item.date|dt('%B %e, %Y') }}</div>
|
||||
<p>{{ item.content|nl2br }}</p>
|
||||
<div class="content">
|
||||
{{ item.content|safe }}
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
article.blog-entry {
|
||||
div.content {
|
||||
img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// Margin
|
||||
.margin-none {
|
||||
margin: 0;
|
||||
}
|
|
@ -1,6 +1,2 @@
|
|||
@import "helpers.less";
|
||||
|
||||
// Margin
|
||||
.margin-none {
|
||||
margin: 0;
|
||||
}
|
||||
@import "oocss.less";
|
||||
@import "blog.less";
|
||||
|
|
Loading…
Reference in New Issue