This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapps.wiz
1 lines (1 loc) · 15.7 KB
/
apps.wiz
1
[{"dic":{"default":{}},"id":"core.theme.head","name":"Head","html":"title SEASON WIZ\n\nmeta(charset='utf-8')\nmeta(name='viewport' content='width=device-width, initial-scale=1, viewport-fit=cover')\nmeta(http-equiv='X-UA-Compatible' content='ie=edge')\nmeta(name='msapplication-TileColor' content='#206bc4')\nmeta(name='theme-color' content='#206bc4')\nmeta(name='apple-mobile-web-app-status-bar-style' content='black-translucent')\nmeta(name='apple-mobile-web-app-capable' content='yes')\nmeta(name='mobile-web-app-capable' content='yes')\nmeta(name='HandheldFriendly' content='True')\nmeta(name='MobileOptimized' content='320')\n\nlink(rel=\"shortcut icon\" href=\"/resources/img/icon.ico\")\nlink(data-n-head=\"ssr\" rel=\"apple-touch-icon\" href=\"/resources/img/icon_g.png\")\n\n//- fontawesome\nlink(href='/resources/wiz/plugin/theme/libs/fontawesome/css/all.min.css' rel='stylesheet')\n\nscript(src='/resources/wiz/plugin/theme/libs/tabler/dist/libs/jquery/dist/jquery.slim.min.js')\nscript(src='/resources/wiz/plugin/theme/libs/jquery/jquery-3.5.1.min.js')\nscript(src='/resources/wiz/plugin/theme/libs/moment/moment-with-locales.min.js')\n\n//- tabler\nlink(href='/resources/wiz/plugin/theme/libs/tabler/dist/css/tabler.min.css' rel='stylesheet')\nlink(href='/resources/wiz/plugin/theme/libs/tabler/dist/css/tabler-flags.min.css' rel='stylesheet')\nlink(href='/resources/wiz/plugin/theme/libs/tabler/dist/css/tabler-payments.min.css' rel='stylesheet')\nlink(href='/resources/wiz/plugin/theme/libs/tabler/dist/css/tabler-buttons.min.css' rel='stylesheet')\nlink(href='/resources/wiz/plugin/theme/libs/tabler/dist/css/demo.min.css' rel='stylesheet')\n\n//- toastr\nlink(href='/resources/wiz/plugin/theme/libs/toastr/toastr.min.css' rel='stylesheet')\nscript(src='/resources/wiz/plugin/theme/libs/toastr/toastr.min.js')\n\n//- tinymce\nscript(src='/resources/wiz/plugin/theme/libs/tinymce/tinymce.min.js')\n\nlink(href='/resources/wiz/plugin/theme/libs/split-pane/split-pane.css' rel='stylesheet')\nscript(src='/resources/wiz/plugin/theme/libs/split-pane/split-pane.js')\n\n//- angular\nscript(src='/resources/wiz/plugin/theme/libs/angular/angular.min.js')\nscript(src='/resources/wiz/plugin/theme/libs/angular/angular-sanitize.js')\nscript(src='/resources/wiz/plugin/theme/libs/angular/ui-monaco.js')\nscript(src='/resources/wiz/plugin/theme/libs/angular/ui-monaco-diff.js')\nscript(src='/resources/wiz/plugin/theme/libs/angular/ui-tinymce.js')\nscript(src='/resources/wiz/plugin/theme/libs/split-pane/angular-split-pane.js')\n\n//- socketio\nscript(src='/resources/wiz/plugin/theme/libs/socketio/socket.io.js')\n\n//- theme\nlink(href='/resources/wiz/plugin/theme/font/nanumgothic/style.css' rel='stylesheet')\nlink(href='/resources/wiz/plugin/theme/less/theme.less' rel='stylesheet')\n\nscript(src='/resources/wiz/plugin/theme/js/base.js')\nscript(src='/resources/wiz/plugin/theme/js/drag.js')\nscript(src='/resources/wiz/plugin/theme/js/shortcut.js')\nscript(src='/resources/wiz/plugin/theme/js/app.js')\nscript(src='/resources/wiz/plugin/theme/js/ansi.js')\nscript(src='/resources/wiz/plugin/theme/js/build.js')\n\nscript(type=\"text/javascript\").\n if (!window.season_wiz) {\n window.season_wiz = (() => {\n let obj = {};\n obj.__cache__ = {};\n\n obj.load = (plugin_id, app_id, render_id) => {\n let wiz = {};\n wiz.id = app_id;\n wiz.render_id = render_id;\n wiz.plugin_id = plugin_id;\n\n wiz.socket = {};\n wiz.socket.active = false;\n\n if (window.io) {\n wiz.socket.active = true;\n wiz.socket.get = (socketnamespace) => {\n let socketns = \"/wiz/api/\" + app_id;\n if (socketnamespace) socketns = \"/wiz/api/\" + socketnamespace;\n if (wiz.branch != 'master') socketns = socketns + \"/\" + wiz.branch;\n\n wiz.socket_instance = window.io(socketns);\n return wiz.socket_instance;\n }\n }\n\n wiz.API = {\n url: (fnname) => '/wiz/admin/api/plugin/' + plugin_id + '/' + app_id + '/' + fnname,\n function: (fnname, data, cb, opts) => {\n let _url = wiz.API.url(fnname);\n let ajax = {\n url: _url,\n type: 'POST',\n data: data\n };\n\n if (opts) {\n for (let key in opts) {\n ajax[key] = opts[key];\n }\n }\n\n $.ajax(ajax).always((a, b, c) => {\n cb(a, b, c);\n });\n },\n async: (fnname, data, opts = {}) => {\n const _url = wiz.API.url(fnname);\n let ajax = {\n url: _url,\n type: \"POST\",\n data: data,\n ...opts,\n };\n\n return new Promise((resolve) => {\n $.ajax(ajax).always(function (a, b, c) {\n resolve(a, b, c);\n });\n });\n }\n };\n\n wiz.timeout = (timestamp) => new Promise((resolve) => {\n setTimeout(resolve, timestamp);\n });\n\n wiz._event = {};\n wiz._response = {};\n wiz._response_activator = {};\n\n wiz.bind = (name, fn) => {\n wiz._event[name] = (data) => new Promise(async (resolve, reject) => {\n let res = await fn(data);\n if (res) {\n return resolve(res);\n }\n\n wiz._response_activator[name] = true;\n\n let response_handler = () => {\n // if not activate, stop loop\n if (!wiz._response_activator[name]) {\n reject(\"deprecated event `\" + name + \"` of `\" + wiz.app_id + \"`\");\n return;\n }\n\n // if activate \n if (name in wiz._response) {\n let resp = wiz._response[name];\n delete wiz._response[name];\n delete wiz._response_activator[name];\n resolve(resp);\n return;\n }\n\n setTimeout(response_handler, 100);\n }\n response_handler();\n });\n return wiz;\n };\n\n wiz.response = (name, data) => {\n if (!wiz._response_activator[name]) return;\n wiz._response[name] = data;\n return wiz;\n }\n\n wiz.connect = (id) => {\n if (!obj.__cache__[id]) return null;\n let connected_wiz = obj.__cache__[id];\n let _obj = {};\n\n _obj.event = async (name) => {\n delete connected_wiz._response_activator[name];\n await wiz.timeout(200);\n\n if (connected_wiz._event[name]) {\n let res = await connected_wiz._event[name](_obj._data);\n return res;\n }\n return null;\n };\n\n _obj._data = null;\n _obj.data = (data) => {\n _obj._data = data;\n return _obj;\n }\n return _obj;\n }\n\n obj.__cache__[app_id] = wiz;\n return wiz;\n }\n\n return obj;\n })();\n }","layout":"none","compile":"none","compile_html":"off","compile_css":"off","compile_js":"off"},{"dic":{"default":{}},"id":"core.theme.layout","name":"Layout","layout":"none","html":"doctype 5\n\nhtml(ng-app=\"app\")\n head\n {$ framework.view('core.theme.head') $}\n \n body.antialiased(style=\"background: white;\" ng-cloak)\n script(src='/resources/wiz/plugin/theme/libs/tabler/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js')\n script(src='/resources/wiz/plugin/theme/libs/tabler/dist/libs/peity/jquery.peity.min.js')\n script(src='/resources/wiz/plugin/theme/libs/tabler/dist/js/tabler.min.js')\n\n - if monaco\n script(src='/resources/wiz/plugin/theme/libs/monaco/min/vs/loader.js')\n script.\n require.config({ paths: { vs: '/resources/wiz/plugin/theme/libs/monaco/min/vs' } });\n\n - if navbar\n {$ framework.view('core.theme.navbar') $}\n\n {$ view $}","compile":"none","api":"","compile_html":"off","compile_css":"off","compile_js":"off"},{"dic":{"default":{}},"id":"core.theme.navbar","name":"Navbar","html":"div\n - if topmenus\n header.navbar.navbar-expand-md.navbar-dark\n .container-xl\n select.form-control.form-control-sm.text-white(ng-model=\"branch.id\" ng-change=\"branch.change(branch.id)\" style=\"width: 90px; display: inline-block;\")\n option(value=\"\" ng-if=\"!branch.id\") select branch\n option(ng-repeat=\"b in branch.list\" value=\"{{b}}\") {{b}}\n \n - if IS_DEV\n a.text-white.ml-3.mr-auto(href=\"?dev=false\")\n span.nav-link-title development\n - else\n a.text-white.ml-3.mr-auto(href=\"?dev=true\")\n span.nav-link-title production\n\n - each menu in topmenus\n a.text-white.ml-4(href=menu['url'])\n span.nav-link-title= menu['title']\n\n header.navbar.navbar-expand-md.navbar-dark\n .container-xl\n button.navbar-toggler.text-white(type='button' data-toggle='collapse' data-target='#navbar-menu')\n span.navbar-toggler-icon\n\n a.navbar-brand.navbar-brand-autodark.d-none-navbar-horizontal.pr-0.pr-md-3(href=\"/wiz\")\n table(style='color: #d7e0fd;')\n tr\n td.p-3.pb-3.pt-1.pr-2\n img(src='/resources/wiz/plugin/theme/img/wiz-font.png' style='height: 26px; margin-top: 16px;')\n img(src='/resources/wiz/plugin/theme/img/logo-sym.png' style='height: 46px; margin-left: 12px;')\n \n .navbar-expand-md\n #navbar-menu.navbar.collapse.navbar-collapse.mb-3\n .container-xl\n ul.navbar-nav\n - each menu in menus\n - if menu.child == null\n li.nav-item(class=menu['class'])\n a.nav-link(href=menu['url'] target=menu['target'])\n - if menu.icon\n span.mr-2(style=\"width: 20px; text-align: center;\")\n i(class=menu['icon'])\n span.nav-link-title= menu['title']\n - if menu.child\n li.nav-item.dropdown(class=menu['class'])\n a.nav-link(href=menu.child[0]['url'] target=menu.child[0]['target'])\n - if menu.icon\n span.mr-2(style=\"width: 20px; text-align: center;\")\n i(class=menu['icon'])\n span.nav-link-title= menu['title']\n\n ul.dropdown-menu(class=menu['show'])\n - each child in menu.child\n li.pl-3\n a.dropdown-item(href=child['url'] target=child['target'] class=child['class'])\n | {$ child['title'] $}\n \n - if submenus\n .container-xl.p-0(style=\"max-width: 1280px;\")\n .subnav.bg-wiz-lt.text-center.p-3(style=\"overflow-x: auto; white-space: nowrap; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px;\")\n .text-center\n - each menu in submenus\n a.p-2.pr-4.pl-4(href=menu['url'] target=menu['target'] class=menu['class'] style=\"color: #0B195F;\")= menu['title']","controller":"wiz = framework.model(\"wiz\")\nfs = framework.model(\"wizfs\").use(f\"wiz/plugin/.cache\")\nconfig = wiz.config.load(\"wiz\")\n\ndef nav(menus):\n for menu in menus:\n pt = None\n if 'pattern' in menu: pt = menu['pattern']\n elif 'url' in menu: pt = menu['url']\n\n if pt is not None:\n if framework.request.match(pt): menu['class'] = 'active'\n else: menu['class'] = ''\n\n if 'child' in menu:\n menu['show'] = 'show'\n for i in range(len(menu['child'])):\n child = menu['child'][i]\n cpt = None\n \n if 'pattern' in child: cpt = child['pattern']\n elif 'url' in child: cpt = child['url']\n\n if cpt is not None:\n if framework.request.match(cpt): \n menu['child'][i]['class'] = 'active'\n menu['show'] = 'show'\n else: \n menu['child'][i]['class'] = ''\n return menus\n\ndef simplenav(menus):\n for menu in menus:\n pt = None\n if 'pattern' in menu: pt = menu['pattern']\n elif 'url' in menu: pt = menu['url']\n\n if pt is not None:\n if framework.request.match(pt): menu['class'] = 'bg-dark text-white'\n else: menu['class'] = ''\n\n return menus\n\nkwargs['IS_DEV'] = wiz.is_dev()\nkwargs['BRANCH'] = wiz.workspace.branch()\nkwargs['BRANCHES'] = wiz.workspace.branches()\n\nmenus = list(config.get(\"topmenus\", []))\nmenus.append({\"title\": \"Setting\", \"url\": '/wiz/admin/setting', 'pattern': r'^/wiz/admin/setting' })\nkwargs['topmenus'] = simplenav(menus)\n\ntry: navdata = fs.read_pickle(\"nav\")\nexcept: navdata = []\nkwargs['menus'] = nav(navdata)\nactive_id = None\nfor menu in kwargs['menus']:\n if menu['class'] == 'active':\n active_id = menu['id']\n\nif active_id is None:\n kwargs['submenus'] = []\nelse:\n try: subnavdata = fs.read_pickle(\"subnav\")\n except: subnavdata = dict()\n\n if active_id in subnavdata:\n subnavdata = subnavdata[active_id]\n kwargs['submenus'] = simplenav(subnavdata)\n","layout":"controller","compile":"controller","api":"","js":"let wiz_controller = async ($sce, $scope, $timeout) => {\n $scope.branch = {};\n $scope.branch.id = wiz.data.BRANCH;\n $scope.branch.list = wiz.data.BRANCHES;\n $scope.branch.change = async (branchname) => {\n location.href = location.pathname + \"?branch=\" + branchname;\n }\n};","css":"","compile_html":"on","compile_css":"on","compile_js":"on"}]