Skip to content

Commit

Permalink
viewer material templates, grid question material templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mwasiluk committed Apr 12, 2016
1 parent 14865a9 commit eb1a2cd
Show file tree
Hide file tree
Showing 18 changed files with 396 additions and 93 deletions.
118 changes: 110 additions & 8 deletions demo-material/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
<h2>
<span>angular-surveys demo</span>
</h2>
<span flex></span>
<md-button aria-label="View on GitHub" class="md-icon-button" href="https://github.com/mwasiluk/angular-surveys" target="_blank">
<i class="fa fa-github fa-lg"></i>
</md-button>
<md-menu>
<md-button aria-label="Change language" class="md-icon-button" ng-click="$mdOpenMenu($event)">
<md-icon class="fa fa-flag"></md-icon>
Language
<i class="fa fa-flag fa-lg"></i>
</md-button>
<md-menu-content width="1">
<md-menu-item ng-repeat="language in ctrl.languages">
Expand All @@ -36,10 +39,10 @@ <h2>
</md-toolbar>

<md-content ng-if="ctrl.formData">
<md-tabs md-dynamic-height md-border-bottom>
<md-tabs md-dynamic-height md-border-bottom md-selected="ctrl.selectedTabIndex">
<md-tab label="Builder">
<md-content class="md-padding tab-content">
<div layout="row" layout-align="center">
<div layout="row" layout-align="center" ctrl.selectedTabIndex===0>
<div flex-gt-sm="66" flex-sm="90" >
<div layout="row" layout-align="center">
<div>
Expand All @@ -62,22 +65,121 @@ <h2>

</md-content>
</md-tab>
<md-tab label="viewer">
<md-content class="md-padding tab-content">
<md-tab label="viewer" md-on-select="ctrl.resetViewer()">
<md-content class="md-padding tab-content" >
<div layout="row" layout-align="center" ng-if="ctrl.selectedTabIndex===1">
<div flex-gt-sm="66" flex-sm="90" >
<div layout="row" layout-align="center">
<div>
<md-button class="md-primary" aria-label="Reset" ng-click="ctrl.resetViewer()">
Reset
</md-button>
<md-checkbox ng-model="ctrl.formOptions.autoStart" aria-label="Autostart">
Autostart
</md-checkbox>
<md-checkbox ng-model="ctrl.viewerReadOnly" aria-label="Read only">
Read only
</md-checkbox>
</div>
</div>

<mw-form-viewer form-data="ctrl.formData" template-data="ctrl.templateData" form-status="ctrl.formStatus" options="ctrl.formOptions" api="ctrl.formViewer" response-data="ctrl.responseData" read-only="ctrl.viewerReadOnly" on-submit="ctrl.saveResponse()"></mw-form-viewer>
<br/>
<hr/>
<br/>
<md-checkbox ng-model="ctrl.showResponseData" aria-label="Show response data">
Show response data
</md-checkbox>
<md-card ng-if="ctrl.showResponseData" class="md-padding">
<pre >
{{ctrl.responseData|json}}
</pre>
</md-card>
</div>

</div>

</md-content>
</md-tab>
<md-tab label="model">
<md-content class="md-padding tab-content">
<md-card>
<md-card class="md-padding">
<pre>
{{ctrl.formData|json}}
</pre>
</md-card>
<md-checkbox ng-model="ctrl.showModelJsonInput" aria-label="Set model value">
Set model value
</md-checkbox>

<md-card class="md-padding" ng-if="ctrl.showModelJsonInput">
<md-input-container class="md-block">
<textarea ng-model="ctrl.modelJsonInput"></textarea>
</md-input-container>
<div>
<md-button class="md-raised" ng-click="ctrl.setModelFromJsonInput()">Set</md-button>
</div>

</md-card>
</md-content>
</md-tab>
<md-tab label="utils">
<md-content class="md-padding tab-content">
<md-content class="md-padding tab-content" ctrl.selectedTabIndex===3>
<md-card class="md-padding">
<h3>mwFormResponseUtils service</h3>
<br />
<h4><a ng-click="ctrl.cmergeFormWithResponse = !ctrl.cmergeFormWithResponse" href="#mergeFormWithResponse" aria-expanded="false" aria-controls="collapseExample"> mergeFormWithResponse(formData, responseData)</a></h4>
<div ng-if="ctrl.cmergeFormWithResponse" id="mergeFormWithResponse">
<md-card class="md-padding">
<pre>
{{ctrl.getMerged() | json}}
</pre>
</md-card>
</div>

<h4><a ng-click="ctrl.cgetQuestionWithResponseList = !ctrl.cgetQuestionWithResponseList" href="#getQuestionWithResponseList" aria-expanded="false" aria-controls="collapseExample"> getQuestionWithResponseList(formData, responseData)</a></h4>
<div ng-if="ctrl.cgetQuestionWithResponseList" id="getQuestionWithResponseList">
<md-card class="md-padding">
<pre>
{{ctrl.getQuestionWithResponseList() | json}}
</pre>
</md-card>
</div>

<h4><a ng-click="ctrl.cgetResponseSheetHeaders = !ctrl.cgetResponseSheetHeaders" href="#getResponseSheetHeaders" aria-expanded="false" aria-controls="collapseExample"> getResponseSheetHeaders(formData, withQuestionNumbers)</a></h4>
<div ng-if="ctrl.cgetResponseSheetHeaders" id="getResponseSheetHeaders">
<md-card class="md-padding">
<md-checkbox ng-model="ctrl.headersWithQuestionNumber" aria-label="headersWithQuestionNumber">
headersWithQuestionNumber
</md-checkbox>
<pre>
{{ctrl.getResponseSheetHeaders() | json}}
</pre>
</md-card>
</div>

<h4><a ng-click="ctrl.cgetResponseSheetRow = !ctrl.cgetResponseSheetRow" href="#getResponseSheetRow" aria-expanded="false" aria-controls="collapseExample"> getResponseSheetRow(formData, responseData)</a></h4>
<div ng-if="ctrl.cgetResponseSheetRow" class="collapse" id="getResponseSheetRow">
<md-card class="md-padding">
<pre>
{{ctrl.getResponseSheetRow() | json}}
</pre>
</md-card>
</div>

<h4><a ng-click="ctrl.cgetResponseSheet = !ctrl.cgetResponseSheet" href="#getResponseSheet" aria-expanded="false" aria-controls="collapseExample"> getResponseSheet(formData, responseDataObjectOrList, headersWithQuestionNumber)</a></h4>
<div ng-if="ctrl.cgetResponseSheet" id="getResponseSheet">
<md-card class="md-padding">
<md-checkbox ng-model="ctrl.headersWithQuestionNumber" aria-label="headersWithQuestionNumber">
headersWithQuestionNumber
</md-checkbox>

<pre>
{{ctrl.getResponseSheet() | json}}
</pre>
</md-card>
</div>
</md-card>
</md-content>
</md-tab>
</md-tabs>
Expand Down
10 changes: 5 additions & 5 deletions demo-material/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ angular.module('app', ['ngMaterial', 'mwFormBuilder', 'mwFormViewer', 'mwFormUti
.controller('DemoController', function($q,$http, $translate, mwFormResponseUtils) {

var ctrl = this;
ctrl.mergeFormWithResponse = true;
ctrl.cgetQuestionWithResponseList = true;
ctrl.cgetResponseSheetHeaders = true;
ctrl.cgetResponseSheetRow = true;
ctrl.cgetResponseSheet = true;
ctrl.cmergeFormWithResponse = false;
ctrl.cgetQuestionWithResponseList = false;
ctrl.cgetResponseSheetHeaders = false;
ctrl.cgetResponseSheetRow = false;
ctrl.cgetResponseSheet = false;
ctrl.headersWithQuestionNumber = true;
ctrl.builderReadOnly = false;
ctrl.viewerReadOnly = false;
Expand Down
60 changes: 40 additions & 20 deletions demo-material/form-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,24 @@
}
]
}
}
],
"namedPage": false
},
{
"id": "d7b158cc2aff4c00b3d452006d79368d",
"number": 2,
"name": null,
"description": null,
"pageFlow": {
"nextPage": true,
"label": "mwForm.pageFlow.goToNextPage"
},
"elements": [
},
{
"id": "d3c87dfb2945a84ad79e9c4b888d7df3",
"orderNo": 7,
"type": "question",
"question": {
"id": "f9c1586e1f1f40705e1eefbd00224218",
"text": "range",
"type": "range",
"required": true,
"pageFlowModifier": false,
"min": 1,
"max": 10
}
},
{
"id": "1b183679857291f8ad46c03c3173e64d",
"orderNo": 1,
"orderNo": 8,
"type": "question",
"question": {
"id": "10b08afca4dff80e975f4910ee85ef3f",
Expand Down Expand Up @@ -213,10 +214,25 @@
},
"pageFlowModifier": false
}
},
}
],
"namedPage": false,
"isFirst": true,
"isLast": false
},
{
"id": "d7b158cc2aff4c00b3d452006d79368d",
"number": 2,
"name": null,
"description": null,
"pageFlow": {
"nextPage": true,
"label": "mwForm.pageFlow.goToNextPage"
},
"elements": [
{
"id": "82332304478a82ee69f2d60157930e0a",
"orderNo": 2,
"orderNo": 1,
"type": "question",
"question": {
"id": "dc640ed493ba5a00d4a44f3a216cfa34",
Expand Down Expand Up @@ -245,7 +261,7 @@
},
{
"id": "358c65a9f3590235b3b9d019722f2372",
"orderNo": 3,
"orderNo": 2,
"type": "question",
"question": {
"id": "8666ad943291900f0e5b34bc14bb18dc",
Expand Down Expand Up @@ -275,7 +291,9 @@
}
}
],
"namedPage": false
"namedPage": false,
"isFirst": false,
"isLast": false
},
{
"id": "5d9fc08eaac5739f574db0e5b86a6a36",
Expand Down Expand Up @@ -320,7 +338,9 @@
}
}
],
"namedPage": true
"namedPage": true,
"isFirst": false,
"isLast": true
}
]
}
2 changes: 1 addition & 1 deletion dist/form-builder-material-tpls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/form-builder-material.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit eb1a2cd

Please sign in to comment.