Commit e10c873b authored by Anton Sudak's avatar Anton Sudak

Use main template provided by play-cms. Various tweaks to make bootstrap4 elements look better

parent 10775a9b
@(data: ch.insign.cms.blocks.errorblock.ErrorPage)
@import views.html.main
@import ch.insign.cms.views.html.main
@import ch.insign.playauth.views.helper._
@import blocks.errorblock.DefaultErrorPage
@import ch.insign.cms.permissions.ErrorPagePermission
@import ch.insign.cms.models.Template
@import ch.insign.cms.models.CollectionBlock
@(data: ch.insign.cms.blocks.errorblock.ErrorPage)
@main(page = data) {
@Template.addBlockToSlot(classOf[CollectionBlock], data, DefaultErrorPage.COLLECTION_SLOT).render()
<div class="row">
......@@ -27,5 +25,4 @@
</div>
</div>
}
}
@import blocks.pageblock.DefaultPage
@import ch.insign.cms.blocks.horizontalcollection.HorizontalCollectionBlock
@(data: DefaultPage)
@import ch.insign.cms.models.ContentBlock
@import ch.insign.cms.models.PageBlock
@import ch.insign.cms.models.Template
@import ch.insign.cms.models.CollectionBlock
@import ch.insign.cms.views.html._navigationByKey;
@import views.html.main
@import ch.insign.cms.views.html._navigationByKey
@import ch.insign.cms.views.html.main
@(data: DefaultPage)
@main(data) {
<h1>@data.getPageTitle</h1>
<div class="row">
<nav class="col-md-2" id="sidebar" role="navigation">
<div class="nav nav-pills flex-column">
@_navigationByKey(
key = PageBlock.KEY_FRONTEND,
active = data
)
</div>
</nav>
<main class="col-md-10">
<h1>@data.getPageTitle</h1>
<div class="row">
<div class="col-md-7">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "main").context("mainContext").render()
</div>
<div class="col-md-5">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "sidebar").context("sidebarContext").render()
</div>
</div>
</main>
<hr>
<section class="container">
@Template.addBlockToSlot(classOf[HorizontalCollectionBlock], data, "bottom").context("bottomContext").render()
</section>
<div class="col-md-7">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "main").context("mainContext").render()
</div>
<div class="col-md-5">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "sidebar").context("sidebarContext").render()
</div>
</div>
<hr>
<footer class="container footer">
@Template.addBlockByKey(classOf[ContentBlock], "GlobalFooter").render()
</footer>
<section class="container">
@Template.addBlockToSlot(classOf[HorizontalCollectionBlock], data, "bottom").context("bottomContext").render()
</section>
}
@import blocks.pageblock.DefaultPage
@(data: DefaultPage)
@import ch.insign.cms.blocks.horizontalcollection.HorizontalCollectionBlock
@import ch.insign.cms.models.ContentBlock
@import ch.insign.cms.models.PageBlock
@import ch.insign.cms.models.Template
@import ch.insign.cms.models.CollectionBlock
@import ch.insign.cms.views.html._navigationByKey;
@import views.html.main2
@main2(data) {
@import ch.insign.cms.views.html._navigationByKey
@import ch.insign.cms.views.html.main
@(data: DefaultPage)
@main(data) {
<h1>@data.getPageTitle</h1>
<section class="container main-content">
<div class="col-md-2" id="sidebar" role="navigation">
<div class="well sidebar-nav">
@_navigationByKey(
key = PageBlock.KEY_FRONTEND,
active = data
)
</div>
</div>
<div class="col-md-6">
<div class="box">
<div class="row">
<div class="col-md-7">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "main").context("mainContext").render()
</div>
</div>
<div class="col-md-4">
<div class="box">
<div class="col-md-5">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "sidebar").context("sidebarContext").render()
</div>
</div>
</section>
<hr>
</div>
<section class="container">
@Template.addBlockToSlot(classOf[CollectionBlock], data, "bottom").context("bottomContext").render()
@Template.addBlockToSlot(classOf[HorizontalCollectionBlock], data, "bottom").context("bottomContext").render()
</section>
<hr>
<footer class="container footer">
@Template.addBlockByKey(classOf[ContentBlock], "GlobalFooter").render()
</footer>
}
......@@ -5,6 +5,7 @@
@import crud.data.entity.Car
@import crud.page.CarInventoryPage
@import crud.views.helpers.VavrToScala.VavrOptionToScalaOption
@import ch.insign.cms.views.html.main
@(data: CarInventoryPage, cars: List[Car])
......
......@@ -324,12 +324,12 @@ public class DemoProjectBootstrapper extends DefaultBootstrapper {
@Override
protected PageBlock getNewPageInstance() {
return new DefaultPage();
return new PageBlock();
}
@Override
protected ErrorPage getErrorPageInstance() {
return new DefaultErrorPage();
return new ErrorPage();
}
/**
......
@import ch.insign.cms.models.StandalonePage
@import views.html.main
@import ch.insign.cms.views.html.main
@import party.User
@(
......
@import ch.insign.cms.models.StandalonePage
@import views.html.main
@import ch.insign.cms.views.html.main
@import play.data.Form
@import b3.vertical.fieldConstructor
@import data.form.EditPasswordForm
......
@import ch.insign.cms.models.StandalonePage
@import views.html.main
@import ch.insign.cms.views.html.main
@import party.User
@import play.data.Form
@import b3.vertical.fieldConstructor
......@@ -20,7 +20,7 @@
<script src="@_asset("javascripts/user-avatar-dropzone.js")"></script>
}
@main(page, "", Html(""), footer) {
@main(page, "", footer) {
<div class="col-md-3">
@views.html.account.partials.sidebar.render(user)
</div>
......
@* --- PLAY-CMS FRONTEND DEFAULT LAYOUT TEMPLATE --- *@
@import ch.insign.cms.models.Template
@import ch.insign.cms.models.PageBlock
@import ch.insign.cms.models.CMS
@import ch.insign.cms.blocks.sliderblock.SliderCollectionBlock
@import play.api.i18n.Messages
@import views.html.user.modals.loginFormModal
@import controllers.routes
@import ch.insign.cms.controllers.AuthController
@import ch.insign.playauth.views.helper.authenticated
@import ch.insign.playauth.views.helper.notAuthenticated
@import ch.insign.cms.views.html.deleteBlockModal
@import ch.insign.cms.views.html.restrictBlockModal
@import ch.insign.cms.views.html.unrestrictBlockModal
@import views.html.tags._asset
@import views.html.tags._webjarAsset
@import ch.insign.cms.models.AbstractBlock
@import ch.insign.cms.views.html._blockBase
@import ch.insign.playauth.views.helper._
@import party.User
@import ch.insign.cms.permissions.ApplicationPermission
@(page: ch.insign.cms.models.Page, nav: String = "", pageEditBar: Html = Html(""), footer: Html = Html(""))(content: Html)
<!DOCTYPE html>
<html lang="en">
<!-- Tpl: ch.insign.cms/views/main -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>@page.getMetaTitle</title>
<!-- Bootstrap core CSS -->
<link href="@ch.insign.cms.views.html.tags._asset("icons/favicon.ico")" rel="icon" type="image/x-icon"/>
<link rel="shortcut icon" href="@{routes.Assets.versioned("frontend/img/favicon.png")}">
<!-- Link compiled less files from app/assets/stylesheets/ -->
<!-- CSS Libraries from play-cms get imported there as well -->
<link rel="stylesheet" media="screen" href=@_asset("stylesheets/main.css") >
<link rel="stylesheet" media="screen" href=@_webjarAsset("bootstrap-modal/css/bootstrap-modal.css") >
</head>
<body>
@loginFormModal(AuthController.LOGIN_FORM ,flash.get("backUrl"), Messages("frontend.login.modal.title"))
@if(page.isInstanceOf[AbstractBlock]) {
@_blockBase.render(page.asInstanceOf[AbstractBlock], false, true, true, false, "", "", false, "", Html.apply(""))
}
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">@Messages("main.title")</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
@for(lang <- CMS.getConfig.frontendLanguages) {
<li @if(Template.getLanguage.equals(lang)){class="active"}>
<a href="@page.alternateLanguageUrl(lang)">
@lang.toUpperCase
</a>
</li>
}
@authenticated { party =>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="/" style="cursor:default" onclick="return false;">
@Messages("main.loggedin.label"):
<br/>
<strong>@party.getName</strong>
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="@controller.routes.AccountController.dashboard()">
@Messages("user.your_profile.label")
</a>
</li>
@hasPermission(ApplicationPermission.DEBUG) {
@if(Template.isDebugMode()) {
<li><a href="@request.path?debug=false">Disable Debug</a></li>
} else {
<li><a href="@request.path?debug=true">Enable Debug</a></li>
}
}
<li role="separator" class="divider"></li>
<li><a href="@CMS.getRouteResolver.logout(request.path)">@Messages("layout.menu.user.logout.title")</a></li>
</ul>
</li>
}
@notAuthenticated {
<li><a href="@controller.routes.UserController.showRegister()">@Messages("user.sign_up_button")</a></li>
<li><a href="#" data-target="#loginModal" data-toggle="modal">@Messages("login.modal.login.btn")</a></li>
}
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar -->
<section class="container main-content">
<div class="row">
<div id="flash-container" class="col-md-12">
@Template.addUncached("flashPartial", page)
</div>
</div>
</section>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
@if(page.getKey == PageBlock.KEY_HOMEPAGE) {
@Template.addBlockByKey(classOf[SliderCollectionBlock], "slider").cached
}
</div>
</div>
@content
</div><!--/.container-->
@if(!Template.isIndexer) {
@deleteBlockModal()
@restrictBlockModal()
@unrestrictBlockModal()
}
@* INFO: Include this if you want to use default javascriptRoutes instead of ScalaJs-autowire functionality *@
<script src="@{ch.insign.cms.controllers.routes.ApplicationController.javascriptRoutes}"></script>
@* remove this if you don't use scala-js for asset-management and do it conventionally by providing script-tags to your resources here *@
@scalajs.html.scripts(projectName = "client", routes.Assets.versioned(_).toString, name => getClass.getResource(s"/public/$name") != null)
@* TODO: integrate those scripts into scala-js code *@
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/login.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("javascripts/blocks.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/sortable.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/main.js")}"></script>
@* Javascript Config object for libraries in use (parsable template, Message halepers can be used to translate initObjectValues) *@
<script src="/javascripts/config" type="text/javascript"></script>
<script src="@_webjarAsset("bootstrap-notify/bootstrap-notify.min.js")" type="text/javascript"></script>
<script src="@_webjarAsset("bootstrap-modal/js/bootstrap-modal.js")"></script>
<script src="@_webjarAsset("bootstrap-modal/js/bootstrap-modalmanager.js")"></script>
<script src="@{views.html.tags._asset("javascripts/notificationSettings.js")}" type="text/javascript"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("javascripts/customNotify.js")}" type="text/javascript"></script>
@* TODO: Include this if you want to have SBT-console output in javascript console (workbench is currently not working in docker-container) *@
@*@@if(!Play.isProd) {*@
@*<script type="text/javascript" src="//localhost:12345/workbench.js"></script>**@
@*}*@
@footer
</body>
</html>
@* --- PLAY-CMS FRONTEND ALTERNATIVE LAYOUT TEMPLATE --- *@
@import ch.insign.cms.models.Template
@import ch.insign.cms.models.PageBlock
@import ch.insign.cms.models.CMS
@import ch.insign.cms.blocks.sliderblock.SliderCollectionBlock
@import play.api.i18n.Messages
@import views.html.user.modals.loginFormModal
@import controllers.routes
@import ch.insign.cms.controllers.AuthController
@import ch.insign.playauth.views.helper.authenticated
@import ch.insign.playauth.views.helper.notAuthenticated
@import ch.insign.cms.views.html.deleteBlockModal
@import ch.insign.cms.views.html.restrictBlockModal
@import ch.insign.cms.views.html.unrestrictBlockModal
@import views.html.tags._asset
@import views.html.tags._webjarAsset
@import ch.insign.cms.models.AbstractBlock
@import ch.insign.cms.views.html._blockBase
@import ch.insign.playauth.views.helper._
@import party.User
@import ch.insign.cms.permissions.ApplicationPermission
@(page: ch.insign.cms.models.Page, nav: String = "", pageEditBar: Html = Html(""), footer: Html = Html(""))(content: Html)
<!DOCTYPE html>
<html lang="en">
<!-- Tpl: ch.insign.cms/views/main -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>@page.getMetaTitle</title>
<!-- Bootstrap core CSS -->
<link href="@ch.insign.cms.views.html.tags._asset("icons/favicon.ico")" rel="icon" type="image/x-icon"/>
<link rel="shortcut icon" href="@{routes.Assets.versioned("frontend/img/favicon.png")}">
<!-- Link compiled less files from app/assets/stylesheets/ -->
<!-- CSS Libraries from play-cms get imported there as well -->
<link rel="stylesheet" media="screen" href=@_asset("stylesheets/main.min.css") >
<link rel="stylesheet" media="screen" href=@_webjarAsset("bootstrap-modal/css/bootstrap-modal.css") >
</head>
<body>
@loginFormModal(AuthController.LOGIN_FORM ,flash.get("backUrl"), Messages("frontend.login.modal.title"))
@if(page.isInstanceOf[AbstractBlock]) {
@_blockBase.render(page.asInstanceOf[AbstractBlock], false, true, true, false, "", "", false, "", Html.apply(""))
}
<div class="navbar navbar-fixed-top navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Play! CMS<small>Site 2</small></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
@for(lang <- CMS.getConfig.frontendLanguages) {
<li @if(Template.getLanguage.equals(lang)){class="active"}>
<a href="@page.alternateLanguageUrl(lang)">
@lang.toUpperCase
</a>
</li>
}
@authenticated { party =>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="/" style="cursor:default" onclick="return false;">
@Messages("main.loggedin.label"):
<br/>
<strong>@party.getName</strong>
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="@controller.routes.AccountController.dashboard()">
@Messages("user.your_profile.label")
</a>
</li>
@hasPermission(ApplicationPermission.DEBUG) {
@if(Template.isDebugMode()) {
<li><a href="@request.path?debug=false">Disable Debug</a></li>
} else {
<li><a href="@request.path?debug=true">Enable Debug</a></li>
}
}
<li role="separator" class="divider"></li>
<li><a href="@CMS.getRouteResolver.logout(request.path)">@Messages("layout.menu.user.logout.title")</a></li>
</ul>
</li>
}
@notAuthenticated {
<li><a href="@controller.routes.UserController.showRegister()">@Messages("user.sign_up_button")</a></li>
<li><a href="#" data-target="#loginModal" data-toggle="modal">@Messages("login.modal.login.btn")</a></li>
}
@for(lang <- CMS.getConfig.frontendLanguages) {
<li @if(Template.getLanguage.equals(lang)){class="active"}>
<a href="@page.alternateLanguageUrl(lang)">
@lang.toUpperCase
</a>
</li>
}
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar -->
<section class="container main-content">
<div class="row">
<div id="flash-container" class="col-md-12">
@Template.addUncached("flashPartial", page)
</div>
</div>
</section>
<div class="container">
<div class="row">
<div class="col-md-12">
@if(page.getKey == PageBlock.KEY_HOMEPAGE) {
@Template.addBlockByKey(classOf[SliderCollectionBlock], "slider").cached
}
</div>
</div>
@content
</div><!--/.container-->
@if(!Template.isIndexer) {
@deleteBlockModal()
@restrictBlockModal()
@unrestrictBlockModal()
}
@* INFO: Include this if you want to use default javascriptRoutes instead of ScalaJs-autowire functionality *@
@*<script src="@{ch.insign.cms.controllers.routes.ApplicationController.javascriptRoutes}"></script>*@
@* remove this if you don't use scala-js for asset-management and do it conventionally by providing script-tags to your resources here *@
@scalajs.html.scripts(projectName = "client", routes.Assets.versioned(_).toString, name => getClass.getResource(s"/public/$name") != null)
@* TODO: integrate those scripts into scala-js code *@
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/login.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("javascripts/blocks.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/sortable.js")}"></script>
<script src="@{ch.insign.cms.views.html.tags._asset("frontend/js/main.js")}"></script>
@* Javascript Config object for libraries in use (parsable template, Message halepers can be used to translate initObjectValues) *@
<script src="/javascripts/config" type="text/javascript"></script>
<script src="@_webjarAsset("bootstrap-modal/js/bootstrap-modal.js")"></script>
<script src="@_webjarAsset("bootstrap-modal/js/bootstrap-modalmanager.js")"></script>
@* TODO: Include this if you want to have SBT-console output in javascript console (workbench is currently not working in docker-container) *@
@*@@if(!Play.isProd) {*@
@*<script type="text/javascript" src="//localhost:12345/workbench.js"></script>**@
@*}*@
@footer
</body>
</html>
@import ch.insign.cms.models.StandalonePage
@import data.form.RegisterUserForm
@import views.html.main
@import ch.insign.cms.views.html.main
@import play.data.Form
@import b3.vertical.fieldConstructor
@import ch.insign.playauth.party.ISOGender
......
@import ch.insign.cms.models.StandalonePage
@import views.html.main
@import ch.insign.cms.views.html.main
@import play.data.Form
@import b3.vertical.fieldConstructor
@import ch.insign.cms.forms.MyIdentity
......
@import ch.insign.cms.models.StandalonePage
@import play.data.Form
@import views.html.main
@import ch.insign.cms.views.html.main
@import data.form.ResetPasswordForm
@(page: StandalonePage, resetPasswordForm: Form[ResetPasswordForm])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment