ui improvements

main
lza_menace 3 years ago
parent 2d04fb74c0
commit e878627cc6

@ -6,7 +6,7 @@ bp = Blueprint('filters', 'filters')
@bp.app_template_filter('shorten_address')
def shorten_address(a):
_p = a[0:4]
_p = a[0:6]
_s = a[-4:]
return f'{_p}...{_s}'

@ -28,9 +28,9 @@ def upload_to_ipfs(meme_id: str):
'name': meme.title,
'description': meme.description,
'image': f'ipfs://{artwork_hash}',
'by': meme.creator_handle,
'by': meme.user.handle,
'properties': {
'creator': meme.creator_handle
'creator': meme.user.handle
}
}
meta_hash = client.add_json(meta)

@ -35,6 +35,7 @@ class User(db.Model):
profile_image = db.Column(db.String(300), nullable=True)
website_url = db.Column(db.String(120), nullable=True)
moderator = db.relationship('Moderator', back_populates='user')
memes = db.relationship('Meme', back_populates='user')
def __repr__(self):
return str(self.handle)
@ -96,6 +97,8 @@ class Meme(db.Model):
title = db.Column(db.String(50))
description = db.Column(db.String(400), nullable=True)
minted = db.Column(db.Boolean, default=False)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
user = db.relationship('User', back_populates='memes')
def __repr__(self):
return str(f'meme-{self.id}')

@ -38,7 +38,7 @@ def mod():
memes = Meme.query.filter(
Meme.meta_ipfs_hash == None
).order_by(Meme.create_date.asc())
return render_template('mod.html', memes=memes)
return render_template('index.html', memes=memes)
@bp.route('/publish', methods=['GET', 'POST'])
def publish():
@ -62,7 +62,6 @@ def publish():
return '<script>window.history.back()</script>'
title = request.form.get('title')
description = request.form.get('description')
creator = request.form.get('creator')
file = request.files["file"]
filename = "{}{}".format(
token_urlsafe(24),
@ -75,7 +74,7 @@ def publish():
file_name=filename,
title=title,
description=description,
creator_handle=creator
user_id=current_user.id
)
db.session.add(meme)
db.session.commit()

@ -0,0 +1,38 @@
{# expects meme var #}
<div class="card">
<div class="card-image">
<figure class="image">
<a href="{{ url_for('meme.show', meme_id=meme.id) }}" up-preload up-follow=".container">
{% if meme.file_name.endswith('mp4') %}
<video class="img-fluid" {% if not request.MOBILE %}autoplay{% else %}controls{% endif %} muted loop>
<source src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% else %}
<img alt="{{ meme.title }}" src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" width="200px" class="img-fluid" style="" />
{% endif %}
</a>
</figure>
</div>
<div class="card-content">
<div class="media">
<div class="media-left">
{% if meme.user.profile_image %}
<figure class="image is-48x48">
<img src="{{ url_for('meta.uploaded_file', filename=meme.user.profile_image) }}" alt="{{ meme.user.handle }} pfp">
</figure>
{% endif %}
</div>
<div class="media-content">
<p class="title is-4">{{ meme.user.handle }}</p>
<p class="subtitle is-6">{{ meme.user.public_address | shorten_address }}</p>
</div>
</div>
<div class="content">
{{ meme.description }}
<br>
<time datetime="2016-1-1">{{ meme.create_date.strftime('%H:%M UTC - %d %b %Y') }}</time>
</div>
</div>
</div>

@ -18,6 +18,6 @@
<a class="button is-primary" id="metamaskConnect" onclick="onboardMetaMask();">Connect</a>
{% endif %}
{% else %}
<a class="button" href="{{ url_for('meme.index') }}" up-target=".container">Go Home</a>
<a class="button" href="{{ url_for('meme.index') }}" up-preload up-follow=".container">Go Home</a>
{% endif %}
</div>

@ -19,44 +19,8 @@
{% if memes %}
{% for _meme in memes | batch(4) %}
<div class="columns">
{% for meme in _meme %}
<div class="card">
<div class="card-image">
<figure class="image">
<a href="{{ url_for('meme.show', meme_id=meme.id) }}" up-preload up-follow=".container">
{% if meme.file_name.endswith('mp4') %}
<video class="img-fluid" {% if not request.MOBILE %}autoplay{% else %}controls{% endif %} muted loop>
<source src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% else %}
<img alt="{{ meme.title }}" src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" width="200px" class="img-fluid" style="" />
{% endif %}
</a>
</figure>
</div>
<div class="card-content">
<div class="media">
<div class="media-left">
<!-- <figure class="image is-48x48">
<img src="https://bulma.io/images/placeholders/96x96.png" alt="Placeholder image">
</figure> -->
</div>
<div class="media-content">
<p class="title is-4">John Smith</p>
<p class="subtitle is-6">@johnsmith</p>
</div>
</div>
<div class="content">
{{ meme.description }}
<br>
<time datetime="2016-1-1">{{ meme.create_date.strftime('%H:%M UTC - %d %b %Y') }}</time>
</div>
</div>
</div>
{% include 'includes/meme_card.html' %}
{% endfor %}
</div>
{% endfor %}

@ -30,7 +30,7 @@
</br>
<p>Title: <strong>{{ meme.title }}</strong></p>
<p>Description: <strong>{{ meme.description }}</strong></p>
<p>Creator handle: <a href="{{ url_for('user.show', handle=meme.creator_handle) }}" up-follow=".container">{{ meme.creator_handle }}</a></p>
<p>Poster Address: <a href="{{ url_for('user.show', handle=meme.user.handle) }}" up-follow=".container">{{ meme.user.handle }}</a></p>
{% if meme.meta_ipfs_hash %}
<p>Meta IPFS: <a href="{{ meta_url }}" target=_self up-preload up-follow=".container">{{ meme.meta_ipfs_hash }}</a></p>
{% endif %}

@ -1,59 +0,0 @@
<!DOCTYPE html>
<html>
{% include 'includes/head.html' %}
<body>
<section class="section">
<div class="container">
{% include 'includes/navbar.html' %}
{% if memes %}
{% for _meme in memes | batch(4) %}
<div class="columns">
{% for meme in _meme %}
<div class="card">
<div class="card-image">
<figure class="image">
<a href="{{ url_for('meme.show', meme_id=meme.id) }}" up-preload up-follow=".container">
{% if meme.file_name.endswith('mp4') %}
<video class="img-fluid" {% if not request.MOBILE %}autoplay{% else %}controls{% endif %} muted loop>
<source src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% else %}
<img alt="{{ meme.title }}" src="{{ url_for('meta.uploaded_file', filename=meme.file_name) }}" width="200px" class="img-fluid" style="" />
{% endif %}
</a>
</figure>
</div>
<div class="card-content">
<div class="media">
<div class="media-left">
<!-- <figure class="image is-48x48">
<img src="https://bulma.io/images/placeholders/96x96.png" alt="Placeholder image">
</figure> -->
</div>
<div class="media-content">
<p class="title is-4">John Smith</p>
<p class="subtitle is-6">@johnsmith</p>
</div>
</div>
<div class="content">
{{ meme.description }}
<br>
<time datetime="2016-1-1">{{ meme.create_date.strftime('%H:%M UTC - %d %b %Y') }}</time>
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
</div>
</section>
{% include 'includes/footer.html' %}
</body>
</html>

@ -11,14 +11,16 @@
<div id="screen">
<div class="screen">
<p><strong>From Avax Chain</strong></p>
<p>Handle: <input type="text" placeholder="{{ user.handle }}" value="{{ user.handle }}"></input>
<p>Handle: ?</p>
<img src="{{ user.get_profile_image() }}" id="profileImage" />
</br></br>
<p><strong>From Local Database</strong></p>
<p>Handle: <input type="text" placeholder="{{ user.handle }}" value="{{ user.handle }}"></input></p>
<p>Register Date: <strong>{{ user.register_date }}</strong></p>
<p>Login Date: <strong>{{ user.last_login_date }}</strong></p>
<p>Moderator: <strong>{{ user.is_moderator() }}</strong></p>
<p>Verified: <strong>{{ user.verified }}</strong></p>
<p>Memes Posted: <strong>{{ user.memes | length }}</strong></p>
{% if user.bio %}
<p>Bio: {{ user.bio }}</p>
{% endif %}

@ -28,9 +28,9 @@
</div>
<div class="field">
<label class="label">Creator</label>
<label class="label">Poster Address</label>
<div class="control">
<input class="input" type="text" placeholder="Your handle" name="creator">
<p>{{ current_user.public_address }}</p>
</div>
</div>

Loading…
Cancel
Save