diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-08 14:20:28 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-08 14:20:28 -0400 |
commit | 3ce0c6113eee9d291a8cba7d398a3d3114792cc9 (patch) | |
tree | 432fd1106da8fd2d33091bdb8954f17835c2230f /mediagoblin/admin | |
parent | 3fb96fc97800ae032e599006e3f49ffd69926c88 (diff) | |
download | mediagoblin-3ce0c6113eee9d291a8cba7d398a3d3114792cc9.tar.lz mediagoblin-3ce0c6113eee9d291a8cba7d398a3d3114792cc9.tar.xz mediagoblin-3ce0c6113eee9d291a8cba7d398a3d3114792cc9.zip |
This update I mostly did work on the templates for the admin pages. I did a co-
-uple other small changes. I changed the information around the media processi-
ng panel to be more specific, since it was written when it was the only admin
page. Git didn't catch this, but I renamed the templates, so mediagoblin/templ-
ates/admin/user.html now referrs to the page which shows the details of a spec-
ific user. The list view pages are now named ELEMENT_panel.html(ie. user_panel)
I also added a column reported_user_id to the ReportBase table, and had to add
to Report filing to make sure that column gets created. Also I moved the report
media button (on a media page) to the sidebar, though it still needs some form-
atting
--\ mediagoblin/static/images/icon_clipboard.png
--| Added this image for use in template mediagoblin/admin/report.html.
--| Distributed by the GNOME project http://www.gnome.org
--| Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
--| I'm still trying to figure out the appropriate way to attribute this in
| the code
--\ mediagoblin/templates/mediagoblin/admin/media_panel.html
--| This template is actually the template formerly know as media.html. I
| renamed it for clarity
--\ mediagoblin/templates/mediagoblin/admin/report_panel.html
--| This template is actually the template formerly know as report.html. I
| renamed it for clarity
--\ mediagoblin/templates/mediagoblin/admin/user_panel.html
--| This template is actually the template formerly know as user.html. I renam-
| -ed it for clarity
--\ mediagoblin/templates/mediagoblin/utils/report.html
--| This template is included in the media_home page. It is the report media
| button. I figured I'd write it like this in case it got more complicated.
--\ mediagoblin/admin/routing.py
--| I changed the routing path /a/panel to /a/media for specificity
--\ mediagoblin/admin/views.py
--| I renamed admin_processing_panel to admin_media_processing_panel
--| I wrote a new view function admin_reports_detail
--| I wrote a new view function admin_users_detail
--\ mediagoblin/db/migrations.py
--| I added in the column reported_user_id to the ReportBase_v0 class
--\ mediagoblin/db/models.py
--| I added in the column reported_user_id to the ReportBase class
--\ mediagoblin/static/css/base.css
--| I added in css classes to display a report. Right now, they are just echo-
| -ing the ways comments are displayed, but with the link in another color
--\ mediagoblin/templates/mediagoblin/admin/report.html
--| Created this new template (although git doesn't realize it) to show the de-
| -tails of a specific report, indicated in the URL
--\ mediagoblin/templates/mediagoblin/admin/user.html
--| Created this new template (although git doesn't realize it) to show the de-
| -tails of a specific user, indicated in the URL
--\ mediagoblin/templates/mediagoblin/base.html
--| Redirected the link from /a/panel to /a/media
--\ mediagoblin/templates/mediagoblin/user_pages/media.html
--| Moved the media report button to the sidebar
--\ mediagoblin/user_pages/lib.py
--| Changed the creation of reports, so that they also assign a column for rep-
| -orted_user_id.
Diffstat (limited to 'mediagoblin/admin')
-rw-r--r-- | mediagoblin/admin/routing.py | 14 | ||||
-rw-r--r-- | mediagoblin/admin/views.py | 49 |
2 files changed, 53 insertions, 10 deletions
diff --git a/mediagoblin/admin/routing.py b/mediagoblin/admin/routing.py index d5edac0f..c7ca5b92 100644 --- a/mediagoblin/admin/routing.py +++ b/mediagoblin/admin/routing.py @@ -15,12 +15,18 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. admin_routes = [ - ('mediagoblin.admin.panel', - '/panel', - 'mediagoblin.admin.views:admin_processing_panel'), + ('mediagoblin.admin.media_panel', + '/media', + 'mediagoblin.admin.views:admin_media_processing_panel'), ('mediagoblin.admin.users', '/users', 'mediagoblin.admin.views:admin_users_panel'), ('mediagoblin.admin.reports', '/reports', - 'mediagoblin.admin.views:admin_reports_panel')] + 'mediagoblin.admin.views:admin_reports_panel'), + ('mediagoblin.admin.users_detail', + '/users/<string:user>', + 'mediagoblin.admin.views:admin_users_detail'), + ('mediagoblin.admin.reports_detail', + '/reports/<int:report_id>', + 'mediagoblin.admin.views:admin_reports_detail')] diff --git a/mediagoblin/admin/views.py b/mediagoblin/admin/views.py index 7a4dfbd4..97970577 100644 --- a/mediagoblin/admin/views.py +++ b/mediagoblin/admin/views.py @@ -16,12 +16,13 @@ from werkzeug.exceptions import Forbidden -from mediagoblin.db.models import MediaEntry, User, MediaComment, CommentReport, ReportBase +from mediagoblin.db.models import (MediaEntry, User, MediaComment, \ + CommentReport, ReportBase, Privilege) from mediagoblin.decorators import require_admin_login from mediagoblin.tools.response import render_to_response @require_admin_login -def admin_processing_panel(request): +def admin_media_processing_panel(request): ''' Show the global media processing panel for this instance ''' @@ -38,7 +39,7 @@ def admin_processing_panel(request): # Render to response return render_to_response( request, - 'mediagoblin/admin/panel.html', + 'mediagoblin/admin/media_panel.html', {'processing_entries': processing_entries, 'failed_entries': failed_entries, 'processed_entries': processed_entries}) @@ -50,13 +51,31 @@ def admin_users_panel(request): ''' user_list = User.query - # Render to response return render_to_response( request, - 'mediagoblin/admin/user.html', + 'mediagoblin/admin/user_panel.html', {'user_list': user_list}) @require_admin_login +def admin_users_detail(request): + ''' + Shows details about a particular user. + ''' + user = User.query.filter_by(username=request.matchdict['user']).first() + privileges = Privilege.query + active_reports = user.reports_filed_on.filter( + ReportBase.resolved==None).limit(5) + closed_reports = user.reports_filed_on.filter( + ReportBase.resolved!=None).all() + + return render_to_response( + request, + 'mediagoblin/admin/user.html', + {'user':user, + 'privileges':privileges, + 'reports':active_reports}) + +@require_admin_login def admin_reports_panel(request): ''' Show the global panel for monitoring reports filed against comments or @@ -72,7 +91,25 @@ def admin_reports_panel(request): # Render to response return render_to_response( request, - 'mediagoblin/admin/report.html', + 'mediagoblin/admin/report_panel.html', {'report_list':report_list, 'closed_report_list':closed_report_list}) +@require_admin_login +def admin_reports_detail(request): + report = ReportBase.query.get(request.matchdict['report_id']) + if report.discriminator == 'comment_report': + comment = MediaComment.query.get(report.comment_id) + media_entry = None + elif report.discriminator == 'media_report': + media_entry = MediaEntry.query.get(report.media_entry_id) + comment = None + + return render_to_response( + request, + 'mediagoblin/admin/report.html', + {'report':report, + 'media_entry':media_entry, + 'comment':comment}) + + |