Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 6b0109e

Browse files
committed
Articles Example Fix
1 parent 44502c0 commit 6b0109e

File tree

9 files changed

+32
-8
lines changed

9 files changed

+32
-8
lines changed

app/views/includes/head.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ head
2424
link(rel='stylesheet', href='/css/common.css')
2525

2626
link(rel='stylesheet', href='/css/views/index.css')
27+
link(rel='stylesheet', href='/css/views/articles.css')
2728

2829
//if lt IE 9
2930
script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')

public/css/common.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
}
55

66
.content {
7-
margin-top: 40px;
7+
margin-top: 50px;
88
width: 100%;
99
}
1010

public/css/views/articles.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
h1 {
2+
text-align: center;
3+
}
4+
5+
ul {
6+
list-style: none;
7+
}
8+
9+
li:not(:last-child) {
10+
border-bottom: 1px solid #ccc;
11+
}

public/js/controllers/articles.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
function ArticlesController($scope, $routeParams, $location, Articles) {
1+
function ArticlesController($scope, $routeParams, $location, Global, Articles) {
2+
$scope.global = Global;
23
$scope.articles = [];
34
$scope.article = {};
45

public/js/controllers/header.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
function HeaderController($scope, $location, Global) {
22
$scope.global = Global;
3+
$scope.menu = [
4+
{
5+
"title": "Articles",
6+
"link": "articles"
7+
},
8+
{
9+
"title": "Create New Article",
10+
"link": "articles/create"
11+
}
12+
];
313

414
$scope.init = function() {
515

public/views/articles/create.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<section data-ng-controller="ArticlesController">
22
<form class="form-horizontal" data-ng-submit="create()">
33
<div class="control-group">
4-
<label class="control-label" for="title">כותרת</label>
4+
<label class="control-label" for="title">Title</label>
55
<div class="controls">
6-
<input type="text" data-ng-model="title" id="title" placeholder="כותרת">
6+
<input type="text" data-ng-model="title" id="title" placeholder="Title">
77
</div>
88
</div>
99
<div class="control-group">
10-
<label class="control-label" for="content">תוכן</label>
10+
<label class="control-label" for="content">Content</label>
1111
<div class="controls">
12-
<textarea data-ng-model="content" id="content" cols="30" rows="10" placeholder="תוכן"></textarea>
12+
<textarea data-ng-model="content" id="content" cols="30" rows="10" placeholder="Content"></textarea>
1313
</div>
1414
</div>
1515
<div class="control-group">

public/views/articles/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ <h2><a data-ng-href="#!/articles/{{article._id}}">{{article.title}}</a></h2>
77
<div>{{article.content}}</div>
88
</li>
99
</ul>
10+
<h1 data-ng-hide="articles.length">No articles yet. <br> Why don't you <a href="/#!/articles/create">Create One</a>?</h1>
1011
</section>

public/views/articles/view.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<section data-ng-controller="ArticlesController" data-ng-init="findOne()">
22
<span>{{article.created | date:'medium'}}</span> /
33
<span>{{article.user.name}}</span>
4-
<h2>{{article.title}}</h2>
4+
<h2>{{article.title}} <a data-ng-show="global.user._id == article.user._id" href="/#!/articles/{{article._id}}/edit">edit</a></h2>
55
<div>{{article.content}}</div>
66
</section>

public/views/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="navbar-inner" data-ng-controller="HeaderController" data-ng-init="init()">
22
<ul class="nav">
33
<li><a class="brand" href="/">MEAN - A Modern Stack</a></li>
4-
<li data-ng-repeat="item in menu" data-ng-show="global.user" data-ng-class="{active: isSelected(item)}"><a href="#/{{item.link}}">{{item.title}}</a></li>
4+
<li data-ng-repeat="item in menu" data-ng-show="global.user" data-ng-class="{active: isSelected(item)}"><a href="#!/{{item.link}}">{{item.title}}</a></li>
55
</ul>
66
<ul class="nav pull-right" data-ng-hide="global.authenticated">
77
<li><a href="signup">Signup</a></li>

0 commit comments

Comments
 (0)