Changeset 13
- Timestamp:
- 03/03/08 12:56:13 (10 months ago)
- Files:
-
- trunk/microfacts/controllers/factlet.py (modified) (1 diff)
- trunk/microfacts/controllers/thread.py (modified) (2 diffs)
- trunk/microfacts/public/css/factlet.css (modified) (8 diffs)
- trunk/microfacts/templates/factlet/read.html (modified) (2 diffs)
- trunk/microfacts/templates/thread/read.html (modified) (1 diff)
- trunk/microfacts/tests/functional/test_factlet.py (modified) (1 diff)
- trunk/microfacts/tests/functional/test_thread.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/microfacts/controllers/factlet.py
r10 r13 15 15 demo_data = self.get_demo_data() 16 16 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 17 23 factlets = demo_data['factlets'] 18 24 try: trunk/microfacts/controllers/thread.py
r12 r13 6 6 def get_demo_data(self): 7 7 from simplejson import load 8 return load(file('./demo/napoleon .js'))8 return load(file('./demo/napoleon2.js')) 9 9 10 10 def read(self, id, format='html'): … … 14 14 id = 0 15 15 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'] 18 19 try: 19 20 factlet = factlets[id] trunk/microfacts/public/css/factlet.css
r10 r13 1 div.factlet-thread { 1 div.thread-with-factlets, 2 div.factlet-with-threads { 2 3 width: 110%; 3 4 } 4 5 5 .factlet-thread h2 { 6 .thread-with-factlets h2, 7 .factlet-with-threads h2 { 6 8 color: #800; 7 9 margin: 0em; … … 11 13 12 14 div.vertical-line { 13 background: #EBDDB5;15 background: black; 14 16 position: absolute; 15 17 height: 1em; 16 width: 2px;18 width: 1px; 17 19 margin: 0 0 0 4.5em; 18 20 } 19 21 20 div.thread { 22 div.thread-factlets, 23 div.factlet-threads { 21 24 float: left; 22 border: 0px solid #EBDDB5;23 25 padding: 1em; 24 26 background: #FFFFE8; 25 width: 14em;26 27 font-family: "Lucida Grande", Lucidagrande, "Lucida Sans", Lucidasans, "Lucida Sans Unicode", Lucidasansunicode, Lucida, "Bitstream Vera Sans", Helvetica, sans-serif; 27 28 margin: 1em 0 0 1em; 28 29 } 29 30 31 div.thread-factlets { 32 border: 2px solid #EBDDB5; 33 width: 50em; 34 } 35 36 div.factlet-threads { 37 border: 0px solid #EBDDB5; 38 width: 14em; 39 } 40 41 div.factlet-thread-summary, div.factlet-thread-create, 30 42 div.thread-factlet-summary, div.thread-factlet-create { 31 width: 12.5em;32 border: 2px solid #EBDDB5;33 43 padding: 0.5em; 34 44 background: #FFFFD8; … … 37 47 } 38 48 49 div.factlet-thread-summary, div.factlet-thread-create { 50 width: 12.5em; 51 border: 2px solid #EBDDB5; 52 } 53 54 div.thread-factlet-summary, div.thread-factlet-create { 55 width: 48em; 56 border: 1px solid black; 57 margin: 0 1em 1em 0.5em; 58 } 59 60 div.thread-factlet-create { 61 border: 1px dashed black; 62 } 63 64 .factlet-thread-summary a, 39 65 .thread-factlet-summary a { 40 66 color: black; 41 67 } 42 68 43 44 div.thread-factlet-create { 45 border: 2px dashed #EBDDB5; 46 } 47 69 div.thread-factlet, 48 70 div.factlet { 49 71 float: left; 50 72 width: 35em; 51 border: 2px solid black; 52 margin: 1em 0 0 2em; 73 margin: 1em 0 0 1em; 53 74 padding: 1.3em; 54 75 font-family: "Lucida Grande", Lucidagrande, "Lucida Sans", Lucidasans, "Lucida Sans Unicode", Lucidasansunicode, Lucida, "Bitstream Vera Sans", Helvetica, sans-serif; … … 56 77 } 57 78 79 div.thread-factlet { 80 border: 2px solid #EBDDB5; 81 } 82 83 div.factlet { 84 border: 2px solid black; 85 } 86 87 .thread-factlets h3, 58 88 .factlet h3 { 59 89 color: black; … … 63 93 } 64 94 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, 65 104 .factlet table { 66 105 margin: 1em 0 0; … … 71 110 } 72 111 112 .thread-factlet tr td, 73 113 .factlet tr td { 74 114 margin: 0 0 0; … … 84 124 } 85 125 126 .thread-factlet a, 86 127 .factlet a { 87 128 color: blue; … … 96 137 } 97 138 98 div. factlet-pushclear {139 div.pushclear { 99 140 clear: both; 100 141 } 101 142 143 144 145 trunk/microfacts/templates/factlet/read.html
r12 r13 6 6 <div py:match="content"> 7 7 8 <div class="factlet- thread">8 <div class="factlet-with-threads"> 9 9 <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 -->32 10 33 11 <div class="factlet"> 34 12 <div class="info-dot"/> 13 35 14 <h3>${c.factlet_title}</h3> 36 15 ${c.factlet_description} … … 61 40 62 41 </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 63 56 </div> 64 57 65 <div class=" factlet-pushclear"/>58 <div class="pushclear"/> 66 59 67 60 </div> trunk/microfacts/templates/thread/read.html
r10 r13 6 6 <div py:match="content"> 7 7 8 <div class=" factlet-thread">8 <div class="thread-with-factlets"> 9 9 <h2>${c.factlet_thread_title}</h2> 10 10 11 <div class="factlet-thread"> 12 13 <div class="thread"> 14 11 <div class="thread-factlets"> 12 <h3>${c.factlet_thread_title}</h3> 15 13 <py:for each="factlet in c.factlets"> 16 17 14 <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> 19 20 </div> 20 21 21 <div class="vertical-line"/> 22 23 22 </py:for> 24 25 <div class="thread-factlet-create"> 26 Create factlet... 27 </div> 23 <div class="thread-factlet-create"> 24 Create factlet... 28 25 </div> 29 26 </div> 30 27 31 <div class="factlet">32 <div class="info-dot"/>33 <h3>${c.factlet_title}</h3>34 ${c.factlet_description}35 28 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>61 29 </div> 62 30 63 <div class=" factlet-pushclear"/>31 <div class="pushclear"/> 64 32 65 </div> 33 </div> 66 34 67 35 <xi:include href="layout.html" /> trunk/microfacts/tests/functional/test_factlet.py
r10 r13 5 5 6 6 def test_read(self): 7 path = url_for(controller='factlet', action='read', id= 1)7 path = url_for(controller='factlet', action='read', id=0) 8 8 response = self.app.get(path) 9 9 assert 'Microfacts' in response 10 10 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 11 17 18 19 trunk/microfacts/tests/functional/test_thread.py
r12 r13 5 5 6 6 def test_read(self): 7 path = url_for(controller='thread', action='read', id= 1)7 path = url_for(controller='thread', action='read', id=0) 8 8 response = self.app.get(path) 9 9 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 11 16
