useradmin.html 13.7 KB
Newer Older
David Haynes's avatar
David Haynes committed
1
<!-- include the base html template -->
2 3
{% extends 'layouts/base.html' %}

David Haynes's avatar
David Haynes committed
4
<!-- define the page title block -->
5
{% block title %} SRCT Go &bull; Administration Panel {% endblock %}
6

David Haynes's avatar
David Haynes committed
7
<!-- define the content block for the page -->
8 9
{% block content %}

10 11 12
<!-- Tell Django to load static files -->
{% load staticfiles %}

David Haynes's avatar
David Haynes committed
13
<!-- define the page header div -->
14 15 16
<div class="page-header" id="banner">
  <div class="row">
    <div class="col-md-12">
17
      <h1>
18 19 20 21
        <span class="fa-stack fa-lg">
          <i class="fa fa-circle fa-stack-2x"></i>
          <i class="fa fa-balance-scale fa-stack-1x fa-inverse"></i>
        </span>
22 23
        Moderation Panel
      </h1>
24 25 26 27
    </div>
  </div>
</div>

28

Zosman's avatar
Zosman committed
29
<!-- Table 1 -->
David Haynes's avatar
David Haynes committed
30
<!-- define the div where we can select users from a table to judge them -->
31
<div class="row">
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  <div class="col-md-12">
    <input class="inputfilter" type="text" id="appliedInput"
      placeholder="Search Usernames or Full Names">
    <h3>Users awaiting moderation</h3>
    <form method="post" action="useradmin">
      <!-- csrf protection  -->
      {% csrf_token %}
      <!-- define out table of users that need approval  -->
      <table class="table table-striped table-hover" id="appliedTable">
        <!-- define the header row -->
        <thead>
          <tr>
            <th>Selected</th>
            <th>Username</th>
            <th>Full Name</th>
            <th>Description</th>
          </tr>
        </thead>
David Haynes's avatar
David Haynes committed
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
        <!-- define the body rows -->
        <tbody>
          <!-- loop through all users in the need_approval list -->
          {% for unapproved in need_approval %}
          <!-- ..and make a new row for each user -->
          <tr>
            <td><input type="checkbox" name="username" value={{ unapproved.user }}></td>
            <td>{{ unapproved.user }}</td>
            <td>{{ unapproved.full_name }}</td>
            <td>{{ unapproved.description|default:"No description provided" }}</td>
          </tr>
          <!-- unless it's empty in which case we show nothing -->
          {% empty %}
          <tr>
            <td>none</td>
            <td>none</td>
            <td>none</td>
            <td>none</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
73

74 75 76 77 78 79 80 81
      <!-- a div containing our form submission buttons -->
      <div class="form-group">
        <!-- the modal for approve doesn't work-->
        <a class="btn btn-primary btn-sm" data-target="#approveModal" data-toggle="modal"> Approve </a>
        <!-- input type="submit" name="_approve" value="Approve" class="btn btn-primary btn-sm"-->
        <a class="btn btn-danger btn-sm" data-target="#denyModal" data-toggle="modal"> Deny </a>
        <a class="btn btn-default btn-sm btn-blockUsr" data-target="#blockModal" data-toggle="modal"
          style="background-color: black; color: white;"> Block </a>
Grady Moran's avatar
Grady Moran committed
82

83 84 85 86 87 88 89 90
        <!--Define Approve Modal-->
        <div id="approveModal" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to approve a user?</h4>
Grady Moran's avatar
Grady Moran committed
91
              </div>
92 93 94 95 96
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_approve" value="Approve" class="btn btn-primary btn-lg"
                  style="border-width: 0px;float:right; width:49%; background-color: #00331a; color: #ffffff; border-radius: 4px;">
Grady Moran's avatar
Grady Moran committed
97
              </div>
98 99 100
            </div>
          </div>
        </div>
Grady Moran's avatar
Grady Moran committed
101

102 103 104 105 106 107 108 109 110 111
        <!--Define Deny Modal-->
        <div id="denyModal" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to deny a user?</h4>
                <h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
                  Please remember the user's feelings</h6>
Grady Moran's avatar
Grady Moran committed
112
              </div>
113 114 115 116 117 118 119 120
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_deny" value="Deny" class="btn btn-danger btn-lg" style="border-width: 0px;float:right; width:49%; background-color: #ac1d37; color: #ffffff; border-radius: 4px;">
              </div>
            </div>
          </div>
        </div>
Grady Moran's avatar
Grady Moran committed
121

122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
        <!--Define Block Modal-->
        <!-- Note there is another block modal for the other block button below -->
        <div id="blockModal" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to block a user?</h4>
                <h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
                  Please remember the user's feelings</h6>
              </div>
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_block" value="Block" class="btn btn-danger btn-lg" style="border-width: 0px; float:right; width:49%;background-color: #000000; color: #ffffff; border-radius: 4px;">
              </div>
139
            </div>
140 141 142 143 144
          </div>
        </div>
      </div>
    </form>
  </div>
145 146
</div>

Zosman's avatar
Zosman committed
147
<!-- Table 2 -->
Zosman's avatar
Zosman committed
148
<!-- define the table that displays blocked users and allows us to unblock them -->
149
<div class="row">
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
  <div class="col-md-12">
    <input class="inputfilter" type="text" id="blockedInput"
      placeholder="Search Usernames or Full Names">
    <h3>Blocked Users</h3>
    <form method="post" action="useradmin">
      <!-- csrf protection  -->
      {% csrf_token %}
      <table class="table table-striped table-hover" id="blockedTable">
        <!-- define the header row -->
        <thead>
          <tr>
            <th>Selected</th>
            <th>Username</th>
            <th>Full Name</th>
            <th>Description</th>
            <th>Approved</th>
          </tr>
        </thead>
168

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
        <!-- define the body rows -->
        <tbody>
          <!-- loop through all blocked users -->
          {% for blockedUsers in blocked_users %}
          <tr>
            <td><input type="checkbox" name="username" value={{ blockedUsers.user }}></td>
            <td>{{ blockedUsers.user }}</td>
            <td>{{ blockedUsers.full_name }}</td>
            <td>{{ blockedUsers.description|default:"No description provided" }}</td>
            <td>{{ blockedUsers.approved }}</td>
          </tr>
          <!-- unless there are no blocked users -->
          {% empty %}
          <tr>
            <td>none</td>
            <td>none</td>
            <td>none</td>
            <td>none</td>
            <td>none</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
Grady Moran's avatar
Grady Moran committed
192

193 194 195 196
      <!-- define an unblock button -->
      <div class="form-group">
        <!-- input type="submit" name="_unblock" value="Un-Block" class="btn btn-default btn-sm btn-Unblock"-->
        <a class="btn btn-default btn-sm btn-Unblock" data-target="#unblockModal" data-toggle="modal"> Unblock </a>
Grady Moran's avatar
Grady Moran committed
197

198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
        <!--Define Un-Block Modal-->
        <div id="unblockModal" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to unblock a user?</h4>
              </div>
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_unblock" value="Un-Block" class="btn btn-default btn-lg"
                  style="border-width: 0px;float:right; width:49%; background-color: #e7e7e7; color: #000000; border-radius: 4px;">
              </div>
213
            </div>
214 215 216 217 218 219
          </div>
        </div>

      </div>
    </form>
  </div>
220 221
</div>

Zosman's avatar
Zosman committed
222
<!-- Table 3 -->
223
<!-- define the table of current users -->
224
<div class="row">
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
  <div class="col-md-12">
    <input class="inputfilter" type="text" id="currentInput" 
      placeholder="Search Usernames or Full Names">
    <h3>Current Users</h3>
    <form method="post" action="useradmin">
      <!-- csrf protection  -->
      {% csrf_token %}
      <table class="table table-striped table-hover " id="currentTable">
        <!-- define the header row -->
        <thead>
          <tr>
            <th>Selected</th>
            <th>Username</th>
            <th>Full Name</th>
            <th>Description</th>
          </tr>
        </thead>
242

243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
        <!-- define the body rows -->
        <tbody>
          <!-- loop through all current users -->
          {% for currentUsers in current_users %}
          <tr>
            <td><input type="checkbox" name="username" value={{ currentUsers.user }}></td>
            <td>{{ currentUsers.user }}</td>
            <td>{{ currentUsers.full_name }}</td>
            <td>{{ currentUsers.description|default:"No description provided" }}</td>
          </tr>
          <!-- unless there are none -->
          {% empty %}
          <tr>
            <td>none</td>
            <td>none</td>
            <td>none</td>
            <td>none</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
264

265 266 267 268 269
      <!-- display our removal and blocking buttons -->
      <div class="form-group">
        <a class="btn btn-danger btn-sm" data-target="#removeModal" data-toggle="modal"> Remove </a>
        <a class="btn btn-default btn-sm btn-blockUsr" data-target="#blockModal2" data-toggle="modal"
          style="background-color: black; color: white;"> Block </a>
270

271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
        <!--Define Remove Modal-->
        <div id="removeModal" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to remove a user?</h4>
                <h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
                  Please remember the user's feelings</h6>
              </div>
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_remove" value="Remove" class="btn btn-danger btn-lg"
                  style="border-width: 0px; float:right; width:49%;background-color: #ac1d37; color: #ffffff; border-radius: 4px;">
287
              </div>
288 289 290
            </div>
          </div>
        </div>
291

292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
        <!--Define Block Modal 2-->
        <div id="blockModal2" class="modal fade" role="dialog" tabindex="-1">
          <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
              <div class="modal-header" style="text-align:center;">
                <h4 class="modal-title  text-center" style="font-weight:bold; font-size: 21px !important;">
                  Are you sure you would like to block a user?</h4>
                <h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
                  Please remember the user's feelings</h6>
              </div>
              <div class="modal-body" style="padding-bottom: 80px">
                <a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
                  data-dismiss="modal">Cancel</a>
                <input type="submit" name="_block" value="Block" class="btn btn-danger btn-lg" style="border-width: 0px; float:right; width:49%;background-color: #000000; color: #ffffff; border-radius: 4px;">
Grady Moran's avatar
Grady Moran committed
307
              </div>
308
            </div>
309 310 311 312 313
          </div>
        </div>
      </div>
    </form>
  </div>
314
</div>
315

316
<script src="{% static "js/useradmin.js" %}"></script>
317

318
{% endblock %}