UI / submission improvements

master
Laurent Morvillier 6 years ago
parent 2895a94ae7
commit 1a6d822a08
  1. 6
      news/choices.py
  2. 8
      news/forms.py
  3. 40
      news/static/news/css/app.css
  4. 2
      news/templates/news/index.html
  5. 8
      news/views.py

@ -1,5 +1,5 @@
STYLE_CHOICES = (
(0, "Standard"),
(1, "Quote"),
(2, "Image Only")
(0, "Standard [Title + URL + Image]"),
(1, "Quote [Title]"),
(2, "Image Only [Image]")
)

@ -11,17 +11,15 @@ class PostForm(forms.Form):
style = forms.ChoiceField(label='Style',choices=STYLE_CHOICES, required=True)
title = forms.CharField(label='Title', max_length=200, required=False)
body = forms.CharField(label='Optional text', max_length=10000, required=False)
url = forms.CharField(label='URL', max_length=200, required=False)
# date = forms.DateTimeField('date published')
# state = forms.IntegerField(label='State', default=1)
body = forms.CharField(label='Optional body', max_length=10000, required=False)
today = datetime.today() # + datetime.timedelta(days=1)
today_formatted = today.strftime("%Y-%m-%d %H:%M:%S")
image = forms.FileField(required=False)
pub_date = forms.DateTimeField(label='Optional publication date, example: ' + today_formatted, required=False)
image = forms.FileField()
class SigninForm(forms.Form):
username = forms.CharField(label='Enter Username', min_length=4, max_length=150)

@ -152,18 +152,6 @@ a h1 {
}
}
.inside_image_top {
position: absolute;
top: 12px;
left: 12px;
}
.inside_image_bottom {
position: absolute;
bottom: 12px;
left: 12px;
}
.details {
font-size: 14px;
color: #999;
@ -197,12 +185,34 @@ a h1 {
}
@media print, screen and (min-width: 40em) {
.imgcontainer {
width: 500px;
width: 600px;
border-bottom: 10px solid #111;
border-top: 10px solid #111;
}
}
.imgcontainer h1 {
padding: 0px 8px;
line-height: 120%;
}
.imgcontainer h1 span {
background-color: #111111;
}
.inside_image_top {
position: absolute;
top: 0px;
left: 12px;
right: 12px;
}
.inside_image_bottom {
position: absolute;
bottom: 12px;
left: 12px;
}
.post {
padding: 10px 0px;
margin-bottom: 10px;
@ -293,7 +303,7 @@ input[type=email] {
input[type=file] {
font-size: 14px;
padding:10px 15px;
background:#e8e8e8;
background:#555;
border:0 none;
cursor:pointer;
-webkit-border-radius: 8px;
@ -303,7 +313,7 @@ input[type=file] {
input[type=file]:hover {
font-size: 14px;
padding:10px 15px;
background:#fcf;
background:#777;
border:0 none;
cursor:pointer;
-webkit-border-radius: 8px;

@ -30,7 +30,7 @@
<img src="{% static 'media/' %}{{ post.image_url }}"/>
<div class="inside_image_top">
{% if post.url %}<a href="{{ post.url }}">{% endif %}
<h1>{{ post.title }}</h1>
<h1><span>{{ post.title }}</span></h1>
{% if post.url %}</a>{% endif %}
{% if post.body %}

@ -106,10 +106,12 @@ def submission(request):
post.url = form.cleaned_data['url']
post.style = form.cleaned_data['style']
filename = str(uuid.uuid4())
handle_uploaded_file(filename, request.FILES['image'])
file = request.FILES.get('image', None)
if file is not None:
filename = str(uuid.uuid4())
handle_uploaded_file(filename, file)
post.image_url = filename
post.image_url = filename
if request.user.is_staff:
post.state = PostState.PUBLISHED.value
pub_date = form.cleaned_data['pub_date']

Loading…
Cancel
Save