-
Notifications
You must be signed in to change notification settings - Fork 0
/
prac7.html
executable file
·154 lines (150 loc) · 8.32 KB
/
prac7.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html>
<head>
<title>POST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"
type="text/javascript"
></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="prac7.css">
</head>
<body ng-app='app' ng-controller='PostsCtrl' >
<nav class="navbar navbar-expand-lg navbar-dark bg-dark ">
<div class="navbar-brand" href="">POST</div>
<button class="navbar-toggler " type="button" data-toggle="collapse" data-target="#toggler" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="toggler">
<ul class="navbar-nav ml-auto" ng-show="notlogged">
<li class="nav-item">
<a class="nav-link" href="">LOGIN</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">SIGNUP</a>
</li>
</ul>
<ul class="navbar-nav ml-auto" ng-hide="notlogged">
<li class="nav-item">
<a class="nav-link" href="">HEY</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">{{username|uppercase}}</a>
</li>
<li class="nav-item">
<a class="nav-link" ng-click="logout()" href="">LOGOUT</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-9">
<div class='container'>
<h1>RECENT POSTS</h1>
<form role='form'>
<div class='form-group'>
<div class='input-group'>
<span class='input-group-btn'>
<button class='btn btn-default'><b>SEARCH</b></button>
</span>
<input id="search1" ng-change="search()" ng-model="searched" class='form-control'/>
</div>
</div>
</form>
<ul class='list-group' ng-show="searchbar">
<li ng-repeat='post in posts' class='list-group-item'>
<div style="overflow-wrap:normal">
<p><strong>@{{ post.username }}</strong></p>
<h5 style="text-align: center;">{{ post.title | uppercase }}</h5>
<p style="overflow-wrap: normal;">{{ post.comment }}</p>
</div>
</li>
</ul>
<ul class='list-group' ng-hide="searchbar">
<li ng-repeat="post in posts | filter :{'title' : searched}" class='list-group-item'>
<div style="overflow-wrap:normal">
<p><strong>@{{ post.username }}</strong></p>
<h5 style="text-align: center;">{{ post.title | uppercase }}</h5>
<p style="overflow-wrap: normal;">{{ post.comment }}</p>
</div>
</li>
</ul>
</div>
</div>
<div class="col-3" style="background-color: tomato;">
<div class='container'>
<div class="login-form container-fluid" ng-show="notlogged">
<form>
<br>
<div class="form-group">
<label>USERNAME</label>
<input ng-model="username" type="text" class="form-control" placeholder="User Name">
</div>
<div class="form-group">
<label>PASSWORD</label>
<input ng-model="password" type="password" class="form-control" placeholder="Password">
</div>
<p>{{ message }}</p>
<br>
<div class="container row">
<div class="col-6">
<button type="submit" style="width: 100px;" ng-click="login()" class="btn btn-black btn-outline-light">Login</button>
</div>
<div class="col-6">
<button type="submit" style="width: 100px;" ng-click="register()" class="btn btn-black btn-outline-light">Register</button>
</div>
</div>
<br><br>
</form>
</div>
<div class="after-login container-fluid" ng-hide="notlogged">
<br>
<h5>CREATE A NEW POST</h5>
<div class="form-group">
<label>Title</label>
<input ng-model="title" type="text" name='title' class="form-control">
</div>
<div class="form-group">
<label>Comments/description</label>
<textarea ng-model="comment" name="comment" class="form-control"></textarea>
</div>
<!-- <div class="form-group">
<label>Upload a image</label>
<input ng-model="image" type="file" name="image">
</div> -->
<div class="form-group">
<p>{{ message }}</p>
<label>Preview</label><br>
<div class="postcard container" style="overflow:hidden">
<p><strong>@{{ username }}</strong></p>
<h5 style="text-align: center;">{{ title | uppercase }}</h5>
<p style="overflow-wrap: normal;">{{ comment }}</p>
<!-- <img src={{ image }}> -->
</div>
</div>
<button ng-click="addPost()" class="btn btn-black btn-outline-dark">ADD</button>
<br><br>
<ul class='list-group'>
<h5>Older posts</h5>
<li ng-repeat="post in posts | filter :{'username' : username}:true" class='list-group-item'>
<div style="overflow-wrap:normal">
<p><strong>@{{ post.username }}</strong></p>
<h5 style="text-align: center;">{{ post.title | uppercase }}</h5>
<p style="overflow-wrap: normal;">{{ post.comment }}</p>
<button class="btn btn-sm btn-black btn-outline-dark" ng-click="deletepost(post)" >DELETE</button>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="./prac7.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</html>