add sitekey helper in list sitekey page

This commit is contained in:
realaravinth
2021-08-12 08:38:09 +05:30
parent 78ebc46c64
commit 751a1046fb
6 changed files with 74 additions and 76 deletions

View File

@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net> * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
use actix_identity::Identity; use actix_identity::Identity;
use actix_web::{HttpResponse, Responder}; use actix_web::{HttpResponse, Responder};

View File

@@ -1,14 +1,7 @@
<ul class="taskbar"> <ul class="taskbar">
<!--
<li class="taskbar__action">Brand Name</li>
-->
<li class="taskbar__spacer"></li> <li class="taskbar__spacer"></li>
<li class="taskbar__action"> <li class="taskbar__action">
<a class="taskbar__link" href="<.= crate::PAGES.panel.sitekey.add .>"> <. include!("./new-sitekey-btn.html"); .>
<button class="taskbar__add-site">
+ New Site
</button>
</a>
</li> </li>
<li class="taskbar__action"> <li class="taskbar__action">
<img class="taskbar__icon" src="<.= <img class="taskbar__icon" src="<.=
@@ -23,7 +16,6 @@
alt="Notifications" /> alt="Notifications" />
</a> </a>
</li> </li>
<li class="taskbar__action"> <li class="taskbar__action">
<a href="<.= crate::V1_API_ROUTES.auth.logout .>"> <a href="<.= crate::V1_API_ROUTES.auth.logout .>">
<img class="taskbar__icon" src="<.= <img class="taskbar__icon" src="<.=

View File

@@ -0,0 +1,5 @@
<a class="taskbar__link" href="<.= crate::PAGES.panel.sitekey.add .>">
<button class="taskbar__add-site">
+ New Site
</button>
</a>

View File

@@ -11,16 +11,8 @@ include!("./navbar/index.html"); .>
<. include!("./help-banner/index.html"); .> <. include!("./help-banner/index.html"); .>
<div class="inner-container"> <div class="inner-container">
<. if sitekeys.is_empty() { .> <. if sitekeys.is_empty() { .>
<ul class="sitekey-list__box"> <. include!("./sitekey/list/empty-sitekey.html"); .>
<p>
It looks like you don't have any sitekeys. Click
<a href="<.= crate::PAGES.panel.sitekey.add .>">here</a> to add new
sitekey.
</p>
</ul>
<.} else {.> <.} else {.>
<table class="sitekey__table"> <table class="sitekey__table">
<thead class="sitekey__table-heading"> <thead class="sitekey__table-heading">
<tr> <tr>
@@ -53,16 +45,15 @@ include!("./navbar/index.html"); .>
</div> </div>
</td> </td>
<td class="sitekey-list__key"> <td class="sitekey-list__key">
<div class="sitekey-list__edit"> <div class="sitekey-list__edit">
<. let key = format!("/sitekey/{}", &sitekey.key); .> <. let key = format!("/sitekey/{}", &sitekey.key); .>
<. include!("./sitekey/view/__edit-sitekey-icon.html"); .> <. include!("./sitekey/view/__edit-sitekey-icon.html"); .>
</div> </div>
</td> </td>
</tr> </tr>
<. } .> <. } .>
</tbody> </tbody>
</table> </table>
<.}.> <.}.>
</div> </div>
<. include!("../components/footers.html"); .> <. include!("../components/footers.html"); .>

View File

@@ -0,0 +1,6 @@
<ul class="sitekey-list__box">
<p>
It looks like you don't have any sitekeys. Click <.
include!("../../header/taskbar/new-sitekey-btn.html"); .> to add new sitekey.
</p>
</ul>

View File

@@ -12,47 +12,51 @@ include!("../../navbar/index.html"); .>
<!-- Main content container --> <!-- Main content container -->
<div class="inner-container"> <div class="inner-container">
<!-- Main menu/ important actions roaster --> <!-- Main menu/ important actions roaster -->
<table class="sitekey__table"> <. if sitekeys.is_empty() { .>
<thead class="sitekey__table-heading"> <. include!("./empty-sitekey.html"); .>
<tr> <.} else {.>
<th colspan="4" class="sitekey__table-title-text"> <table class="sitekey__table">
Your Sitekeys <thead class="sitekey__table-heading">
</th> <tr>
</tr> <th colspan="4" class="sitekey__table-title-text">
</thead> Your Sitekeys
<tbody class="sitekey__body"> </th>
<. for sitekey in sitekeys.iter() { .> </tr>
<tr class="sitekey__item"> </thead>
<td class="sitekey-list__name"> <tbody class="sitekey__body">
<a <. for sitekey in sitekeys.iter() { .>
href="/sitekey/<.= sitekey.key .>/" <tr class="sitekey__item">
class="sitekey-list__sitekey-link" <td class="sitekey-list__name">
>
<.= sitekey.name .>
</a>
</td>
<td class="sitekey-list__key">
<div class="sitekey__key-container">
<. let clipboard_data = ("sitekey", &sitekey.key); .>
<. include!("../../../components/clipboard/index.html"); .>
<a <a
class="sitekey__widget-link" href="/sitekey/<.= sitekey.key .>/"
href="<.= crate::WIDGET_ROUTES.verification_widget .>/?sitekey=<.= sitekey.key .>" class="sitekey-list__sitekey-link"
> >
<.= &sitekey.key[0..5] .> <.= sitekey.name .>
</a> </a>
</div> </td>
</td> <td class="sitekey-list__key">
<td class="sitekey-list__key"> <div class="sitekey__key-container">
<div class="sitekey-list__edit"> <. let clipboard_data = ("sitekey", &sitekey.key); .>
<. let key = format!("/sitekey/{}", &sitekey.key); .> <. include!("../../../components/clipboard/index.html"); .>
<. include!("../view/__edit-sitekey-icon.html"); .> <a
</div> class="sitekey__widget-link"
</td> href="<.= crate::WIDGET_ROUTES.verification_widget .>/?sitekey=<.= sitekey.key .>"
</tr> >
<. } .> <.= &sitekey.key[0..5] .>
</tbody> </a>
</table> </div>
</td>
<td class="sitekey-list__key">
<div class="sitekey-list__edit">
<. let key = format!("/sitekey/{}", &sitekey.key); .>
<. include!("../view/__edit-sitekey-icon.html"); .>
</div>
</td>
</tr>
<. } .>
</tbody>
</table>
<.}.>
</div> </div>
<!-- end of container --> <!-- end of container -->
<. include!("../../../components/footers.html"); .> <. include!("../../../components/footers.html"); .>