Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make thumbnails #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Config(object):

DATABASE_CONNECT_OPTIONS = {}

#Ratio for image_editor, can be : 1.7777777777777777, 1.3333333333333333, 0.6666666666666666, 1
IMAGE_EDITOR_RATIO = 1.3333333333333333

# Enable protection against *Cross-site Request Forgery (CSRF)*
CSRF_ENABLED = True

Expand All @@ -66,6 +69,7 @@ class ProductionDevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = \
database_uri(host, username, password, db_name)


# Use a secure, unique and absolutely secret key for
# signing the data.
CSRF_SESSION_KEY = os.getenv('PRODUCTION_SERVER_CSRF_SESSION_KEY', None)
Expand Down
6 changes: 4 additions & 2 deletions profapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import profapp.controllers.views_auth as views_auth
import profapp.controllers.views_filemanager as views_fileman
import profapp.controllers.views_index as views_ind
import profapp.controllers.views_image_editor as views_imged
from authomatic.providers import oauth2
from authomatic import Authomatic
from profapp.models.users import User
Expand Down Expand Up @@ -42,9 +43,10 @@ def create_app(config='config.ProductionDevelopmentConfig'):
app.register_blueprint(views_ind.general_bp, url_prefix='/')
app.register_blueprint(views_art.article_bp, url_prefix='/articles')
app.register_blueprint(views_auth.user_bp, url_prefix='/users')
app.register_blueprint(views_fileman.filemanager_bp,
url_prefix='/filemanager')
app.register_blueprint(views_fileman.filemanager_bp, url_prefix='/filemanager')
app.register_blueprint(views_fileman.static_bp, url_prefix='/static')
app.register_blueprint(views_imged.image_editor_bp, url_prefix='/image_editor')


# see: http://flask.pocoo.org/docs/0.10/patterns/sqlalchemy/
# Flask will automatically remove database sessions at the end of the request
Expand Down
2 changes: 1 addition & 1 deletion profapp/controllers/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
article_bp = Blueprint('articles', __name__)
filemanager_bp = Blueprint('filemanager', __name__)
static_bp = Blueprint('static', __name__, static_url_path='')
# static_bp = Blueprint('static', __name__)
image_editor_bp = Blueprint('image_editor', __name__)
10 changes: 4 additions & 6 deletions profapp/controllers/views_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from profapp.models.company import Company
from db_init import db_session
from .blueprints import article_bp
#import os


@article_bp.route('/article/', methods=['GET', 'POST'])
Expand All @@ -16,8 +15,7 @@ def article(page=1):
posts = ArticleHistory.query.filter(ArticleHistory.id == page)

if form.validate_on_submit():
article_history=ArticleHistory(form.name.data,form.article.data, 0,
User.query.first().id)
article_history = ArticleHistory(form.name.data, form.article.data, 0, User.query.first().id)
db_session.add(article_history)
db_session.commit()

Expand All @@ -29,10 +27,10 @@ def article(page=1):
db_session.add(article)
db_session.commit()
return redirect(url_for('article', page=article_history.id))
elif request.method!='POST':
elif request.method != 'POST':

for post in posts:
form.name.data=post.name
form.article.data=post.article_text
form.name.data = post.name
form.article.data = post.article_text

return render_template('article.html', form=form, posts=posts)
16 changes: 16 additions & 0 deletions profapp/controllers/views_image_editor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from .blueprints import image_editor_bp
from flask import render_template, request
from config import Config

@image_editor_bp.route('/')
def image_editor():

ratio = Config.IMAGE_EDITOR_RATIO
return render_template('image_editor.html',
ratio=ratio
)

@image_editor_bp.route('/editor', methods=['GET', 'POST'])
def editor():

return render_template('image_editor.html')
2 changes: 1 addition & 1 deletion profapp/static/filemanager/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
app.directive('angularFileManager', ['$parse', function($parse) {
return {
restrict: 'EA',
templateUrl: 'assets/templates/index.html'
templateUrl: 'assets/templates/image_editor.html'
};
}]);

Expand Down
2 changes: 1 addition & 1 deletion profapp/static/filemanager/dist/angular-filemanager.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion profapp/static/filemanager/dist/cached-templates.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions profapp/static/image_editor/assets/css/bootstrap.min.css

Large diffs are not rendered by default.

Loading