Skip to content

Commit 9bfb37d

Browse files
committed
added navigation
1 parent 08275b9 commit 9bfb37d

12 files changed

+258
-47
lines changed

SelfHosting.Nancy/SelfHosting.Nancy.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@
256256
<EmbeddedResource Include="Views\content\public\vendor\angular-resource.min.js" />
257257
<EmbeddedResource Include="Views\content\public\vendor\angular-mocks.js" />
258258
<EmbeddedResource Include="Views\content\public\app\common\services\productResourceMock.js" />
259+
<EmbeddedResource Include="Views\content\public\app\controllers\productListView.html" />
260+
<EmbeddedResource Include="Views\content\public\vendor\angular-ui-router.min.js" />
261+
<EmbeddedResource Include="Views\content\public\app\welcome.html" />
262+
<EmbeddedResource Include="Views\content\public\app\controllers\productEditView.html" />
263+
<EmbeddedResource Include="Views\content\public\app\controllers\productEditCtrl.js" />
264+
<EmbeddedResource Include="Views\content\public\app\controllers\productDetailView.html" />
265+
<EmbeddedResource Include="Views\content\public\app\controllers\productDetailCtrl.js" />
259266
<Content Include="Views\content\vendor\angular\angular-ui\.gitignore" />
260267
<Content Include="Views\content\vendor\angular\angular-ui\build\angular-ui-ieshiv.js" />
261268
<EmbeddedResource Include="Views\content\vendor\angular\angular-ui\build\angular-ui-ieshiv.min.js" />

SelfHosting.Nancy/Views/MasterPage.html

+67-44
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,89 @@
66
<title></title>
77
<link rel="stylesheet" type="text/css" href="/content/public/css/default.css" />
88

9-
<link rel="stylesheet" type="text/css" href="/content/vendor/bootstrap/dist/css/bootstrap-theme.min.css" />
9+
<link rel="stylesheet" type="text/css" href="/content/vendor/bootstrap/dist/css/bootstrap-theme.min.css"/>
10+
<link rel="stylesheet" type="text/css" href="/content/vendor/bootstrap/dist/css/bootstrap.min.css" />
1011
<link rel="stylesheet" type="text/css" href="/content/vendor/font-awesome/css/font-awesome.min.css" />
1112
<link rel="stylesheet" type="text/css" href="/content/vendor/angular/angular-csp.css" />
1213

1314
<link rel="stylesheet" type="text/css" href="/content/vendor/angular-ui/build/angular-ui.min.css" />
1415
</head>
1516
<body class="boxed " ng-app="productManagement">
1617

17-
<h1>Hello world Self Hosting nancy{{10+11}}</h1>
18-
19-
<div class="panel panel-primary">
20-
21-
<div class="panel-heading">Heading</div>
22-
<div class="panel-body">
2318

19+
<script src="content/vendor/jquery/dist/jquery.min.js"></script>
20+
<script src="content/vendor/angular/angular.min.js"></script>
21+
<script src="content/vendor/angular-ui/build/angular-ui-ieshiv.min.js"></script>
22+
<script src="content/vendor/angular-ui/build/angular-ui.min.js"></script>
23+
<script src="content/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
24+
<script src="content/public/vendor/angular-resource.min.js"></script>
25+
<script src="content/public/vendor/angular-mocks.js"></script>
26+
<script src="content/public/vendor/angular-ui-router.min.js"></script>
27+
<script src="content/public/app/app.js"></script>
2428

25-
<table class="table" ng-controller="ProductListCtrl as vm">
29+
<script src="content/public/app/controllers/productlistctrl.js"></script>
30+
<script src="content/public/app/common/services/common.services.js"></script>
31+
<script src="content/public/app/common/services/productResourceMock.js"></script>
32+
<script src="content/public/app/common/services/productresuource.js"></script>
2633

27-
<thead>
28-
<tr>
29-
<td>Product name</td>
30-
<td>Price </td>
31-
<td>
32-
<button type="button" ng-click="vm.toggleImage()" class="btn btn-primary">
33-
{{vm.showImage?"Hide ":"Show "}} Image
34-
</button>
35-
</td>
36-
</tr>
37-
</thead>
38-
39-
<tbody>
40-
<tr data-ng-repeat="product in vm.products">
41-
<td>{{product.productName}}</td>
42-
<td>{{product.price|currency}}</td>
43-
<td>
44-
<img ng-if="vm.showImage"
45-
ng-src="{{product.imageUrl}}"
46-
style="width: 50px; margin: 2px;" title="{{product.productName}}" />
47-
</td>
48-
</tr>
49-
</tbody>
34+
<script src="content/public/app/controllers/producteditctrl.js"></script>
35+
<script src="content/public/app/controllers/productdetailctrl.js"></script>
36+
<!--<div class="navbar navbar-inverse">
37+
<div class="container">
38+
<a class="navbar-brand">Product management</a>
39+
<div class="navbar-header">
40+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
41+
<span class="sr-only">Toggle navigation</span>
42+
<span class="icon-bar"></span>
43+
<span class="icon-bar"></span>
44+
<span class="icon-bar"></span>
45+
</button>
46+
</div>
47+
<div class="navbar-collapse collapse">
48+
<ul class="nav navbar-nav">
49+
<li><a>Product list</a></li>
50+
<li><a><i class="glyphicon glyphicon-plus"></i>Add product list</a></li>
51+
</ul>
52+
</div>
53+
</div>
54+
</div>-->
5055

51-
</table>
5256

57+
<div class="navbar navbar-inverse navbar-fixed-top">
58+
<div class="container">
59+
<a asp-controller="Home" class="navbar-brand" data-ui-sref="home">Product Management</a>
60+
<div class="navbar-header">
61+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
62+
<span class="sr-only">Toggle navigation</span>
63+
<span class="icon-bar"></span>
64+
<span class="icon-bar"></span>
65+
<span class="icon-bar"></span>
66+
</button>
67+
68+
</div>
69+
<div class="navbar-collapse collapse">
70+
<ul class="nav navbar-nav">
71+
<li><a data-ui-sref="productList">Product List</a></li>
72+
73+
<li><a data-ui-sref="productEdit({productId:0})"><i class="glyphicon glyphicon-plus"></i>Add product list</a></li>
74+
75+
</ul>
76+
77+
</div>
5378
</div>
79+
</div>
80+
81+
<h1>Hello world Self Hosting nancy{{10+11}}</h1>
82+
<div class="container">
83+
<div data-ui-view>
5484

5585
</div>
86+
</div>
87+
5688

57-
<script language="javascript" type="text/javascript" src="content/vendor/jquery/dist/jquery.min.js"></script>
58-
<script language="javascript" type="text/javascript" src="content/vendor/angular/angular.min.js"></script>
59-
<script language="javascript" type="text/javascript" src="content/vendor/angular-ui/build/angular-ui-ieshiv.min.js"></script>
60-
<script language="javascript" type="text/javascript" src="content/vendor/angular-ui/build/angular-ui.min.js"></script>
61-
<script language="javascript" type="text/javascript" src="content/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
62-
<script language="javascript" type="text/javascript" src="content/public/vendor/angular-resource.min.js"></script>
63-
<script language="javascript" type="text/javascript" src="content/public/vendor/angular-mocks.js"></script>
64-
<script language="javascript" type="text/javascript" src="content/public/app/app.js"></script>
89+
<footer>
90+
<p>&copy; 2016 - WebApplication1</p>
91+
</footer>
6592

66-
<script language="javascript" type="text/javascript" src="content/public/app/controllers/productlistctrl.js"></script>
67-
<script language="javascript" type="text/javascript" src="content/public/app/common/services/common.services.js"></script>
68-
<script language="javascript" type="text/javascript" src="content/public/app/common/services/productResourceMock.js"></script>
69-
<script language="javascript" type="text/javascript" src="content/public/app/common/services/productresuource.js"></script>
7093
</body>
7194
</html>

SelfHosting.Nancy/Views/content/public/app/app.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
"use strict";
44

5-
var app = angular.module("productManagement", ["common.services", "productResourceMock"]);
5+
var app = angular.module("productManagement", ["common.services", "ui.router", "productResourceMock"]);
6+
7+
8+
app.config(["$stateProvider", "$urlRouterProvider", function ($stateProvider, $urlRouterProvider) {
9+
10+
$urlRouterProvider.otherwise("/");
11+
12+
13+
$stateProvider.state("home", {
14+
url: "/",
15+
templateUrl: "content/public/app/welcome.html"
16+
})
17+
.state("productList", {
18+
url: "/products",
19+
templateUrl: "content/public/app/controllers/productListView.html",
20+
controller: "ProductListCtrl as vm"
21+
})
22+
.state("productEdit", {
23+
url: "/products/edit/:productId",
24+
templateUrl: "content/public/app/controllers/productEditView.html",
25+
controller: "ProductEditCtrl as vm"
26+
})
27+
.state("productDetail", {
28+
url: "/products/:productId",
29+
templateUrl: "content/public/app/controllers/productDetailView.html",
30+
controller: "ProductDetailCtrl as vm"
31+
});
32+
33+
}]);
634

735
}());

SelfHosting.Nancy/Views/content/public/app/common/services/productResourceMock.js

+2
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@
5757
];
5858

5959
$httpBackend.whenGET("/api/products").respond(products);
60+
61+
$httpBackend.whenGET(/controllers\/.*/).passThrough();
6062
});
6163
}())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(function() {
2+
3+
"use strict";
4+
5+
angular.module("productManagement").controller("ProductDetailCtrl", productDetailCtrl);
6+
7+
function productDetailCtrl() {
8+
9+
var vm = this;
10+
11+
vm.product = {
12+
"productId": 1,
13+
"productName": "Sample product 1",
14+
"price": 19.89,
15+
"cost": 9.0,
16+
"imageUrl": "http://",
17+
tags: ["leaf", "tool"]
18+
};
19+
20+
vm.title = "Product Details: " + vm.product.productName;
21+
22+
if (vm.product.tags) {
23+
vm.tagList = vm.product.tags.toString();
24+
}
25+
26+
}
27+
28+
}())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class="panel panel-primary">
2+
<div class="panel-heading" style="font-size: large">
3+
{{vm.title}}
4+
</div>
5+
6+
<div class="panel-body">
7+
<div class="row">
8+
9+
</div>
10+
</div>
11+
12+
<div class="panel-footer">
13+
<a class="btn btn-default" data-ui-sref="productList"><i class="glyphicon glyphicon-chevron-left"></i>Back</a>
14+
<a class="btn btn-primary" data-ui-sref="productEdit({productId:vm.product.productId})">Edit</a>
15+
</div>
16+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function() {
2+
"user strict";
3+
4+
angular.module("productManagement")
5+
.controller("ProductEditCtrl", ["productResource", productEditCtrl]);
6+
7+
function productEditCtrl(productResource) {
8+
var vm = this;
9+
10+
}
11+
12+
13+
//
14+
15+
}())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div class="panel panel-primary">
2+
<div class="panel panel-primary">
3+
4+
<div class="panel-heading">Product List</div>
5+
<div class="panel-body">
6+
7+
8+
<table class="table">
9+
10+
<thead>
11+
<tr>
12+
<td>Product name</td>
13+
<td>Price </td>
14+
<td>
15+
<button type="button" ng-click="vm.toggleImage()" class="btn btn-primary">
16+
{{vm.showImage?"Hide ":"Show "}} Image
17+
</button>
18+
</td>
19+
<td></td>
20+
</tr>
21+
</thead>
22+
23+
<tbody>
24+
<tr data-ng-repeat="product in vm.products">
25+
<td><a data-ui-sref="productDetail({productId:product.productId})">
26+
{{product.productName}}
27+
</a></td>
28+
<td>{{product.price|currency}}</td>
29+
<td>
30+
<img ng-if="vm.showImage"
31+
ng-src="{{product.imageUrl}}"
32+
style="width: 50px; margin: 2px;" title="{{product.productName}}"/>
33+
</td>
34+
<td>
35+
<a class="btn btn-primary" data-ui-sref="productEdit({productId:product.productId})">Edit</a>
36+
</td>
37+
</tr>
38+
</tbody>
39+
40+
</table>
41+
42+
</div>
43+
44+
</div>
45+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+

2+
3+
<div class="panel panel-primary text-center">
4+
<div class="panel-heading" style="font-size: x-large">Product management</div>
5+
<h1>Welcome !!!</h1>
6+
</div>
7+
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1-
.boxed {
2-
background: aqua;
1+
body {
2+
padding-top: 50px;
3+
padding-bottom: 20px;
4+
}
5+
6+
/* Wrapping element */
7+
/* Set some basic padding to keep content from hitting the edges */
8+
.body-content {
9+
padding-left: 15px;
10+
padding-right: 15px;
11+
}
12+
13+
/* Set widths on the form inputs since otherwise they're 100% wide */
14+
input,
15+
select,
16+
textarea {
17+
max-width: 280px;
18+
}
19+
20+
/* Carousel */
21+
.carousel-caption {
22+
z-index: 10 !important;
23+
}
24+
25+
.carousel-caption p {
26+
font-size: 20px;
27+
line-height: 1.4;
28+
}
29+
30+
@media (min-width: 768px) {
31+
.carousel-caption {
32+
z-index: 10 !important;
33+
}
334
}

SelfHosting.Nancy/Views/content/public/vendor/angular-ui-router.min.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)