refactored sitekey routes

This commit is contained in:
realaravinth 2021-05-05 12:57:05 +05:30
parent f0254b3b77
commit 6069962d3e
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
24 changed files with 48 additions and 44 deletions

View file

@ -37,6 +37,12 @@ lazy_static! {
static ref INDEX: String = IndexPage::default().render_once().unwrap(); static ref INDEX: String = IndexPage::default().render_once().unwrap();
} }
async fn panel() -> impl Responder {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(&*INDEX)
}
pub fn services(cfg: &mut actix_web::web::ServiceConfig) { pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
use crate::define_resource; use crate::define_resource;
use crate::PAGES; use crate::PAGES;
@ -45,12 +51,6 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
sitekey::services(cfg); sitekey::services(cfg);
} }
async fn panel() -> impl Responder {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(&*INDEX)
}
pub mod routes { pub mod routes {
use super::sitekey::routes::Sitekey; use super::sitekey::routes::Sitekey;
pub struct Panel { pub struct Panel {

View file

@ -26,7 +26,7 @@ lazy_static! {
} }
#[derive(TemplateOnce, Clone)] #[derive(TemplateOnce, Clone)]
#[template(path = "panel/add-site-key/index.html")] #[template(path = "panel/sitekey/add/index.html")]
pub struct IndexPage<'a> { pub struct IndexPage<'a> {
pub levels: usize, pub levels: usize,
pub form_title: &'a str, pub form_title: &'a str,

View file

@ -24,7 +24,7 @@ use crate::errors::*;
use crate::Data; use crate::Data;
#[derive(TemplateOnce, Clone)] #[derive(TemplateOnce, Clone)]
#[template(path = "panel/site-keys/index.html")] #[template(path = "panel/sitekey/list/index.html")]
pub struct IndexPage { pub struct IndexPage {
sitekeys: SiteKeys, sitekeys: SiteKeys,
} }

View file

@ -20,7 +20,7 @@ import {Router} from './router';
import * as login from './auth/login'; import * as login from './auth/login';
import * as register from './auth/register'; import * as register from './auth/register';
import * as panel from './panel/index'; import * as panel from './panel/index';
import * as addSiteKey from './panel/add-site-key/'; import * as addSiteKey from './panel/sitekey/add/';
import VIEWS from './views/v1/routes'; import VIEWS from './views/v1/routes';
@ -29,8 +29,9 @@ import './panel/main.scss';
import './panel/header/sidebar/main.scss'; import './panel/header/sidebar/main.scss';
import './panel/taskbar/main.scss'; import './panel/taskbar/main.scss';
import './panel/help-banner/main.scss'; import './panel/help-banner/main.scss';
import './panel/add-site-key/main.scss'; import './panel/sitekey/add/main.scss';
import './panel/site-keys/main.scss'; import './panel/sitekey/list/main.scss';
import './errors/main.scss'; import './errors/main.scss';
const router = new Router(); const router = new Router();
@ -41,3 +42,6 @@ router.register(VIEWS.loginUser, login.index);
router.register(VIEWS.addSiteKey, addSiteKey.index); router.register(VIEWS.addSiteKey, addSiteKey.index);
router.route(); router.route();

View file

@ -1,15 +0,0 @@
<. include!("../../components/headers.html"); .> <. include!("../header/index.html");
.>
<main>
<. include!("../taskbar/index.html"); .> <.
include!("../help-banner/index.html"); .>
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<. include!("../add-site-key/form.html"); .>
</div>
<!-- end of container -->
</main>
<. include!("../../components/footers.html"); .>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

View file

@ -17,12 +17,12 @@
import {LEVELS} from './levels'; import {LEVELS} from './levels';
import isBlankString from '../../utils/isBlankString'; import isBlankString from '../../../utils/isBlankString';
import getFormUrl from '../../utils/getFormUrl'; import getFormUrl from '../../../utils/getFormUrl';
import genJsonPayload from '../../utils/genJsonPayload'; import genJsonPayload from '../../../utils/genJsonPayload';
import isNumber from '../../utils/isNumber'; import isNumber from '../../../utils/isNumber';
import VIEWS from '../../views/v1/routes'; import VIEWS from '../../../views/v1/routes';
const SITE_KEY_FORM_CLASS = 'sitekey-form'; const SITE_KEY_FORM_CLASS = 'sitekey-form';
const FORM = <HTMLFormElement>document.querySelector(`.${SITE_KEY_FORM_CLASS}`); const FORM = <HTMLFormElement>document.querySelector(`.${SITE_KEY_FORM_CLASS}`);

View file

@ -0,0 +1,15 @@
<. include!("../../../components/headers.html"); .> <. include!("../../header/index.html");
.>
<main>
<. include!("../../taskbar/index.html"); .> <.
include!("../../help-banner/index.html"); .>
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<. include!("../add/form.html"); .>
</div>
<!-- end of container -->
</main>
<. include!("../../../components/footers.html"); .>

View file

@ -18,7 +18,7 @@
import {Level} from './index'; import {Level} from './index';
import CONST from '../const'; import CONST from '../const';
import isNumber from '../../../utils/isNumber'; import isNumber from '../../../../utils/isNumber';
/** Fetches level from DOM using the ID passesd and validates */ /** Fetches level from DOM using the ID passesd and validates */
const getLevelFields = (id: number) => { const getLevelFields = (id: number) => {

View file

@ -15,10 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@import '../../reset'; @import '../../../reset';
@import '../../vars'; @import '../../../vars';
@import '../../components/button'; @import '../../../components/button';
@import '../../components/forms'; @import '../../../components/forms';
.sitekey-form { .sitekey-form {
display: flex; display: flex;

View file

@ -1,9 +1,9 @@
<. include!("../../components/headers.html"); .> <. <. include!("../../../components/headers.html"); .> <.
include!("../header/index.html"); .> include!("../../header/index.html"); .>
<main> <main>
<. include!("../taskbar/index.html"); .> <. <. include!("../../taskbar/index.html"); .> <.
include!("../help-banner/index.html"); .> include!("../../help-banner/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 -->
@ -27,4 +27,4 @@ include!("../header/index.html"); .>
</div> </div>
<!-- end of container --> <!-- end of container -->
</main> </main>
<. include!("../../components/footers.html"); .> <. include!("../../../components/footers.html"); .>

View file

@ -15,9 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
@import '../../reset'; @import '../../../reset';
@import '../../vars'; @import '../../../vars';
@import '../../components/box'; @import '../../../components/box';
.sitekey-list__box { .sitekey-list__box {
@include box; @include box;