Opened 14 years ago
Last modified 14 years ago
#41 closed defect (FIXED)
Basic individual media view
Reported by: | Christopher Allan Webber | Owned by: | joar |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Keywords: | ||
Cc: | Parent Tickets: |
Description
Currently when you submit an image all that happens is it shows up on the mainpage as a thumbnail. Boring! We should be able to view those images on their own page. If I upload the media entry of "A Walk in the Park" which has the ID of 4d8e5b0048b1520586000000, I should be able to view that at: [http://mediagoblin.example.org/\ :sub:`cwebber/m/d8e5b0048b1520586000000/](http://mediagoblin.example.org/`\ cwebber/m/d8e5b0048b1520586000000/) (Eventually I'll also want to be able to view it by its prettier slugified URL: [http://mediagoblin.example.org/\ :sub:`cwebber/m/a-walk-in-the-park/](http://mediagoblin.example.org/`\ cwebber/m/a-walk-in-the-park/) ... but that's waiting on `http://bugs.foocorp.net/issues/306 <http://bugs.foocorp.net/issues/306>`_ ) This URL should have the following things: - The image, fully sized (we don't have scaled down versions implemented yet besides the thumbnail, so that's fine) - The author's name - When it was uploaded - The title - The description Mockup: :: | GNU MediaGoblin | login | register | |------------------------------------------------| | | | The Terror of Tinman Tim | | Posted by cwebber on May 8, 2011 | | ___________________________________________ | | | | | | | __ ____ | | | | (O)== | |=(O) | | | | | |O o| DESTROY ALL HUMANS | | | | |__|[ww]| | | | | | | _ | _ | | | | | ((((((_ |((_ | | | | | | | | | | | |____|____| | | | | |_| \_\ _ | | | | _/_/_ \_// / | | | | |___|| |/_/ | | | | | | | '-------------------------------------------' | | _________________________________________ | | | Just another piece on a robot who wants | | | | to do what any robot would want to do. | | | '-----------------------------------------' | | | | Comments: | | __________________________________________ | | | Wow I love your robot!!!!!! | | | | sue @ May 8 2011 11:45PM | | | '------------------------------------------' | Don't worry about the comments for now though. In addition, the thumbs currently on the main page should link to this URL.
Attachments (1)
Change History (8)
comment:2 by , 14 years ago
Patch is here: `https://gitorious.org/mediagoblin/mediagoblin/merge\_requests/4 <https://gitorious.org/mediagoblin/mediagoblin/merge_requests/4>`_ Given that I don't know a lot about how things are supposed to work, this should probably be reviewed. For example, I hardcode the URL as /m/ on the "root" page, I am not sure if there is a function that fetches a Media() url, as django's get\_absolute\_url() does. Anyway, here it is. Please consider for merging.
comment:3 by , 14 years ago
So this is a good start. A few things: It seems we're moving from /~cwebber/ style to /u/cwebber/ style, so see about being able to handle the full media URL with the username in it (which is a more useful URL I think): `http://mediagoblin.example.org/u/cwebber/m/d8e5b0048b1520586000000/ <http://mediagoblin.example.org/u/cwebber/m/d8e5b0048b1520586000000/>`_ It probably makes sense to start a mediagoblin.user\_pages section with: - mediagoblin/user\_pages/**init**.py - mediagoblin/user\_pages/views.py - mediagoblin/user\_pages/routing.py Do similar routing like is done with the auth routes to map the routes that start with /u/ to mediagoblin/user\_pages/routing.py and move the view to views.py It probably makes sense to "name" the route for this view something like mediagoblin.user\_pages.view\_media... by this I mean what you use for reversing, the first parameter of a Route() instantiation (see the auth routes) To simplify the query, you can probably just query for the MediaEntry id as it is currently since that's already definitice, but just assert also that the uploader username is the same as what's grabbed from the url so that we don't misattribute a work via the URL to someone who didn't do it. Lastly, if you could indent the if/else sections of the template I think that makes it more readable. :: {% if media %} <h2>Media details for {{media.title}}</h2> <div> <img src="{{ request.app.public_store.file_url( media.media_files.main) }}" /> <br/>Uploaded: {{ media.created}} <br/>Description: {{media.description}} </div> {% else %} <p>Sorry, no such media found.<p/> {% endif %} {% if media %} <h2>Media details for {{media.title}}</h2> <div> <img src="{{ request.app.public_store.file_url( media.media_files.main) }}" /> <br/>Uploaded: {{ media.created}} <br/>Description: {{media.description}} </div> {% else %} <p>Sorry, no such media found.<p/> {% endif %} See what I mean? I think it makes it easier to see what's part of what block. Great work on this ticket so far!
comment:4 by , 14 years ago
Thanks for the feedback. I have now created the user\_pages/\* stuff and adapted everything. Please check the gory details in: `https://gitorious.org/mediagoblin/mediagoblin/merge\_requests/8 <https://gitorious.org/mediagoblin/mediagoblin/merge_requests/8>`_ The URL is now /u//m/. One thing that is NOT YET part of this patch is the check if the username and the media uploader correspond as I have no clue how to throw an error 404. I added a placeholder for that. Please merge and add that :). I also created a placeholder "user homepage" while being at it (it still needs content, so that ticket can not be resolved just yet :-)). I am not sure, I like the /u/spaetz/m/123456781234567812345678 URL scheme a lot. THe /m/ somehow sticks out as odd and unneccessary. I would propose to go for something like this: /u//<mediaobjectID\_as\_24\_hexdigits)> That will still allow us to do /u//profile\|timeline\|whatever... Also, I think it would be useful to have an additional /m/<mediaobjectID\_as\_24\_hexdigits)> URL. This way someone who knows a mediaID can call its page without having to find out who the uploader is. It is also slightly more efficient to call as we don't have to check that the username and media uploader correspond.
by , 14 years ago
Attachment: | 0001-Implement-simple-media-detail-page.patch added |
---|
0001-Implement-simple-media-detail-page.patch
comment:5 by , 14 years ago
Willkg told me we don't do merge requests, so here is the patch as a patch :-)
comment:6 by , 14 years ago
Status: | New → Closed |
---|
(You forgot to indent the templates, but it's okay, I did it. ;)) Committed, thanks very much! :) For the reference here's how to do a 404; use webob's HTTPNotFound. :: # at the top from webob import exc # at the appropriate place return exc.HTTPNotFound()
Note:
See TracTickets
for help on using tickets.