##// END OF EJS Templates
Added themes support. Added 'snow white' theme by Mystra_x64.
neko259 -
r35:4962ee48 default
parent child Browse files
Show More
@@ -1,4 +1,5 b''
1 from django import forms
1 from django import forms
2 from neboard import settings
2
3
3
4
4 class PostForm(forms.Form):
5 class PostForm(forms.Form):
@@ -54,4 +55,8 b' class ThreadForm(PostForm):'
54 def clean(self):
55 def clean(self):
55 cleaned_data = super(ThreadForm, self).clean()
56 cleaned_data = super(ThreadForm, self).clean()
56
57
57 return cleaned_data No newline at end of file
58 return cleaned_data
59
60
61 class SettingsForm(forms.Form):
62 theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect) No newline at end of file
@@ -83,4 +83,9 b' html {'
83 margin: 5px;
83 margin: 5px;
84 padding: 10px;
84 padding: 10px;
85 border-radius: 5px;
85 border-radius: 5px;
86 color: #eee;
87 }
88
89 #navigation_panel .link:last-child {
90 float: right;
86 } No newline at end of file
91 }
1 NO CONTENT: file renamed from boards/static/css/login.css to boards/static/css/md/login.css
NO CONTENT: file renamed from boards/static/css/login.css to boards/static/css/md/login.css
@@ -1,45 +1,101 b''
1 * {
2 font-size: inherit;
3 margin: 0;
4 padding: 0;
5 }
1 html {
6 html {
2 background: #555;
7 background: #fff;
3 color: #ffffff;
8 color: #000;
9 font: medium sans-serif;
10 }
11 a {
12 color: inherit;
13 text-decoration: underline;
4 }
14 }
5
15
6 #admin_panel {
16 #admin_panel {
7 background: #FF0000;
17 background: #182F6F;
8 color: #00FF00
18 color: #fff;
19 padding: .5ex 1ex .5ex 1ex;
20 }
21
22 #navigation_panel {
23 background: #182F6F;
24 color: #B4CFEC;
25 margin-bottom: 1em;
26 padding: .5ex 1ex 1ex 1ex;
27 }
28 #navigation_panel::after {
29 clear: both;
30 content: ".";
31 display: block;
32 height: 0;
33 line-height: 0;
34 visibility: hidden;
35 }
36
37 #navigation_panel a:link, #navigation_panel a:visited, #navigation_panel a:hover {
38 text-decoration: none;
39 }
40
41 #navigation_panel .link {
42 border-right: 1px solid #fff;
43 color: #fff;
44 font-weight: bold;
45 margin-right: 1ex;
46 padding-right: 1ex;
47 }
48 #navigation_panel .link:last-child {
49 border-left: 1px solid #fff;
50 border-right: none;
51 float: right;
52 margin-left: 1ex;
53 margin-right: 0;
54 padding-left: 1ex;
55 padding-right: 0;
56 }
57
58 #navigation_panel .tag {
59 color: #fff;
9 }
60 }
10
61
11 .title {
62 .title {
63 color: #182F6F;
12 font-weight: bold;
64 font-weight: bold;
13 color: #ffcc00;
14 }
65 }
15
66
16 .post-form {
67 .post-form {
17 text-align: left;
68 background: #182F6F;
69 border-radius: 1ex;
70 color: #fff;
18 display: table;
71 display: table;
19 border-radius: 5px;
72 margin: 1em 1ex;
20 padding: 5px;
73 padding: 1ex;
21 margin: 5px;
74 text-align: left;
22 background: #334;
23 }
75 }
24
76
25 .form-row {
77 .post-form .form-row {
26 display: table-row;
78 display: table-row;
27 }
79 }
28
80
29 .form-input {
81 .post-form .form-input {
30 display: table-cell;
82 display: table-cell;
83 padding: .25em 0;
84 }
85
86 .post-form input[type="submit"] {
87 padding: .2em 1ex;
31 }
88 }
32
89
33 .link {
90 .post-form .form-row input, .post-form .form-row textarea {
34 color: #afdcec;
91 background: #fff;
92 border: none;
93 color: #000;
94 width: 100%;
35 }
95 }
36
96
37 .link:hover {
97 .post-form hr {
38 color: #fff380;
98 margin: 1em 0;
39 }
40
41 .post_id {
42 color: #ffffff;
43 }
99 }
44
100
45 .block {
101 .block {
@@ -47,23 +103,16 b' html {'
47 vertical-align: top;
103 vertical-align: top;
48 }
104 }
49
105
50 .tag {
51 color: #b4cfec;
52 }
53
54 .tag:hover {
55 color: #d0edb4;
56 }
57
58 .post_id {
106 .post_id {
59 color: #fff380;
107 color: #a00;
60 }
108 }
61
109
62 .post {
110 .post {
63 background: #333;
111 background: #FFF;
64 margin: 5px;
112 border-bottom: 1px solid #182F6F;
65 padding: 10px;
113 margin: 0 1ex 1em 1ex;
66 border-radius: 5px;
114 overflow-x: auto;
115 padding-bottom: 1em;
67 }
116 }
68
117
69 .form-title {
118 .form-title {
@@ -71,16 +120,10 b' html {'
71 }
120 }
72
121
73 .metadata {
122 .metadata {
74 padding: 2px;
123 background: #C0E4E8;
75 margin-top: 10px;
124 border: 1px solid #7F9699;
76 border: solid 1px #666;
125 border-radius: .4ex;
77 font-size: 0.9em;
126 display: table;
78 color: #ddd
127 margin-top: .5em;
79 }
128 padding: .4em;
80
81 #navigation_panel {
82 background: #444;
83 margin: 5px;
84 padding: 10px;
85 border-radius: 5px;
86 } No newline at end of file
129 }
1 NO CONTENT: file copied from boards/static/css/login.css to boards/static/css/sw/login.css
NO CONTENT: file copied from boards/static/css/login.css to boards/static/css/sw/login.css
@@ -12,10 +12,9 b" urlpatterns = patterns('',"
12 url(r'^logout$', views.logout, name='logout'),
12 url(r'^logout$', views.logout, name='logout'),
13
13
14 # /boards/tag/
14 # /boards/tag/
15 url(r'^tag/(?P<tag_name>\w+)/$', views.tag, name = 'tag'),
15 url(r'^tag/(?P<tag_name>\w+)/$', views.tag, name='tag'),
16 # /boards/post_id/
16 # /boards/post_id/
17 url(r'^thread/(?P<post_id>\w+)/$', views.thread, name = 'thread'),
17 url(r'^thread/(?P<post_id>\w+)/$', views.thread, name='thread'),
18 # /boards/tag/post/
18 # /boards/theme/theme_name/
19 url(r'^post.html$', views.new_post,
19 url(r'^settings$', views.settings, name='settings'),
20 name='post'),
21 )
20 )
@@ -1,10 +1,11 b''
1 from django.template import RequestContext
1 from django.template import RequestContext
2 from boards import forms
2 from boards import forms
3 import boards
3 import boards
4 from boards.forms import ThreadForm, PostForm
4 from boards.forms import ThreadForm, PostForm, SettingsForm
5 from boards.models import Post, Admin, Tag
5 from boards.models import Post, Admin, Tag
6 from django.shortcuts import render, get_list_or_404, redirect
6 from django.shortcuts import render, get_list_or_404, redirect
7 from django.http import HttpResponseRedirect, Http404
7 from django.http import HttpResponseRedirect, Http404
8 import neboard
8
9
9
10
10 def index(request):
11 def index(request):
@@ -18,6 +19,7 b' def index(request):'
18 context['threads'] = None if len(threads) == 0 else threads
19 context['threads'] = None if len(threads) == 0 else threads
19 context['form'] = forms.ThreadForm()
20 context['form'] = forms.ThreadForm()
20 context['tags'] = Tag.objects.get_not_empty_tags()
21 context['tags'] = Tag.objects.get_not_empty_tags()
22 context['theme'] = _get_theme(request)
21
23
22 return render(request, 'posting_general.html',
24 return render(request, 'posting_general.html',
23 context)
25 context)
@@ -51,7 +53,7 b' def new_post(request, thread_id=boards.m'
51 tag_strings = data['tags']
53 tag_strings = data['tags']
52
54
53 if tag_strings:
55 if tag_strings:
54 tag_strings = tag_strings.split(',')
56 tag_strings = tag_strings.split(' ')
55 for tag_name in tag_strings:
57 for tag_name in tag_strings:
56 tag_name = tag_name.strip()
58 tag_name = tag_name.strip()
57 if len(tag_name) > 0:
59 if len(tag_name) > 0:
@@ -83,6 +85,7 b' def tag(request, tag_name):'
83 context['threads'] = None if len(threads) == 0 else threads
85 context['threads'] = None if len(threads) == 0 else threads
84 context['tag'] = tag_name
86 context['tag'] = tag_name
85 context['tags'] = Tag.objects.get_not_empty_tags()
87 context['tags'] = Tag.objects.get_not_empty_tags()
88 context['theme'] = _get_theme(request)
86
89
87 context['form'] = forms.ThreadForm(initial={'tags': tag_name})
90 context['form'] = forms.ThreadForm(initial={'tags': tag_name})
88
91
@@ -104,6 +107,7 b' def thread(request, post_id):'
104 context['posts'] = posts
107 context['posts'] = posts
105 context['form'] = forms.PostForm()
108 context['form'] = forms.PostForm()
106 context['tags'] = Tag.objects.get_not_empty_tags()
109 context['tags'] = Tag.objects.get_not_empty_tags()
110 context['theme'] = _get_theme(request)
107
111
108 return render(request, 'thread.html', context)
112 return render(request, 'thread.html', context)
109
113
@@ -133,4 +137,28 b' def login(request):'
133
137
134 def logout(request):
138 def logout(request):
135 request.session['admin'] = False
139 request.session['admin'] = False
136 return HttpResponseRedirect('/') No newline at end of file
140 return HttpResponseRedirect('/')
141
142
143 def settings(request):
144 context = RequestContext(request)
145
146 if request.method == 'POST':
147 form = SettingsForm(request.POST)
148 if form.is_valid():
149 selected_theme = form.cleaned_data['theme']
150 request.session['theme'] = selected_theme
151
152 return redirect(settings)
153 else:
154 selected_theme = _get_theme(request)
155 form = SettingsForm(initial={'theme': selected_theme})
156 context['form'] = form
157 context['tags'] = Tag.objects.get_not_empty_tags()
158 context['theme'] = _get_theme(request)
159
160 return render(request, 'settings.html', context)
161
162
163 def _get_theme(request):
164 return request.session.get('theme', neboard.settings.DEFAULT_THEME) No newline at end of file
@@ -167,4 +167,10 b' LOGGING = {'
167
167
168 # Custom imageboard settings
168 # Custom imageboard settings
169 MAX_POSTS_PER_THREAD = 100
169 MAX_POSTS_PER_THREAD = 100
170 MAX_THREAD_COUNT = 20 No newline at end of file
170 MAX_THREAD_COUNT = 20
171 SITE_NAME = 'Neboard'
172
173 THEMES = [
174 ('md', 'Mystic Dark'),
175 ('sw', 'Snow White') ]
176 DEFAULT_THEME = 'md' No newline at end of file
@@ -5,7 +5,7 b''
5 <html>
5 <html>
6 <head>
6 <head>
7 <link rel="stylesheet" type="text/css"
7 <link rel="stylesheet" type="text/css"
8 href="{% static "css/base_page.css" %}" media="all"/>
8 href="{{ STATIC_URL }}/css/{{ theme }}/base_page.css" media="all"/>
9 {% block head %}{% endblock %}
9 {% block head %}{% endblock %}
10 </head>
10 </head>
11 <body>
11 <body>
@@ -15,7 +15,6 b''
15 Admin panel TODO: Need to implement <BR />
15 Admin panel TODO: Need to implement <BR />
16 {% endif %}
16 {% endif %}
17
17
18
19 </div>
18 </div>
20
19
21 <div id="navigation_panel">
20 <div id="navigation_panel">
@@ -24,6 +23,7 b''
24 <a class="tag" href=" {% url 'tag' tag_name=tag.name %}">
23 <a class="tag" href=" {% url 'tag' tag_name=tag.name %}">
25 {{ tag.name }}</a>({{ tag.get_post_count }})
24 {{ tag.name }}</a>({{ tag.get_post_count }})
26 {% endfor %}
25 {% endfor %}
26 <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a>
27 </div>
27 </div>
28
28
29 {% block content %}{% endblock %}
29 {% block content %}{% endblock %}
@@ -1,7 +1,7 b''
1 <!DOCTYPE html>
1 <!DOCTYPE html>
2 <html>
2 <html>
3 <head>
3 <head>
4 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/login.css" media="all"/>
4 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/md/login.css" media="all"/>
5 <title>Login page</title>
5 <title>Login page</title>
6 </head>
6 </head>
7
7
@@ -3,73 +3,26 b''
3 {% load i18n %}
3 {% load i18n %}
4
4
5 {% block head %}
5 {% block head %}
6 <title>Neboard</title>
6 <title>Neboard settings</title>
7 {% endblock %}
7 {% endblock %}
8
8
9 {% block content %}
9 {% block content %}
10
10
11 {% if threads %}
12 {% for thread in threads %}
13 <div class="post">
14 {% if thread.image %}
15 <div class="block">
16 <a href="{{ thread.image.url }}"><img
17 src="{{ thread.image.url_200x150 }}" />
18 </a>
19 </div>
20 {% endif %}
21 <div class="block">
22 <span class="title">{{ thread.title }}</span>
23 <span class="post_id">(#{{ thread.id }})</span>
24 [{{ thread.pub_time }}]
25 [<a class="link" href="{% url 'thread' thread.id %}"
26 >{% trans "View" %}</a>]<br />
27 {{ thread.get_parsed_text|linebreaksbr|truncatechars:300 }}<br
28 />
29 </div>
30 <div class="metadata">
31 {{ thread.get_reply_count }} {% trans 'replies' %},
32 {{ thread.get_images_count }} {% trans 'images' %},
33 {{ thread.get_gets_count }} {% trans 'gets' %}.
34 {% if thread.tags.all %}
35 <span class="tags">{% trans 'Tags' %}:
36 {% for tag in thread.tags.all %}
37 <a class="tag" href="
38 {% url 'tag' tag_name=tag.name %}">
39 {{ tag.name }}</a>
40 {% endfor %}
41 </span>
42 {% endif %}
43 </div>
44 </div>
45 {% endfor %}
46 {% else %}
47 No threads found.
48 <hr />
49 {% endif %}
50
51 <div class="post-form">
11 <div class="post-form">
52 <span class="form-title">{% trans "Create new thread" %}</span>
12 <span class="form-title">{% trans "Theme" %}</span>
53 <form enctype="multipart/form-data" method="post">{% csrf_token %}
13 <form method="post">{% csrf_token %}
54 <div class="form-row">
14 {% for choice in form.fields.theme.choices %}
55 <div class="form-input">{% trans 'Title' %}</div>
15 <input type="radio" name="theme"
56 <div class="form-input">{{ form.title }}</div>
16 id="{{ choice.0 }}"
57 </div>
17 value="{{ choice.0 }}"
58 <div class="form-row">
18 {% ifequal form.initial.theme choice.0 %}
59 <div class="form-input">{% trans 'Text' %}</div>
19 checked
60 <div class="form-input">{{ form.text }}</div>
20 {% endifequal %}
61 </div>
21 />
62 <div class="form-row">
22 <label for="{{ choice.0 }}">{{ choice.1 }}
63 <div class="form-input">{% trans 'Image' %}</div>
23 </label><br />
64 <div class="form-input">{{ form.image }}</div>
24 {% endfor %}
65 </div>
25 <input type="submit" value="{% trans "Save" %}" />
66 <div class="form-row">
67 <div class="form-input">{% trans 'Tags' %}</div>
68 <div class="form-input">{{ form.tags }}</div>
69 </div>
70 <input type="submit" value="{% trans 'Post' %}" />
71 <hr />
72 {% trans "Tags must be delimited by spaces. Text or image is required." %}
73 </form>
26 </form>
74 </div>
27 </div>
75
28
General Comments 0
You need to be logged in to leave comments. Login now