Fix merge of #59 with data-click2 attributes.

PR #59 was started prior to 59e0beebb2
and data-click2 -> data-click was not automerged for obvious reasons.
Resolve this to fix the delete banner buttons.
pull/64/head
Snakes 2022-12-11 20:03:22 -05:00
parent 6a8e36caef
commit 3459c4c9da
Signed by: Snakes
GPG Key ID: E745A82778055C7E
2 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
from random import Random import random
import time import time
from typing import Optional from typing import Optional
@ -50,9 +50,8 @@ class Sub(Base):
return [] return []
@lazy @lazy
def random_banner(self, random:Optional[Random]=None): def random_banner(self):
if not self.banner_urls: return None if not self.banner_urls: return None
if not random: random = Random()
return random.choice(self.banner_urls) return random.choice(self.banner_urls)
@property @property

View File

@ -69,7 +69,7 @@
</div> </div>
<div class="body w-lg-100 my-auto"> <div class="body w-lg-100 my-auto">
<div class="d-flex"> <div class="d-flex">
<button class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-{{loop.index}}" onclick="areyousure(this)" data-click2="postToastReload(this, '/h/{{sub.name}}/settings/banners/{{loop.index - 1}}', 'DELETE');">Delete</button> <button class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-{{loop.index}}" onclick="areyousure(this)" data-click="postToastReload(this, '/h/{{sub.name}}/settings/banners/{{loop.index - 1}}', 'DELETE');">Delete</button>
</div> </div>
</div> </div>
</section> </section>
@ -88,7 +88,7 @@
<label class="btn btn-secondary text-capitalize mr-2 mb-0"> <label class="btn btn-secondary text-capitalize mr-2 mb-0">
Upload New Banner<input autocomplete="off" type="file" accept="image/*" hidden name="banner" onchange="form.submit()"> Upload New Banner<input autocomplete="off" type="file" accept="image/*" hidden name="banner" onchange="form.submit()">
</label> </label>
<button type="button" class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-all" onclick="areyousure(this)" data-click2="postToastReload(this, '/h/{{sub.name}}/settings/banners/', 'DELETE');">Delete All Banners</button> <button type="button" class="btn btn-danger sub-banner-delete-button" id="sub-banner-delete-all" onclick="areyousure(this)" data-click="postToastReload(this, '/h/{{sub.name}}/settings/banners/', 'DELETE');">Delete All Banners</button>
</form> </form>
</div> </div>
</div> </div>