fdfd
This commit is contained in:
parent
83776a4cab
commit
e22e15c205
2 changed files with 137 additions and 3 deletions
|
@ -23,6 +23,53 @@ defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip()
|
||||||
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip()
|
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip()
|
||||||
cardview = bool(int(environ.get("CARD_VIEW", 1)))
|
cardview = bool(int(environ.get("CARD_VIEW", 1)))
|
||||||
|
|
||||||
|
if site_name == "Drama":
|
||||||
|
AWARDS = {
|
||||||
|
"ban": {
|
||||||
|
"kind": "ban",
|
||||||
|
"title": "One-Day Ban",
|
||||||
|
"description": "Bans the author for a day.",
|
||||||
|
"icon": "fas fa-gavel",
|
||||||
|
"color": "text-danger",
|
||||||
|
"price": 5000
|
||||||
|
},
|
||||||
|
"shit": {
|
||||||
|
"kind": "shit",
|
||||||
|
"title": "Shit",
|
||||||
|
"description": "Makes flies swarm a post.",
|
||||||
|
"icon": "fas fa-poop",
|
||||||
|
"color": "text-black-50",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
|
"stars": {
|
||||||
|
"kind": "stars",
|
||||||
|
"title": "Stars",
|
||||||
|
"description": "Puts stars on the post.",
|
||||||
|
"icon": "fas fa-sparkles",
|
||||||
|
"color": "text-warning",
|
||||||
|
"price": 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
AWARDS = {
|
||||||
|
"shit": {
|
||||||
|
"kind": "shit",
|
||||||
|
"title": "shit",
|
||||||
|
"description": "Makes flies swarm a post.",
|
||||||
|
"icon": "fas fa-poop",
|
||||||
|
"color": "text-black-50",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
|
"stars": {
|
||||||
|
"kind": "stars",
|
||||||
|
"title": "Stars",
|
||||||
|
"description": "Puts stars on the post.",
|
||||||
|
"icon": "fas fa-sparkles",
|
||||||
|
"color": "text-warning",
|
||||||
|
"price": 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class User(Base, Stndrd, Age_times):
|
class User(Base, Stndrd, Age_times):
|
||||||
__tablename__ = "users"
|
__tablename__ = "users"
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
@ -133,6 +180,18 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def user_awards(v):
|
||||||
|
|
||||||
|
return_value = list(AWARDS.values())
|
||||||
|
|
||||||
|
user_awards = v.awards
|
||||||
|
|
||||||
|
for val in return_value: val['owned'] = user_awards.filter_by(kind=val['kind'], submission_id=None, comment_id=None).count()
|
||||||
|
|
||||||
|
return return_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def referral_count(self):
|
def referral_count(self):
|
||||||
|
|
|
@ -1,5 +1,80 @@
|
||||||
<script src='/assets/js/bundle.js'></script>
|
|
||||||
|
|
||||||
<input type="hidden" id="awardTarget" value="" />
|
<input type="hidden" id="awardTarget" value="" />
|
||||||
<div class="modal fade" id="awardModal" tabindex="-1" role="dialog" aria-labelledby="awardModalTitle" aria-hidden="true">
|
<div class="modal fade" id="awardModal" tabindex="-1" role="dialog" aria-labelledby="awardModalTitle" aria-hidden="true">
|
||||||
</div>
|
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Give Award</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="awardModalBody" class="modal-body">
|
||||||
|
<form class="pt-3 pb-0" action="/post/{{p.id}}/awards" method="post">
|
||||||
|
<div class="card-columns awards-wrapper">
|
||||||
|
{% for award in v.awards %}
|
||||||
|
<div>
|
||||||
|
<label class="card" onclick="document.getElementById('desc-{{award.kind}}').classList.toggle('d-none');document.getElementById('giveaward').disabled=false">
|
||||||
|
<i class="{{award.icon}} {{award.color}}"></i><br />
|
||||||
|
<span class="d-block pt-2" style="font-weight: bold; font-size: 14px;">{{award.title}}</span>
|
||||||
|
<span class="text-muted">{{award.owned}} owned</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="desc-{{award.kind}}" class="d-none">
|
||||||
|
<div class="award-desc p-3">
|
||||||
|
<i style="font-size: 35px;"></i>
|
||||||
|
<div style="margin-left: 15px;">
|
||||||
|
<strong>{{pickedAward.title}} Award</strong><br />
|
||||||
|
<span class="text-muted">{{pickedAward.description}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label for="note" class="pt-4">Note (optional):</label>
|
||||||
|
<textarea id="note" name="note" class="form-control" placeholder="Note to include in award notification"></textarea>
|
||||||
|
</div>
|
||||||
|
<input name="{{award.kind}}" hidden>
|
||||||
|
<input id="giveaward" class="btn btn-primary" type="submit" value="Give Award" disabled>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.awards-wrapper input[type="radio"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awards-wrapper label {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 15px;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: none!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awards-wrapper label i {
|
||||||
|
font-size: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awards-wrapper label.disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awards-wrapper label:hover {
|
||||||
|
/*background-color: rgba(173, 226, 255, 0.7)!important;*/
|
||||||
|
background-color: var(--primary)!important;
|
||||||
|
background-opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.awards-wrapper input[type="radio"]:checked+label {
|
||||||
|
/*background-color: rgba(173, 226, 255, 0.9)!important;*/
|
||||||
|
background-color: var(--primary)!important;
|
||||||
|
background-opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.award-desc {
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: rgba(221, 221, 221, 0.23);
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Add table
Add a link
Reference in a new issue