Commit bdc4f3fc14d7040d73a0cd811d0ff6994c6d800f
1 parent
b229e40a
added constant for ethnicity and modesty.
added by default laod of mail body view list.
Showing
4 changed files
with
74 additions
and
84 deletions
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj.user
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <VisualStudio> |
8 | 8 | <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> |
9 | 9 | <WebProjectProperties> |
10 | - <StartPageUrl>login.html</StartPageUrl> | |
10 | + <StartPageUrl>app/views/da/da-body-view-list.html</StartPageUrl> | |
11 | 11 | <StartAction>SpecificPage</StartAction> |
12 | 12 | <AspNetDebugging>True</AspNetDebugging> |
13 | 13 | <SilverlightDebugging>False</SilverlightDebugging> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -AIA.controller("DAController", ["$scope","$http", "$log", "$location", "$timeout", | |
4 | - function ($scope,$http, $log, $location, $timeout) { | |
3 | +AIA.controller("DAController", ["$scope", "$compile", "$http", "$log", "$location", "$timeout","DA", | |
4 | + function ($scope, $compile,$http, $log, $location, $timeout,DA ) { | |
5 | 5 | |
6 | 6 | $scope.genderId = ""; |
7 | 7 | $scope.BodyViewData = null; |
8 | 8 | $scope.selectedGenderBodyViewData = null; |
9 | 9 | $scope.imagePath = ""; |
10 | 10 | |
11 | - //get body view list data | |
12 | - $http({ method: 'GET', url: 'http://localhost/AIA/content/data/json/da_dat_contentlist.json' }).success(function (data) { | |
13 | - debugger; | |
14 | - $scope.BodyViewData = data; | |
15 | - //clonsole.log($scope.BodyRegionData); | |
16 | - }) | |
17 | - .error(function (data, status, headers, config) { | |
18 | - console.log(data); | |
19 | - }); | |
11 | + | |
20 | 12 | |
21 | 13 | |
22 | 14 | |
23 | 15 | //get the DA body view list based on selected gender |
24 | 16 | $scope.getDAViewList = function ($event) { |
25 | 17 | |
26 | - debugger; | |
18 | + | |
27 | 19 | $("#bodyViewList").empty(); |
28 | 20 | //for default load |
29 | 21 | if ($event == null) { |
... | ... | @@ -39,26 +31,27 @@ AIA.controller("DAController", ["$scope","$http", "$log", "$location", "$timeout |
39 | 31 | |
40 | 32 | |
41 | 33 | angular.forEach($scope.selectedGenderBodyViewData, function (value, key) { |
42 | - // debugger | |
34 | + | |
35 | + var userEthnicity = DA[0].ethnicity; | |
36 | + var userModestysettings = DA[0].modesty; | |
43 | 37 | var userSelectedSkintone = 'W'; |
44 | 38 | $scope.userModestySetting = 'Y' |
45 | - var thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userSelectedSkintone + $scope.userModestySetting)) + '.jpg'; | |
46 | - $scope.imagePath = "http://localhost/AIA/content/images/DA/BodyViews/" + value._id + '/skintone/' + userSelectedSkintone + '/' + thumbnailImage; | |
39 | + var thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userEthnicity + userModestysettings)) + '.jpg'; | |
40 | + $scope.imagePath = "http://localhost/AIA/content/images/DA/BodyViews/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage; | |
47 | 41 | |
48 | 42 | $scope.isImageExists = $scope.checkImgExistance($scope.imagePath); |
49 | - | |
43 | + //debugger | |
50 | 44 | |
51 | 45 | if ($scope.isImageExists == false) { |
52 | 46 | $scope.imagePath = ($scope.imagePath).replace($scope.userModestySetting, ""); |
53 | 47 | } |
54 | 48 | |
55 | - var bodyView = '<div class="col-sm-3 col-lg-2"><div class="thumbnail"><a href="male-lateral.html">' | |
56 | - + '<img class= "daImg" id="' + value._title + '" src="' + $scope.imagePath + '" alt="" title="" ng-click=openView()>' | |
57 | - + '<div class="caption"><p>' + value._title + '</p></div></a></div></div>'; | |
58 | - | |
59 | - | |
60 | - $('#bodyViewList').append(bodyView); | |
61 | - | |
49 | + //debugger | |
50 | + var $el = $('<div id=' + value._id + ' class="col-sm-3 col-lg-2" data-ng-click="openView($event)"><div class="thumbnail" >' | |
51 | + + '<img class= "daImg" id="' + value._title + '" src="' + $scope.imagePath + '" alt="" title="" >' | |
52 | + + '<div class="caption"><p>' + value._title + '</p></div></a></div></div>').appendTo('#bodyViewList'); | |
53 | + $compile($el)($scope); | |
54 | + | |
62 | 55 | |
63 | 56 | }); |
64 | 57 | |
... | ... | @@ -79,13 +72,40 @@ AIA.controller("DAController", ["$scope","$http", "$log", "$location", "$timeout |
79 | 72 | |
80 | 73 | }, |
81 | 74 | }) |
82 | - debugger; | |
75 | + debugger | |
83 | 76 | return result; |
84 | 77 | } |
85 | 78 | |
86 | - $(document).on("click", ".daImg", function () { | |
87 | - alert('opening') | |
79 | + | |
80 | + | |
81 | + $scope.openView = function ($event) { | |
82 | + alert('clicked: ' + $event.currentTarget.id) | |
83 | + } | |
84 | + | |
85 | + | |
86 | + //load json data for body view | |
87 | + $scope.loadData = function () { | |
88 | + $http({ method: 'GET', url: 'http://localhost/AIA/content/data/json/da_dat_contentlist.json' }).success(function (data) { | |
89 | + | |
90 | + $scope.BodyViewData = data; | |
91 | + //load default body view list for male | |
92 | + $scope.getDAViewList(); | |
93 | + | |
94 | + }) | |
95 | + .error(function (data, status, headers, config) { | |
96 | + console.log(data); | |
97 | + }); | |
98 | + } | |
99 | + | |
100 | + | |
101 | + angular.element(document).ready(function () { | |
102 | + | |
103 | + | |
104 | + | |
88 | 105 | }) |
89 | 106 | |
90 | 107 | }] |
108 | + | |
109 | + | |
110 | + | |
91 | 111 | ); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... | ... | @@ -3,47 +3,6 @@ |
3 | 3 | var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute']); |
4 | 4 | |
5 | 5 | |
6 | -AIA.directive('checkImageExistance', function ($http) { | |
7 | - return { | |
8 | - restrict: 'A', | |
9 | - link: function (scope, element, attrs) { | |
10 | - debugger; | |
11 | - attrs.$observe('ngSrc', function (ngSrc) { | |
12 | - $http.get(ngSrc).success(function () { | |
13 | - alert('image exist'); | |
14 | - }).error(function () { | |
15 | - alert('image not exist'); | |
16 | - element.attr('src', 'http://upload.wikimedia.org/wikipedia/commons/7/73/Lion_waiting_in_Namibia.jpg'); // set default image | |
17 | - }); | |
18 | - }); | |
19 | - } | |
20 | - }; | |
21 | -}); | |
22 | - | |
23 | - | |
24 | -AIA.directive('nnkn', function () { | |
25 | - return { | |
26 | - restrict: 'E', | |
27 | - link: function (scope, element, attrs) { | |
28 | - alert('nt') | |
29 | - // show an image-missing image | |
30 | - element.error(function () { | |
31 | - alert('not exist') | |
32 | - var w = element.width(); | |
33 | - var h = element.height(); | |
34 | - var source = element.src; | |
35 | - // using 20 here because it seems even a missing image will have ~18px width | |
36 | - // after this error function has been called | |
37 | - if (w <= 20) { w = 100; } | |
38 | - if (h <= 20) { h = 100; } | |
39 | - var url = 'http://placehold.it/' + w + 'x' + h + '/cccccc/ffffff&text=Oh No!'; | |
40 | - element.prop('src', url); | |
41 | - element.css('border', 'double 3px #cccccc'); | |
42 | - }); | |
43 | - } | |
44 | - } | |
45 | -}); | |
46 | - | |
47 | 6 | |
48 | 7 | AIA.constant('pages', [ |
49 | 8 | { |
... | ... | @@ -67,6 +26,15 @@ AIA.constant('pages', [ |
67 | 26 | ]); |
68 | 27 | |
69 | 28 | |
29 | +AIA.constant('DA', [ | |
30 | + { | |
31 | + ethnicity: 'W', | |
32 | + modesty: 'Y', | |
33 | + | |
34 | + }, | |
35 | +]); | |
36 | + | |
37 | + | |
70 | 38 | AIA.config(function ($routeProvider, pages) { |
71 | 39 | for (var i = 0; i < pages.length; i++) { |
72 | 40 | if (pages[i].pageSlug != null) { | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/da/da-body-view-list.html
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <link href="../../../themes/default/css/bootstrap/3.3.6/jquery.mCustomScrollbar.css" rel="stylesheet" /> |
21 | 21 | <link href="../../../themes/default/css/bootstrap/3.3.6/jquery-ui.css" rel="stylesheet" /> |
22 | 22 | </head> |
23 | -<body> | |
23 | +<body ng-controller="DAController"> | |
24 | 24 | <div class="container-fluid "> |
25 | 25 | <!--Header--> |
26 | 26 | <nav class="navbar navbar-inverse navbar-fixed-top"> |
... | ... | @@ -160,27 +160,29 @@ |
160 | 160 | </ul> |
161 | 161 | </div> |
162 | 162 | <!--Main--> |
163 | - <div class="main" ng-controller="DAController"> | |
164 | - <div class="col-sm-12"> | |
165 | - <div id="inner-anatomyPage" ng-init="getDAViewList($event)"> | |
163 | + <div ng-init="loadData()"> | |
164 | + <div class="main"> | |
165 | + <div class="col-sm-12"> | |
166 | + <div id="inner-anatomyPage" > | |
166 | 167 | |
167 | - <!-- Nav tabs --> | |
168 | - <ul class="nav nav-tabs" role="tablist"> | |
169 | - <li role="presentation" id="Male" class="active" ng-click="getDAViewList($event)"><a><i class="fa fa-mars-stroke "></i> Male</a></li> | |
170 | - <li role="presentation" id="Female" ng-click="getDAViewList($event)"><a><i class="fa fa-venus"></i> Female</a></li> | |
171 | - </ul> | |
172 | - <!--<button role="presentation" id="male" class="genderButton"><i class="fa fa-mars-stroke" ng-click="getDAViewList('male'')"></i> Male</button> | |
173 | - <button role="presentation" id="female" class="genderButton" style="background: #383838; border: 0px ;" ng-click="getDAViewList()"><i class="fa fa-venus"></i> Female</button>--> | |
174 | - <!-- Tab panes --> | |
175 | - <div class="tab-content"> | |
176 | - <div role="tabpanel" class="tab-pane active"> | |
177 | - <div class="row" id="bodyViewList"> | |
168 | + <!-- Nav tabs --> | |
169 | + <ul class="nav nav-tabs" role="tablist" > | |
170 | + <li role="presentation" id="Male" class="active" ng-click="getDAViewList($event)"><a><i class="fa fa-mars-stroke "></i> Male</a></li> | |
171 | + <li role="presentation" id="Female" ng-click="getDAViewList($event)"><a><i class="fa fa-venus"></i> Female</a></li> | |
172 | + </ul> | |
173 | + <!--<button role="presentation" id="male" class="genderButton"><i class="fa fa-mars-stroke" ng-click="getDAViewList('male'')"></i> Male</button> | |
174 | + <button role="presentation" id="female" class="genderButton" style="background: #383838; border: 0px ;" ng-click="getDAViewList()"><i class="fa fa-venus"></i> Female</button>--> | |
175 | + <!-- Tab panes --> | |
176 | + <div class="tab-content"> | |
177 | + <div role="tabpanel" class="tab-pane active"> | |
178 | + <div class="row" id="bodyViewList"> | |
178 | 179 | |
179 | 180 | |
180 | 181 | |
182 | + </div> | |
181 | 183 | </div> |
182 | - </div> | |
183 | 184 | |
185 | + </div> | |
184 | 186 | </div> |
185 | 187 | </div> |
186 | 188 | </div> | ... | ... |