Merge pull request #14 from dredgy/modals
Added a simple close modal feature.
This commit is contained in:
@@ -13,10 +13,10 @@ let decoratorItem (imageName, imageUrl) =
|
|||||||
let decoratorRow decoratorItems = div [_class "decoratorRow"] [yield! decoratorItems]
|
let decoratorRow decoratorItems = div [_class "decoratorRow"] [yield! decoratorItems]
|
||||||
|
|
||||||
let decorator (decorationRows: XmlNode[]) =
|
let decorator (decorationRows: XmlNode[]) =
|
||||||
div [_id "decorator"] [
|
div [_id "decorator"; _class "modal"] [
|
||||||
div [_id "decoratorHeader"] [
|
div [_id "decoratorHeader"] [
|
||||||
h2 [] [lang "choose_decoration"]
|
h2 [] [lang "choose_decoration"]
|
||||||
a [_class "posButton hideDecorator"] [str "×"]
|
a [_class "posButton hideModals"] [str "×"]
|
||||||
]
|
]
|
||||||
div [_id "decoratorContent"] [
|
div [_id "decoratorContent"] [
|
||||||
yield! decorationRows
|
yield! decorationRows
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ const lang = (key: string, replacements?: string[] | string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check if a variable is defined */
|
/** Check if a variable is defined */
|
||||||
const defined = (variable: any) => {
|
const defined = (variable: any) => typeof variable !== 'undefined'
|
||||||
return typeof variable !== 'undefined'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Call an Ajax function asynchronously */
|
/** Call an Ajax function asynchronously */
|
||||||
const ajax = (endpoint: string, data: any, method = 'POST', successFunction: Function, errorFunction: Function, beforeFunction: any) => {
|
const ajax = (endpoint: string, data: any, method = 'POST', successFunction: Function, errorFunction: Function, beforeFunction: any) => {
|
||||||
@@ -69,18 +67,17 @@ const ajaxSync = (endpoint: string, data?: any, method = 'POST') => {
|
|||||||
/* Redirect to a specific URL */
|
/* Redirect to a specific URL */
|
||||||
const redirect = (url: string): void => location.assign(url)
|
const redirect = (url: string): void => location.assign(url)
|
||||||
|
|
||||||
const resize = () => {
|
const resize = () => $('#pageContainer').height(window.innerHeight + "px");
|
||||||
$('#pageContainer').height(window.innerHeight + "px");
|
|
||||||
}
|
|
||||||
|
|
||||||
const setupCore = (languageVars: Record<string, string>) => {
|
const setupCore = (languageVars: Record<string, string>) => {
|
||||||
Application.languageVars = languageVars
|
Application.languageVars = languageVars
|
||||||
const doc = $(document)
|
$(document)
|
||||||
doc.on('click', '#alertNo, #alertOk', hideAlerts)
|
.on('click', '#alertNo, #alertOk', hideAlerts)
|
||||||
doc.on('click', '.toggle', toggle)
|
.on('click', '.toggle', toggle)
|
||||||
|
.on('click', '.hideModals', hideModals)
|
||||||
|
|
||||||
window.addEventListener('resize', resize)
|
window.addEventListener('resize', resize)
|
||||||
resize()
|
resize()
|
||||||
|
|
||||||
setElementVisibilityByMode()
|
setElementVisibilityByMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +114,7 @@ const confirmation = (message: string, data: any, title = 'Confirm', submitFunct
|
|||||||
|
|
||||||
|
|
||||||
const hideAlerts = () => $('#alert').hide()
|
const hideAlerts = () => $('#alert').hide()
|
||||||
|
const hideModals = () => $('.modal').hide()
|
||||||
|
|
||||||
const turnOnMode = (mode: PosMode) => {
|
const turnOnMode = (mode: PosMode) => {
|
||||||
Application.mode.push(mode)
|
Application.mode.push(mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user