Skip to content

Instantly share code, notes, and snippets.

@tgtxmorgan
Created February 25, 2015 01:32
Show Gist options
  • Save tgtxmorgan/8c83a80740a3a15cb2cf to your computer and use it in GitHub Desktop.
Save tgtxmorgan/8c83a80740a3a15cb2cf to your computer and use it in GitHub Desktop.
<apex:page showHeader="false" sidebar="false" expires="0" cache="false" docType="html" controller="TargetX_Base.TX_CommunitiesBase" extensions="AppStartController">
<apex:composition template="{!defaultTemplate}">
<!-- use head for extra css or important js before dom load
<apex:define name="head">
<script>console.log('igothere');</script>
</apex:define>
<!-- set subheading tag to disable the boilerplate heading -->
<apex:define name="subheader"/>
<apex:define name="content">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular-sanitize.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.2.2/textAngular-sanitize.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.2.2/textAngular.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.min.js"/>
<script type="text/javascript">
var appStart = angular.module('appStart', ['ui.bootstrap','textAngular','ngSanitize']);
appStart.filter('flatten' , function() {
return function(array) {
return array.reduce(function(flatten, group) {
group.options.forEach(function(item) {
flatten.push({ group: group.process, label: item.label, value: item.value })
})
return flatten;
},[]);
}
});
appStart.controller('appStartController', function($scope,$timeout,$sce) {
$scope.keyQuestions = [
{
"label": "Program",
"field_api": "TargetX_SRMb__Program__c"
},
{
"label": "Concentration",
"field_api": "TargetX_SRMb__Anticipated_Major__c"
}
];
$scope.keyQuestionOptions = [
{
"TargetX_SRMb__Program__c": [
{"label": "Biology", "value": "Biology"},
{"label": "Political Science", "value": "Poly Sci"}
],
"TargetX_SRMb__Anticipated_Major__c": [
{"label": "Biology", "value": "Biology"},
{"label": "Grad Only", "value": "Grad Only"}
]
},
{
"TargetX_SRMb__Program__c": [
{"label": "Law School", "value": "Law"},
{"label": "MBA", "value": "MBA"}
],
"TargetX_SRMb__Anticipated_Major__c": [
{"label": "Laying down the law", "value": "Laying"},
{"label": "Business as usual", "value": "Business"}
]
}
];
$scope.answers = {};
$scope.enabled = {};
for(var q in $scope.keyQuestions)
{
$scope.answers[q.field_api] = '';
$scope.enabled[q.field_api] = false;
}
$scope.getOptions = function()
{
for(var q in $scope.keyQuestions)
{
if($scope.answers[q.field_api] == null || $scope.answers[q.field_api] == "")
{
}
}
}
});
</script>
<div ng-app="appStart" ng-controller="appStartController">
<div ng-repeat="q in keyQuestions">
<h3>{{ q.label }}</h3>
<select class="form-control style_2" name="q.field_api" ng-model="answers[q.field_api]" ng-options="getOptions()" ng-disabled="getDisabled()"/>
<div>&nbsp;</div>
</div>
</div>
</apex:define>
<!-- replace footer newsletter subscribe -->
<apex:define name="footer">
<style>
footer {
background: #005b7f;
padding-top: 20px;
}
<apex:outputText escape="false" value="{!customCss}"/>
</style>
</apex:define>
</apex:composition>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment