Changeset 13

Show
Ignore:
Timestamp:
03/03/08 12:56:13 (10 months ago)
Author:
johnbywater
Message:

Improved factlet/thread read view tests, views, and css.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/microfacts/controllers/factlet.py

    r10 r13  
    1515        demo_data = self.get_demo_data() 
    1616        c.factlet_thread_title = demo_data['title'] 
     17        threads = [] 
     18        threads.append({ 
     19            'title': demo_data['title'], 
     20            'id': '0' 
     21        }) 
     22        c.factlet_threads = threads 
    1723        factlets = demo_data['factlets'] 
    1824        try: 
  • trunk/microfacts/controllers/thread.py

    r12 r13  
    66    def get_demo_data(self): 
    77        from simplejson import load 
    8         return load(file('./demo/napoleon.js')) 
     8        return load(file('./demo/napoleon2.js')) 
    99 
    1010    def read(self, id, format='html'): 
     
    1414            id = 0 
    1515        demo_data = self.get_demo_data() 
    16         c.factlet_thread_title = demo_data['title'] 
    17         factlets = demo_data['factlets'] 
     16        thread = demo_data['threads'][id] 
     17        c.factlet_thread_title = thread['title'] 
     18        factlets = thread['factlets'] 
    1819        try: 
    1920            factlet = factlets[id] 
  • trunk/microfacts/public/css/factlet.css

    r10 r13  
    1 div.factlet-thread { 
     1div.thread-with-factlets, 
     2div.factlet-with-threads { 
    23  width: 110%; 
    34} 
    45 
    5 .factlet-thread h2 { 
     6.thread-with-factlets h2, 
     7.factlet-with-threads h2 { 
    68  color: #800; 
    79  margin: 0em; 
     
    1113 
    1214div.vertical-line { 
    13   background: #EBDDB5
     15  background: black
    1416  position: absolute; 
    1517  height: 1em; 
    16   width: 2px; 
     18  width: 1px; 
    1719  margin: 0 0 0 4.5em; 
    1820} 
    1921 
    20 div.thread { 
     22div.thread-factlets, 
     23div.factlet-threads { 
    2124  float: left; 
    22   border: 0px solid #EBDDB5; 
    2325  padding: 1em; 
    2426  background: #FFFFE8; 
    25   width: 14em; 
    2627  font-family: "Lucida Grande", Lucidagrande, "Lucida Sans", Lucidasans, "Lucida Sans Unicode", Lucidasansunicode, Lucida, "Bitstream Vera Sans", Helvetica, sans-serif; 
    2728  margin: 1em 0 0 1em; 
    2829} 
    2930 
     31div.thread-factlets { 
     32  border: 2px solid #EBDDB5; 
     33  width: 50em; 
     34} 
     35 
     36div.factlet-threads { 
     37  border: 0px solid #EBDDB5; 
     38  width: 14em; 
     39} 
     40 
     41div.factlet-thread-summary, div.factlet-thread-create, 
    3042div.thread-factlet-summary, div.thread-factlet-create { 
    31   width: 12.5em; 
    32   border: 2px solid #EBDDB5; 
    3343  padding: 0.5em; 
    3444  background: #FFFFD8; 
     
    3747} 
    3848 
     49div.factlet-thread-summary, div.factlet-thread-create { 
     50  width: 12.5em; 
     51  border: 2px solid #EBDDB5; 
     52} 
     53 
     54div.thread-factlet-summary, div.thread-factlet-create { 
     55  width: 48em; 
     56  border: 1px solid black; 
     57  margin: 0 1em 1em 0.5em; 
     58} 
     59 
     60div.thread-factlet-create { 
     61  border: 1px dashed black; 
     62} 
     63 
     64.factlet-thread-summary a, 
    3965.thread-factlet-summary a { 
    4066  color: black; 
    4167} 
    4268 
    43  
    44 div.thread-factlet-create { 
    45   border: 2px dashed #EBDDB5; 
    46 
    47  
     69div.thread-factlet, 
    4870div.factlet { 
    4971  float: left; 
    5072  width: 35em; 
    51   border: 2px solid black; 
    52   margin: 1em 0 0 2em; 
     73  margin: 1em 0 0 1em; 
    5374  padding: 1.3em; 
    5475  font-family: "Lucida Grande", Lucidagrande, "Lucida Sans", Lucidasans, "Lucida Sans Unicode", Lucidasansunicode, Lucida, "Bitstream Vera Sans", Helvetica, sans-serif; 
     
    5677} 
    5778 
     79div.thread-factlet { 
     80  border: 2px solid #EBDDB5; 
     81} 
     82 
     83div.factlet { 
     84  border: 2px solid black; 
     85} 
     86 
     87.thread-factlets h3, 
    5888.factlet h3 { 
    5989  color: black; 
     
    6393} 
    6494 
     95.thread-factlets h4, 
     96.factlet h4 { 
     97  color: black; 
     98  margin: 0 0 0.5em 0; 
     99  font-size: 1.2em; 
     100  font-family: "Lucida Grande", Lucidagrande, "Lucida Sans", Lucidasans, "Lucida Sans Unicode", Lucidasansunicode, Lucida, "Bitstream Vera Sans", Helvetica, sans-serif; 
     101} 
     102 
     103.thread-factlet table, 
    65104.factlet table { 
    66105  margin: 1em 0 0; 
     
    71110} 
    72111 
     112.thread-factlet tr td, 
    73113.factlet tr td { 
    74114  margin: 0 0 0; 
     
    84124} 
    85125 
     126.thread-factlet a, 
    86127.factlet a { 
    87128  color: blue; 
     
    96137} 
    97138 
    98 div.factlet-pushclear { 
     139div.pushclear { 
    99140  clear: both; 
    100141} 
    101142 
     143 
     144 
     145 
  • trunk/microfacts/templates/factlet/read.html

    r12 r13  
    66  <div py:match="content"> 
    77 
    8     <div class="factlet-thread"> 
     8    <div class="factlet-with-threads"> 
    99      <h2>${c.factlet_title}</h2> 
    10  
    11 <!-- 
    12       <div class="factlet-thread"> 
    13  
    14         <div class="thread"> 
    15  
    16         <py:for each="factlet in c.factlets"> 
    17  
    18           <div class="thread-factlet-summary"> 
    19             <a href="${h.url_for(action='read', id=factlet['id'])}">${factlet['title']}</a> 
    20           </div> 
    21  
    22           <div class="vertical-line"/> 
    23  
    24         </py:for> 
    25            
    26           <div class="thread-factlet-create"> 
    27        Create factlet... 
    28           </div> 
    29         </div> 
    30       </div> 
    31 --> 
    3210 
    3311      <div class="factlet"> 
    3412        <div class="info-dot"/> 
     13         
    3514        <h3>${c.factlet_title}</h3> 
    3615        ${c.factlet_description} 
     
    6140 
    6241      </div> 
     42 
     43      <div class="factlet-threads"> 
     44        <py:for each="thread in c.factlet_threads"> 
     45          <div class="factlet-thread-summary"><a 
     46            href="${h.url_for( 
     47                controller='thread', 
     48                action='read', 
     49                id=thread['id'] 
     50            )}" 
     51          >${thread['title']}</a> 
     52          </div> 
     53        </py:for> 
     54      </div> 
     55 
    6356    </div> 
    6457 
    65     <div class="factlet-pushclear"/> 
     58    <div class="pushclear"/> 
    6659 
    6760  </div> 
  • trunk/microfacts/templates/thread/read.html

    r10 r13  
    66  <div py:match="content"> 
    77 
    8     <div class="factlet-thread"> 
     8    <div class="thread-with-factlets"> 
    99      <h2>${c.factlet_thread_title}</h2> 
    1010 
    11       <div class="factlet-thread"> 
    12  
    13         <div class="thread"> 
    14  
     11      <div class="thread-factlets"> 
     12        <h3>${c.factlet_thread_title}</h3> 
    1513        <py:for each="factlet in c.factlets"> 
    16  
    1714          <div class="thread-factlet-summary"> 
    18             <a href="${h.url_for(action='read', id=factlet['id'])}">${factlet['title']}</a> 
     15            <h4><a href="${h.url_for( 
     16                 controller='factlet', 
     17                 action='read', 
     18                 id=factlet['id'])}">${factlet['title']}</a></h4> 
     19            <p>${factlet['description']}</p> 
    1920          </div> 
    20  
    2121          <div class="vertical-line"/> 
    22  
    2322        </py:for> 
    24            
    25           <div class="thread-factlet-create"> 
    26        Create factlet... 
    27           </div> 
     23        <div class="thread-factlet-create"> 
     24          Create factlet... 
    2825        </div> 
    2926      </div> 
    3027 
    31       <div class="factlet"> 
    32         <div class="info-dot"/> 
    33         <h3>${c.factlet_title}</h3> 
    34         ${c.factlet_description} 
    3528 
    36         <div class="factlet-resources"> 
    37         <table> 
    38         <tr> 
    39           <td class="factlet-resource-name">Web</td> 
    40           <td> 
    41             <a href="${c.factlet_url}">${c.factlet_url}</a> 
    42           </td> 
    43         </tr> 
    44         <tr> 
    45           <td class="factlet-resource-name">Calendar</td> 
    46           <td> 
    47             <a href="#">${c.factlet_date_start}</a> 
    48           </td> 
    49         </tr> 
    50         <tr> 
    51           <td class="factlet-resource-name">Map</td> 
    52           <td> 
    53             <a href="#">View map</a> 
    54             <a href="#">Find nearby events</a> 
    55           </td> 
    56         </tr> 
    57         </table> 
    58         </div> 
    59  
    60       </div> 
    6129    </div> 
    6230 
    63     <div class="factlet-pushclear"/> 
     31    <div class="pushclear"/> 
    6432 
    65   </div> 
     33  </div>  
    6634 
    6735  <xi:include href="layout.html" /> 
  • trunk/microfacts/tests/functional/test_factlet.py

    r10 r13  
    55 
    66    def test_read(self): 
    7         path = url_for(controller='factlet', action='read', id=1
     7        path = url_for(controller='factlet', action='read', id=0
    88        response = self.app.get(path) 
    99        assert 'Microfacts' in response 
    1010        assert 'Battle of Austerlitz' in response 
     11        assert 'Battles in the Napoleonic Wars' in response 
     12        response = response.click('Battles in the Napoleonic Wars') 
     13        assert 'Battles in the Napoleonic Wars' in response 
     14        assert 'Battle of Austerlitz' in response 
     15        assert 'Battle of Borodino' in response 
     16        assert 'Battle of Waterloo' in response 
    1117 
     18 
     19 
  • trunk/microfacts/tests/functional/test_thread.py

    r12 r13  
    55 
    66    def test_read(self): 
    7         path = url_for(controller='thread', action='read', id=1
     7        path = url_for(controller='thread', action='read', id=0
    88        response = self.app.get(path) 
    99        assert 'Microfacts' in response 
    10         assert 'Napoleonic' in response 
     10        assert 'Battles in the Napoleonic Wars' in response 
     11        assert 'Battle of Friedland' in response 
     12        response = response.click('Battle of Friedland') 
     13        assert 'View map' in response  
     14        assert 'View map' in response  
     15        assert 'fought on June 14, 1807 about twenty-seven miles' in response 
    1116