cosmetic refactor, removed index js
This commit is contained in:
parent
ab2e37a2e0
commit
2350b12c4c
@ -1,36 +1,36 @@
|
|||||||
from flask import Blueprint, jsonify, abort
|
from flask import Blueprint, jsonify, abort
|
||||||
from sarsoo.art import db
|
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 = Blueprint('artapi', __name__)
|
||||||
|
|
||||||
|
|
||||||
@art_api_print.route('/', methods=['GET'])
|
@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:
|
for tag_dict in tagdicts:
|
||||||
collections.append({
|
art_collections.append({
|
||||||
'name': dict['name'],
|
'name': tag_dict['name'],
|
||||||
'id': dict['doc_name'],
|
'id': tag_dict['doc_name'],
|
||||||
'description': dict['description'],
|
'description': tag_dict['description'],
|
||||||
'index': dict['index'],
|
'index': tag_dict['index'],
|
||||||
'splash_url': getAssetUrl(dict['splash']['file_name'])
|
'splash_url': get_asset_url(tag_dict['splash']['file_name'])
|
||||||
})
|
})
|
||||||
|
|
||||||
response = {'collections': collections}
|
response = {'collections': art_collections}
|
||||||
|
|
||||||
return jsonify(response)
|
return jsonify(response)
|
||||||
|
|
||||||
|
|
||||||
@art_api_print.route('/<id>', methods=['GET'])
|
@art_api_print.route('/<id>', methods=['GET'])
|
||||||
def getcollection(id):
|
def get_named_collection(art_id):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tagdict = db.getPopulatedTagDict(id)
|
tagdict = db.pull_named_tag(art_id)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def getcollection(id):
|
|||||||
|
|
||||||
for image in tagdict['images']:
|
for image in tagdict['images']:
|
||||||
artlist.append({
|
artlist.append({
|
||||||
'file_url': getAssetUrl(image['file_name']),
|
'file_url': get_asset_url(image['file_name']),
|
||||||
'date': image['date'].strftime('%d %B %y')
|
'date': image['date'].strftime('%d %B %y')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ dev_api_print = Blueprint('devapi', __name__)
|
|||||||
|
|
||||||
|
|
||||||
@dev_api_print.route('/', methods=['GET'])
|
@dev_api_print.route('/', methods=['GET'])
|
||||||
def collections():
|
def get_all_collections():
|
||||||
|
|
||||||
dev_collection = fs.collection(u'dev')
|
dev_collection = fs.collection(u'dev')
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from flask import Blueprint, render_template
|
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/'
|
staticbucketurl = 'https://storage.googleapis.com/sarsooxyzstatic/'
|
||||||
urlprefix = 'art'
|
urlprefix = 'art'
|
||||||
@ -9,23 +9,22 @@ art_print = Blueprint('art', __name__, template_folder='templates')
|
|||||||
|
|
||||||
|
|
||||||
@art_print.route('/')
|
@art_print.route('/')
|
||||||
def root():
|
def view_root():
|
||||||
tags = getTagDicts()
|
tags = pull_all_tags()
|
||||||
#print(tags)
|
return render_template('art/index.html', tags=tags, staticroot=staticbucketurl, urlprefix=urlprefix)
|
||||||
return render_template('art/index.html', tags = tags, staticroot = staticbucketurl, urlprefix = urlprefix)
|
|
||||||
|
|
||||||
|
|
||||||
@art_print.route('/<tag>')
|
@art_print.route('/<tag>')
|
||||||
def tag_view(tag):
|
def view_named_tag(tag):
|
||||||
tags = getPopulatedTagDict(tag)
|
tags = pull_named_tag(tag)
|
||||||
return render_template('art/all.html', staticroot = staticbucketurl, tags = [tags])
|
return render_template('art/all.html', staticroot=staticbucketurl, tags=[tags])
|
||||||
|
|
||||||
|
|
||||||
@art_print.route('/all')
|
@art_print.route('/all')
|
||||||
def all():
|
def view_all_tags():
|
||||||
sections = getPopulatedTagDicts()
|
sections = get_populated_tags()
|
||||||
return render_template('art/all.html', staticroot = staticbucketurl, tags=sections)
|
return render_template('art/all.html', staticroot=staticbucketurl, tags=sections)
|
||||||
|
|
||||||
|
|
||||||
def getAssetUrl(name):
|
def get_asset_url(name):
|
||||||
return staticbucketurl + 'art/' + name + '.jpg'
|
return staticbucketurl + 'art/' + name + '.jpg'
|
||||||
|
@ -6,7 +6,7 @@ staticbucketurl = 'https://storage.googleapis.com/sarsooxyzstatic/'
|
|||||||
fs = firestore.Client()
|
fs = firestore.Client()
|
||||||
|
|
||||||
|
|
||||||
def getTagDicts():
|
def pull_all_tags():
|
||||||
|
|
||||||
art_tags_collection = fs.collection(u'art_tags')
|
art_tags_collection = fs.collection(u'art_tags')
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ def getTagDicts():
|
|||||||
return sorted(dicts, key=lambda k: k['index'])
|
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))
|
name_doc = fs.document(u'art_tags/{}'.format(name))
|
||||||
|
|
||||||
@ -38,9 +38,9 @@ def getPopulatedTagDict(name):
|
|||||||
return tag_dicts
|
return tag_dicts
|
||||||
|
|
||||||
|
|
||||||
def getPopulatedTagDicts():
|
def get_populated_tags():
|
||||||
|
|
||||||
tag_dicts = getTagDicts()
|
tag_dicts = pull_all_tags()
|
||||||
|
|
||||||
for tag in tag_dicts:
|
for tag in tag_dicts:
|
||||||
image_list = []
|
image_list = []
|
||||||
|
@ -33,9 +33,7 @@ def main():
|
|||||||
for image in index_dict['art']:
|
for image in index_dict['art']:
|
||||||
art.append(image.get().to_dict())
|
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')
|
@app.route('/dev')
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<p>electronic engineering student / disney intern</p>
|
<p>electronic engineering student / disney intern</p>
|
||||||
|
|
||||||
<p>proficient in C, Java, Python</p>
|
<p>proficient in C, Java, Python</p>
|
||||||
<p id="root"></p>
|
|
||||||
{% if splash %}<p>{{ splash }}</p>{% endif %}
|
{% if splash %}<p>{{ splash }}</p>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 profile">
|
<div class="col-3 profile">
|
||||||
@ -27,5 +26,4 @@
|
|||||||
<img src="{{ staticroot }}art/{{ image.file_name }}.jpg" alt="{{ image.file_name }}" class="pad-4">
|
<img src="{{ staticroot }}art/{{ image.file_name }}.jpg" alt="{{ image.file_name }}" class="pad-4">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<script src="{{ url_for('static', filename='js/index.bundle.js') }}"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import React, { Component } from "react";
|
|
||||||
|
|
||||||
class App extends Component{
|
|
||||||
|
|
||||||
render(){
|
|
||||||
return(
|
|
||||||
<div className="App">
|
|
||||||
<h1> hello world!!!!! </h1>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
@ -1,6 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
|
|
||||||
import App from "./App.js";
|
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root'));
|
|
@ -3,7 +3,6 @@ const webpack = require('webpack');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
index: './src/js/index/index.js',
|
|
||||||
dev: './src/js/dev/dev.js'
|
dev: './src/js/dev/dev.js'
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
Loading…
Reference in New Issue
Block a user