-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
123 lines (102 loc) · 5.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html ng-app="desafio">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="css/extra.css"/>
<title>Favoritar</title>
</head>
<body ng-controller="Index">
<div class="container">
<h1>Favoritos</h1>
<hr/>
<blockquote ng-show="!favoritos.length">Nenhum Post Favoritado</blockquote>
<div class="row" id="favoritos" ng-show="favoritos.length">
<div class="col-md-4" ng-repeat="post in favoritos">
<post-detail post="post" favorito="true"></post-detail>
</div>
</div>
<h1>Posts</h1>
<hr/>
<input class="form-control" type="text" ng-model="query" placeholder="Search" style="width: 100%">
<br/>
<div class="row">
<div class="col-md-4">
Exibir
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default" ng-class="{active: exibir == 10}" ng-click="exibir = 10">
<input type="radio"> 10
</label>
<label class="btn btn-default" ng-class="{active: exibir == 20}" ng-click="exibir = 20">
<input type="radio"> 20
</label>
<label class="btn btn-default" ng-class="{active: exibir == 30}" ng-click="exibir = 30">
<input type="radio"> 30
</label>
</div>
Posts
</div>
<div class="col-md-4 pull-center">
Ordenar por
<select ng-model="ordenacao">
<option value="" selected>Nada</option>
<option value="data.title">Nome</option>
<option value="data.ups">Ups</option>
<option value="data.downs">Downs</option>
</select>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default" ng-class="{active: !desc}" ng-click="desc = false">
<input type="radio"> Asc
</label>
<label class="btn btn-default" ng-class="{active: desc}" ng-click="desc = true">
<input type="radio"> Desc
</label>
</div>
</div>
<section class="pull-right">
<span>Atualização automática:</span>
<select ng-model="interval" ng-change="configurarAtualizacaoAutomatica()">
<option value="0" selected>Desativado</option>
<option value="1000">1 segundo</option>
<option value="10000">10 segundos</option>
<option value="60000">1 minuto</option>
<option value="600000">10 minutos</option>
<option value="1800000">30 minutos</option>
</select>
</section>
</div>
<hr/>
<div class="row">
<div class="col-md-4" ng-repeat="post in posts | filter:query | limitTo:exibir | orderBy: ordenacao:desc">
<post-detail post="post" favorito="false"></post-detail>
</div>
</div>
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.0.js"></script>
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<script src="js/angular.js" type="text/javascript"></script>
<script type="text/ng-template" id="post-detail.html">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title text-overflow">{{post.data.title}}</h3>
</div>
<div class="panel-body">
<ul class="media-list">
<li class="media">
<a class="pull-left" href="#">
<img class="media-object" ng-src="{{post.data.thumbnail}}" height="70">
</a>
<div class="media-body">
<i class="glyphicon glyphicon-arrow-up"></i><span class="badge">{{post.data.ups}}</span>
<i class="glyphicon glyphicon-arrow-down"></i><span class="badge">{{post.data.downs}}</span>
</div>
</li>
</ul>
<h5 class="pull-left">by {{post.data.author}}</h5>
<button class="btn btn-danger pull-right btn-xs" ng-if="favorito" ng-click="desfavoritar()" data-toggle="tooltip" title="Desfavoritar"><i class="glyphicon glyphicon-trash"></i></button>
<button class="btn btn-default pull-right btn-xs" ng-if="!favorito" ng-click="favoritar()" data-toggle="tooltip" title="Favoritar"><i class="glyphicon glyphicon-star-empty"></i></button>
</div>
</div>
</script>
</body>
</html>