refactored sitekey routes
This commit is contained in:
parent
f0254b3b77
commit
6069962d3e
24 changed files with 48 additions and 44 deletions
|
@ -37,6 +37,12 @@ lazy_static! {
|
|||
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) {
|
||||
use crate::define_resource;
|
||||
use crate::PAGES;
|
||||
|
@ -45,12 +51,6 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
|
|||
sitekey::services(cfg);
|
||||
}
|
||||
|
||||
async fn panel() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*INDEX)
|
||||
}
|
||||
|
||||
pub mod routes {
|
||||
use super::sitekey::routes::Sitekey;
|
||||
pub struct Panel {
|
||||
|
|
|
@ -26,7 +26,7 @@ lazy_static! {
|
|||
}
|
||||
|
||||
#[derive(TemplateOnce, Clone)]
|
||||
#[template(path = "panel/add-site-key/index.html")]
|
||||
#[template(path = "panel/sitekey/add/index.html")]
|
||||
pub struct IndexPage<'a> {
|
||||
pub levels: usize,
|
||||
pub form_title: &'a str,
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::errors::*;
|
|||
use crate::Data;
|
||||
|
||||
#[derive(TemplateOnce, Clone)]
|
||||
#[template(path = "panel/site-keys/index.html")]
|
||||
#[template(path = "panel/sitekey/list/index.html")]
|
||||
pub struct IndexPage {
|
||||
sitekeys: SiteKeys,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import {Router} from './router';
|
|||
import * as login from './auth/login';
|
||||
import * as register from './auth/register';
|
||||
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';
|
||||
|
||||
|
@ -29,8 +29,9 @@ import './panel/main.scss';
|
|||
import './panel/header/sidebar/main.scss';
|
||||
import './panel/taskbar/main.scss';
|
||||
import './panel/help-banner/main.scss';
|
||||
import './panel/add-site-key/main.scss';
|
||||
import './panel/site-keys/main.scss';
|
||||
import './panel/sitekey/add/main.scss';
|
||||
import './panel/sitekey/list/main.scss';
|
||||
|
||||
import './errors/main.scss';
|
||||
|
||||
const router = new Router();
|
||||
|
@ -41,3 +42,6 @@ router.register(VIEWS.loginUser, login.index);
|
|||
router.register(VIEWS.addSiteKey, addSiteKey.index);
|
||||
|
||||
router.route();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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 |
|
@ -17,12 +17,12 @@
|
|||
|
||||
import {LEVELS} from './levels';
|
||||
|
||||
import isBlankString from '../../utils/isBlankString';
|
||||
import getFormUrl from '../../utils/getFormUrl';
|
||||
import genJsonPayload from '../../utils/genJsonPayload';
|
||||
import isNumber from '../../utils/isNumber';
|
||||
import isBlankString from '../../../utils/isBlankString';
|
||||
import getFormUrl from '../../../utils/getFormUrl';
|
||||
import genJsonPayload from '../../../utils/genJsonPayload';
|
||||
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 FORM = <HTMLFormElement>document.querySelector(`.${SITE_KEY_FORM_CLASS}`);
|
15
templates/panel/sitekey/add/index.html
Normal file
15
templates/panel/sitekey/add/index.html
Normal 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"); .>
|
|
@ -18,7 +18,7 @@
|
|||
import {Level} from './index';
|
||||
import CONST from '../const';
|
||||
|
||||
import isNumber from '../../../utils/isNumber';
|
||||
import isNumber from '../../../../utils/isNumber';
|
||||
|
||||
/** Fetches level from DOM using the ID passesd and validates */
|
||||
const getLevelFields = (id: number) => {
|
|
@ -15,10 +15,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import '../../reset';
|
||||
@import '../../vars';
|
||||
@import '../../components/button';
|
||||
@import '../../components/forms';
|
||||
@import '../../../reset';
|
||||
@import '../../../vars';
|
||||
@import '../../../components/button';
|
||||
@import '../../../components/forms';
|
||||
|
||||
.sitekey-form {
|
||||
display: flex;
|
|
@ -1,9 +1,9 @@
|
|||
<. include!("../../components/headers.html"); .> <.
|
||||
include!("../header/index.html"); .>
|
||||
<. include!("../../../components/headers.html"); .> <.
|
||||
include!("../../header/index.html"); .>
|
||||
|
||||
<main>
|
||||
<. include!("../taskbar/index.html"); .> <.
|
||||
include!("../help-banner/index.html"); .>
|
||||
<. include!("../../taskbar/index.html"); .> <.
|
||||
include!("../../help-banner/index.html"); .>
|
||||
<!-- Main content container -->
|
||||
<div class="inner-container">
|
||||
<!-- Main menu/ important actions roaster -->
|
||||
|
@ -27,4 +27,4 @@ include!("../header/index.html"); .>
|
|||
</div>
|
||||
<!-- end of container -->
|
||||
</main>
|
||||
<. include!("../../components/footers.html"); .>
|
||||
<. include!("../../../components/footers.html"); .>
|
|
@ -15,9 +15,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import '../../reset';
|
||||
@import '../../vars';
|
||||
@import '../../components/box';
|
||||
@import '../../../reset';
|
||||
@import '../../../vars';
|
||||
@import '../../../components/box';
|
||||
|
||||
.sitekey-list__box {
|
||||
@include box;
|
Loading…
Reference in a new issue