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

Commit

Permalink
Articles Example Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amoshaviv committed Jul 25, 2013
1 parent 6995ba2 commit ccf7eb3
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/views/includes/head.jade
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ head
link(rel='stylesheet', href='/css/common.css')

link(rel='stylesheet', href='/css/views/index.css')
link(rel='stylesheet', href='/css/views/articles.css')

//if lt IE 9
script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')
2 changes: 1 addition & 1 deletion public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

.content {
margin-top: 40px;
margin-top: 50px;
width: 100%;
}

Expand Down
11 changes: 11 additions & 0 deletions public/css/views/articles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
h1 {
text-align: center;
}

ul {
list-style: none;
}

li:not(:last-child) {
border-bottom: 1px solid #ccc;
}
3 changes: 2 additions & 1 deletion public/js/controllers/articles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function ArticlesController($scope, $routeParams, $location, Articles) {
function ArticlesController($scope, $routeParams, $location, Global, Articles) {
$scope.global = Global;
$scope.articles = [];
$scope.article = {};

Expand Down
10 changes: 10 additions & 0 deletions public/js/controllers/header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
function HeaderController($scope, $location, Global) {
$scope.global = Global;
$scope.menu = [
{
"title": "Articles",
"link": "articles"
},
{
"title": "Create New Article",
"link": "articles/create"
}
];

$scope.init = function() {

Expand Down
8 changes: 4 additions & 4 deletions public/views/articles/create.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<section data-ng-controller="ArticlesController">
<form class="form-horizontal" data-ng-submit="create()">
<div class="control-group">
<label class="control-label" for="title">כותרת</label>
<label class="control-label" for="title">Title</label>
<div class="controls">
<input type="text" data-ng-model="title" id="title" placeholder="כותרת">
<input type="text" data-ng-model="title" id="title" placeholder="Title">
</div>
</div>
<div class="control-group">
<label class="control-label" for="content">תוכן</label>
<label class="control-label" for="content">Content</label>
<div class="controls">
<textarea data-ng-model="content" id="content" cols="30" rows="10" placeholder="תוכן"></textarea>
<textarea data-ng-model="content" id="content" cols="30" rows="10" placeholder="Content"></textarea>
</div>
</div>
<div class="control-group">
Expand Down
1 change: 1 addition & 0 deletions public/views/articles/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ <h2><a data-ng-href="#!/articles/{{article._id}}">{{article.title}}</a></h2>
<div>{{article.content}}</div>
</li>
</ul>
<h1 data-ng-hide="articles.length">No articles yet. <br> Why don't you <a href="/#!/articles/create">Create One</a>?</h1>
</section>
2 changes: 1 addition & 1 deletion public/views/articles/view.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section data-ng-controller="ArticlesController" data-ng-init="findOne()">
<span>{{article.created | date:'medium'}}</span> /
<span>{{article.user.name}}</span>
<h2>{{article.title}}</h2>
<h2>{{article.title}} <a data-ng-show="global.user._id == article.user._id" href="/#!/articles/{{article._id}}/edit">edit</a></h2>
<div>{{article.content}}</div>
</section>
2 changes: 1 addition & 1 deletion public/views/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="navbar-inner" data-ng-controller="HeaderController" data-ng-init="init()">
<ul class="nav">
<li><a class="brand" href="/">MEAN - A Modern Stack</a></li>
<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>
<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>
</ul>
<ul class="nav pull-right" data-ng-hide="global.authenticated">
<li><a href="signup">Signup</a></li>
Expand Down

0 comments on commit ccf7eb3

Please sign in to comment.