diff --git a/sarsoo/api/art_api.py b/sarsoo/api/art_api.py index a834cfa..628b438 100644 --- a/sarsoo/api/art_api.py +++ b/sarsoo/api/art_api.py @@ -1,36 +1,36 @@ from flask import Blueprint, jsonify, abort from sarsoo.art import db -from sarsoo.art.art import getAssetUrl +from sarsoo.art.art import get_asset_url art_api_print = Blueprint('artapi', __name__) @art_api_print.route('/', methods=['GET']) -def collections(): +def get_all_collections(): - tagdicts = db.getTagDicts() + tagdicts = db.pull_all_tags() - collections = [] + art_collections = [] - for dict in tagdicts: - collections.append({ - 'name': dict['name'], - 'id': dict['doc_name'], - 'description': dict['description'], - 'index': dict['index'], - 'splash_url': getAssetUrl(dict['splash']['file_name']) + for tag_dict in tagdicts: + art_collections.append({ + 'name': tag_dict['name'], + 'id': tag_dict['doc_name'], + 'description': tag_dict['description'], + 'index': tag_dict['index'], + 'splash_url': get_asset_url(tag_dict['splash']['file_name']) }) - response = {'collections': collections} + response = {'collections': art_collections} return jsonify(response) @art_api_print.route('/', methods=['GET']) -def getcollection(id): +def get_named_collection(art_id): try: - tagdict = db.getPopulatedTagDict(id) + tagdict = db.pull_named_tag(art_id) except TypeError as e: abort(404) @@ -38,7 +38,7 @@ def getcollection(id): for image in tagdict['images']: artlist.append({ - 'file_url': getAssetUrl(image['file_name']), + 'file_url': get_asset_url(image['file_name']), 'date': image['date'].strftime('%d %B %y') }) diff --git a/sarsoo/api/dev_api.py b/sarsoo/api/dev_api.py index 694cea6..45e8a41 100644 --- a/sarsoo/api/dev_api.py +++ b/sarsoo/api/dev_api.py @@ -7,7 +7,7 @@ dev_api_print = Blueprint('devapi', __name__) @dev_api_print.route('/', methods=['GET']) -def collections(): +def get_all_collections(): dev_collection = fs.collection(u'dev') diff --git a/sarsoo/art/art.py b/sarsoo/art/art.py index 0260ddf..1e31770 100644 --- a/sarsoo/art/art.py +++ b/sarsoo/art/art.py @@ -1,6 +1,6 @@ from flask import Blueprint, render_template -from .db import getTagDicts, getPopulatedTagDict, getPopulatedTagDicts +from .db import pull_all_tags, pull_named_tag, get_populated_tags staticbucketurl = 'https://storage.googleapis.com/sarsooxyzstatic/' urlprefix = 'art' @@ -9,23 +9,22 @@ art_print = Blueprint('art', __name__, template_folder='templates') @art_print.route('/') -def root(): - tags = getTagDicts() - #print(tags) - return render_template('art/index.html', tags = tags, staticroot = staticbucketurl, urlprefix = urlprefix) +def view_root(): + tags = pull_all_tags() + return render_template('art/index.html', tags=tags, staticroot=staticbucketurl, urlprefix=urlprefix) @art_print.route('/') -def tag_view(tag): - tags = getPopulatedTagDict(tag) - return render_template('art/all.html', staticroot = staticbucketurl, tags = [tags]) +def view_named_tag(tag): + tags = pull_named_tag(tag) + return render_template('art/all.html', staticroot=staticbucketurl, tags=[tags]) @art_print.route('/all') -def all(): - sections = getPopulatedTagDicts() - return render_template('art/all.html', staticroot = staticbucketurl, tags=sections) +def view_all_tags(): + sections = get_populated_tags() + return render_template('art/all.html', staticroot=staticbucketurl, tags=sections) -def getAssetUrl(name): +def get_asset_url(name): return staticbucketurl + 'art/' + name + '.jpg' diff --git a/sarsoo/art/db.py b/sarsoo/art/db.py index 2163c86..a327fa2 100644 --- a/sarsoo/art/db.py +++ b/sarsoo/art/db.py @@ -6,7 +6,7 @@ staticbucketurl = 'https://storage.googleapis.com/sarsooxyzstatic/' fs = firestore.Client() -def getTagDicts(): +def pull_all_tags(): art_tags_collection = fs.collection(u'art_tags') @@ -23,7 +23,7 @@ def getTagDicts(): return sorted(dicts, key=lambda k: k['index']) -def getPopulatedTagDict(name): +def pull_named_tag(name): name_doc = fs.document(u'art_tags/{}'.format(name)) @@ -38,9 +38,9 @@ def getPopulatedTagDict(name): return tag_dicts -def getPopulatedTagDicts(): +def get_populated_tags(): - tag_dicts = getTagDicts() + tag_dicts = pull_all_tags() for tag in tag_dicts: image_list = [] diff --git a/sarsoo/sarsoo.py b/sarsoo/sarsoo.py index f51f41b..5db3871 100644 --- a/sarsoo/sarsoo.py +++ b/sarsoo/sarsoo.py @@ -33,9 +33,7 @@ def main(): for image in index_dict['art']: art.append(image.get().to_dict()) - print(index_dict['art'][0].get().to_dict()) - - return render_template('index.html', staticroot = staticbucketurl, splash = splashtext, art=art) + return render_template('index.html', staticroot=staticbucketurl, splash=splashtext, art=art) @app.route('/dev') diff --git a/sarsoo/templates/index.html b/sarsoo/templates/index.html index 71a1372..b512880 100644 --- a/sarsoo/templates/index.html +++ b/sarsoo/templates/index.html @@ -13,7 +13,6 @@

electronic engineering student / disney intern

proficient in C, Java, Python

-

{% if splash %}

{{ splash }}

{% endif %}
@@ -27,5 +26,4 @@ {{ image.file_name  }} {% endfor %}
- {% endblock %} diff --git a/src/js/index/App.js b/src/js/index/App.js deleted file mode 100644 index dd24156..0000000 --- a/src/js/index/App.js +++ /dev/null @@ -1,15 +0,0 @@ -import React, { Component } from "react"; - -class App extends Component{ - - render(){ - return( -
-

hello world!!!!!

-
- ); - } - -} - -export default App; \ No newline at end of file diff --git a/src/js/index/index.js b/src/js/index/index.js deleted file mode 100644 index cd857f9..0000000 --- a/src/js/index/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; - -import App from "./App.js"; - -ReactDOM.render(, document.getElementById('root')); \ No newline at end of file diff --git a/webpack.common.js b/webpack.common.js index e57a1e9..1a6b23c 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -3,7 +3,6 @@ const webpack = require('webpack'); module.exports = { entry: { - index: './src/js/index/index.js', dev: './src/js/dev/dev.js' }, module: {