Some fixes for magprog
This commit is contained in:
parent
5e207a1a64
commit
be2a9499c6
@ -20,7 +20,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Hack: Enable IE flexbox workarounds.
|
// Hack: Enable IE flexbox workarounds.
|
||||||
if (browser.name === 'ie')
|
if (browser.name == 'ie')
|
||||||
$body.addClass('is-ie');
|
$body.addClass('is-ie');
|
||||||
|
|
||||||
// Play initial animations on page load.
|
// Play initial animations on page load.
|
||||||
@ -57,7 +57,7 @@
|
|||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
// External link? Bail.
|
// External link? Bail.
|
||||||
if ($this.attr('href').charAt(0) !== '#')
|
if ($this.attr('href').charAt(0) != '#')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Deactivate all links.
|
// Deactivate all links.
|
||||||
@ -96,7 +96,7 @@
|
|||||||
$section.removeClass('inactive');
|
$section.removeClass('inactive');
|
||||||
|
|
||||||
// No locked links? Deactivate all links and activate this section's one.
|
// No locked links? Deactivate all links and activate this section's one.
|
||||||
if ($sidebar_a.filter('.active-locked').length === 0) {
|
if ($sidebar_a.filter('.active-locked').length == 0) {
|
||||||
|
|
||||||
$sidebar_a.removeClass('active');
|
$sidebar_a.removeClass('active');
|
||||||
$this.addClass('active');
|
$this.addClass('active');
|
||||||
@ -139,7 +139,7 @@
|
|||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
|
||||||
// Deactivate section.
|
// Deactivate section.
|
||||||
$(this).addClass('inactive');
|
// $(this).addClass('inactive');
|
||||||
|
|
||||||
},
|
},
|
||||||
enter: function () {
|
enter: function () {
|
||||||
@ -160,7 +160,7 @@
|
|||||||
$image.css('background-image', 'url(' + $img.attr('src') + ')');
|
$image.css('background-image', 'url(' + $img.attr('src') + ')');
|
||||||
|
|
||||||
// Set background position.
|
// Set background position.
|
||||||
if (x === $img.data('position'))
|
if (x = $img.data('position'))
|
||||||
$image.css('background-position', x);
|
$image.css('background-position', x);
|
||||||
|
|
||||||
// Hide <img>.
|
// Hide <img>.
|
||||||
@ -187,20 +187,5 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
//From https://www.w3schools.com/howto/howto_js_collapsible.asp
|
|
||||||
const coll = document.getElementsByClassName("collapsible");
|
|
||||||
let i;
|
|
||||||
|
|
||||||
for (i = 0; i < coll.length; i++) {
|
|
||||||
coll[i].addEventListener("click", function() {
|
|
||||||
this.classList.toggle("active");
|
|
||||||
const content = this.nextElementSibling;
|
|
||||||
if (content.style.maxHeight){
|
|
||||||
content.style.maxHeight = null;
|
|
||||||
} else {
|
|
||||||
content.style.maxHeight = content.scrollHeight + "px";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
@ -20,8 +20,8 @@
|
|||||||
b.push(
|
b.push(
|
||||||
'<a ' +
|
'<a ' +
|
||||||
'class="link depth-' + indent + '"' +
|
'class="link depth-' + indent + '"' +
|
||||||
( (typeof target !== 'undefined' && target !== '') ? ' target="' + target + '"' : '') +
|
( (typeof target !== 'undefined' && target != '') ? ' target="' + target + '"' : '') +
|
||||||
( (typeof href !== 'undefined' && href !== '') ? ' href="' + href + '"' : '') +
|
( (typeof href !== 'undefined' && href != '') ? ' href="' + href + '"' : '') +
|
||||||
'>' +
|
'>' +
|
||||||
'<span class="indent-' + indent + '"></span>' +
|
'<span class="indent-' + indent + '"></span>' +
|
||||||
$this.text() +
|
$this.text() +
|
||||||
@ -42,7 +42,7 @@
|
|||||||
$.fn.panel = function(userConfig) {
|
$.fn.panel = function(userConfig) {
|
||||||
|
|
||||||
// No elements?
|
// No elements?
|
||||||
if (this.length === 0)
|
if (this.length == 0)
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
// Multiple elements?
|
// Multiple elements?
|
||||||
@ -153,7 +153,7 @@
|
|||||||
href = $a.attr('href'),
|
href = $a.attr('href'),
|
||||||
target = $a.attr('target');
|
target = $a.attr('target');
|
||||||
|
|
||||||
if (!href || href === '#' || href === '' || href === '#' + id)
|
if (!href || href == '#' || href == '' || href == '#' + id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Cancel original event.
|
// Cancel original event.
|
||||||
@ -166,7 +166,7 @@
|
|||||||
// Redirect to href.
|
// Redirect to href.
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
|
|
||||||
if (target === '_blank')
|
if (target == '_blank')
|
||||||
window.open(href);
|
window.open(href);
|
||||||
else
|
else
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
@ -287,7 +287,7 @@
|
|||||||
if (config.hideOnEscape)
|
if (config.hideOnEscape)
|
||||||
$window.on('keydown', function(event) {
|
$window.on('keydown', function(event) {
|
||||||
|
|
||||||
if (event.keyCode === 27)
|
if (event.keyCode == 27)
|
||||||
$this._hide(event);
|
$this._hide(event);
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -307,7 +307,7 @@
|
|||||||
return $(this);
|
return $(this);
|
||||||
|
|
||||||
// No elements?
|
// No elements?
|
||||||
if (this.length === 0)
|
if (this.length == 0)
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
// Multiple elements?
|
// Multiple elements?
|
||||||
@ -329,8 +329,8 @@
|
|||||||
|
|
||||||
var i = $(this);
|
var i = $(this);
|
||||||
|
|
||||||
if (i.val() === ''
|
if (i.val() == ''
|
||||||
|| i.val() === i.attr('placeholder'))
|
|| i.val() == i.attr('placeholder'))
|
||||||
i
|
i
|
||||||
.addClass('polyfill-placeholder')
|
.addClass('polyfill-placeholder')
|
||||||
.val(i.attr('placeholder'));
|
.val(i.attr('placeholder'));
|
||||||
@ -343,7 +343,7 @@
|
|||||||
if (i.attr('name').match(/-polyfill-field$/))
|
if (i.attr('name').match(/-polyfill-field$/))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i.val() === '')
|
if (i.val() == '')
|
||||||
i
|
i
|
||||||
.addClass('polyfill-placeholder')
|
.addClass('polyfill-placeholder')
|
||||||
.val(i.attr('placeholder'));
|
.val(i.attr('placeholder'));
|
||||||
@ -356,7 +356,7 @@
|
|||||||
if (i.attr('name').match(/-polyfill-field$/))
|
if (i.attr('name').match(/-polyfill-field$/))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i.val() === i.attr('placeholder'))
|
if (i.val() == i.attr('placeholder'))
|
||||||
i
|
i
|
||||||
.removeClass('polyfill-placeholder')
|
.removeClass('polyfill-placeholder')
|
||||||
.val('');
|
.val('');
|
||||||
@ -377,16 +377,16 @@
|
|||||||
.replace(/type=password/i, 'type=text')
|
.replace(/type=password/i, 'type=text')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (i.attr('id') !== '')
|
if (i.attr('id') != '')
|
||||||
x.attr('id', i.attr('id') + '-polyfill-field');
|
x.attr('id', i.attr('id') + '-polyfill-field');
|
||||||
|
|
||||||
if (i.attr('name') !== '')
|
if (i.attr('name') != '')
|
||||||
x.attr('name', i.attr('name') + '-polyfill-field');
|
x.attr('name', i.attr('name') + '-polyfill-field');
|
||||||
|
|
||||||
x.addClass('polyfill-placeholder')
|
x.addClass('polyfill-placeholder')
|
||||||
.val(x.attr('placeholder')).insertAfter(i);
|
.val(x.attr('placeholder')).insertAfter(i);
|
||||||
|
|
||||||
if (i.val() === '')
|
if (i.val() == '')
|
||||||
i.hide();
|
i.hide();
|
||||||
else
|
else
|
||||||
x.hide();
|
x.hide();
|
||||||
@ -398,7 +398,7 @@
|
|||||||
|
|
||||||
var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
||||||
|
|
||||||
if (i.val() === '') {
|
if (i.val() == '') {
|
||||||
|
|
||||||
i.hide();
|
i.hide();
|
||||||
x.show();
|
x.show();
|
||||||
@ -442,7 +442,7 @@
|
|||||||
if (i.attr('name').match(/-polyfill-field$/))
|
if (i.attr('name').match(/-polyfill-field$/))
|
||||||
i.attr('name', '');
|
i.attr('name', '');
|
||||||
|
|
||||||
if (i.val() === i.attr('placeholder')) {
|
if (i.val() == i.attr('placeholder')) {
|
||||||
|
|
||||||
i.removeClass('polyfill-placeholder');
|
i.removeClass('polyfill-placeholder');
|
||||||
i.val('');
|
i.val('');
|
||||||
@ -478,7 +478,7 @@
|
|||||||
|
|
||||||
x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
|
||||||
|
|
||||||
if (i.val() === '') {
|
if (i.val() == '') {
|
||||||
i.hide();
|
i.hide();
|
||||||
x.show();
|
x.show();
|
||||||
}
|
}
|
||||||
@ -498,7 +498,7 @@
|
|||||||
case 'textarea':
|
case 'textarea':
|
||||||
i.val(i.attr('defaultValue'));
|
i.val(i.attr('defaultValue'));
|
||||||
|
|
||||||
if (i.val() === '') {
|
if (i.val() == '') {
|
||||||
i.addClass('polyfill-placeholder');
|
i.addClass('polyfill-placeholder');
|
||||||
i.val(i.attr('placeholder'));
|
i.val(i.attr('placeholder'));
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@
|
|||||||
$parent = $e.parent();
|
$parent = $e.parent();
|
||||||
|
|
||||||
// No parent? Bail.
|
// No parent? Bail.
|
||||||
if ($parent.length === 0)
|
if ($parent.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Not moved? Move it.
|
// Not moved? Move it.
|
||||||
@ -552,7 +552,7 @@
|
|||||||
$p = $e.prev();
|
$p = $e.prev();
|
||||||
|
|
||||||
// Couldn't find anything? Means this element's already at the top, so bail.
|
// Couldn't find anything? Means this element's already at the top, so bail.
|
||||||
if ($p.length === 0)
|
if ($p.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Move element to top of parent.
|
// Move element to top of parent.
|
||||||
|
@ -3,6 +3,7 @@ package center.sciprog
|
|||||||
import io.ktor.server.application.Application
|
import io.ktor.server.application.Application
|
||||||
import io.ktor.server.application.call
|
import io.ktor.server.application.call
|
||||||
import io.ktor.server.application.install
|
import io.ktor.server.application.install
|
||||||
|
import io.ktor.server.application.log
|
||||||
import io.ktor.server.plugins.forwardedheaders.ForwardedHeaders
|
import io.ktor.server.plugins.forwardedheaders.ForwardedHeaders
|
||||||
import io.ktor.server.plugins.forwardedheaders.XForwardedHeaders
|
import io.ktor.server.plugins.forwardedheaders.XForwardedHeaders
|
||||||
import io.ktor.server.response.respondRedirect
|
import io.ktor.server.response.respondRedirect
|
||||||
@ -46,7 +47,7 @@ fun Application.spcModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
siteData.forEach { namedData ->
|
siteData.forEach { namedData ->
|
||||||
println("${namedData.name}: ${namedData.meta[FileData.FILE_PATH_KEY]}")
|
log.debug("Loading data {} from {}", namedData.name, namedData.meta[FileData.FILE_PATH_KEY])
|
||||||
}
|
}
|
||||||
|
|
||||||
routing {
|
routing {
|
||||||
|
@ -5,6 +5,9 @@ import kotlinx.html.*
|
|||||||
import space.kscience.dataforge.data.Data
|
import space.kscience.dataforge.data.Data
|
||||||
import space.kscience.dataforge.data.await
|
import space.kscience.dataforge.data.await
|
||||||
import space.kscience.dataforge.data.getByType
|
import space.kscience.dataforge.data.getByType
|
||||||
|
import space.kscience.dataforge.io.Binary
|
||||||
|
import space.kscience.dataforge.io.readWith
|
||||||
|
import space.kscience.dataforge.io.yaml.YamlMetaFormat
|
||||||
import space.kscience.dataforge.meta.Meta
|
import space.kscience.dataforge.meta.Meta
|
||||||
import space.kscience.dataforge.meta.get
|
import space.kscience.dataforge.meta.get
|
||||||
import space.kscience.dataforge.meta.getIndexed
|
import space.kscience.dataforge.meta.getIndexed
|
||||||
@ -45,7 +48,7 @@ private fun wrapSection(
|
|||||||
id: String,
|
id: String,
|
||||||
title: String,
|
title: String,
|
||||||
sectionContent: FlowContent.() -> Unit,
|
sectionContent: FlowContent.() -> Unit,
|
||||||
): MagProgSection = MagProgSection(id, title, "wrapper style1 fullscreen fade-up") {
|
): MagProgSection = MagProgSection(id, title, "wrapper style1 fullscreen") {
|
||||||
div("inner") {
|
div("inner") {
|
||||||
h2 { +title }
|
h2 { +title }
|
||||||
sectionContent()
|
sectionContent()
|
||||||
@ -69,7 +72,7 @@ private val ENROLL_PATH: Name = CONTENT_NODE_NAME + "enroll"
|
|||||||
private val CONTACTS_PATH: Name = CONTENT_NODE_NAME + "contacts"
|
private val CONTACTS_PATH: Name = CONTENT_NODE_NAME + "contacts"
|
||||||
private val PROGRAM_PATH: Name = CONTENT_NODE_NAME + "program"
|
private val PROGRAM_PATH: Name = CONTENT_NODE_NAME + "program"
|
||||||
private val RECOMMENDED_COURSES_PATH: Name = CONTENT_NODE_NAME + "recommendedCourses"
|
private val RECOMMENDED_COURSES_PATH: Name = CONTENT_NODE_NAME + "recommendedCourses"
|
||||||
private val PARTNERS_PATH: Name = CONTENT_NODE_NAME + "partners"
|
private val PARTNERS_PATH: Name = CONTENT_NODE_NAME + "partners.yaml".asName()
|
||||||
|
|
||||||
private val programSection = PageFragment {
|
private val programSection = PageFragment {
|
||||||
val programBlock = data.resolveHtmlOrNull(PROGRAM_PATH)!!
|
val programBlock = data.resolveHtmlOrNull(PROGRAM_PATH)!!
|
||||||
@ -90,8 +93,10 @@ private val programSection = PageFragment {
|
|||||||
|
|
||||||
|
|
||||||
private val partners = PageFragment {
|
private val partners = PageFragment {
|
||||||
//val partnersData: Meta = resolve<Any>(PARTNERS_PATH)?.meta ?: Meta.EMPTY
|
val partnersData: Meta = runBlocking {
|
||||||
val partnersData: Meta = runBlocking { data.getByType<Meta>(PARTNERS_PATH)?.await() } ?: Meta.EMPTY
|
//TODO add meta reading step to data preparation
|
||||||
|
data.getByType<Binary>(PARTNERS_PATH)?.await()?.readWith(YamlMetaFormat)
|
||||||
|
} ?: Meta.EMPTY
|
||||||
div("inner") {
|
div("inner") {
|
||||||
h2 { +"Партнеры" }
|
h2 { +"Партнеры" }
|
||||||
div("features") {
|
div("features") {
|
||||||
@ -311,13 +316,13 @@ internal val spcMasters = HtmlSite {
|
|||||||
static("images")
|
static("images")
|
||||||
static("common", "")
|
static("common", "")
|
||||||
|
|
||||||
page{
|
page {
|
||||||
val sections = listOf(
|
val sections = listOf(
|
||||||
wrapSection(data.resolveHtmlOrNull(INTRO_PATH)!!, "intro"),
|
wrapSection(data.resolveHtmlOrNull(INTRO_PATH)!!, "intro"),
|
||||||
MagProgSection(
|
MagProgSection(
|
||||||
id = "partners",
|
id = "partners",
|
||||||
title = "Партнеры",
|
title = "Партнеры",
|
||||||
style = "wrapper style3 fullscreen fade-up"
|
style = "wrapper style3 fullscreen"
|
||||||
) {
|
) {
|
||||||
fragment(partners)
|
fragment(partners)
|
||||||
},
|
},
|
||||||
@ -332,7 +337,7 @@ internal val spcMasters = HtmlSite {
|
|||||||
MagProgSection(
|
MagProgSection(
|
||||||
id = "program",
|
id = "program",
|
||||||
title = "Учебная программа",
|
title = "Учебная программа",
|
||||||
style = "wrapper style3 fullscreen fade-up"
|
style = "wrapper style3 fullscreen"
|
||||||
) {
|
) {
|
||||||
fragment(programSection)
|
fragment(programSection)
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user