-
Notifications
You must be signed in to change notification settings - Fork 893
Expand file tree
/
Copy pathadmin.blade.php
More file actions
187 lines (159 loc) · 8.4 KB
/
admin.blade.php
File metadata and controls
187 lines (159 loc) · 8.4 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
@extends('layouts.base')
@section('css')
<link rel='stylesheet' href='/css/admin.css'>
<link rel='stylesheet' href='/css/datatables.min.css'>
<link rel='stylesheet' href='css/index.css' />
@endsection
@section('content')
<div ng-controller="AdminCtrl" class="ng-root">
<div class='col-md-2'>
<ul class='nav nav-pills nav-stacked admin-nav' role='tablist'>
<li role='presentation' aria-controls="home" class='admin-nav-item active'><a href='#home'>Home</a></li>
<li role='presentation' aria-controls="links" class='admin-nav-item'><a href='#links'>Links</a></li>
<li role='presentation' aria-controls="settings" class='admin-nav-item'><a href='#settings'>Settings</a></li>
@if ($role == $admin_role)
<li role='presentation' class='admin-nav-item'><a href='#admin'>Admin</a></li>
@endif
@if ($api_active == 1)
<li role='presentation' class='admin-nav-item'><a href='#developer'>Developer</a></li>
@endif
</ul>
</div>
<div class='col-md-10'>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<h2>Welcome to your {{env('APP_NAME')}} dashboard!</h2>
<p>Choose to shorten an URL below and use the links on the left hand side to navigate your {{env('APP_NAME')}} dashboard.</p>
<form method='POST' action='/admin/shorten' role='form'>
<input type='url' autocomplete='off'
class='form-control long-link-input' placeholder='http://' name='link-url' />
<div class='row' id='options' ng-cloak>
<p>Customize link</p>
@if (!env('SETTING_PSEUDORANDOM_ENDING'))
{{-- Show secret toggle only if using counter-based ending --}}
<div class='btn-group btn-toggle visibility-toggler' data-toggle='buttons'>
<label class='btn btn-primary btn-sm active'>
<input type='radio' name='options' value='p' checked /> Public
</label>
<label class='btn btn-sm btn-default'>
<input type='radio' name='options' value='s' /> Secret
</label>
</div>
@endif
<div>
<div class='custom-link-text'>
<h2 class='site-url-field'>{{env('APP_ADDRESS')}}/</h2>
<input type='text' autocomplete="off" class='form-control custom-url-field' name='custom-ending' />
</div>
<div>
<a href='#' class='btn btn-success btn-xs check-btn' id='check-link-availability'>Check Availability</a>
<div id='link-availability-status'></div>
</div>
</div>
</div>
<input type='submit' class='btn btn-info' id='shorten' value='Shorten' />
<a href='#' class='btn btn-warning' id='show-link-options'>Link Options</a>
<input type="hidden" name='_token' value='{{csrf_token()}}' />
</form>
</div>
<div role="tabpanel" class="tab-pane" id="links">
@include('snippets.link_table', [
'table_id' => 'user_links_table'
])
</div>
<div role="tabpanel" class="tab-pane" id="settings">
<h3>Change Password</h3>
<form action='/admin/action/change_password' method='POST'>
Old Password: <input class="form-control password-box" type='password' name='current_password' />
New Password: <input class="form-control password-box" type='password' name='new_password' />
<input type="hidden" name='_token' value='{{csrf_token()}}' />
<input type='submit' class='btn btn-success change-password-btn'/>
</form>
</div>
@if ($role == $admin_role)
<div role="tabpanel" class="tab-pane" id="admin">
<h3>Links</h3>
@include('snippets.link_table', [
'table_id' => 'admin_links_table'
])
<h3 class="users-heading">Users</h3>
<a ng-click="state.showNewUserWell = !state.showNewUserWell" class="btn btn-primary btn-sm status-display">New</a>
<div ng-if="state.showNewUserWell" class="new-user-fields well">
<table class="table">
<tr>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>Role</th>
<th></th>
</tr>
<tr id="new-user-form">
<td><input type="text" class="form-control" ng-model="newUserParams.username"></td>
<td><input type="password" class="form-control" ng-model="newUserParams.userPassword"></td>
<td><input type="email" class="form-control" ng-model="newUserParams.userEmail"></td>
<td>
<select class="form-control new-user-role" ng-model="newUserParams.userRole">
@foreach ($user_roles as $role_text => $role_val)
<option value="{{$role_val}}">{{$role_text}}</option>
@endforeach
</select>
</td>
<td>
<a ng-click="addNewUser($event)" class="btn btn-primary btn-sm status-display new-user-add">Add</a>
</td>
</tr>
</table>
</div>
@include('snippets.user_table', [
'table_id' => 'admin_users_table'
])
</div>
@endif
@if ($api_active == 1)
<div role="tabpanel" class="tab-pane" id="developer">
<h3>Developer</h3>
<p>API keys and documentation for developers.</p>
<p>
Documentation:
<a href='http://docs.polr.me/en/latest/developer-guide/api/'>http://docs.polr.me/en/latest/developer-guide/api/</a>
</p>
<h4>API Key: </h4>
<div class='row'>
<div class='col-md-8'>
<input class='form-control status-display' disabled type='text' value='{{$api_key}}'>
</div>
<div class='col-md-4'>
<a href='#' ng-click="generateNewAPIKey($event, '{{$user_id}}', true)" id='api-reset-key' class='btn btn-danger'>Reset</a>
</div>
</div>
<h4>API Quota: </h4>
<h2 class='api-quota'>
@if ($api_quota == -1)
unlimited
@else
<code>{{$api_quota}}</code>
@endif
</h2>
<span> requests per minute</span>
</div>
@endif
</div>
</div>
<div class="angular-modals">
<edit-long-link-modal ng-repeat="modal in modals.editLongLink" link-ending="modal.linkEnding"
old-long-link="modal.oldLongLink" clean-modals="cleanModals"></edit-long-link-modal>
<edit-user-api-info-modal ng-repeat="modal in modals.editUserApiInfo" user-id="modal.userId"
api-quota="modal.apiQuota" api-active="modal.apiActive" api-key="modal.apiKey"
generate-new-api-key="generateNewAPIKey" clean-modals="cleanModals"></edit-user-api-info>
</div>
</div>
@endsection
@section('js')
{{-- Include modal templates --}}
@include('snippets.modals')
{{-- Include extra JS --}}
<script src='/js/datatables.min.js'></script>
<script src='/js/api.js'></script>
<script src='/js/AdminCtrl.js'></script>
<script src='js/index.js'></script>
@endsection