edit sitekey, router pattern matching, sitekey update optimization, rm level delete and level err handling

This commit is contained in:
realaravinth
2021-07-16 17:40:52 +05:30
parent 863d22f62c
commit ea8264054a
31 changed files with 746 additions and 526 deletions

View File

@@ -0,0 +1,5 @@
<a href="./edit/">
<img class="sitekey-form__edit" src="<.=
crate::FILES.get("./static/cache/img/svg/edit.svg").unwrap() .>" alt="Edit
sitekey" />
</a>

View File

@@ -0,0 +1,4 @@
</form>
</div>
<!-- end of container -->
<. include!("../../../components/footers.html"); .>

View File

@@ -0,0 +1,56 @@
<. include!("../../../components/headers/widget-headers.html"); .>
<body class="layout">
<. include!("../../navbar/index.html"); .>
<div class="tmp-layout">
<. include!("../../header/index.html"); .>
<main class="panel-main">
<. include!("../../help-banner/index.html"); .>
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<form class="sitekey-form" action="<.= URL .>" method="post">
<h1 class="form__title">Sitekey: <.= name .>
<a
target="_blank"
href="<.= crate::WIDGET_ROUTES.verification_widget .>/?sitekey=<.= key.>"
>View deployment
<img class="sitekey-form__widget-link"
src="<.= crate::FILES.get("./static/cache/img/svg/external-link.svg").unwrap() .>"
alt="View widget deployment"
/>
</a>
<. if READONLY { .>
<. include!("./__edit-sitekey-icon.html"); .>
<. } .>
</h1>
<label class="sitekey-form__label" for="description">
Description
<input
<. if READONLY { .>
<.= "readonly='readonly'" .>
<. } .>
class="sitekey-form__input"
type="text"
name="description"
id="description"
required
<. if !name.trim().is_empty() { .>
value="<.= name .>"
<. } .>
/>
</label>
<label class="sitekey-form__label" for="duration">
Cooldown Duratoin(in seconds)
<input
<. if READONLY { .>
<.= "readonly='readonly'" .>
<. } .>
class="sitekey-form__input"
type="number"
name="duration"
id="duration"
min=0
required
value="<.= duration .>"
/>
</label>

View File

@@ -1,58 +1,7 @@
<. include!("../../../components/headers/widget-headers.html"); .>
<body class="layout">
<. include!("../../navbar/index.html"); .>
<div class="tmp-layout">
<. include!("../../header/index.html"); .>
<main class="panel-main">
<. include!("../../help-banner/index.html"); .>
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<form class="sitekey-form" action="<.= crate::V1_API_ROUTES.levels.add .>" method="post">
<h1 class="form__title">Sitekey: <.= name .>
<a
target="_blank"
href="<.= crate::WIDGET_ROUTES.verification_widget .>/?sitekey=<.= key.>"
>View widget
<img class="sitekey-form__widget-link"
src="<.= crate::FILES.get("./static/cache/img/svg/external-link.svg").unwrap() .>"
alt="View widget deployment"
/>
</a>
</h1>
<label class="sitekey-form__label" for="description">
Description
<input
readonly="readonly"
class="sitekey-form__input"
type="text"
name="description"
id="description"
required
<. if !name.trim().is_empty() { .>
value="<.= name .>"
<. } .>
/>
</label>
<label class="sitekey-form__label" for="duration">
Cooldown Duratoin(in seconds)
<input
readonly="readonly"
class="sitekey-form__input"
type="number"
name="duration"
id="duration"
min=0
required
value="<.= duration .>"
/>
</label>
<. const URL: &str = crate::V1_API_ROUTES.levels.add; .>
<. const READONLY: bool = true; .>
<. include!("./__form-top.html"); .>
<. for (count, level) in levels.iter().enumerate() { .>
<. include!("./existing-level.html"); .>
<. } .>
</form>
</div>
<!-- end of container -->
<. include!("../../../components/footers.html"); .>
<. include!("./__form-bottom.html"); .>

View File

@@ -14,5 +14,4 @@
* 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/>.
*/
export const index = () => {};