Skip to content
Permalink
Browse files

Social things, all the articles, and stuff like that

  • Loading branch information...
Depado committed May 11, 2015
1 parent b5c1b68 commit 60267d862c2b5ea93cfde48f1f5dc848f72371b8
@@ -89,4 +89,23 @@ class SettingForm(CustomForm):
'help': "Which them would you like to apply to your syntax highlighted code ?"
}
)

linkedin_url = StringField(
'LinkedIn Profile URL',
validators=[Optional(), URL(), Length(min=5, max=200)],
description={'placeholder': "LinkedIn Profile URL"}
)
gplus_url = StringField(
'Google Plus Profile URL',
validators=[Optional(), URL(), Length(min=5, max=200)],
description={'placeholder': "Google Plus Profile URL"}
)
github_url = StringField(
'GitHub Profile URL',
validators=[Optional(), URL(), Length(min=5, max=200)],
description={'placeholder': "GitHub Profile URL"}
)
twitter_url = StringField(
'Twitter Profile URL',
validators=[Optional(), URL(), Length(min=5, max=200)],
description={'placeholder': "Twitter Profile URL"}
)
@@ -53,6 +53,10 @@ class User(db.Model):
active = db.Column(db.Boolean())
register_date = db.Column(db.DateTime())
last_login = db.Column(db.DateTime())
linkedin_url = db.Column(db.String(200), default="")
gplus_url = db.Column(db.String(200), default="")
github_url = db.Column(db.String(200), default="")
twitter_url = db.Column(db.String(200), default="")

# Blog Related Informations
blog_slug = db.Column(db.String(50), unique=True)

Large diffs are not rendered by default.

@@ -0,0 +1,69 @@
.my-fa-facebook:before {
content: "\f09a";
}
.my-fa-facebook-square:before {
content: "\f082";
}
.my-fa-flickr:before {
content: "\f16e";
}
.my-fa-google-plus-square:before {
content: "\f0d4";
}
.my-fa-google-plus:before {
content: "\f0d5";
}
.my-fa-google:before {
content: "\f1a0";
}
.my-fa-instagram:before {
content: "\f16d";
}
.my-fa-linkedin:before {
content: "\f0e1";
}
.my-fa-linkedin-square:before {
content: "\f08c";
}
.my-fa-pinterest:before {
content: "\f0d2";
}
.my-fa-pinterest-square:before {
content: "\f0d3";
}
.my-fa-reddit:before {
content: "\f1a1";
}
.my-fa-reddit-square:before {
content: "\f1a2";
}
.my-fa-share-square-o:before {
content: "\f045";
}
.my-fa-share-alt:before {
content: "\f1e0";
}
.my-fa-soundcloud:before {
content: "\f1be";
}
.my-fa-tumblr:before {
content: "\f173";
}
.my-fa-tumblr-square:before {
content: "\f174";
}
.my-fa-twitter-square:before {
content: "\f081";
}
.my-fa-twitter:before {
content: "\f099";
}
.my-fa-youtube-square:before {
content: "\f166";
}
.my-fa-youtube:before {
content: "\f167";
}
.my-fa-youtube-play:before {
content: "\f16a";
}
Binary file not shown.
@@ -9,7 +9,7 @@
<meta name="keywords" content="markdown, blog, blogging, platform, plateforme, markdownblog, technical, code, codin, syntax, highlight">

<!-- Favicon Stuff (404 For now) -->
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.gif') }}">

<!-- CSS Files -->
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
@@ -21,7 +21,9 @@
{% if syntax_highlighter_css %}
<link href="{{ syntax_highlighter_css | safe }}" rel="stylesheet">
{% endif %}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href="{{ url_for('static', filename='css/bootstrap-social.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/fix.css') }}" rel="stylesheet">
{% block extra_css_resources %}{% endblock %}
{% block extra_style %}{% endblock %}
<style type="text/css">
@@ -3,30 +3,36 @@
{% block inner_content %}
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Recently Registered Users</div>
<div class="panel-heading">Recent Articles</div>
<div class="panel-content">
<ul class="nav nav-pills nav-stacked">
{% for latest in latest_users %}
<li>
<a href="{{ url_for('blog.index', user_slug=latest.blog_slug) }}">
{{ latest.username }}{% with count = latest.posts.count() %}<span class="badge pull-right">
{% if count %}{{ count }} Article{% if count > 1 %}s{% endif %}{% else %}No Articles{% endif %}</span>{% endwith %}
</a>
</li>
{% for post in posts %}
<li><a href="{{ url_for('blog.get', user_slug=post.user.blog_slug, post_slug=post.title_slug) }}" data-toggle="tooltip" data-placement="right" data-container="body" title="{{ post.pub_date.strftime('%d-%m-%Y %H:%M') }} by {{ post.user.username | e }}">{{ post.title | e }}</a></li>
{% endfor %}
</ul>
</div>
<div class="panel-footer" style="text-align: center;">
<a class="btn btn-primary" href="{{ url_for('explore_all') }}">See all the blog posts.</a>
</div>
</div>
</div>
<div class="col-md-3">

</div>
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">Recent Articles</div>
<div class="panel-heading">Recently Registered Users</div>
<div class="panel-content">
<ul class="nav nav-pills nav-stacked">
{% for post in latest_posts %}
<li><a href="{{ url_for('blog.get', user_slug=post.user.blog_slug, post_slug=post.title_slug) }}" data-toggle="tooltip" data-placement="right" data-container="body" title="{{ post.pub_date.strftime('%d-%m-%Y %H:%M') }} by {{ post.user.username | e }}">{{ post.title | e }}</a></li>
{% for latest in latest_users %}
<li>
<a href="{{ url_for('blog.index', user_slug=latest.blog_slug) }}">
{{ latest.username }}{% with count = latest.posts.count() %}<span class="badge pull-right">
{% if count %}{{ count }} Article{% if count > 1 %}s{% endif %}{% else %}No Articles{% endif %}</span>{% endwith %}
</a>
</li>
{% endfor %}
</ul>
</div>
@@ -0,0 +1,20 @@
{% extends "blog_base.html" %}

{% block inner_content %}
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">All the Articles</div>
<div class="panel-content">
<ul class="nav nav-pills nav-stacked">
{% for post in posts %}
<li><a href="{{ url_for('blog.get', user_slug=post.user.blog_slug, post_slug=post.title_slug) }}" data-toggle="tooltip" data-placement="right" data-container="body" title="{{ post.pub_date.strftime('%d-%m-%Y %H:%M') }} by {{ post.user.username | e }}">{{ post.title | e }}</a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -83,15 +83,24 @@
{% if user.blog_image %}
<img src="{{ user.blog_image }}" alt="avatar"
class="{% if user.blog_image_rounded %}img-circle{% endif %} img-responsive">
{% else %}
No Picture
{% endif %}
</div>
<div class="panel-footer">
<h4><a href="{{ url_for('blog.index', user_slug=user.blog_slug) }}">{{ user.blog_title | e }}</a></h4>

<p>{{ user.blog_description | e }}</p>
<a href="{{ url_for('blog.rss_feed', user_slug=user.blog_slug) }}">Rss Feed <i class="fa fa-rss"></i></a><br/>
{% if user.gplus_url %}
<a href="{{ user.gplus_url }}" style="color: #d34836;"><i class="fa my-fa-google-plus-square fa-2x"></i></a>
{% endif %}
{% if user.twitter_url %}
<a href="{{ user.twitter_url }}"><i class="fa my-fa-twitter-square fa-2x"></i></a>
{% endif %}
{% if user.linkedin_url %}
<a href="{{ user.linkedin_url }}"><i class="fa my-fa-linkedin-square fa-2x"></i></a>
{% endif %}
{% if user.github_url %}
<a href="{{ user.github_url }}" style="color: black;"><i class="fa fa-github-square fa-2x"></i></a>
{% endif %}
<a href="{{ url_for('blog.rss_feed', user_slug=user.blog_slug) }}"><i class="fa fa-rss-square fa-2x"></i></a>
{% if owner %}
<a href="{{ url_for('new') }}" class="btn btn-primary btn-block">Write a New Article</a>
{% endif %}
@@ -41,6 +41,12 @@ <h2>Blog Global Settings</h2>
{{ render_field(form.blog_public, toggle=True) }}
{{ render_field(form.blog_truncate_posts, toggle=True) }}
{{ render_field(form.blog_syntax_highlighter_css) }}
<hr>
<h2>Social</h2>
{{ render_field(form.linkedin_url) }}
{{ render_field(form.gplus_url) }}
{{ render_field(form.github_url) }}
{{ render_field(form.twitter_url) }}
<button class="btn btn-lg btn-primary btn-block" name="btn" type="submit" value="{{ form._prefix }}btn">Save</button>
</div>
</div>
@@ -9,9 +9,16 @@

def explore_context():
latest_users = User.query.order_by(desc(User.register_date)).limit(10).all()
latest_posts = Post.query.join(User).filter(User.blog_public).order_by(desc(Post.pub_date)).limit(10).all()
return dict(latest_posts=latest_posts, latest_users=latest_users)
posts = Post.query.join(User).filter(User.blog_public).order_by(desc(Post.pub_date)).limit(10).all()
return dict(posts=posts, latest_users=latest_users)


@app.route("/explore")
def explore():
return render_template("blog_explore.html", **explore_context())


@app.route("/all")
def explore_all():
posts = Post.query.join(User).filter(User.blog_public).order_by(desc(Post.pub_date)).all()
return render_template("blog_explore_all.html", posts=posts)
@@ -81,6 +81,10 @@ def settings():
current_user.blog_public = form.blog_public.data
current_user.blog_truncate_posts = form.blog_truncate_posts.data
current_user.blog_syntax_highlighter_css = form.blog_syntax_highlighter_css.data
current_user.linkedin_url = form.linkedin_url.data
current_user.gplus_url = form.gplus_url.data
current_user.github_url = form.github_url.data
current_user.twitter_url = form.twitter_url.data
saved = current_user.save()
if saved:
flash("Saved your settings...")
@@ -0,0 +1,32 @@
"""adding_more_profile_customization
Revision ID: 50bb91d1615
Revises: 13234475ad5
Create Date: 2015-05-11 21:04:17.237732
"""

# revision identifiers, used by Alembic.
revision = '50bb91d1615'
down_revision = '13234475ad5'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('github_url', sa.String(length=200), nullable=True))
op.add_column('user', sa.Column('gplus_url', sa.String(length=200), nullable=True))
op.add_column('user', sa.Column('linkedin_url', sa.String(length=200), nullable=True))
op.add_column('user', sa.Column('twitter_url', sa.String(length=200), nullable=True))
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'twitter_url')
op.drop_column('user', 'linkedin_url')
op.drop_column('user', 'gplus_url')
op.drop_column('user', 'github_url')
### end Alembic commands ###

0 comments on commit 60267d8

Please sign in to comment.
You can’t perform that action at this time.