Changeset 183:d86eb3a539e6
- Timestamp:
- 09/01/08 20:47:21 (2 years ago)
- Author:
- rgrp
- Branch:
- default
- convert_revision:
- svn:10edda23-d834-0410-9182-b00384516d49/trunk@195
- Message:
-
[factlet][m]: fix up factlet read views to show all the new attributes.
- Location:
- microfacts
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r94
|
r183
|
|
| 61 | 61 | # see this thread: |
| 62 | 62 | # http://groups.google.com/group/genshi/browse_thread/thread/a587cc282403aace |
| 63 | | html = render('factlet/read_core', fragment=True) |
| | 63 | html = render('factlet/read_core', format='xml') |
| 64 | 64 | return html |
| 65 | 65 | else: |
| … |
… |
|
| 72 | 72 | return render('factlet/read') |
| 73 | 73 | |
| 74 | | def edit(self, id): |
| | 74 | def update(self, id): |
| 75 | 75 | return self.read(id) |
| 76 | 76 | |
-
|
r172
|
r183
|
|
| 4 | 4 | { |
| 5 | 5 | "title" : "Battle of Austerlitz", |
| | 6 | "image" : "http://upload.wikimedia.org/wikipedia/commons/5/56/Austerlitz-baron-Pascal.jpg", |
| 6 | 7 | "description" : |
| 7 | 8 | "The Battle of Austerlitz (Czech: 'Battle of Slavkov'), also known as the Battle of the Three Emperors, was one of Napoleon's greatest victories, effectively destroying the Third Coalition against the French Empire. On December 2 1805, French troops, commanded by Emperor Napoleon I, decisively defeated a Russo-Austrian army, commanded by Tsar Alexander I, after nearly nine hours", |
-
|
r141
|
r183
|
|
| 7 | 7 | > |
| 8 | 8 | |
| 9 | | <div id="factlet-${c.factlet.id}" class="factlet"> |
| 10 | | <h3 class="title editable" title="Click to edit...">${c.factlet.title}</h3> |
| | 9 | <div id="factlet-${c.factlet.id}" class="factlet factlet-details"> |
| | 10 | <h3 class="title">${c.factlet.title}</h3> |
| 11 | 11 | |
| | 12 | <img src="${c.factlet.image}" /> |
| 12 | 13 | <p class="description">${c.factlet.description}</p> |
| 13 | 14 | <dl> |
| 14 | 15 | <dt>Date</dt> |
| 15 | | <dd><a href="#">${c.factlet.start}</a></dd> |
| | 16 | <dd> |
| | 17 | Start: ${c.factlet.start} <br /> |
| | 18 | End: ${c.factlet.end} |
| | 19 | </dd> |
| | 20 | <dt>Location</dt> |
| | 21 | <dd> |
| | 22 | Long: ${c.factlet.location.x} <br /> |
| | 23 | Lat: ${c.factlet.location.y} |
| | 24 | </dd> |
| | 25 | <dt>Source</dt> |
| | 26 | <dd><a href="${c.factlet.source}">${c.factlet.source}</a></dd> |
| | 27 | <dt>License</dt> |
| | 28 | <dd>${c.factlet.license}</dd> |
| 16 | 29 | </dl> |
| 17 | 30 | |
| 18 | | <py:choose> |
| 19 | | <py:when test="c.has_inline_edit"> |
| 20 | | <!-- TODO: this should become a generic edit link i think --> |
| 21 | | <p class="factlet-description-edit"><a href="${h.url_for(controller='factlet', action='edit', id=c.factlet.id)}">Edit »</a></p> |
| 22 | | </py:when> |
| 23 | | <py:otherwise> |
| 24 | | <p><a href="${h.url_for(controller='factlet', action='edit', id=c.factlet.id)}">Edit »</a></p> |
| 25 | | </py:otherwise> |
| 26 | | </py:choose> |
| | 31 | <p> |
| | 32 | <a href="${h.url_for(controller='factlet', action='update', id=c.factlet.id)}">Edit »</a> |
| | 33 | </p> |
| 27 | 34 | </div> |
| 28 | 35 | </div> |
-
|
r166
|
r183
|
|
| 37 | 37 | }); |
| 38 | 38 | </script> |
| | 39 | <!-- 2008-09-01 shove this here for time being and move into stylesheet once sass |
| | 40 | stuff is sorted --> |
| | 41 | <style type="text/css"> |
| | 42 | div.factlet-details img |
| | 43 | { |
| | 44 | max-width: 150px; |
| | 45 | float: right; |
| | 46 | } |
| | 47 | </style> |
| 39 | 48 | ${select('*[local-name()!="title"]')} |
| 40 | 49 | </head> |
-
|
r179
|
r183
|
|
| 72 | 72 | def test_read_core(self): |
| 73 | 73 | factletId = self.factlets[0].id |
| | 74 | fct = self.factlets[0] |
| 74 | 75 | path = url_for(controller='factlet', action='read_core', id=factletId) |
| 75 | 76 | response = self.app.get(path) |
| 76 | 77 | print response |
| 77 | 78 | assert 'Battle of Austerlitz' in response |
| | 79 | assert str(fct.license) in response |
| | 80 | assert fct.start in response |
| | 81 | assert str(fct.source) in response |
| | 82 | assert fct.location.x in response |
| 78 | 83 | |
| 79 | 84 | def test_read(self): |
| | 85 | # do not too much testing here as should be in read_core |
| 80 | 86 | factletId = self.factlets[0].id |
| 81 | 87 | assert factletId |
| 82 | 88 | path = url_for(controller='factlet', action='read', id=factletId) |
| 83 | 89 | response = self.app.get(path) |
| 84 | | try: |
| 85 | | assert 'Microfacts' in response |
| 86 | | assert 'Battle of Austerlitz' in response |
| 87 | | except: |
| 88 | | print response |
| 89 | | raise |
| | 90 | assert 'Microfacts' in response, response |
| | 91 | assert 'Battle of Austerlitz' in response, response |
| 90 | 92 | |
| 91 | 93 | # Delete when threads are showing again. |