Skip to content

Commit

Permalink
issue-1156-1157: added handlebars to core (adaptlearning#1158)
Browse files Browse the repository at this point in the history
* issue-1156-1157: added handlebars to core

* issue-1156-1157: removed handlebars comments

* issue-1156-1157: removed buttons.hbs partial
  • Loading branch information
oliverfoster authored Jul 27, 2016
1 parent e93bfd4 commit 8ef54d8
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ src/menu
src/extensions
src/less
src/less/adapt.less
templates
build
bower_components
node_modules
Expand Down
2 changes: 1 addition & 1 deletion grunt/config/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = function(grunt) {
files: [
{
src: [
'<%= sourcedir %>components/**/*.hbs',
'<%= sourcedir %>core/**/*.hbs',
'<%= sourcedir %>components/**/*.hbs',
'<%= sourcedir %>extensions/**/*.hbs',
'<%= sourcedir %>menu/<%= menu %>/**/*.hbs',
'<%= sourcedir %>theme/<%= theme %>/**/*.hbs'
Expand Down
33 changes: 33 additions & 0 deletions src/core/templates/article.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{! .block-container: Adapt will place the articles blocks inside this class}}
<div class="article-inner block-container">

<div class="article-header">
{{! Check if a page title exist and render it}}
{{#if displayTitle}}
<div class="article-title">
<div role="heading" tabindex="0" class="article-title-inner h2" aria-level="2">
{{{displayTitle}}}
</div>
</div>
{{/if}}

{{! Check if page body exists and render it}}
{{#if body}}
<div class="article-body">
<div class="article-body-inner">
{{{a11y_text body}}}
</div>
</div>
{{/if}}

{{! Check if page body exists and render it}}
{{#if instruction}}
<div class="article-instruction">
<div class="article-instruction-inner">
{{{a11y_text instruction}}}
</div>
</div>
{{/if}}
</div>

</div>
32 changes: 32 additions & 0 deletions src/core/templates/block.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{! .component-container: Adapt will place the blocks components inside this class}}
<div class="block-inner">
{{! Check if a page title exist and render it}}
{{#if displayTitle}}
<div class="block-title">
<div role="heading" tabindex="0" class="block-title-inner h3" aria-level="3">
{{{displayTitle}}}
</div>
</div>
{{/if}}

{{! Check if page body exists and render it}}
{{#if body}}
<div class="block-body">
<div class="block-body-inner">
{{{a11y_text body}}}
</div>
</div>
{{/if}}

{{! Check if page body exists and render it}}
{{#if instruction}}
<div class="block-instruction">
<div class="block-instruction-inner">
{{{a11y_text instruction}}}
</div>
</div>
{{/if}}

<div class="component-container">
</div>
</div>
18 changes: 18 additions & 0 deletions src/core/templates/buttons.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="buttons-inner">
<div class="buttons-cluster clearfix">
{{#unless _shouldDisplayAttempts}}
<div class="buttons-marking-icon icon display-none">
</div>
{{/unless}}
<button class="buttons-action" aria-label="{{_buttons._submit.ariaLabel}}">{{{_buttons._submit.buttonText}}}</button>
<button class="buttons-feedback" aria-label="{{_buttons._showFeedback.ariaLabel}}" disabled="true">{{{_buttons._showFeedback.buttonText}}}</button>
</div>
{{#if _shouldDisplayAttempts}}
<div class="buttons-display">
<div class="buttons-marking-icon icon display-none">
</div>
<div class="buttons-display-inner">
</div>
</div>
{{/if}}
</div>
15 changes: 15 additions & 0 deletions src/core/templates/drawer.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="drawer-inner">
<span class='aria-label prevent-default' tabindex='0' role='region'>{{_globals._accessibility._ariaLabels.drawer}}</span>
<div class="drawer-holder">
</div>
<div class="drawer-toolbar clearfix">
<div class="drawer-back-button">
<button class="base drawer-back icon icon-controls-small-left" role="button" aria-label="{{_globals._accessibility._ariaLabels.previous}}">
</button>
</div>
<div class="drawer-close-button">
<button class="base drawer-close icon icon-cross" role="button" aria-label="{{_globals._accessibility._ariaLabels.closeDrawer}}">
</button>
</div>
</div>
</div>
8 changes: 8 additions & 0 deletions src/core/templates/drawerItem.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<button class="base drawer-item-open {{className}}">
<div class="drawer-item-title">
<div class="drawer-item-title-inner h5">{{{title}}}</div>
</div>
<div class="drawer-item-description">
<div class="drawer-item-description-inner">{{{a11y_text description}}}</div>
</div>
</button>
4 changes: 4 additions & 0 deletions src/core/templates/loading.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{! .loading-image contains the overlay with the animated image which is displayed while content is loaded in}}
<div class="loading">
<div class="loader-gif"><div role="heading" tabindex="0" class="h3" aria-level="1">Loading...</div></div>
</div>
5 changes: 5 additions & 0 deletions src/core/templates/navigation.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{! All links in the nav bar should have an attritbue of data-event, navigationView uses this to fire a global event}}
<div class="navigation-inner clearfix" role="navigation" aria-label="{{_globals._accessibility._ariaLabels.navigation}}">
<button class="base navigation-back-button icon icon-controls-small-left" data-event="backButton" role="button" aria-label="{{_globals._accessibility._ariaLabels.previous}}"></button>
<button class="base navigation-drawer-toggle-button icon icon-list" data-event="toggleDrawer" role="button" aria-label="{{_globals._accessibility._ariaLabels.navigationDrawer}}"></button>
</div>
50 changes: 50 additions & 0 deletions src/core/templates/notify.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="notify-popup notify-type-{{_type}} {{_classes}}" role="region" aria-label="{{_globals._accessibility._ariaLabels.feedbackPopUp}}">
<div class="notify-popup-inner">
<div class="notify-popup-content">
<div class="notify-popup-content-inner">
{{#if _showIcon}}
<div class="notify-popup-icon">
<div class="icon{{#if_value_equals _type "prompt"}} icon-question{{/if_value_equals}}{{#if_value_equals _type "alert"}} icon-warning{{/if_value_equals}}">
</div>
</div>
{{/if}}
{{#if title}}
<div class="notify-popup-title">
<div class="notify-popup-title-inner h5" tabindex="0" role="heading" aria-level="1">
{{{title}}}
</div>
</div>
{{/if}}
{{#if body}}
<div class="notify-popup-body">
<div class="notify-popup-body-inner">{{{a11y_text body}}}</div>
</div>
{{/if}}

{{#if_value_equals _type "alert"}}
<div class="notify-popup-buttons">
<button class="notify-popup-button notify-popup-alert-button" role="button" aria-label="{{{confirmText}}}">{{{confirmText}}}</button>
</div>
{{/if_value_equals}}

{{#if_value_equals _type "prompt"}}
<div class="notify-popup-buttons">
{{#each _prompts}}
<button class="notify-popup-button notify-popup-prompt-button" data-event="{{_callbackEvent}}" role="button" aria-label="{{{promptText}}}">{{{promptText}}}</button>
{{/each}}
</div>
{{/if_value_equals}}

</div>
</div>
{{! toolbar moved for AA purposes - last tabbable element}}
{{#if_value_equals _type "popup"}}
<button class="base notify-popup-done" role="button" aria-label="{{_globals._accessibility._ariaLabels.closePopup}}">
<div class="notify-popup-icon-close icon icon-cross"></div>
</button>
{{/if_value_equals}}
</div>
</div>


<div class="notify-shadow"></div>
15 changes: 15 additions & 0 deletions src/core/templates/notifyPush.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="notify-push-inner" role="region" aria-label="{{_globals._accessibility._ariaLabels.feedbackPopUp}}">
<div class="notify-push-title">
<div class="notify-push-title-inner h5" tabindex="0" role="heading" aria-level="1">
{{{title}}}
</div>
</div>
<div class="notify-push-body">
<div class="notify-push-body-inner">
{{{a11y_text body}}}
</div>
</div>
</div>
<button class="base notify-push-close" role="button" aria-label="{{_globals._accessibility._ariaLabels.closePopup}}">
<span class="icon icon-cross"></span>
</button>
36 changes: 36 additions & 0 deletions src/core/templates/page.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div class="page-inner article-container" role="main" aria-label="{{_globals._accessibility._ariaLabels.page}}">

<div class="page-header">
<div class="page-header-inner clearfix">

<div class="page-header-content">
<div class="page-header-content-inner">

{{#if displayTitle}}
<div class="page-title">
<div class="page-title-inner h1" tabindex="0" role="heading" aria-level="1">
{{{displayTitle}}}
</div>
</div>
{{/if}}

{{#if body}}
<div class="page-body">
<div class="page-body-inner">
{{#if pageBody}}
{{{a11y_text pageBody}}}
{{else}}
{{{a11y_text body}}}
{{/if}}
</div>
</div>
{{/if}}

</div>
</div>

</div>
</div>

</div>
<div class="aria-label relative a11y-ignore-focus prevent-default" tabindex="0" role="region">{{_globals._accessibility._ariaLabels.pageEnd}}</div>
29 changes: 29 additions & 0 deletions src/core/templates/partials/component.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div class="{{_component}}-header component-header">
<div class="{{_component}}-header-inner component-header-inner">

{{#if displayTitle}}
<div class="{{_component}}-title component-title">
<div role="heading" tabindex="0" class="{{_component}}-title-inner component-title-inner" aria-level="4">
{{{displayTitle}}}
</div>
</div>
{{/if}}

{{#if body}}
<div class="{{_component}}-body component-body">
<div class="{{_component}}-body-inner component-body-inner">
{{{a11y_text body}}}
</div>
</div>
{{/if}}

{{#if instruction}}
<div class="{{_component}}-instruction component-instruction">
<div class="{{_component}}-instruction-inner component-instruction-inner">
{{{a11y_text instruction}}}
</div>
</div>
{{/if}}

</div>
</div>
7 changes: 7 additions & 0 deletions src/core/templates/partials/state.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="accessibility-state">
{{#if _isComplete}}
<span tabindex="0" role="region" class="aria-label a11y-ignore-focus prevent-default" id="buttons-aria-label-complete">{{a11y_normalize displayTitle}} {{_globals._accessibility._ariaLabels.complete}} {{#if _isQuestionType}}{{#if _canShowFeedback}}{{#if _isCorrect}}{{_globals._accessibility._ariaLabels.correct}}{{else}}{{_globals._accessibility._ariaLabels.incorrect}}{{/if}}{{/if}}{{/if}}</span>
{{else}}
<span tabindex="0" role="region" class="aria-label a11y-ignore-focus prevent-default" id="buttons-aria-label-incomplete">{{a11y_normalize displayTitle}} {{_globals._accessibility._ariaLabels.incomplete}}</span>
{{/if}}
</div>
2 changes: 2 additions & 0 deletions src/core/templates/shadow.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{! drawerView.js will appends this on documnet's body}}
<div id="shadow" class="shadow display-none"></div>

0 comments on commit 8ef54d8

Please sign in to comment.