3 Commits ed943eb615 ... 3adc4933ca

Author SHA1 Message Date
  guilmour ross 3adc4933ca New options on list pages for mods/adms 5 years ago
  guilmour ross 190c7ea56c Added adm/mod in the navbar 5 years ago
  guilmour ross 0159794d80 Color Css Correction 5 years ago

+ 3 - 2
controllers/admin.js

@@ -1,5 +1,6 @@
 var User = require('../models/User');
 let Watch = require('../models/Watch');
+var mongoose = require('mongoose');
 
 exports.listWatches = (req, res) => {
 
@@ -12,6 +13,6 @@ exports.listWatches = (req, res) => {
         watch: watch
       });
     }
-  });
+  }).populate('criador');
 
-}
+}

+ 4 - 1
middlewares/auth-admin.js

@@ -9,10 +9,13 @@ function isAuthenticatedAdmin(req, res, next) {
     if (req.user.adm) {
       next();
     }
+    else if (req.user.mod) {
+      next();
+    }
 
   } else {
     res.redirect('/no-permission');
   }
 };
 
-module.exports = isAuthenticatedAdmin;
+module.exports = isAuthenticatedAdmin;

+ 1 - 1
public/css/vendor/bootstrap.css

@@ -4932,7 +4932,7 @@ a.label:focus {
   vertical-align: middle;
   white-space: nowrap;
   text-align: center;
-  background-color: #d9230f;
+  background-color: #468847;
   border-radius: 10px;
 }
 .badge:empty {

+ 6 - 6
views/account/list-watches.html

@@ -1,4 +1,4 @@
-{% set title = "Esqueci minha senha" %} 
+{% set title = "Esqueci minha senha" %}
 {% extends 'layout.html' %}
 
 {% block body %}
@@ -27,22 +27,22 @@
           {{ w.title }}
         </td>
         <td>
-          {{ w.criador }}
+          {{ w.criador.name }} ({{ w.criador.email }})
         </td>
         <td>
-          {% if w.status == 'true' %}
+          {% if w.featured == 'true' %}
             <div class="badge badge-success">Publicado</div>
           {% endif %}
         </td>
         <td>
           <div class="btn-group">
-          
+
             <a class="btn btn-default" href="/edit/{{ w._id }}">Editar</a>
             <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
               <span class="caret"></span>
               <span class="sr-only">Toggle Dropdown</span>
             </button>
-          
+
             <ul class="dropdown-menu">
               <li>
                 <a href="/edit/{{ w._id }}">Editar</a>
@@ -62,4 +62,4 @@
 
 </div>
 
-{% endblock %}
+{% endblock %}

+ 1 - 1
views/list.html

@@ -33,7 +33,7 @@
 </div>
 <h2>Obras Pendentes</h2>
 <section class="work">
-    {% if user.mod %}
+    {% if (user.mod) or (user.adm) %}
     <ul class="entries" style="font-size: 12pt;">
       {% for w in watch %}
       {% if w.featured == 'false' %}

+ 3 - 0
views/partials/navbar.html

@@ -83,6 +83,9 @@
         <ul class="dropdown-menu">
           <li><a href="/u/{{ user.username }}">Meu Perfil</a></li>
           <li><a href="/account">Editar Conta</a></li>
+          {% if (user.adm) or (user.mod) %}
+            <li><a href="/list-watches">Listar Filmes</a></li>
+          {% endif %}
           <li class="divider"></li>
           <!-- <li><a href="#">Minhas Produções</a></li>
           <li class="divider"></li> -->