Opened 11 years ago

Closed 8 years ago

#805 closed enhancement (fixed)

Add template_hook near media_title

Reported by: Michael Müller Owned by:
Priority: trivial Milestone:
Component: programming Keywords: test
Cc: Parent Tickets:

Description

It would be nice if we could add a template_hook in the user_pages/media.html template file. This would enable plugins to display content near the "media_title".

At the moment there is an "Edit" and "Delete" button below the media, placed right of the media_title (when logged in). On my MediaGoblin instance I have added a media_titleinfo template_hook. This is used to display a publicly visible micropayment button for each media. Here is a screenshot of what and where i mean. There are some other use cases as well: consider somebody would like to add a button besides the standard "Edit" and "Delete" button: "Report this media", "View in Fullscreen" or Social Media sharing buttons for example.

The sidebar gets quite crowded at the moment, because the user_pages/media.html template has only the media_sideinfo template_hook as a possibility to put additional information. IMO the media_title line would be a fitting additional place for certain information as well.

Attachments (2)

media_titleinfo.patch (848 bytes ) - added by Michael Müller 11 years ago.
media_titleinfo.jpg (161.4 KB ) - added by ayleph 9 years ago.
example of media_titleinfo template hook placement

Download all attachments as: .zip

Change History (11)

by Michael Müller, 11 years ago

Attachment: media_titleinfo.patch added

comment:1 by ShawnRisk, 9 years ago

Status: newreview

comment:2 by ayleph, 9 years ago

I would also enjoy a media page template_hook so I could add plugin code on media pages without having to stuff it into the sidebar.

comment:3 by Christopher Allan Webber, 9 years ago

Status: reviewaccepted

Egads, sorry this took so long. This seems like a useful patch; I wonder if it still aligns in the right place. I'm happy to merge it as long as someone can test putting something in that place and ensuring that it renders correctly. I think we might have made some changes in CSS organization since this time and that might mean that things don't quite render in that place anymore...?

As long as someone can verify testing that things fit there, I'm happy to merge.

comment:4 by ShawnRisk, 9 years ago

Keywords: test added

comment:5 by ayleph, 9 years ago

As suspected, there were some intermediate changes that prevented the patch from being applicable. I've updated it to fit in current master code.

From 2097f39e4bef9458481a16d8c43d53e467886ad8 Mon Sep 17 00:00:00 2001
From: ayleph <ayleph@thisshitistemp.com>
Date: Tue, 2 Feb 2016 23:14:57 -0500
Subject: [PATCH] Add media_titleinfo template hook

This patch is based on work by cmichi to add a template hook near the 
media title section of the page. I rearranged the code in the original
patch to match the current media.html page.
---
 mediagoblin/templates/mediagoblin/user_pages/media.html | 1 + 
 1 file changed, 1 insertion(+)

diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index 1a35414..c9f5747 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -75,6 +75,7 @@
     <h2 class="media_title">
       {{ media.title }}
     </h2>
+    {% template_hook("media_titleinfo") %}
     {% if request.user and 
           (media.actor == request.user.id or
            request.user.has_privilege('admin')) %}
-- 
2.7.0

by ayleph, 9 years ago

Attachment: media_titleinfo.jpg added

example of media_titleinfo template hook placement

comment:6 by ayleph, 9 years ago

The above attachment illustrates the layout of the media_titleinto template hook space, below the media title and above the media description.

comment:7 by ayleph, 9 years ago

Status: acceptedreview

comment:8 by Christopher Allan Webber, 9 years ago

This looks easy to merge but should happen after 0.9.0 is out.

. o O (We could have a "thaw" branch for features being merged in during freeze...)

comment:9 by ayleph, 8 years ago

Resolution: fixed
Status: reviewclosed

Merged in 2baad04.

Note: See TracTickets for help on using tickets.