got url-linked tabs to work for admin panel
This commit is contained in:
parent
22cf37424f
commit
86d8b88231
|
@ -20,6 +20,8 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
|
|||
|
||||
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()){
|
||||
|
|
|
@ -44,12 +44,32 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
|
|||
};
|
||||
|
||||
$scope.tabData = [
|
||||
{
|
||||
heading: $filter('translate')('CREATE_TAB'),
|
||||
route: 'viewForm.create'
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('CONFIGURE_TAB'),
|
||||
templateName: 'configure'
|
||||
route: 'viewForm.configure'
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('ANALYZE_TAB'),
|
||||
route: 'viewForm.analyze'
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('SHARE_TAB'),
|
||||
route: 'viewForm.share'
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('DESIGN_TAB'),
|
||||
route: 'viewForm.design'
|
||||
}
|
||||
];
|
||||
|
||||
$scope.go = function(route){
|
||||
$state.go(route);
|
||||
};
|
||||
|
||||
$scope.designTabActive = false
|
||||
|
||||
$scope.deactivateDesignTab = function(){
|
||||
|
|
|
@ -59,22 +59,11 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<uib-tabset active="activePill" vertical="true" type="pills">
|
||||
<uib-tab index="0" heading="{{ 'CREATE_TAB' | translate }}" select="deactivateDesignTab()">
|
||||
<edit-form-directive myform="myform"></edit-form-directive>
|
||||
</uib-tab>
|
||||
<uib-tab ng-repeat="tab in tabData" index="{{$index+1}}" heading="{{tab.heading}}" select="deactivateDesignTab()">
|
||||
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'"></div>
|
||||
</uib-tab>
|
||||
<uib-tab index="2" heading="{{ 'ANALYZE_TAB' | translate }}" select="deactivateDesignTab()">
|
||||
<edit-submissions-form-directive myform="myform" user="myform.admin"></edit-submissions-form-directive>
|
||||
</uib-tab>
|
||||
<uib-tab ng-if="tabData" heading="{{ 'SHARE_TAB' | translate }}" index="3" select="deactivateDesignTab()">
|
||||
<share-form-directive actualformurl="actualFormURL"></share-form-directive>
|
||||
</uib-tab>
|
||||
<uib-tab class="design-tab" ng-if="tabData && myform.form_fields.length" heading="{{ 'DESIGN_TAB' | translate }}" index="4" select="activateDesignTab()">
|
||||
<design-form-directive myform="myform" formurl="formURL"></design-form-directive>
|
||||
<uib-tab ng-repeat="tab in tabData" index="{{$index}}" select="go(tab.route)" heading="{{tab.heading}}">
|
||||
<div ui-view></div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
1
public/modules/forms/admin/views/adminTabs/design.html
Normal file
1
public/modules/forms/admin/views/adminTabs/design.html
Normal file
|
@ -0,0 +1 @@
|
|||
<design-form-directive myform="myform" formurl="formURL"></design-form-directive>
|
1
public/modules/forms/admin/views/adminTabs/share.html
Normal file
1
public/modules/forms/admin/views/adminTabs/share.html
Normal file
|
@ -0,0 +1 @@
|
|||
<share-form-directive actualformurl="actualFormURL"></share-form-directive>
|
|
@ -43,6 +43,7 @@ angular.module('forms').config(['$stateProvider',
|
|||
controller: 'SubmitFormController',
|
||||
controllerAs: 'ctrl'
|
||||
}).state('viewForm', {
|
||||
abstract: true,
|
||||
url: '/forms/:formId/admin',
|
||||
templateUrl: 'modules/forms/admin/views/admin-form.client.view.html',
|
||||
data: {
|
||||
|
@ -60,18 +61,21 @@ angular.module('forms').config(['$stateProvider',
|
|||
}
|
||||
},
|
||||
controller: 'AdminFormController'
|
||||
}).state('viewForm.create', {
|
||||
url: '/create',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/create.html'
|
||||
}).state('viewForm.configure', {
|
||||
url: '/configure',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/configure.html'
|
||||
}).state('viewForm.design', {
|
||||
url: '/design',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/design.html'
|
||||
}).state('viewForm.share', {
|
||||
url: '/share',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/share.html'
|
||||
}).state('viewForm.analyze', {
|
||||
url: '/analyze',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/analyze.html'
|
||||
}).state('viewForm.create', {
|
||||
url: '/create',
|
||||
templateUrl: 'modules/forms/admin/views/adminTabs/create.html'
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue