Merge lp:~widelands-dev/widelands-website/wlhelp_internal_names into lp:widelands-website

Proposed by kaputtnik
Status: Merged
Merged at revision: 486
Proposed branch: lp:~widelands-dev/widelands-website/wlhelp_internal_names
Merge into: lp:widelands-website
Diff against target: 821 lines (+233/-259)
17 files modified
media/css/encyclopedia.css (+8/-5)
media/js/encyclopedia.js (+60/-78)
templates/wlhelp/base.html (+1/-0)
templates/wlhelp/building_details.html (+2/-3)
templates/wlhelp/buildings.html (+12/-39)
templates/wlhelp/index.html (+3/-13)
templates/wlhelp/inlines/display_buildings.html (+14/-14)
templates/wlhelp/inlines/js_form_buildings.html (+23/-0)
templates/wlhelp/inlines/js_form_scripting.html (+7/-0)
templates/wlhelp/inlines/tribes_details.html (+5/-19)
templates/wlhelp/ware_details.html (+2/-24)
templates/wlhelp/wares.html (+43/-14)
templates/wlhelp/worker_details.html (+2/-3)
templates/wlhelp/workers.html (+28/-15)
wlhelp/models.py (+2/-1)
wlhelp/urls.py (+0/-2)
wlhelp/views.py (+21/-29)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/wlhelp_internal_names
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+341265@code.launchpad.net

Description of the change

Add the attribute 'name' to the encyclopedia, which is needed for scenario scripting. This is done by adding another checkbox on the top of the pages, which, once checked, shows the attribute in the table-cell 'Description'.

This small change results in bigger followup changes:

- Reworked the templates and used more includes
- Reworked the js to filter buildings to be consistent in using jquery
- Fixed a warning of mysql regarding the new building 'market'
- Fixed errors reported by w3c-html-validator

To post a comment you must log in.
492. By kaputtnik

merged trunk

Revision history for this message
kaputtnik (franku) wrote :

Merged and deployed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'media/css/encyclopedia.css'
2--- media/css/encyclopedia.css 2017-03-15 20:59:33 +0000
3+++ media/css/encyclopedia.css 2018-03-18 10:56:39 +0000
4@@ -2,10 +2,7 @@
5 width: 100%;
6 border-collapse: collapse;
7 margin-bottom: 20px;
8-}
9-
10-table.help tr {
11-
12+ table-layout: fixed;
13 }
14
15 table.help th {
16@@ -18,10 +15,16 @@
17 table.help td {
18 padding: 4px;
19 border: 1px solid black;
20+ overflow: hidden;
21+}
22+
23+table.help div.scripting{
24+ padding-top: 1em;
25+ display: none;
26 }
27
28 img.icon {
29- margin: 0px 10px 10px 0px;
30+ margin: 0 10px 0 0;
31 }
32
33 /* Let Table headers look like h2 */
34
35=== modified file 'media/js/encyclopedia.js'
36--- media/js/encyclopedia.js 2017-09-23 08:52:36 +0000
37+++ media/js/encyclopedia.js 2018-03-18 10:56:39 +0000
38@@ -1,9 +1,4 @@
39 $(document).ready(function() {
40- $('#apply_filter').on('click', set_display);
41- // Find names of checkboxes:
42- checkb_names = get_input_names();
43- // Initialize after reload, e.g. pressing F5:
44- init_checkboxes();
45
46 // Smooth scrolling, taken from:
47 // http://stackoverflow.com/a/18795112
48@@ -13,71 +8,68 @@
49 }, 500);
50 event.preventDefault();
51 });
52+
53+ // Toggle display of scripting values
54+ // Usage of sessionStore makes it possible to keep the status
55+ // when switching to different pages. When switching the page the
56+ // state of checkbox and the visibility of items has to be set.
57+ if ( $("input#toggle_scripting").length > 0 &&
58+ sessionStorage.getItem('scripting_status') === "true"){
59+ $("input#toggle_scripting")[0].checked = true;
60+ $(".scripting").show();
61+ }
62+ $("input#toggle_scripting").click(function(){
63+ $(".scripting").toggle();
64+ sessionStorage.setItem('scripting_status', this.checked);
65+ });
66+
67+ // Toggle the display of whole tables
68+ $("input#small").click(function(){
69+ $(".size-S").toggle();
70+ });
71+
72+ $("input#medium").click(function(){
73+ $(".size-M").toggle();
74+ });
75+
76+ $("input#big").click(function(){
77+ $(".size-B").toggle();
78+ });
79+
80+ $("input#mines").click(function(){
81+ $(".size-I").toggle();
82+ });
83+
84+ // Toggle rows of tables
85+ $("input#warehouse").click(function(){
86+ $(".type-W").toggle( function(){
87+ hide_empty_tables();
88+ });
89+ });
90+
91+ $("input#production").click(function(){
92+ $(".type-P").toggle( function(){
93+ hide_empty_tables();
94+ });
95+ });
96+
97+ $("input#military").click(function(){
98+ $(".type-M").toggle( function(){
99+ hide_empty_tables();
100+ });
101+ });
102+
103+ $("input#training").click(function(){
104+ $(".type-T").toggle( function(){
105+ hide_empty_tables();
106+ });
107+ });
108+
109 });
110
111-function get_input_names(){
112- var inp = document.getElementById('filter_select').getElementsByTagName('input');
113- var n = [];
114- for (var i=0; i<inp.length; i++){
115- if (! n.includes(inp[i].name)){
116- n.push(inp[i].name);
117- }
118- }
119- return n;
120-}
121-
122-function set_display(){
123- // Hide/unhide tables and/or rows
124- // Tables get hidden when filtering by size
125- // Rows get hidden when filtering by type
126- for (var y=0; y<checkb_names.length; y++){
127- var option_boxes = document.getElementsByName(checkb_names[y]);
128- if ( check_checked(option_boxes) === false ){
129- // Mark all as checked if none is checked for one type of filter
130- // This makes it possible to search e.g. for all of type
131- // 'Production' (and no 'size' is checked), or all of size
132- // 'Big' (and no 'type' is checked)
133- for (var j=0; j<option_boxes.length; j++){
134- option_boxes[j].checked = true;
135- }
136- }
137- for (var i = 0; i < option_boxes.length; i++) {
138- var elements = document.getElementsByName(option_boxes[i].value);
139- hide_unhide_elements(elements, option_boxes[i].checked);
140- }
141- }
142- // Filtering by type may lead into empty tables resulting in showing just
143- // rows with <th> or caption
144- hide_empty_tables();
145-}
146-
147-function hide_unhide_elements(elem_list, checked){
148- elem_list.forEach( function(elem){
149- if (checked){
150- elem.style.display = '';
151- }else{
152- elem.style.display = 'none';
153- }
154- });
155-}
156-
157-function check_checked(chb_list){
158- // Check if none of the checkbox is checked in this list
159- var c=0;
160- chb_list.forEach( function(chb){
161- if (! chb.checked){
162- c++;
163- }
164- });
165- if (c == chb_list.length){
166- return false;
167- }
168- return true;
169-}
170-
171 function hide_empty_tables(){
172- // Hide a table if no row is displayed in it
173- var tables = document.getElementsByTagName('table');
174+ // Hide a whole table if no row is displayed in it
175+ var tables = $("table");
176 for (var i=0; i<tables.length; i++){
177 var table = tables[i];
178 var hidden_rows = 0;
179@@ -93,14 +85,4 @@
180 table.style.display = '';
181 }
182 }
183-}
184-
185-function init_checkboxes(){
186- // Mark all checkboxes as checked
187- for (var x=0; x<checkb_names.length; x++){
188- var option_boxes = document.getElementsByName(checkb_names[x]);
189- for (i=0; i < option_boxes.length; i++){
190- option_boxes[i].checked = true;
191- }
192- }
193-}
194+}
195\ No newline at end of file
196
197=== modified file 'templates/wlhelp/base.html'
198--- templates/wlhelp/base.html 2017-09-23 08:52:36 +0000
199+++ templates/wlhelp/base.html 2018-03-18 10:56:39 +0000
200@@ -6,5 +6,6 @@
201
202 {% block extra_head %}
203 <link rel="stylesheet" type="text/css" media="all" href="{{ MEDIA_URL }}css/encyclopedia.css" />
204+ <script src="{{ MEDIA_URL }}js/encyclopedia.js"></script>
205 {{ block.super}}
206 {% endblock %}
207\ No newline at end of file
208
209=== modified file 'templates/wlhelp/building_details.html'
210--- templates/wlhelp/building_details.html 2016-03-02 21:02:38 +0000
211+++ templates/wlhelp/building_details.html 2018-03-18 10:56:39 +0000
212@@ -10,9 +10,8 @@
213 {% block content %}
214 <h1>{{ tribe.displayname }}: {{ building.displayname }}</h1>
215 <div class="blogEntry">
216- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
217- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
218- <a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a> &#187;
219+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
220+ <a href="{% url 'wlhelp_buildings' tribe.name %}">{{ tribe.displayname }} Buildings</a> &#187;
221 {{ building.displayname }}
222 <br /><br />
223
224
225=== modified file 'templates/wlhelp/buildings.html'
226--- templates/wlhelp/buildings.html 2017-09-23 08:52:36 +0000
227+++ templates/wlhelp/buildings.html 2018-03-18 10:56:39 +0000
228@@ -7,52 +7,25 @@
229 Buildings - {{ tribe.displayname }} - {{ block.super }}
230 {% endblock %}
231
232-{% block extra_head %}
233- <script type="text/javascript" src="{{ MEDIA_URL }}js/encyclopedia.js"></script>
234-{{ block.super}}
235-{% endblock %}
236-
237 {% block content %}
238 <h1>{{ tribe.displayname }}: Buildings</h1>
239 <div class="blogEntry">
240 <div class="posRight">
241- <form id="filter_select">
242- <fieldset style="display: inline; border: none">
243- {# Attribute 'name': Groups filters (sizes/types) #}
244- {# Attribute 'value': Corresponding names of html elements (tables/rows) #}
245- <legend>Show Buildings by Size and/or Type:</legend>
246- <input type="checkbox" id="small" name="sizes" value="size-S" checked="checked" />
247- <label for="small">Small</label>
248- <input type="checkbox" id="medium" name="sizes" value="size-M" checked="checked" />
249- <label for="medium">Medium</label>
250- <input type="checkbox" id="big" name="sizes" value="size-B" checked="checked" />
251- <label for="big">Big</label>
252- <input type="checkbox" id="mines" name="sizes" value="size-I" checked="checked" />
253- <label for="mines">Mines</label><br />
254- <input type="checkbox" id="warehouse" name="types" value="type-W" checked="checked" />
255- <label for="warehouse">Warehouse</label>
256- <input type="checkbox" id="production" name="types" value="type-P" checked="checked" />
257- <label for="production">Production</label>
258- <input type="checkbox" id="military" name="types" value="type-M" checked="checked" />
259- <label for="military">Military</label>
260- <input type="checkbox" id="training" name="types" value="type-T" checked="checked" />
261- <label for="training">Trainingsites</label><br />
262- <button type="button" id="apply_filter" class="button">Update</button>
263- </fieldset>
264- </form>
265- </div>
266- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
267- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
268- Buildings
269+ {% include 'wlhelp/inlines/js_form_buildings.html' %}<br />
270+ {% include 'wlhelp/inlines/js_form_scripting.html' %}
271+ </div>
272+ <div class="breadCrumb">
273+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Buildings
274+ </div>
275
276 {# Headquarters #}
277- <div name="size-B">
278+ <div class="size-B">
279 {% with buildings.headquarters as buildings %}
280 {% include "wlhelp/inlines/display_buildings.html" with header="Headquarters" %}
281 {% endwith %}
282 </div>
283
284- <div name="size-S">
285+ <div class="size-S">
286 {# Small buildings #}
287 {% if buildings.small.count %}
288 {% with buildings.small as buildings %}
289@@ -66,7 +39,7 @@
290 {% endif %}
291 </div>
292
293- <div name="size-M">
294+ <div class="size-M">
295 {# Medium buildings #}
296 {% if buildings.medium.count %}
297 {% with buildings.medium as buildings %}
298@@ -80,7 +53,7 @@
299 {% endif %}
300 </div>
301
302- <div name="size-B">
303+ <div class="size-B">
304 {# Big buildings #}
305 {% if buildings.big.count %}
306 {% with buildings.big as buildings %}
307@@ -94,7 +67,7 @@
308 {% endif %}
309 </div>
310
311- <div name="size-I">
312+ <div class="size-I">
313 {# Mines #}
314 {% if buildings.mine.count %}
315 {% with buildings.mine as buildings %}
316@@ -108,7 +81,7 @@
317 {% endif %}
318 </div>
319
320- <div name="size-B">
321+ <div class="size-B">
322 {# Ports #}
323 {% if buildings.port.count %}
324 {% with buildings.port as buildings %}
325
326=== modified file 'templates/wlhelp/index.html'
327--- templates/wlhelp/index.html 2017-03-07 11:12:33 +0000
328+++ templates/wlhelp/index.html 2018-03-18 10:56:39 +0000
329@@ -10,21 +10,11 @@
330 {% block content %}
331 <h1>Encyclopedia</h1>
332 <div class="blogEntry">
333-Encyclopedia &#187; Index
334+Encyclopedia Index
335 <h2>All Tribes in Widelands:</h2>
336 {% for tribe in tribes %}
337-<p><img class="posLeft icon" src="{{ tribe.icon_url }}" alt="">
338- <a href="{% url 'wlhelp_tribe_details' tribe.name %}"><b>{{ tribe.displayname }}</b></a><br />
339- {{ tribe.descr }}</p>
340- <ul style="list-style: circle; margin-left: 1em; margin-top: -0.2em;">
341- <li><a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a></li>
342- <li><a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a></li>
343- <li><a href="{% url 'wlhelp_workers' tribe.name %}">Workers</a></li>
344- <li><a href="{{ tribe.network_pdf_url }}" target="_blank">Economy Network as PDF</a></li>
345- <li><a href="{{ tribe.network_gif_url }}" target="_blank">Economy Network as GIF</a></li>
346- </ul>
347- </li>
348-</ul>
349+ <h3>{{ tribe.displayname }}</h3>
350+ {% include "wlhelp/inlines/tribes_details.html" %}
351 {% endfor %}
352 </div>
353 {% endblock %}
354
355=== modified file 'templates/wlhelp/inlines/display_buildings.html'
356--- templates/wlhelp/inlines/display_buildings.html 2017-03-15 22:49:54 +0000
357+++ templates/wlhelp/inlines/display_buildings.html 2018-03-18 10:56:39 +0000
358@@ -1,22 +1,21 @@
359 <table class="help">
360 <caption style="text-align: left">{{ header }}</caption>
361 <tr>
362- <th style="width: 14em;">Image</th>
363- <th>Description</th>
364+ <th style="width: 113px">Building</th>
365+ <th style="width: 50%">Description</th>
366 <th>Build cost</th>
367 <th>Produces</th>
368 <th>Stores</th>
369 </tr>
370 {% for b in buildings %}
371- <tr class="{% cycle "odd" "even" %}" name="type-{{ b.type }}">
372- <td>
373- <a href="{% url 'wlhelp_building_details' b.tribe.name b.name %}" title="{{ b.displayname }}" id="{{ b.name }}">
374- {{ b.displayname }}
375- <br />
376+ <tr class="{% cycle "odd" "even" %} type-{{ b.type }}" id="{{ b.name }}">
377+ <td> {# Buildings name and image #}
378+ <a href="{% url 'wlhelp_building_details' b.tribe.name b.name %}" title="Show economy graph">
379+ {{ b.displayname }}<br />
380 <img alt="{{b.displayname}}" src="{{ b.image_url }}" />
381 </a>
382 </td>
383- <td>
384+ <td> {# Description #}
385 {{ b.help }}
386 {% if b.enhanced_from or b.enhancement %}
387 <ul>
388@@ -28,19 +27,20 @@
389 {% endif %}
390 </ul>
391 {% endif %}
392+ <div class="small scripting">Internal name: "{{ b.name }}"</div>
393 </td>
394- <td>
395+ <td> {# Build cost #}
396 {% for costs in b.get_build_cost %}
397 {% for w in costs %}
398- <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
399+ <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="Show economy graph for {{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
400 {% endfor %}
401 <br />
402 {% endfor %}
403 </td>
404- <td>
405+ <td> {# Produces #}
406 {% if b.produces and not b.trains %}
407 {% for w in b.get_ware_outputs %}
408- <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
409+ <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="Show economy graph for {{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
410 {% endfor %}
411 {% endif %}
412 {% if b.trains and not b.produces %}
413@@ -49,10 +49,10 @@
414 {% endfor %}
415 {% endif %}
416 </td>
417- <td>
418+ <td> {## Stored wares #}
419 {% for costs in b.get_stored_wares %}
420 {% for w in costs %}
421- <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
422+ <a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="Show economy graph for {{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
423 {% endfor %}
424 <br />
425 {% endfor %}
426
427=== added file 'templates/wlhelp/inlines/js_form_buildings.html'
428--- templates/wlhelp/inlines/js_form_buildings.html 1970-01-01 00:00:00 +0000
429+++ templates/wlhelp/inlines/js_form_buildings.html 2018-03-18 10:56:39 +0000
430@@ -0,0 +1,23 @@
431+ <form id="filter_select">
432+ <fieldset style="display: inline; border: none">
433+ {# Attribute 'name': Groups filters (sizes/types) #}
434+ {# Attribute 'value': Corresponding names of html elements (tables/rows) #}
435+ <legend>Show Buildings by Size and/or Type:</legend>
436+ <input type="checkbox" id="small" name="sizes" value="size-S" checked="checked" />
437+ <label for="small">Small</label>
438+ <input type="checkbox" id="medium" name="sizes" value="size-M" checked="checked" />
439+ <label for="medium">Medium</label>
440+ <input type="checkbox" id="big" name="sizes" value="size-B" checked="checked" />
441+ <label for="big">Big</label>
442+ <input type="checkbox" id="mines" name="sizes" value="size-I" checked="checked" />
443+ <label for="mines">Mines</label><br />
444+ <input type="checkbox" id="warehouse" name="types" value="type-W" checked="checked" />
445+ <label for="warehouse">Warehouse</label>
446+ <input type="checkbox" id="production" name="types" value="type-P" checked="checked" />
447+ <label for="production">Production</label>
448+ <input type="checkbox" id="military" name="types" value="type-M" checked="checked" />
449+ <label for="military">Military</label>
450+ <input type="checkbox" id="training" name="types" value="type-T" checked="checked" />
451+ <label for="training">Trainingsites</label><br />
452+ </fieldset>
453+ </form>
454
455=== added file 'templates/wlhelp/inlines/js_form_scripting.html'
456--- templates/wlhelp/inlines/js_form_scripting.html 1970-01-01 00:00:00 +0000
457+++ templates/wlhelp/inlines/js_form_scripting.html 2018-03-18 10:56:39 +0000
458@@ -0,0 +1,7 @@
459+
460+ <form id="show_scripting">
461+ <fieldset style="display: inline; border: none">
462+ <input type="checkbox" id="toggle_scripting" name="scripting" value="toggle_on" />
463+ <label for="toggle_scripting">Show names for scripting</label>
464+ </fieldset>
465+ </form>
466
467=== renamed file 'templates/wlhelp/tribe_details.html' => 'templates/wlhelp/inlines/tribes_details.html'
468--- templates/wlhelp/tribe_details.html 2016-03-02 21:02:38 +0000
469+++ templates/wlhelp/inlines/tribes_details.html 2018-03-18 10:56:39 +0000
470@@ -1,20 +1,7 @@
471-{% extends "wlhelp/base.html" %}
472-{% comment %}
473- vim:ft=htmldjango
474-{% endcomment %}
475-
476-{% block title %}
477-{{ tribe.displayname }} - {{ block.super }}
478-{% endblock %}
479-
480-{% block content %}
481-<h1>{{ tribe.displayname }}</h1>
482-<div class="blogEntry">
483-<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
484-{{ tribe.displayname }}
485-<br /><br />
486-<img class="posLeft icon" src="{{ tribe.icon_url }}" alt="" />
487-<p>{{ tribe.descr }}</p>
488+<div>
489+ <img class="posLeft icon" src="{{ tribe.icon_url }}" alt="" />
490+ <p>{{ tribe.descr }}</p>
491+</div>
492 <ul>
493 <li><a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a></li>
494 <li><a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a></li>
495@@ -22,5 +9,4 @@
496 <li><a href="{{ tribe.network_pdf_url }}" target="_blank">Economy Network as PDF</a></li>
497 <li><a href="{{ tribe.network_gif_url }}" target="_blank">Economy Network as GIF</a></li>
498 </ul>
499-</div>
500-{% endblock %}
501+
502
503=== modified file 'templates/wlhelp/ware_details.html'
504--- templates/wlhelp/ware_details.html 2016-03-02 21:02:38 +0000
505+++ templates/wlhelp/ware_details.html 2018-03-18 10:56:39 +0000
506@@ -10,9 +10,8 @@
507 {% block content %}
508 <h1>{{ tribe.displayname }}: {{ ware.displayname }}</h1>
509 <div class="blogEntry">
510- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
511- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
512- <a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a> &#187;
513+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
514+ <a href="{% url 'wlhelp_wares' tribe.name %}">{{ tribe.displayname }} Wares</a> &#187;
515 {{ ware.displayname }}
516 <br /><br />
517
518@@ -22,26 +21,5 @@
519 <h2>Economy Graph</h2>
520 {{ ware.imagemap|safe }}
521 <img src="{{ ware.graph_url }}" usemap="#G" alt="Graph for {{ ware.displayname }}" />
522-{% comment %}
523-{% if ware.build_ware_for_buildings.all %}
524-<h2>Used in the construction of</h2>
525-<table style="width:100%" class="building">
526- <tr>
527- <th>Building</th>
528- <th>Name</th>
529- <th>Description</th>
530- </tr>
531- {% for b in ware.build_ware_for_buildings.all %}
532- <tr class="odd">
533- <td><img src="{{ b.image_url }}" alt="{{b.displayname}}" /></td>
534- <td><a href="../../buildings/{{b.name}}/">{{ b.displayname }}</a></td>
535- <td>{{ b.help }}</td>
536- </tr>
537- {% endfor %}
538-</table>
539-{% else %}
540-Not used for building.<br />
541-{% endif %}
542-{% endcomment %}
543 </div>
544 {% endblock %}
545
546=== modified file 'templates/wlhelp/wares.html'
547--- templates/wlhelp/wares.html 2016-03-02 21:02:38 +0000
548+++ templates/wlhelp/wares.html 2018-03-18 10:56:39 +0000
549@@ -4,32 +4,61 @@
550 {% endcomment %}
551
552 {% block title %}
553-Wares - {{ tribe.displayname }} - {{ block.super }}
554+{{ tribe.displayname }} - Wares - {{ block.super }}
555 {% endblock %}
556
557 {% block content %}
558 <h1>{{ tribe.displayname }}: Wares</h1>
559 <div class="blogEntry">
560- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
561- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
562- Wares
563- <br /><br />
564+ <div class="posRight">
565+ {% include 'wlhelp/inlines/js_form_scripting.html' %}
566+ </div>
567+ <div class="breadCrumb">
568+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Wares
569+ </div>
570
571 <table class="help">
572 <tr>
573- <th>Image</th>
574- <th>Name</th>
575- <th>Description</th>
576+ <th>Ware</th>
577+ <th style="width: 70%;">Description</th>
578+ <th style="width: 20%">Produced at/by</th>
579 </tr>
580- {% for ware in wares %}
581- <tr class="{% cycle "odd" "even" %}">
582+ {% for w in wares %}
583+ <tr class="{% cycle "odd" "even" %}" id="{{ w.name }}">
584 <td>
585- <a href="{% url 'wlhelp_ware_details' tribe.name ware.name %}">
586- <img src="{{ ware.image_url }}" alt="{{ ware.name }}" />
587+ <a id="{{ w.name }}" href="{% url 'wlhelp_ware_details' tribe.name w.name %}" title="Show economy graph">
588+ {{ w.displayname }}
589+ <br />
590+ <img src="{{ w.image_url }}" alt="{{ w.name }}" />
591 </a>
592 </td>
593- <td><a id="{{ ware.name }}" href="{% url 'wlhelp_ware_details' tribe.name ware.name %}">{{ ware.displayname }}</a></td>
594- <td>{{ ware.help }}</td>
595+ <td>
596+ {{ w.help }}
597+ <div class="small scripting">Internal name: "{{ w.name }}"</div>
598+ </td>
599+ <td>
600+ <table class="help small">
601+ <tr>
602+ <th>At:</th>
603+ <th>By:</th>
604+ </tr>
605+ {% for building in w.produced_by_buildings.all %}
606+ <tr>
607+ <td>
608+ <a href="../buildings/#{{ building.name }}">{{ building.displayname }}<br />
609+ <img src="{{ building.image_url }}" alt="{{ building.displayname }}" />
610+ </a>
611+ </td>
612+ <td>
613+ {% for worker in building.workers_types.all %}
614+ <a href="../workers/#{{ worker.name }}">{{ worker.displayname }}<br />
615+ <img src="{{ worker.image_url }}" alt="{{ worker.displayname }}" />
616+ </a><br />
617+ {% endfor %}
618+ </td>
619+ </tr>
620+ {% endfor %}
621+ </table>
622 </tr>
623 {% endfor %}
624 </table>
625
626=== modified file 'templates/wlhelp/worker_details.html'
627--- templates/wlhelp/worker_details.html 2016-03-02 21:02:38 +0000
628+++ templates/wlhelp/worker_details.html 2018-03-18 10:56:39 +0000
629@@ -10,9 +10,8 @@
630 {% block content %}
631 <h1>{{ tribe.displayname }}: {{ worker.displayname }}</h1>
632 <div class="blogEntry">
633- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
634- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
635- <a href="{% url 'wlhelp_workers' tribe.name %}">Workers</a> &#187;
636+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
637+ <a href="{% url 'wlhelp_workers' tribe.name %}">{{ tribe.displayname }} Workers</a> &#187;
638 {{ worker.displayname }}
639 <br /><br />
640
641
642=== modified file 'templates/wlhelp/workers.html'
643--- templates/wlhelp/workers.html 2016-03-02 21:02:38 +0000
644+++ templates/wlhelp/workers.html 2018-03-18 10:56:39 +0000
645@@ -10,26 +10,39 @@
646 {% block content %}
647 <h1>{{ tribe.displayname }}: Workers</h1>
648 <div class="blogEntry">
649- <a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
650- <a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
651- Workers
652- <br /><br />
653+ <div class="posRight">
654+ {% include 'wlhelp/inlines/js_form_scripting.html' %}
655+ </div>
656+ <div class="breadCrumb">
657+ <a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Workers
658+ </div>
659
660 <table class="help">
661 <tr>
662- <th>Image</th>
663- <th>Name</th>
664- <th>Description</th>
665+ <th>Worker</th>
666+ <th style="width: 75%">Description</th>
667+ <th style="width: 15%">Works at</th>
668 </tr>
669 {% for worker in workers %}
670- <tr class="{% cycle "odd" "even" %}">
671- <td>
672- <a href="{% url 'wlhelp_worker_details' tribe.name worker.name %}">
673- <img src="{{ worker.image_url }}" alt="{{ worker.name }}" />
674- </a>
675- </td>
676- <td><a id="{{ worker.name }}" href="{% url 'wlhelp_worker_details' tribe.name worker.name %}">{{ worker.displayname }}</a></td>
677- <td>{{ worker.help }}</td>
678+ <tr class="{% cycle "odd" "even" %}" id="{{ worker.name }}">
679+ <td>
680+ <a href="{% url 'wlhelp_worker_details' tribe.name worker.name %}" title="Show economy graph">
681+ {{ worker.displayname }}<br />
682+ <img src="{{ worker.image_url }}" alt="{{ worker.displayname }}" />
683+ </a>
684+ </td>
685+ <td>
686+ {{ worker.help }}
687+ <div class="small scripting">Internal name: "{{ worker.name }}"</div>
688+ </td>
689+ <td> {# works at #}
690+ {% for building in worker.workers_for_buildings.all %}
691+ <a href="../buildings/#{{ building.name }}" class="small">{{ building.displayname }}<br />
692+ <img src="{{ building.image_url }}" alt="{{building.displayname}}" />
693+ </a>
694+ <br />
695+ {% endfor %}
696+ </td>
697 </tr>
698 {% endfor %}
699 </table>
700
701=== modified file 'wlhelp/models.py'
702--- wlhelp/models.py 2017-09-12 18:04:34 +0000
703+++ wlhelp/models.py 2018-03-18 10:56:39 +0000
704@@ -92,7 +92,8 @@
705 ('P', 'productionsite'),
706 ('W', 'warehouse'),
707 ('M', 'militarysite'),
708- ('T', 'trainingsite')
709+ ('T', 'trainingsite'),
710+ ('m', 'market'),
711 )
712
713 objects = BuildingManager()
714
715=== modified file 'wlhelp/urls.py'
716--- wlhelp/urls.py 2016-12-13 18:28:51 +0000
717+++ wlhelp/urls.py 2018-03-18 10:56:39 +0000
718@@ -15,8 +15,6 @@
719 urlpatterns = [
720 url(r'^$', index, name='wlhelp_index'),
721
722- # Detail pages
723- url(r'^(?P<tribe>\w+)/$', tribe_details, name='wlhelp_tribe_details'),
724 url(r'^(?P<tribe>\w+)/wares/(?P<ware>[^/]+)/$',
725 ware_details, name='wlhelp_ware_details'),
726 url(r'^(?P<tribe>\w+)/buildings/(?P<building>[^/]+)/$',
727
728=== modified file 'wlhelp/views.py'
729--- wlhelp/views.py 2016-07-02 12:38:06 +0000
730+++ wlhelp/views.py 2018-03-18 10:56:39 +0000
731@@ -1,4 +1,4 @@
732-from django.shortcuts import render_to_response, get_object_or_404
733+from django.shortcuts import render, get_object_or_404
734 from django.template import RequestContext
735 from django.http import HttpResponse
736 from .models import Worker, Ware, Building, Tribe
737@@ -9,58 +9,49 @@
738 def index(request):
739 tribes = Tribe.objects.all().order_by('displayname')
740
741- return render_to_response('wlhelp/index.html',
742- context_instance=RequestContext(request,
743- {'tribes': tribes}))
744-
745-
746-def tribe_details(request, tribe):
747- t = get_object_or_404(Tribe, name=tribe)
748-
749- return render_to_response('wlhelp/tribe_details.html',
750- context_instance=RequestContext(request,
751- {'tribe': t}))
752+ return render(request, 'wlhelp/index.html',
753+ {'tribes': tribes, })
754
755
756 def ware_details(request, tribe, ware):
757 w = get_object_or_404(Ware, tribe__name=tribe, name=ware)
758 t = Tribe.objects.get(name=tribe)
759
760- return render_to_response('wlhelp/ware_details.html',
761- context_instance=RequestContext(request,
762- {'ware': w, 'tribe': t}))
763+ return render(request, 'wlhelp/ware_details.html',
764+ {'ware': w,
765+ 'tribe': t, })
766
767
768 def building_details(request, tribe, building):
769 b = get_object_or_404(Building, tribe__name=tribe, name=building)
770 t = Tribe.objects.get(name=tribe)
771
772- return render_to_response('wlhelp/building_details.html',
773- context_instance=RequestContext(request,
774- {'building': b, 'tribe': t}))
775+ return render(request, 'wlhelp/building_details.html',
776+ {'building': b,
777+ 'tribe': t, })
778
779
780 def worker_details(request, tribe, worker):
781 w = get_object_or_404(Worker, tribe__name=tribe, name=worker)
782 t = Tribe.objects.get(name=tribe)
783
784- return render_to_response('wlhelp/worker_details.html',
785- context_instance=RequestContext(request,
786- {'worker': w, 'tribe': t}))
787+ return render(request, 'wlhelp/worker_details.html',
788+ {'worker': w,
789+ 'tribe': t, })
790
791
792 def workers(request, tribe='barbarians'):
793 t = get_object_or_404(Tribe, name=tribe)
794- return render_to_response('wlhelp/workers.html', context_instance=RequestContext(request,
795- {'workers': Worker.objects.filter(tribe=t).order_by('displayname'),
796- 'tribe': t}))
797+ return render(request, 'wlhelp/workers.html',
798+ {'workers': Worker.objects.filter(tribe=t).order_by('displayname'),
799+ 'tribe': t, })
800
801
802 def wares(request, tribe='barbarians'):
803 t = get_object_or_404(Tribe, name=tribe)
804- return render_to_response('wlhelp/wares.html', context_instance=RequestContext(request,
805- {'wares': Ware.objects.filter(tribe=t).order_by('displayname'),
806- 'tribe': t}))
807+ return render(request, 'wlhelp/wares.html',
808+ {'wares': Ware.objects.filter(tribe=t).order_by('displayname'),
809+ 'tribe': t, })
810
811
812 def buildings(request, tribe='barbarians'):
813@@ -98,5 +89,6 @@
814 buildings['port'] = port.filter(enhanced_from=None)
815 buildings['port_enhanced'] = port.exclude(enhanced_from=None)
816
817- return render_to_response('wlhelp/buildings.html', context_instance=RequestContext(request,
818- {'buildings': buildings, 'tribe': t}))
819+ return render(request, 'wlhelp/buildings.html',
820+ {'buildings': buildings,
821+ 'tribe': t, })

Subscribers

People subscribed via source and target branches