-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ViUR3 #15
base: main
Are you sure you want to change the base?
ViUR3 #15
Conversation
deploy/vi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is standard gitignore file in viur base. The VI is served by the viur-cli.
[submodule "deploy/server"] | ||
path = deploy/server | ||
url = [email protected]:viur-framework/server.git | ||
[submodule "sources/less/ignite"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is ignite no longer a submdule?
#name = "testpypi" | ||
|
||
[packages] | ||
viur-core = "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use a specific version?
/viur/docs/ | ||
/viur/CHANGELOG.md | ||
/viur/LICENSE | ||
/viur/README.md | ||
/viur/.readthedocs.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be necessary, if we load the core from pip
/** | ||
* Remove leading indent | ||
* Inspired by https://github.com/jamiebuilds/min-indent | ||
*/ | ||
function minIndent(str: string): number { | ||
const match = str.match(/^[ \t]*(?=\S)/gm); | ||
|
||
if (!match) { | ||
return 0; | ||
} | ||
|
||
return match.reduce((r, a) => Math.min(r, a.length), Infinity); | ||
} | ||
|
||
/** | ||
* Remove leading indent | ||
* Inspired by https://github.com/sindresorhus/strip-indent | ||
*/ | ||
function unIndent(str: string): string { | ||
const indent: number = minIndent(str); | ||
|
||
if (indent === 0) { | ||
return str; | ||
} | ||
|
||
const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm'); | ||
return str.replace(regex, ''); | ||
} | ||
|
||
function escapeHtml(html: string): string { | ||
const div = document.createElement('div'); | ||
div.appendChild(document.createTextNode(html)); | ||
return div.innerHTML; | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const menu: Element = document.querySelector('.js-menu')!; | ||
const menuBtn: Element = document.querySelector('.js-menu-btn')!; | ||
|
||
menuBtn.addEventListener('click', () => { | ||
menu.classList.toggle('is-active'); | ||
menuBtn.classList.toggle('burger--to-cross'); | ||
}); | ||
|
||
document.querySelectorAll<HTMLElement>('.js-code-me').forEach((block: HTMLElement) => { | ||
block.innerHTML = unIndent(block.innerHTML).trim(); | ||
hljs.highlightBlock(block); | ||
// @ts-ignore | ||
hljs.lineNumbersBlock(block); | ||
}); | ||
|
||
document.querySelectorAll<HTMLElement>('.js-code-child').forEach((item: HTMLElement) => { | ||
const escapedHtml = escapeHtml(unIndent(item.innerHTML).trim()); | ||
|
||
const codeNode: HTMLElement = document.createElement('code'); | ||
codeNode.classList.add('hljs', 'language-html', 'syntaxhighlighter'); | ||
codeNode.innerHTML = escapedHtml; | ||
|
||
item.parentElement!.insertBefore(codeNode, item.nextSibling); | ||
|
||
hljs.highlightBlock(codeNode); | ||
// @ts-ignore | ||
hljs.lineNumbersBlock(codeNode); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the source file?
|
||
gulp.task('eslint', () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this task, the linting config and the husky hook?
@@ -0,0 +1,361 @@ | |||
import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, why we should need allbones.py
here...
{{ url("s/bar", "0.9") }} | ||
{{ url("s/box", "0.9") }} | ||
{{ url("s/buttons", "0.9") }} | ||
{{ url("s/components", "0.9") }} | ||
{{ url("s/forms", "0.9") }} | ||
{{ url("s/gettingstarted", "0.9") }} | ||
{{ url("s/guidelines", "0.9") }} | ||
{{ url("s/messages", "0.9") }} | ||
{{ url("s/mixins", "0.9") }} | ||
{{ url("s/popout", "0.9") }} | ||
{{ url("s/popup", "0.9") }} | ||
{{ url("s/states", "0.9") }} | ||
{{ url("s/tables", "0.9") }} | ||
{{ url("s/types", "0.9") }} | ||
{{ url("s/variables", "0.9") }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{ url("s/bar", "0.9") }} | |
{{ url("s/box", "0.9") }} | |
{{ url("s/buttons", "0.9") }} | |
{{ url("s/components", "0.9") }} | |
{{ url("s/forms", "0.9") }} | |
{{ url("s/gettingstarted", "0.9") }} | |
{{ url("s/guidelines", "0.9") }} | |
{{ url("s/messages", "0.9") }} | |
{{ url("s/mixins", "0.9") }} | |
{{ url("s/popout", "0.9") }} | |
{{ url("s/popup", "0.9") }} | |
{{ url("s/states", "0.9") }} | |
{{ url("s/tables", "0.9") }} | |
{{ url("s/types", "0.9") }} | |
{{ url("s/variables", "0.9") }} | |
{% for menu in getMenu() -%} | |
{% for site, name in menu.items() if site != "start" -%} | |
{{ url("s/%s" % site, "0.9") }} | |
{% endfor %} | |
{% endfor %} |
// Burger Menu Mobile | ||
$('.js_burger').click(function() { | ||
$('.mainmenu').toggleClass("is-open"); | ||
$('.burger').toggleClass(""); | ||
$('html').toggleClass("no-scroll"); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This project doesn't uses jQuery and there's is no .js_burger
element.
from viur.core.render import admin, html, json, vi, xml | ||
|
||
@html.utils.jinjaGlobalFilter | ||
def isList(render, val): | ||
return isinstance(val, list) | ||
|
||
@html.utils.jinjaGlobalFilter | ||
def isDict(render, val): | ||
return isinstance(val, dict) | ||
|
||
# -*- coding: utf-8 -*- | ||
import render.html | ||
from server.render import admin, json, vi | ||
import os | ||
from collections import OrderedDict | ||
|
||
from viur.core import conf, request, utils | ||
from viur.core.render.html import default as defaultRender | ||
from viur.core.render.html.utils import jinjaGlobalFunction | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can please clean up the order of imports and methods...
def requestPreprocessor(path): | ||
def isWhitelisted(): | ||
reqPath = request.current.get().request.path | ||
for testUrl in conf["viur.noSSLCheckUrls"]: | ||
if testUrl.endswith("*"): | ||
if reqPath.startswith(testUrl[:-1]): | ||
return True | ||
else: | ||
if testUrl == reqPath: | ||
return True | ||
return False | ||
|
||
url = request.current.get().request.url | ||
if "://ignite.viur.is" in url and not isWhitelisted(): | ||
raise errors.Redirect(url.replace("://ignite.viur.is", "://ignite.viur.dev"), status=301) | ||
|
||
return path | ||
|
||
|
||
conf["viur.requestPreprocessor"] = requestPreprocessor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please keep the requestPreprocessor
?
Whole project running on ViUR3 now.