diff --git a/main/__pycache__/forms.cpython-37.pyc b/main/__pycache__/forms.cpython-37.pyc index 8cdffe9..cabeb15 100644 Binary files a/main/__pycache__/forms.cpython-37.pyc and b/main/__pycache__/forms.cpython-37.pyc differ diff --git a/main/__pycache__/models.cpython-37.pyc b/main/__pycache__/models.cpython-37.pyc index 0645ae6..2f9d1c0 100644 Binary files a/main/__pycache__/models.cpython-37.pyc and b/main/__pycache__/models.cpython-37.pyc differ diff --git a/main/__pycache__/routes.cpython-37.pyc b/main/__pycache__/routes.cpython-37.pyc index d384e3f..a0ceb3c 100644 Binary files a/main/__pycache__/routes.cpython-37.pyc and b/main/__pycache__/routes.cpython-37.pyc differ diff --git a/main/forms.py b/main/forms.py index 5e89155..634b58b 100644 --- a/main/forms.py +++ b/main/forms.py @@ -87,7 +87,8 @@ class NewPostForm(FlaskForm): title = StringField('Title', validators=[DataRequired(), Length(3)]) content = TextAreaField('Content', validators=[DataRequired(), Length(3)]) - thumbnail = StringField('Thumbnail(Image URL)', validators=[DataRequired(), Length(3)]) + thumbnail = StringField('Thumbnail Optional (Image URL)', render_kw={ + "placeholder": "For eg. https://picsum.photos/536/354"}) submit = SubmitField('Post') diff --git a/main/models.py b/main/models.py index 8a3c9d6..e4bac57 100644 --- a/main/models.py +++ b/main/models.py @@ -99,11 +99,7 @@ class Post(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) - thumbnail = db.Column( - db.String(1000), - nullable=False, - default="https://designshack.net/wp-content/uploads/placeholder-image.png" - ) + thumbnail = db.Column(db.String(500), nullable=True) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) content = db.Column(db.Text, nullable=False) diff --git a/main/static/main.css b/main/static/main.css index dedea35..09730d7 100644 --- a/main/static/main.css +++ b/main/static/main.css @@ -226,6 +226,16 @@ body { } +/* Class to add elipsis to text */ +.elipsis { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 11; + -webkit-box-orient: vertical; +} + + /* Bounce Animation */ @keyframes bounce{ from { transform: translate3d(0, 0, 0);} diff --git a/main/templates/new-post.html b/main/templates/new-post.html index 1a6fed7..61db299 100644 --- a/main/templates/new-post.html +++ b/main/templates/new-post.html @@ -15,7 +15,7 @@
-
+
{{ form.title.label(class="form-control-label") }} @@ -33,7 +33,7 @@
-
+
{{ form.thumbnail.label(class="form-control-label") }} diff --git a/main/templates/post-detail.html b/main/templates/post-detail.html index 334dcfd..e0cce50 100644 --- a/main/templates/post-detail.html +++ b/main/templates/post-detail.html @@ -27,10 +27,20 @@

{{ post.title }}

- Posted By- {{ post.author.username }} + + +
-

{{ post.content|markdown }}

{{ post.date_posted.replace(microsecond = 0) }} + +
+ +

{{ post.content|markdown }}

diff --git a/main/templates/post-update.html b/main/templates/post-update.html index 3b6fd48..120a215 100644 --- a/main/templates/post-update.html +++ b/main/templates/post-update.html @@ -15,7 +15,7 @@
-
+
{{ form.title.label(class="form-control-label") }} @@ -33,7 +33,7 @@
-