Skip to content

Commit 1207941

Browse files
first draft of getting started guide
1 parent 40dc30b commit 1207941

File tree

4 files changed

+91
-4
lines changed

4 files changed

+91
-4
lines changed

Diff for: README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ add the --save option to automatically add it to your bower.json file as depende
3030
##getting local changes into other projects##
3131
- execute 'gulpw' once to ensure that a bower.json file is present within the 'dist' folder
3232
- execute 'bower link' within the 'dist' folder of cat-angular
33-
- execute 'bower link cat-angular' in the directory containing your bower.json file of your project - **NOTE** _admin privileges required_
33+
- execute 'bower link cat-angular' in the directory containing your bower.json file of your project - **NOTE** _admin privileges required_
34+
35+
36+
##Documentation##
37+
38+
[Getting started guide](doc/getting-started.md)

Diff for: doc/getting-started.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Getting started
2+
3+
In this guide you'll learn how to create a mini bookstore.
4+
5+
## The model
6+
7+
To keep things simple our model `Book` only contains three properties:
8+
- an auto-generated `id`
9+
- `name`
10+
- `author`
11+
12+
## Server
13+
14+
TODO
15+
16+
## Client
17+
### Templates
18+
19+
To get a basic CRUD (Create, Read, Update and Delete), you need three templates:
20+
- `list.tpl.html` (shows an overview of all your models, with optional searching/filtering and sorting)
21+
- `details-view.tpl.html` (detail page of a specific object)
22+
- `details-edit.tpl.html` (create and edit page of an object)
23+
24+
#### list template
25+
26+
```
27+
<table class="table">
28+
<thead>
29+
<tr>
30+
<th cat-sortable="name">Name</th>
31+
<th cat-sortable="author">Author</th>
32+
</tr>
33+
</thead>
34+
<tbody>
35+
<tr ng-repeat="data in listData.collection">
36+
<td><a ui-sref="Book.detail({id: data.id})">{{::data.name}}</a></td>
37+
<td>{{::data.author}}</td>
38+
</tr>
39+
</tbody>
40+
</table>
41+
```
42+
43+
Save this file as `book-list.tpl.html` in the `src/main/resources/static/book` directory.
44+
This template generates a table with two columns, Name and Author. The attribute `cat-sortable` marks the column sortable
45+
(the attribute value is the model attribute name). All model objects are in the `listData.collection` array.
46+
47+
#### detail view template
48+
49+
```
50+
<form class="form-horizontal">
51+
<div class="form-group">
52+
<label class="col-sm-2 control-label">Name</label>
53+
<div class="col-sm-10">
54+
<p class="form-control-static">{{::detail.name}}</p>
55+
</div>
56+
</div>
57+
<div class="form-group">
58+
<label class="col-sm-2 control-label">Author</label>
59+
<div class="col-sm-10">
60+
<p class="form-control-static">{{::detail.author}}</p>
61+
</div>
62+
</div>
63+
</form>
64+
```
65+
66+
Save this file as `book-details-view.tpl.html` in the `src/main/resources/static/book` directory.
67+
In this template the model is named `detail`. You can access the model attributes of the `Book` model with `detail.name` and `detail.author`.
68+
69+
#### detail edit template
70+
71+
```
72+
<div class="form-horizontal">
73+
<div cat-input-group label="Name" name="name">
74+
<input id="name" ng-model="editDetail.name" class="form-control" />
75+
</div>
76+
77+
<div cat-input-group label="Author" name="author">
78+
<input id="author" ng-model="editDetail.author" class="form-control" />
79+
</div>
80+
</div>
81+
```
82+
83+
Save this file as `book-details-edit.tpl.html` in the `src/main/resources/static/book` directory.
84+
This template is the form for creating and editing models. The angular model is called `editDetail`.

Diff for: src/main/javascript/controller/cat-base-tabs-controller.js

-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ function CatBaseTabsController($scope, $controller, $stateParams, $location, cat
6868
$scope.activeTab[tab.name] = isTabActive(tab);
6969
});
7070

71-
// TODO replace by url resolver service as soon as it is available
72-
7371
$scope.getTabTemplate = function (tab) {
7472
return urlResolverService.getTabTemplate(tab, config);
7573
};

Diff for: src/test/javascript/service/cat-url-resolver-service.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55

6-
describe('CatGlobalMessages', function () {
6+
describe('CatUrlResolverService', function () {
77
'use strict';
88

99
var urlResolverService;

0 commit comments

Comments
 (0)