Skip to content

Commit

Permalink
Dev: added "No Bootstrap" template, first step
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Oct 16, 2017
1 parent 99165bc commit 3fbe61b
Show file tree
Hide file tree
Showing 90 changed files with 5,298 additions and 8 deletions.
23 changes: 15 additions & 8 deletions templates/minimal/config.xml → templates/nobootstrap/config.xml
Expand Up @@ -8,17 +8,17 @@
<config>
<!-- Those metadata will be displayed in the template configuration page. They are not used for now. -->
<metadatas>
<name>Minimal</name>
<creationDate>08/01/2016</creationDate>
<name>no_bootstrap</name>
<creationDate>16/10/2017</creationDate>
<author>Louis-Sébastien Gac Artigas</author>
<authorEmail>louis.gac@limesurvey.org</authorEmail>
<authorUrl>http://www.limesurvey.org</authorUrl>
<copyright>Copyright (C) 2005 - 2016 LimeSurvey Gmbh, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later</license>
<version>1.0</version>
<apiVersion>3</apiVersion>
<description><![CDATA[<strong>LimeSurvey Minimal Template</strong><br>A clean and simple base that can be used by developers to create their own Bootstrap based template.]]></description>
<last_update>2016-11-14 17:21:00</last_update>
<description><![CDATA[<strong>LimeSurvey No Bootstrap Template</strong><br>A clean and simple base that can be used by developers to create their own template without Bootstrap.]]></description>
<last_update>2017-10-16 17:21:00</last_update>
</metadatas>

<!--
Expand All @@ -37,16 +37,14 @@
</print_css>
</files>

<!-- You can add here any option you want. It will be available in twig file via aSurveyInfo.options.youroptionname -->
<!-- no options in this template. Check the Advanced Template to see how to add your own custom options to your template !-->
<options>
</options>

<!-- Here datas about how LimeSurvey should load the template -->
<engine>
<!-- If empty, bootstrap css/js files will not be loaded. In the future, we may have more engines, like foundation -->
<cssframework>
<name>bootstrap</name>
</cssframework>
<cssframework></cssframework>

<!-- Path of the views files (can be different than pstpl -->
<viewdirectory>views</viewdirectory>
Expand Down Expand Up @@ -76,6 +74,7 @@
<file type="view" role="subview">./subviews/progess_bar.twig</file>
<file type="view" role="subview">./subviews/no_js_alert.twig</file>
<file type="view" role="subview">./subviews/language_changer.twig</file>
<file type="css">./css/background-image.css</file>
<file type="css">./css/template.css</file>
<file type="js">./scripts/template.js</file>
</question>
Expand All @@ -84,6 +83,7 @@
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_survey_list.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</surveylist>

Expand All @@ -94,6 +94,7 @@
<file type="view" role="subview">./subviews/warnings.twig</file>
<file type="view" role="subview">./subviews/no_js_alert.twig</file>
<file type="view" role="subview">./subviews/privacy/privacy.twig</file>
<file type="css">./css/background-image.css</file>
<file type="css">./css/template.css</file>
<file type="js">./scripts/template.js</file>
</welcome>
Expand All @@ -102,6 +103,7 @@
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_submit.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</completed>

Expand All @@ -110,31 +112,36 @@
<file type="view" role="layout">layout_submit.twig</file>
<file type="view" role="subview">./subviews/assessments.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</assessments>

<error>
<file type="view" role="layout">layout_errors.twig</file>
<file type="css">./css/errors.css</file>
</error>

<clearall>
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_clearall.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</clearall>

<load>
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_load.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</load>

<save>
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_save.twig</file>
<file type="css">./css/template.css</file>
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</save>
</screens>
Expand Down
27 changes: 27 additions & 0 deletions templates/nobootstrap/css/print_template.css
@@ -0,0 +1,27 @@
body {
font-family: arial, helvetica, sans-serif;
font-size: 12pt;
}
h1,h2,h3,h4 {
font-family: verdana, arial, helvetica, sans-serif;
}
* {
page-break-after: auto;
}
.container{width:100%}
@page{
margin: 1cm 1cm 2cm;
}
.question-wrapper {
border: 0.1em solid #aaa;
padding: 1em;
margin: 1em 0.5em;
clear: both;
page-break-inside: avoid;
page-break-before: auto;
}
.dir-ltr .question-code{margin-right:1em}
.dir-rtl .question-code{margin-left:1em}
.question-wrapper .h3{margin-top:0}
.table-print-answers thead th{text-align:center;vertical-align:bottom}
.table-print-answers tbody td{text-align:center;vertical-align:middle}
1 change: 1 addition & 0 deletions templates/nobootstrap/css/template.css
@@ -0,0 +1 @@
.top-container { margin-top: 10px}
Binary file added templates/nobootstrap/favicon.ico
Binary file not shown.
Binary file added templates/nobootstrap/files/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/nobootstrap/files/logo_340.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/nobootstrap/files/logo_w_s.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/nobootstrap/logo_pdf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/nobootstrap/poweredby.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/nobootstrap/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
150 changes: 150 additions & 0 deletions templates/nobootstrap/scripts/template.js
@@ -0,0 +1,150 @@
/*
* LimeSurvey
* Copyright (C) 2007-2016 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v3 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
*
* Description: Javascript file for templates. Put JS-functions for your template here.
*
*
*/


/**
* The function focusFirst puts the Focus on the first non-hidden element in the Survey.
* Normally this is the first input field (the first answer).
*/
function focusFirst(Event)
{
$('#limesurvey :input:visible:enabled:first').focus();
}

/**
* Code included inside this will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute
* @see https://learn.jquery.com/using-jquery-core/document-ready/
*/
$(document).ready(function()
{
/* Uncomment below if you want to use the focusFirst function */
//focusFirst();
/* Some function are launched in endpage.pstpl */
hideEmptyPart();
// If list of nav-bar action is empty: remove it (else .navbar-toggle is shown on small screen) //
if(!$("#navbar li").length){
$("#navbar").remove();
$("[data-target='#navbar']").remove();
}
// Scroll to first error
if($(".input-error").length > 0) {
$('#bootstrap-alert-box-modal').on('hidden.bs.modal', function () {
$firstError = $(".input-error").first();
$pixToScroll = ( $firstError.offset().top - 100 );
$('html, body').animate({
scrollTop: $pixToScroll + 'px'
}, 'fast');
});
}

$('.language-changer').each(function(){
$that = $(this);
if(!$.trim($that.children('div').html()))
{
$that.hide();
}
});

// Hide the menu buttons at the end of the Survey
if($(".hidemenubutton").length>0)
{
$('.navbar-right').hide();
}

// Survey list footer
if($('#surveyListFooter').length>0)
{
$surveyListFooter = $('#surveyListFooter');
$('#outerframeContainer').after($surveyListFooter);
}

$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
});
/**
* Code included inside this will run each time windows is resized
* @see https://api.jquery.com/resize/
*/
$(window).resize(function () {
fixBodyPadding();
});

/**
* Replace all existing alert default javascript function
*/
//~ window.alert = function(message, title) {
//~ $(function() {
//~ $("#bootstrap-alert-box-modal .modal-header .h4").text(title || "");
//~ $("#bootstrap-alert-box-modal .modal-body").html("<p>"+message+"</p>" || "");
//~ $("#bootstrap-alert-box-modal").modal('show');
//~ });
//~ };


/**
* fix padding of body according to navbar-fixed-top
* in endpage and in $(window).resize
*/
function fixBodyPadding(){
/* The 60 px is fixed in template.css */
$("body").css("padding-top",$(".navbar-fixed-top").height()+"px")
}
/**
* Set suffix/prefix clone for little screen (at top)
*/
function sliderSuffixClone(){
$(".numeric-multi .slider-item .slider-right").each(function(){
if($(this).closest(".slider-item").find(".slider-left").length){
var colWidth="6";
}else{
var colWidth="12";
}
$(this).clone().removeClass("col-xs-12").addClass("visible-xs-block col-xs-"+colWidth).prop("aria-hidden",true).insertBefore($(this).prev(".slider-container"));
$(this).addClass("hidden-xs");
$(this).closest(".slider-item").find(".slider-left").removeClass("col-xs-12").addClass("col-xs-6");
});
}

/**
* Hide some part if empty
* Some can be needed if contain only js
* Some are not really needed : little margin only is shown
*/
function hideEmptyPart()
{
$(".question-help-container").each(function(){
if($(this).text().trim()==""){/* Only if have only script tag inside or empty tag */
$(this).addClass("hidden");
}
});
$(".group-description").each(function(){
if($(this).text().trim()==""){/* Only if have only script tag inside or empty tag */
$(this).addClass("hidden");
}
});
$(".question-help-container.hidden").on("html:updated",function(){
if($(this).text().trim()!=""){
$(this).removeClass("hidden");
}
});
$(".question-help-container").on("html:updated",function(){ // .question-help-container:not(.hidden) don't work ?
if($(this).text().trim()==""){
$(this).addClass("hidden");
}
});
}
Binary file added templates/nobootstrap/vanilla.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions templates/nobootstrap/views/layout_clearall.twig
@@ -0,0 +1,28 @@
{#
LimeSurvey
Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Clear All Layout ·._.·´¯)·._.·´¯)
This file displays the page shown to a respondent when they have cleared the survey (only show "Restart this survey")
NOTE: It probably doesn't need to be a separated layout.
#}

{# Call the global layout #}
{% extends "./layout_global.twig" %}

{# Replace the content block #}
{% block content %}
<div class='{{ aSurveyInfo.class.clearall }}'>
<div class=" {{ aSurveyInfo.class.clearalldiv }} ">
<a href="{{ aSurveyInfo.surveyUrl }}" class="{{ aSurveyInfo.class.clearalla }}">{{ "Restart this Survey" | t}}</a>
</div>
</div>
{% endblock %}
61 changes: 61 additions & 0 deletions templates/nobootstrap/views/layout_errors.twig
@@ -0,0 +1,61 @@
{#
LimeSurvey
Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Default Template Errors Layout ·._.·´¯)·._.·´¯)
This layout is used to render errors that block survey rendering.
Eg: wrong survey id, empty group in preview group, etc.
It has no obligation to be the same layout as layout.twig, it can be completly different.
NOTE: the main purpose of this file is to show how different the layouts can be. This one has a completely different design.
To see it: just try to preview a survey with an empty group.
#}
{% set aError = aSurveyInfo.aError %}

<!DOCTYPE html>
<html lang="{{ aSurveyInfo.languagecode }}" dir="{{ aSurveyInfo.dir }}" class="{{ aSurveyInfo.languagecode }} dir-{{ aSurveyInfo.dir }} {{ aSurveyInfo.class.html }}">

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>
ERROR! {{ aSurveyInfo.surveyls_title }}
</title>

{#
NOTE: YES, it's very bad to do it here. It a first cycle. I'll see what to do once I'll done all those kind of error page
TODO: move it to a separated css file
#}
<meta name="generator" content="LimeSurvey http://www.limesurvey.org" />
<link rel="shortcut icon" href="{{ templateurl }}favicon.ico" />
</head>

<body class="{{ aSurveyInfo.class.body }} lang-{{surveylanguage}} {{surveyformat}}" marginwidth="0" marginheight="0" {{ aSurveyInfo.attr.body }}>
<div id="block_error">
<div>
<h2>{{ aError.title }}</h2>
<p>
{{ aError.message }}
</p>
<p>
{{"For further information please contact"| t }} {{ aSurveyInfo.adminname }}:<br>
<a href='mailto:{{ aSurveyInfo.adminemail }}'>{{ aSurveyInfo.adminemail }}</a>
</p>
</div>
</div>
</body>
</html>

0 comments on commit 3fbe61b

Please sign in to comment.