mirror of https://github.com/akveo/blur-admin
Merge branch 'v2' of https://github.com/1itvinka/blur-admin into v2
commit
784a533647
|
@ -22,8 +22,9 @@
|
|||
.state('form-wizard',
|
||||
{
|
||||
url: '/form-wizard',
|
||||
templateUrl: 'app/pages/form/wizard/wizard.html',
|
||||
controller: 'WizardCtrl'
|
||||
templateUrl: 'app/pages/form/wizard/wizardPage.html',
|
||||
controller: 'WizardCtrl',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<section ng-show="selected" class="tab" ng-transclude></section>
|
|
@ -1,119 +1,25 @@
|
|||
<div class="widgets">
|
||||
|
||||
<div class="wizard">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<blur-panel title="Form Wizard" class-container="with-scroll">
|
||||
<div class="row">
|
||||
<div class="mail-navigation-container">
|
||||
<div ng-repeat="t in tabs" class="mail-navigation {{tab == $index ? 'active' : ''}}" ng-click="selectTab($index)">
|
||||
{{t.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="progress progress-wizard">
|
||||
<div class="progress-bar progress-bar-info active" role="progressbar"
|
||||
aria-valuenow="{{progress}}" aria-valuemin="0" aria-valuemax="100" style="{{'width: ' + progress + '%;'}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="wizardForm">
|
||||
<div ng-show="tab == 0">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputFirstName">First Name</label>
|
||||
<input type="text" class="form-control" id="inputFirstName" placeholder="First Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputLastName">Last Name</label>
|
||||
<input type="text" class="form-control" id="inputLastName" placeholder="Last Name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputFirstName">Email</label>
|
||||
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputWebsite">Website</label>
|
||||
<input type="text" class="form-control" id="inputWebsite" placeholder="Website">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
|
||||
<div ng-show="tab == 1">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1">Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Check me out</span>
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-danger">Submit</button>
|
||||
</div>
|
||||
|
||||
<div ng-show="tab == 2">
|
||||
<div class="form-group">
|
||||
<label for="input01">Text</label>
|
||||
<input type="text" class="form-control" id="input01" placeholder="Text">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="input02">Password</label>
|
||||
<input type="password" class="form-control" id="input02" placeholder="Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="input03">Rounded Corners</label>
|
||||
<input type="text" class="form-control form-control-rounded" id="input03" placeholder="Rounded Corners">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="input04">With help</label>
|
||||
<input type="text" class="form-control" id="input04" placeholder="With help">
|
||||
<span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="input05">Disabled Input</label>
|
||||
<input type="text" class="form-control" id="input05" placeholder="Disabled Input" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="textarea01">Textarea</label>
|
||||
<textarea placeholder="Default Input" class="form-control" id="textarea01"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control input-sm" id="input2" placeholder="Small Input">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control input-lg" id="input4" placeholder="Large Input">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<nav>
|
||||
<ul class="pager wizard-pager">
|
||||
<li class="previous"><button ng-disabled="isFirstTab()" ng-click="previousTab()" type="button" class=" btn btn-primary"><span aria-hidden="true">←</span> previous</button></li>
|
||||
<li class="next"> <button ng-disabled="isLastTab()" ng-click="nextTab()" type="button" class="btn btn-primary">next <span aria-hidden="true">→</span></button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</blur-panel>
|
||||
<div class="wizard-navigation-container">
|
||||
<div ng-repeat="t in $baWizardController.tabs" class="wizard-navigation {{$baWizardController.tabNum == $index ? 'active' : ''}}" ng-click="$baWizardController.selectTab($index)">
|
||||
{{t.title}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="progress progress-wizard">
|
||||
<div class="progress-bar progress-bar-info active" role="progressbar"
|
||||
aria-valuenow="{{$baWizardController.progress}}" aria-valuemin="0" aria-valuemax="100" style="{{'width: ' + progress + '%;'}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="steps" ng-transclude></div>
|
||||
|
||||
<nav>
|
||||
<ul class="pager wizard-pager">
|
||||
<li class="previous"><button ng-disabled="$baWizardController.isFirstTab()" ng-click="$baWizardController.previousTab()" type="button" class=" btn btn-primary"><span aria-hidden="true">←</span> previous</button></li>
|
||||
<li class="next"> <button ng-disabled="$baWizardController.isLastTab()" ng-click="$baWizardController.nextTab()" type="button" class="btn btn-primary">next <span aria-hidden="true">→</span></button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<div class="widgets">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<blur-panel title="Form Wizard" class-container="with-scroll">
|
||||
<ba-wizard>
|
||||
<ba-wizard-tab title="Personal info">
|
||||
<form name="vm.personalInfoForm" novalidate>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email" required max="5">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1">Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" required>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Check me out</span>
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-danger">Submit</button>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Product Info">
|
||||
<form name="productInfoForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputFirstName">First Name</label>
|
||||
<input type="text" class="form-control" id="inputFirstName" placeholder="First Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputLastName">Last Name</label>
|
||||
<input type="text" class="form-control" id="inputLastName" placeholder="Last Name">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputFirstName">Email</label>
|
||||
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="inputWebsite">Website</label>
|
||||
<input type="text" class="form-control" id="inputWebsite" placeholder="Website">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Payment">
|
||||
<form class="row form-inline" name="paymentForm" novalidate>
|
||||
<div class="form-group col-sm-3 col-xs-6">
|
||||
<input type="text" class="form-control" id="exampleInputName2" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-group col-sm-3 col-xs-6">
|
||||
<input type="email" class="form-control" id="exampleInputEmail2" placeholder="Email">
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Remember me</span>
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Send invitation</button>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Finish">
|
||||
<form class="form-horizontal" name="finishForm" novalidate>
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-2 control-label">Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Remember me</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-warning">Sign in</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
</ba-wizard>
|
||||
</blur-panel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -2,53 +2,96 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.pages.form')
|
||||
.controller('WizardCtrl', WizardCtrl);
|
||||
.controller('WizardCtrl', WizardCtrl)
|
||||
.directive('baWizard', baWizard)
|
||||
.directive('baWizardTab', baWizardTab);
|
||||
|
||||
/** @ngInject */
|
||||
function WizardCtrl($scope, $location, $sce) {
|
||||
$scope.tabs = [
|
||||
{
|
||||
name: 'Step 1'
|
||||
},
|
||||
{
|
||||
name: 'Step 2'
|
||||
},
|
||||
{
|
||||
name: 'Step 3'
|
||||
}];
|
||||
var vm = this;
|
||||
setTimeout(function (evt, isValid) {
|
||||
console.log(vm.personalInfoForm);
|
||||
$scope.formValid = isValid;
|
||||
}, 1000);
|
||||
$scope.bla= 'Ctrl'
|
||||
}
|
||||
|
||||
$scope.$watch('tab', countProgress);
|
||||
function baWizard() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
templateUrl: 'app/pages/form/wizard/wizard.html',
|
||||
controllerAs: '$baWizardController',
|
||||
controller: ['$scope', function ($scope) {
|
||||
var vm = this;
|
||||
vm.tabs = [];
|
||||
|
||||
$scope.selectTab = function (tab) {
|
||||
$scope.tab = tab;
|
||||
};
|
||||
vm.tabNum = 0;
|
||||
vm.progress = 0;
|
||||
|
||||
$scope.isSelectedTab = function (tab) {
|
||||
return $scope.tab === tab;
|
||||
};
|
||||
vm.addTab = function(tab) {
|
||||
vm.tabs.push(tab);
|
||||
vm.selectTab(0);
|
||||
};
|
||||
|
||||
$scope.isFirstTab = function () {
|
||||
return $scope.tab == 0;
|
||||
};
|
||||
$scope.$watch(angular.bind(vm, function () {return vm.tabNum;}), countProgress);
|
||||
|
||||
$scope.isLastTab = function () {
|
||||
return $scope.tab == $scope.tabs.length - 1 ;
|
||||
};
|
||||
vm.selectTab = function (tabNum) {
|
||||
vm.tabNum = tabNum;
|
||||
vm.tabs.forEach(function (t, tIndex) {
|
||||
tIndex == vm.tabNum ? t.select(true) : t.select(false);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.nextTab = function () {
|
||||
$scope.tab++;
|
||||
};
|
||||
vm.isFirstTab = function () {
|
||||
return vm.tabNum == 0;
|
||||
};
|
||||
|
||||
$scope.previousTab = function () {
|
||||
$scope.tab--;
|
||||
};
|
||||
vm.isLastTab = function () {
|
||||
return vm.tabNum == vm.tabs.length - 1 ;
|
||||
};
|
||||
|
||||
function countProgress() {
|
||||
$scope.progress = (($scope.tab + 1) / $scope.tabs.length) * 100;
|
||||
vm.nextTab = function () {
|
||||
vm.tabNum++;
|
||||
};
|
||||
|
||||
vm.previousTab = function () {
|
||||
vm.tabNum--;
|
||||
};
|
||||
|
||||
function countProgress() {
|
||||
vm.progress = ((vm.tabNum + 1) / vm.tabs.length) * 100;
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
$scope.tab = 0;
|
||||
$scope.progress = 0;
|
||||
function baWizardTab() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
require: '^baWizard',
|
||||
scope: {
|
||||
availability: '='
|
||||
},
|
||||
templateUrl: 'app/pages/form/wizard/tab.html',
|
||||
link: function($scope, $element, $attrs, wizard) {
|
||||
$scope.selected = true;
|
||||
|
||||
function select(isSelected) {
|
||||
if (isSelected) {
|
||||
$scope.selected = true;
|
||||
} else {
|
||||
$scope.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
wizard.addTab({
|
||||
title: $attrs.title,
|
||||
select: select
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
@ -498,4 +498,22 @@ label.custom-input-danger {
|
|||
.next {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.wizard-navigation-container {
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
padding: 15px 0;
|
||||
.wizard-navigation {
|
||||
cursor: pointer;
|
||||
display: table-cell;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
font-weight: 100;
|
||||
font-size: 18px;
|
||||
&.active {
|
||||
color: $primary-dark;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue