got static url for admin tabs to work

This commit is contained in:
David Baldwynn 2017-10-31 12:28:01 -07:00
parent 798d28d92d
commit 12e1fd0947
7 changed files with 50 additions and 104 deletions

View file

@ -42,6 +42,8 @@ block content
script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.8/angular-strap.min.js')
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js")
//Application JavaScript Files
each jsFile in jsFiles
script(type='text/javascript', src=jsFile)

View file

@ -19,9 +19,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
$state.previous = fromState;
var statesToIgnore = ['home', 'signin', 'resendVerifyEmail', 'verify', 'signup', 'signup-success', 'forgot', 'reset-invalid', 'reset', 'reset-success'];
console.log(fromState);
console.log(toState);
//Redirect to listForms if user is authenticated
if(statesToIgnore.indexOf(toState.name) > 0){
if(Auth.isAuthenticated()){

View file

@ -4,19 +4,12 @@
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$translate',
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $translate) {
//Set active tab to Create
$scope.activePill = 0;
$scope.copied = false;
$scope.onCopySuccess = function (e) {
$scope.copied = true;
};
$scope = $rootScope;
$scope.animationsEnabled = true;
$scope.myform = myForm;
$rootScope.saveInProgress = false;
$scope.oldForm = _.cloneDeep($scope.myform);
$scope.designTabActive = false
CurrentForm.setForm($scope.myform);
@ -36,7 +29,6 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
}
var refreshFrame = $scope.refreshFrame = function(){
if(document.getElementById('iframe')) {
document.getElementById('iframe').contentWindow.location.reload();
@ -46,31 +38,59 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.tabData = [
{
heading: $filter('translate')('CREATE_TAB'),
route: 'viewForm.create'
route: 'viewForm.create',
active: false
},
{
heading: $filter('translate')('CONFIGURE_TAB'),
route: 'viewForm.configure.general'
route: 'viewForm.configure.general',
active: false
},
{
heading: $filter('translate')('ANALYZE_TAB'),
route: 'viewForm.analyze'
route: 'viewForm.analyze',
active: false
},
{
heading: $filter('translate')('SHARE_TAB'),
route: 'viewForm.share'
route: 'viewForm.share',
active: false
},
{
heading: $filter('translate')('DESIGN_TAB'),
route: 'viewForm.design'
route: 'viewForm.design',
active: false
}
];
$scope.go = function(route){
$state.go(route);
$scope.go = function(tab){
$state.go(tab.route);
};
$scope.designTabActive = false
function setActiveTab() {
var start = new Date().getTime();
$scope.tabData.forEach(function(tab) {
tab.active = ($state.current.name === tab.route);
if(tab.active && tab.route === 'viewForm.design'){
$scope.designTabActive = true;
} else {
$scope.designTabActive = false;
}
});
var end = new Date().getTime();
var time = end - start;
console.log('Execution time: ' + time);
}
setActiveTab();
$scope.$on("$stateChangeSuccess", function() {
setActiveTab();
});
$scope.deactivateDesignTab = function(){
$scope.designTabActive = false

View file

@ -57,13 +57,14 @@
</div>
<div class="row">
<div class="col-xs-12">
<uib-tabset active="activePill" vertical="true" type="pills">
<uib-tab ng-repeat="tab in tabData" index="{{$index}}" select="go(tab.route)" heading="{{tab.heading}}">
<div ui-view></div>
<div >
<uib-tabset vertical="true" type="pills">
<uib-tab ng-repeat="tab in tabData" active="tab.active" select="go(tab)" heading="{{tab.heading}}">
</uib-tab>
</uib-tabset>
</div>
<div class="col-xs-10">
<div ui-view></div>
</div>
</div>
</section>

View file

@ -1,5 +1,5 @@
<div class="row">
<div class="col-sm-offset-2 col-sm-4">
<div class="col-sm-offset-2">
<div class="row field">
<div class="field-title col-sm-12">
<h5>{{ 'FORM_NAME' | translate }}</h5>
@ -86,79 +86,4 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row field">
<div class="field-title col-sm-12">
<h5>{{ 'GA_TRACKING_CODE' | translate }}</h5>
</div>
<div class="col-sm-12">
<input class="form-control"
type="text"
ng-model="myform.analytics.gaCode"
value="{{myform.analytics.gaCode}}"
style="width: 100%;"
ng-minlength="4"
placeholder="UA-XXXXX-Y"
ng-pattern="/\bUA-\d{4,10}-\d{1,4}\b/">
</div>
</div>
<div class="row field">
<div class="field-title col-sm-12">
<h5>{{ 'DISPLAY_FOOTER' | translate }}</h5>
</div>
<div class="field-input col-sm-12">
<label style="display: inline-block;">
<input type="radio" data-ng-value="false" ng-model="myform.hideFooter" ng-required="true" />
&nbsp;<span>{{ 'YES' | translate }}</span>
</label>
<label style="display: inline-block;">
<input type="radio" data-ng-value="true" ng-model="myform.hideFooter" ng-required="true" />
&nbsp;<span>{{ 'NO' | translate }}</span>
</label>
</div>
</div>
<div class="row field">
<div class="field-title col-sm-12">
<h5>{{ 'DISPLAY_START_PAGE' | translate }}</h5>
</div>
<div class="field-input col-sm-12">
<label style="display: inline-block;">
<input type="radio" data-ng-value="true" ng-model="myform.startPage.showStart" ng-required="true" style="background-color:#33CC00;"/>
&nbsp;<span>{{ 'YES' | translate }}</span>
</label>
<label style="display: inline-block;">
<input type="radio" data-ng-value="false" ng-model="myform.startPage.showStart" ng-required="true" />
&nbsp;<span>{{ 'NO' | translate }}</span>
</label>
</div>
</div>
<div class="row field">
<div class="field-title col-sm-12">
<h5>{{ 'DISPLAY_END_PAGE' | translate }}</h5>
</div>
<div class="field-input col-sm-12">
<label style="display: inline-block;">
<input type="radio" data-ng-value="true" ng-model="myform.endPage.showEnd" ng-required="true" style="background-color:#33CC00;"/>
&nbsp;<span>{{ 'YES' | translate }}</span>
</label>
<label style="display: inline-block;">
<input type="radio" data-ng-value="false" ng-model="myform.endPage.showEnd" ng-required="true" />
&nbsp;<span>{{ 'NO' | translate }}</span>
</label>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
<div class="submissions-table container">
<div class="submissions-table row">
<div class="row text-center analytics">
<div class="col-xs-12 header-title">
<div class="col-xs-3">

View file

@ -1,4 +1,4 @@
<div class="config-form">
<div class="config-form row">
<div class="row">
<div class="col-sm-12">
<uib-tabset active="activePill" vertical="true" type="pills">