Changeset 183:d86eb3a539e6

Show
Ignore:
Timestamp:
09/01/08 20:47:21 (19 months 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:
5 modified

Legend:

Unmodified
Added
Removed
  • microfacts/controllers/factlet.py

    r94 r183  
    6161            # see this thread: 
    6262            # 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') 
    6464            return html 
    6565        else: 
     
    7272        return render('factlet/read') 
    7373 
    74     def edit(self, id): 
     74    def update(self, id): 
    7575        return self.read(id) 
    7676 
  • microfacts/data/napoleon.js

    r172 r183  
    44    { 
    55      "title" : "Battle of Austerlitz", 
     6      "image" : "http://upload.wikimedia.org/wikipedia/commons/5/56/Austerlitz-baron-Pascal.jpg", 
    67      "description" : 
    78        "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", 
  • microfacts/templates/factlet/read_core.html

    r141 r183  
    77  > 
    88 
    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> 
    1111     
     12      <img src="${c.factlet.image}" /> 
    1213      <p class="description">${c.factlet.description}</p> 
    1314      <dl> 
    1415        <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> 
    1629      </dl> 
    1730 
    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 &raquo;</a></p> 
    22         </py:when> 
    23         <py:otherwise> 
    24         <p><a href="${h.url_for(controller='factlet', action='edit', id=c.factlet.id)}">Edit &raquo;</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 &raquo;</a> 
     33      </p> 
    2734    </div> 
    2835</div> 
  • microfacts/templates/layout.html

    r166 r183  
    3737        }); 
    3838      </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> 
    3948      ${select('*[local-name()!="title"]')} 
    4049    </head> 
  • microfacts/tests/functional/test_factlet.py

    r179 r183  
    7272    def test_read_core(self): 
    7373        factletId = self.factlets[0].id 
     74        fct = self.factlets[0] 
    7475        path = url_for(controller='factlet', action='read_core', id=factletId) 
    7576        response = self.app.get(path) 
    7677        print response 
    7778        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 
    7883 
    7984    def test_read(self): 
     85        # do not too much testing here as should be in read_core 
    8086        factletId = self.factlets[0].id 
    8187        assert factletId 
    8288        path = url_for(controller='factlet', action='read', id=factletId) 
    8389        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 
    9092 
    9193        # Delete when threads are showing again.