Blame view
app/scripts/controllers/main.js
1.97 KB
|
c87bc1f33
|
1 2 |
define(['app'], function (app) {
'use strict';
|
|
422e7837d
|
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
app.controller('MainCtrl', function ($rootScope, $scope, $illustration, $t_shirt) {
//Action T-Shirt choice color and Back or Front
$scope.tShirtColor = $t_shirt.getTShirtColor(0);
//Set color name default
var tShirtColorFirstKey = 0;
$scope.tShirtChoiceBackFrontKey = 'front';
$scope.tShirtColorKey = tShirtColorFirstKey;
$rootScope.tShirtColorCode = $scope.tShirtColor[tShirtColorFirstKey].code;
$scope.tShirtColorName = $scope.tShirtColor[tShirtColorFirstKey].name;
$scope.tShirtImgFront = $scope.tShirtColor[tShirtColorFirstKey].img.front;
$scope.tShirtImgBack = $scope.tShirtColor[tShirtColorFirstKey].img.back;
$scope.tShirtImg = $scope.tShirtImgFront;
$scope.choiceTShirtColor = function(key) {
$scope.tShirtColorKey = key;
$rootScope.tShirtColorCode = $scope.tShirtColor[key].code;
$scope.tShirtColorName = $scope.tShirtColor[key].name;
$scope.tShirtImgFront = $scope.tShirtColor[key].img.front;
$scope.tShirtImgBack = $scope.tShirtColor[key].img.back;
if($scope.tShirtChoiceBackFrontKey == 'front') {
$scope.tShirtImg = $scope.tShirtImgFront;
} else {
$scope.tShirtImg = $scope.tShirtImgBack;
}
};
$scope.choiceTShirtBackFront = function(choice) {
if(choice == 'front') {
$scope.tShirtImg = $scope.tShirtImgFront;
} else {
$scope.tShirtImg = $scope.tShirtImgBack;
}
$scope.tShirtChoiceBackFrontKey = choice;
};
|
|
6f105dbd5
|
36 37 38 39 40 41 42 |
$scope.showIllustration = function(tab){
$scope.isShowLeftPanel = tab;
switch (tab){
case 'illustration': {
$scope.IllustrationList = $illustration.getAll();
$scope.illustrationSelectConfig = {
allowClear:true
|
|
422e7837d
|
43 |
}; |
|
6f105dbd5
|
44 45 46 47 |
break; } // case: '' } |
|
422e7837d
|
48 |
}; |
|
6f105dbd5
|
49 |
|
|
87c93a029
|
50 |
$scope.modalTShirtDesign = function() {
|
|
5fe93ca88
|
51 52 53 54 55 56 |
$('#tshirt-design').modal(
{
backdrop: 'static',
keyboard: false
}
);
|
|
6f105dbd5
|
57 |
$scope.showIllustration('default');
|
|
5fe93ca88
|
58 59 60 |
};
$scope.modalClose = function(){
$('#tshirt-design').modal('hide');
|
|
422e7837d
|
61 |
}; |
|
c87bc1f33
|
62 63 |
}); }); |