← Back to team overview

widelands-dev team mailing list archive

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

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/wlhelp_internal_names into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1753582 in Widelands Website: "Add the name attribute to the encyclopedia"
  https://bugs.launchpad.net/widelands-website/+bug/1753582

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/wlhelp_internal_names/+merge/341265

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
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/wlhelp_internal_names into lp:widelands-website.
=== modified file 'media/css/encyclopedia.css'
--- media/css/encyclopedia.css	2017-03-15 20:59:33 +0000
+++ media/css/encyclopedia.css	2018-03-09 19:27:20 +0000
@@ -2,10 +2,7 @@
 	width: 100%;
 	border-collapse: collapse;
 	margin-bottom: 20px;
-}
-
-table.help tr {
-	
+	table-layout: fixed;
 }
 
 table.help th {
@@ -18,10 +15,16 @@
 table.help td {
 	padding: 4px;
 	border: 1px solid black;
+		overflow: hidden;
+}
+
+table.help div.scripting{
+	padding-top: 1em;
+	display: none;
 }
 
 img.icon {
-	margin: 0px 10px 10px 0px;
+	margin: 0 10px 0 0;
 }
 
 /* Let Table headers look like h2 */

=== modified file 'media/js/encyclopedia.js'
--- media/js/encyclopedia.js	2017-09-23 08:52:36 +0000
+++ media/js/encyclopedia.js	2018-03-09 19:27:20 +0000
@@ -1,9 +1,4 @@
 $(document).ready(function() {
-    $('#apply_filter').on('click', set_display);
-    // Find names of checkboxes:
-    checkb_names = get_input_names(); 
-    // Initialize after reload, e.g. pressing F5:
-    init_checkboxes();
 
     // Smooth scrolling, taken from:
     // http://stackoverflow.com/a/18795112
@@ -13,71 +8,68 @@
         }, 500);
         event.preventDefault();
     });
+
+    // Toggle display of scripting values
+    // Usage of sessionStore makes it possible to keep the status
+    // when switching to different pages. When switching the page the
+    // state of checkbox and the visibility of items has to be set.
+    if ( $("input#toggle_scripting").length > 0 &&
+        sessionStorage.getItem('scripting_status') === "true"){
+        $("input#toggle_scripting")[0].checked = true;
+        $(".scripting").show();
+    }
+    $("input#toggle_scripting").click(function(){
+        $(".scripting").toggle();
+        sessionStorage.setItem('scripting_status', this.checked);
+    });
+
+    // Toggle the display of whole tables
+    $("input#small").click(function(){
+        $(".size-S").toggle();
+    });
+
+    $("input#medium").click(function(){
+        $(".size-M").toggle();
+    });
+
+    $("input#big").click(function(){
+        $(".size-B").toggle();
+    });
+
+    $("input#mines").click(function(){
+        $(".size-I").toggle();
+    });
+
+    // Toggle rows of tables
+    $("input#warehouse").click(function(){
+        $(".type-W").toggle( function(){
+            hide_empty_tables();
+        });
+    });
+
+    $("input#production").click(function(){
+        $(".type-P").toggle( function(){
+            hide_empty_tables();
+        });
+    });
+
+    $("input#military").click(function(){
+        $(".type-M").toggle( function(){
+            hide_empty_tables();
+        });
+    });
+
+    $("input#training").click(function(){
+        $(".type-T").toggle( function(){
+            hide_empty_tables();
+        });
+    });
+
 });
 
-function get_input_names(){
-    var inp = document.getElementById('filter_select').getElementsByTagName('input');
-    var n = [];
-    for (var i=0; i<inp.length; i++){
-        if (! n.includes(inp[i].name)){
-            n.push(inp[i].name);
-            }
-    }
-    return n;
-}
-
-function set_display(){
-    // Hide/unhide tables and/or rows
-    // Tables get hidden when filtering by size
-    // Rows get hidden when filtering by type
-    for (var y=0; y<checkb_names.length; y++){
-        var option_boxes = document.getElementsByName(checkb_names[y]);
-        if ( check_checked(option_boxes) === false ){
-            // Mark all as checked if none is checked for one type of filter
-            // This makes it possible to search e.g. for all of type
-            // 'Production' (and no 'size' is checked), or all of size
-            // 'Big' (and no 'type' is checked)
-            for (var j=0; j<option_boxes.length; j++){
-                option_boxes[j].checked = true;
-            }
-        }
-        for (var i = 0; i < option_boxes.length; i++) {
-            var elements = document.getElementsByName(option_boxes[i].value);
-            hide_unhide_elements(elements, option_boxes[i].checked);
-        }
-    }
-    // Filtering by type may lead into empty tables resulting in showing just
-    // rows with <th> or caption
-    hide_empty_tables();
-}
-
-function hide_unhide_elements(elem_list, checked){
-    elem_list.forEach( function(elem){
-        if (checked){
-            elem.style.display = '';
-        }else{
-            elem.style.display = 'none';
-        }
-    });
-}
-
-function check_checked(chb_list){
-    // Check if none of the checkbox is checked in this list
-    var c=0;
-    chb_list.forEach( function(chb){
-        if (! chb.checked){
-            c++;
-        }
-    });
-    if (c == chb_list.length){
-        return false;
-    }
-    return true;
-}
-
 function hide_empty_tables(){
-    // Hide a table if no row is displayed in it
-    var tables = document.getElementsByTagName('table');
+    // Hide a whole table if no row is displayed in it
+    var tables = $("table");
     for (var i=0; i<tables.length; i++){
         var table = tables[i];
         var hidden_rows = 0;
@@ -93,14 +85,4 @@
             table.style.display = '';
         }
     }
-}
-
-function init_checkboxes(){
-    // Mark all checkboxes as checked
-    for (var x=0; x<checkb_names.length; x++){
-        var option_boxes = document.getElementsByName(checkb_names[x]);
-        for (i=0; i < option_boxes.length; i++){
-            option_boxes[i].checked = true;
-        }
-    }
-}
+}
\ No newline at end of file

=== modified file 'templates/wlhelp/base.html'
--- templates/wlhelp/base.html	2017-09-23 08:52:36 +0000
+++ templates/wlhelp/base.html	2018-03-09 19:27:20 +0000
@@ -6,5 +6,6 @@
 
 {% block extra_head %}
 	<link rel="stylesheet" type="text/css" media="all" href="{{ MEDIA_URL }}css/encyclopedia.css" />
+	<script src="{{ MEDIA_URL }}js/encyclopedia.js"></script>
 {{ block.super}}
 {% endblock %}
\ No newline at end of file

=== modified file 'templates/wlhelp/building_details.html'
--- templates/wlhelp/building_details.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/building_details.html	2018-03-09 19:27:20 +0000
@@ -10,9 +10,8 @@
 {% block content %}
 <h1>{{ tribe.displayname }}: {{ building.displayname }}</h1>
 <div class="blogEntry">
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	<a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a> &#187;
+	<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
+	<a href="{% url 'wlhelp_buildings' tribe.name %}">{{ tribe.displayname }} Buildings</a> &#187;
 	{{ building.displayname }}
 	<br /><br />
 

=== modified file 'templates/wlhelp/buildings.html'
--- templates/wlhelp/buildings.html	2017-09-23 08:52:36 +0000
+++ templates/wlhelp/buildings.html	2018-03-09 19:27:20 +0000
@@ -7,52 +7,25 @@
 Buildings - {{ tribe.displayname }} - {{ block.super }}
 {% endblock %}
 
-{% block extra_head %}
-	<script type="text/javascript" src="{{ MEDIA_URL }}js/encyclopedia.js"></script>
-{{ block.super}}
-{% endblock %}
-
 {% block content %}
 <h1>{{ tribe.displayname }}: Buildings</h1>
 <div class="blogEntry">
 	<div class="posRight">
-	<form id="filter_select">
-		<fieldset style="display: inline; border: none">
-			{# Attribute 'name': Groups filters (sizes/types) #}
-			{# Attribute 'value': Corresponding names of html elements (tables/rows) #}
-			<legend>Show Buildings by Size and/or Type:</legend>
-			<input type="checkbox" id="small" name="sizes" value="size-S"  checked="checked" />
-			<label for="small">Small</label>
-			<input type="checkbox" id="medium" name="sizes" value="size-M"  checked="checked" />
-			<label for="medium">Medium</label>
-			<input type="checkbox" id="big" name="sizes" value="size-B" checked="checked" />
-			<label for="big">Big</label>
-			<input type="checkbox" id="mines" name="sizes" value="size-I"  checked="checked" />
-			<label for="mines">Mines</label><br />
-			<input type="checkbox" id="warehouse" name="types" value="type-W" checked="checked" />
-			<label for="warehouse">Warehouse</label>
-			<input type="checkbox" id="production" name="types" value="type-P"  checked="checked" />
-			<label for="production">Production</label>
-			<input type="checkbox" id="military" name="types" value="type-M"  checked="checked" />
-			<label for="military">Military</label>
-			<input type="checkbox" id="training" name="types" value="type-T" checked="checked" />
-			<label for="training">Trainingsites</label><br />
-			<button type="button" id="apply_filter" class="button">Update</button>
-		</fieldset>
-		</form>
-	</div>
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	Buildings
+		{% include 'wlhelp/inlines/js_form_buildings.html' %}<br />
+		{% include 'wlhelp/inlines/js_form_scripting.html' %}
+	</div>
+	<div class="breadCrumb">
+	<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Buildings
+	</div>
 	
 	{# Headquarters #}
-	<div name="size-B">
+	<div class="size-B">
 		{% with buildings.headquarters as buildings %}
 			{% include "wlhelp/inlines/display_buildings.html" with header="Headquarters" %}
 		{% endwith %}
 	</div>
 	
-	<div name="size-S">
+	<div class="size-S">
 	{# Small buildings #}
 	{% if buildings.small.count %}
 		{% with buildings.small as buildings %}
@@ -66,7 +39,7 @@
 	{% endif %}
 	</div>
 	
-	<div name="size-M">
+	<div class="size-M">
 	{# Medium buildings #}
 	{% if buildings.medium.count %}
 		{% with buildings.medium as buildings %}
@@ -80,7 +53,7 @@
 	{% endif %}
 	</div>
 	
-	<div name="size-B">
+	<div class="size-B">
 	{# Big buildings #}
 	{% if buildings.big.count %}
 		{% with buildings.big as buildings %}
@@ -94,7 +67,7 @@
 	{% endif %}
 	</div>
 	
-	<div name="size-I">
+	<div class="size-I">
 	{# Mines #}
 	{% if buildings.mine.count %}
 		{% with buildings.mine as buildings %}
@@ -108,7 +81,7 @@
 	{% endif %}
 	</div>
 
-	<div name="size-B">
+	<div class="size-B">
 	{# Ports #}
 	{% if buildings.port.count %}
 		{% with buildings.port as buildings %}

=== modified file 'templates/wlhelp/index.html'
--- templates/wlhelp/index.html	2017-03-07 11:12:33 +0000
+++ templates/wlhelp/index.html	2018-03-09 19:27:20 +0000
@@ -10,21 +10,11 @@
 {% block content %}
 <h1>Encyclopedia</h1>
 <div class="blogEntry">
-Encyclopedia &#187; Index
+Encyclopedia Index
 <h2>All Tribes in Widelands:</h2>
 {% for tribe in tribes %}
-<p><img class="posLeft icon" src="{{ tribe.icon_url }}" alt="">
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}"><b>{{ tribe.displayname }}</b></a><br />
-	{{ tribe.descr }}</p>
-	<ul style="list-style: circle; margin-left: 1em; margin-top: -0.2em;">
-		<li><a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a></li>
-		<li><a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a></li>
-		<li><a href="{% url 'wlhelp_workers' tribe.name %}">Workers</a></li>
-		<li><a href="{{ tribe.network_pdf_url }}" target="_blank">Economy Network as PDF</a></li>
-		<li><a href="{{ tribe.network_gif_url }}" target="_blank">Economy Network as GIF</a></li>
-	</ul>
-	</li>
-</ul>
+	<h3>{{ tribe.displayname }}</h3>
+	{% include "wlhelp/inlines/tribes_details.html" %}
 {% endfor %}
 </div>
 {% endblock %}

=== modified file 'templates/wlhelp/inlines/display_buildings.html'
--- templates/wlhelp/inlines/display_buildings.html	2017-03-15 22:49:54 +0000
+++ templates/wlhelp/inlines/display_buildings.html	2018-03-09 19:27:20 +0000
@@ -1,22 +1,21 @@
 <table class="help">
 	<caption style="text-align: left">{{ header }}</caption>
 	<tr>
-		<th style="width: 14em;">Image</th>
-		<th>Description</th>
+		<th style="width: 113px">Building</th>
+		<th style="width: 50%">Description</th>
 		<th>Build cost</th>
 		<th>Produces</th>
 		<th>Stores</th>
 	</tr>
 {% for b in buildings %}
-	<tr class="{% cycle "odd" "even" %}" name="type-{{ b.type }}">
-		<td>
-			<a href="{% url 'wlhelp_building_details' b.tribe.name b.name %}" title="{{ b.displayname }}" id="{{ b.name }}">
-				{{ b.displayname }}
-				<br />
+	<tr class="{% cycle "odd" "even" %} type-{{ b.type }}" id="{{ b.name }}">
+		<td> {# Buildings name and image #}
+			<a href="{% url 'wlhelp_building_details' b.tribe.name b.name %}" title="Show economy graph">
+				{{ b.displayname }}<br />
 				<img alt="{{b.displayname}}" src="{{ b.image_url }}" />
 			</a>
 		</td>
-		<td>
+		<td> {# Description #}
 			{{ b.help }}
 			{% if b.enhanced_from or b.enhancement %}
 			<ul>
@@ -28,19 +27,20 @@
 				{% endif %}
 			</ul>
 			{% endif %}
+			<div class="small scripting">Internal name: "{{ b.name }}"</div>
 		</td>
-		<td>
+		<td> {# Build cost #}
 			{% for costs in b.get_build_cost %}
 				{% for w in costs %}
-				<a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
+				<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>
 				{% endfor %}
 			<br />
 			{% endfor %}
 		</td>
-		<td>
+		<td> {# Produces #}
 			{% if b.produces and not b.trains %}
 				{% for w in b.get_ware_outputs %}
-				<a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
+				<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>
 				{% endfor %}
 			{% endif %}
 			{% if b.trains and not b.produces %}
@@ -49,10 +49,10 @@
 				{% endfor %}
 			{% endif %}
 		</td>
-		<td>
+		<td> {## Stored wares #}
 			{% for costs in b.get_stored_wares %}
 				{% for w in costs %}
-				<a href="{% url 'wlhelp_ware_details' w.tribe.name w.name %}" title="{{w.displayname}}"><img src="{{ w.image_url }}" alt="{{ w.name }}" /></a>
+				<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>
 				{% endfor %}
 			<br />
 			{% endfor %}

=== added file 'templates/wlhelp/inlines/js_form_buildings.html'
--- templates/wlhelp/inlines/js_form_buildings.html	1970-01-01 00:00:00 +0000
+++ templates/wlhelp/inlines/js_form_buildings.html	2018-03-09 19:27:20 +0000
@@ -0,0 +1,23 @@
+    <form id="filter_select">
+		<fieldset style="display: inline; border: none">
+			{# Attribute 'name': Groups filters (sizes/types) #}
+			{# Attribute 'value': Corresponding names of html elements (tables/rows) #}
+			<legend>Show Buildings by Size and/or Type:</legend>
+			<input type="checkbox" id="small" name="sizes" value="size-S"  checked="checked" />
+			<label for="small">Small</label>
+			<input type="checkbox" id="medium" name="sizes" value="size-M"  checked="checked" />
+			<label for="medium">Medium</label>
+			<input type="checkbox" id="big" name="sizes" value="size-B" checked="checked" />
+			<label for="big">Big</label>
+			<input type="checkbox" id="mines" name="sizes" value="size-I"  checked="checked" />
+			<label for="mines">Mines</label><br />
+			<input type="checkbox" id="warehouse" name="types" value="type-W" checked="checked" />
+			<label for="warehouse">Warehouse</label>
+			<input type="checkbox" id="production" name="types" value="type-P"  checked="checked" />
+			<label for="production">Production</label>
+			<input type="checkbox" id="military" name="types" value="type-M"  checked="checked" />
+			<label for="military">Military</label>
+			<input type="checkbox" id="training" name="types" value="type-T" checked="checked" />
+			<label for="training">Trainingsites</label><br />
+		</fieldset>
+	</form>

=== added file 'templates/wlhelp/inlines/js_form_scripting.html'
--- templates/wlhelp/inlines/js_form_scripting.html	1970-01-01 00:00:00 +0000
+++ templates/wlhelp/inlines/js_form_scripting.html	2018-03-09 19:27:20 +0000
@@ -0,0 +1,7 @@
+
+	<form id="show_scripting">
+			<fieldset style="display: inline; border: none">
+				<input type="checkbox" id="toggle_scripting" name="scripting" value="toggle_on" />
+				<label for="toggle_scripting">Show names for scripting</label>
+			</fieldset>
+	</form>

=== renamed file 'templates/wlhelp/tribe_details.html' => 'templates/wlhelp/inlines/tribes_details.html'
--- templates/wlhelp/tribe_details.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/inlines/tribes_details.html	2018-03-09 19:27:20 +0000
@@ -1,20 +1,7 @@
-{% extends "wlhelp/base.html" %}
-{% comment %}
-   vim:ft=htmldjango
-{% endcomment %}
-
-{% block title %}
-{{ tribe.displayname }} - {{ block.super }}
-{% endblock %}
-
-{% block content %}
-<h1>{{ tribe.displayname }}</h1>
-<div class="blogEntry">
-<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-{{ tribe.displayname }}
-<br /><br />
-<img class="posLeft icon" src="{{ tribe.icon_url }}" alt="" />
-<p>{{ tribe.descr }}</p>
+<div>
+	<img class="posLeft icon" src="{{ tribe.icon_url }}" alt="" />
+	<p>{{ tribe.descr }}</p>
+</div>
 <ul>
 	<li><a href="{% url 'wlhelp_buildings' tribe.name %}">Buildings</a></li>
 	<li><a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a></li>
@@ -22,5 +9,4 @@
 	<li><a href="{{ tribe.network_pdf_url }}" target="_blank">Economy Network as PDF</a></li>
 	<li><a href="{{ tribe.network_gif_url }}" target="_blank">Economy Network as GIF</a></li>
 </ul>
-</div>
-{% endblock %}
+

=== modified file 'templates/wlhelp/ware_details.html'
--- templates/wlhelp/ware_details.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/ware_details.html	2018-03-09 19:27:20 +0000
@@ -10,9 +10,8 @@
 {% block content %}
 <h1>{{ tribe.displayname }}: {{ ware.displayname }}</h1>
 <div class="blogEntry">
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	<a href="{% url 'wlhelp_wares' tribe.name %}">Wares</a> &#187;
+	<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
+	<a href="{% url 'wlhelp_wares' tribe.name %}">{{ tribe.displayname }} Wares</a> &#187;
 	{{ ware.displayname }}
 	<br /><br />
 
@@ -22,26 +21,5 @@
 	<h2>Economy Graph</h2>
 	{{ ware.imagemap|safe }}
 	<img src="{{ ware.graph_url }}" usemap="#G" alt="Graph for {{ ware.displayname }}" />
-{% comment %}
-{% if ware.build_ware_for_buildings.all %}
-<h2>Used in the construction of</h2>
-<table style="width:100%" class="building">
-    <tr>
-        <th>Building</th>
-        <th>Name</th>
-        <th>Description</th>
-    </tr>
-    {% for b in ware.build_ware_for_buildings.all %}
-    <tr class="odd">
-        <td><img src="{{ b.image_url }}" alt="{{b.displayname}}" /></td>
-        <td><a href="../../buildings/{{b.name}}/">{{ b.displayname }}</a></td>
-        <td>{{ b.help }}</td>
-    </tr>
-    {% endfor %}
-</table>
-{% else %}
-Not used for building.<br />
-{% endif %}
-{% endcomment %}
 </div>
 {% endblock %}

=== modified file 'templates/wlhelp/wares.html'
--- templates/wlhelp/wares.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/wares.html	2018-03-09 19:27:20 +0000
@@ -4,32 +4,61 @@
 {% endcomment %}
 
 {% block title %}
-Wares - {{ tribe.displayname }} - {{ block.super }}
+{{ tribe.displayname }} - Wares - {{ block.super }}
 {% endblock %}
 
 {% block content %}
 <h1>{{ tribe.displayname }}: Wares</h1>
 <div class="blogEntry">
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	Wares
-	<br /><br />
+	<div class="posRight">
+		{% include 'wlhelp/inlines/js_form_scripting.html' %}
+	</div>
+	<div class="breadCrumb">
+		<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Wares
+	</div>
 
 	<table class="help">
 		<tr>
-			<th>Image</th>
-			<th>Name</th>
-			<th>Description</th>
+			<th>Ware</th>
+			<th style="width: 70%;">Description</th>
+			<th style="width: 20%">Produced at/by</th>
 		</tr>
-	{% for ware in wares %}
-		<tr class="{% cycle "odd" "even" %}">
+	{% for w in wares %}
+		<tr class="{% cycle "odd" "even" %}" id="{{ w.name }}">
 			<td>
-				<a href="{% url 'wlhelp_ware_details' tribe.name ware.name %}">
-					<img src="{{ ware.image_url }}"  alt="{{ ware.name }}" />
+				<a id="{{ w.name }}" href="{% url 'wlhelp_ware_details' tribe.name w.name %}" title="Show economy graph">
+					{{ w.displayname }}
+					<br />
+					<img src="{{ w.image_url }}"  alt="{{ w.name }}" />
 				</a>
 			</td>
-			<td><a id="{{ ware.name }}" href="{% url 'wlhelp_ware_details' tribe.name ware.name %}">{{ ware.displayname }}</a></td>
-			<td>{{ ware.help }}</td> 
+			<td>
+				{{ w.help }}
+				<div class="small scripting">Internal name: "{{ w.name }}"</div>
+			</td>
+			<td>
+				<table class="help small">
+					<tr>
+						<th>At:</th>
+						<th>By:</th>
+					</tr>
+					{% for building in w.produced_by_buildings.all %}
+					<tr>
+						<td>
+							<a href="../buildings/#{{ building.name }}">{{ building.displayname }}<br />
+								<img src="{{ building.image_url }}"  alt="{{ building.displayname }}" />
+							</a>
+						</td>
+						<td>
+							{% for worker in building.workers_types.all %}
+								<a href="../workers/#{{ worker.name }}">{{ worker.displayname }}<br />
+									<img src="{{ worker.image_url }}"  alt="{{ worker.displayname }}" />
+								</a><br />
+							{% endfor %}
+						</td>
+					</tr>
+					{% endfor %}
+				</table>
 		</tr>
 	{% endfor %}
 	</table>

=== modified file 'templates/wlhelp/worker_details.html'
--- templates/wlhelp/worker_details.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/worker_details.html	2018-03-09 19:27:20 +0000
@@ -10,9 +10,8 @@
 {% block content %}
 <h1>{{ tribe.displayname }}: {{ worker.displayname }}</h1>
 <div class="blogEntry">
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	<a href="{% url 'wlhelp_workers' tribe.name %}">Workers</a> &#187;
+	<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187;
+	<a href="{% url 'wlhelp_workers' tribe.name %}">{{ tribe.displayname }} Workers</a> &#187;
 	{{ worker.displayname }}
 	<br /><br />
 

=== modified file 'templates/wlhelp/workers.html'
--- templates/wlhelp/workers.html	2016-03-02 21:02:38 +0000
+++ templates/wlhelp/workers.html	2018-03-09 19:27:20 +0000
@@ -10,26 +10,39 @@
 {% block content %}
 <h1>{{ tribe.displayname }}: Workers</h1>
 <div class="blogEntry">
-	<a href="{% url 'wlhelp_index' %}">Encyclopedia</a> &#187;
-	<a href="{% url 'wlhelp_tribe_details' tribe.name %}">{{ tribe.displayname }}</a> &#187;
-	Workers
-	<br /><br />
+	<div class="posRight">
+		{% include 'wlhelp/inlines/js_form_scripting.html' %}
+	</div>
+	<div class="breadCrumb">
+		<a href="{% url 'wlhelp_index' %}">Encyclopedia Index</a> &#187; {{ tribe.displayname }} Workers
+	</div>
 
 	<table class="help">
 		<tr>
-			<th>Image</th>
-			<th>Name</th>
-			<th>Description</th>
+			<th>Worker</th>
+			<th style="width: 75%">Description</th>
+			<th style="width: 15%">Works at</th>
 		</tr>
 	{% for worker in workers %}
-		<tr class="{% cycle "odd" "even" %}">
-			<td>
-				<a href="{% url 'wlhelp_worker_details' tribe.name worker.name %}">
-					<img src="{{ worker.image_url }}"  alt="{{ worker.name }}" />
-				</a>
-			</td>
-			<td><a id="{{ worker.name }}" href="{% url 'wlhelp_worker_details' tribe.name worker.name %}">{{ worker.displayname }}</a></td>
-			<td>{{ worker.help }}</td> 
+		<tr class="{% cycle "odd" "even" %}" id="{{ worker.name }}">
+			<td>
+				<a href="{% url 'wlhelp_worker_details' tribe.name worker.name %}" title="Show economy graph">
+					{{ worker.displayname }}<br />
+					<img src="{{ worker.image_url }}"  alt="{{ worker.displayname }}" />
+				</a>
+			</td>
+			<td>
+				{{ worker.help }}
+				<div class="small scripting">Internal name: "{{ worker.name }}"</div>
+			</td>
+			<td> {# works at #}
+				{% for building in worker.workers_for_buildings.all %}
+				<a href="../buildings/#{{ building.name }}" class="small">{{ building.displayname }}<br />
+					<img src="{{ building.image_url }}" alt="{{building.displayname}}" />
+				</a>
+				<br />
+				{% endfor %}
+			</td>
 		</tr>
 	{% endfor %}
 	</table>

=== modified file 'wlhelp/models.py'
--- wlhelp/models.py	2017-09-12 18:04:34 +0000
+++ wlhelp/models.py	2018-03-09 19:27:20 +0000
@@ -92,7 +92,8 @@
             ('P', 'productionsite'),
             ('W', 'warehouse'),
             ('M', 'militarysite'),
-            ('T', 'trainingsite')
+            ('T', 'trainingsite'),
+            ('m', 'market'),
     )
 
     objects = BuildingManager()

=== modified file 'wlhelp/urls.py'
--- wlhelp/urls.py	2016-12-13 18:28:51 +0000
+++ wlhelp/urls.py	2018-03-09 19:27:20 +0000
@@ -15,8 +15,6 @@
 urlpatterns = [
     url(r'^$', index, name='wlhelp_index'),
 
-    # Detail pages
-    url(r'^(?P<tribe>\w+)/$', tribe_details, name='wlhelp_tribe_details'),
     url(r'^(?P<tribe>\w+)/wares/(?P<ware>[^/]+)/$',
         ware_details, name='wlhelp_ware_details'),
     url(r'^(?P<tribe>\w+)/buildings/(?P<building>[^/]+)/$',

=== modified file 'wlhelp/views.py'
--- wlhelp/views.py	2016-07-02 12:38:06 +0000
+++ wlhelp/views.py	2018-03-09 19:27:20 +0000
@@ -1,4 +1,4 @@
-from django.shortcuts import render_to_response, get_object_or_404
+from django.shortcuts import render, get_object_or_404
 from django.template import RequestContext
 from django.http import HttpResponse
 from .models import Worker, Ware, Building, Tribe
@@ -9,58 +9,49 @@
 def index(request):
     tribes = Tribe.objects.all().order_by('displayname')
 
-    return render_to_response('wlhelp/index.html',
-                              context_instance=RequestContext(request,
-                                                              {'tribes': tribes}))
-
-
-def tribe_details(request, tribe):
-    t = get_object_or_404(Tribe, name=tribe)
-
-    return render_to_response('wlhelp/tribe_details.html',
-                              context_instance=RequestContext(request,
-                                                              {'tribe': t}))
+    return render(request, 'wlhelp/index.html',
+                  {'tribes': tribes, })
 
 
 def ware_details(request, tribe, ware):
     w = get_object_or_404(Ware, tribe__name=tribe, name=ware)
     t = Tribe.objects.get(name=tribe)
 
-    return render_to_response('wlhelp/ware_details.html',
-                              context_instance=RequestContext(request,
-                                                              {'ware': w, 'tribe': t}))
+    return render(request, 'wlhelp/ware_details.html',
+                  {'ware': w,
+                   'tribe': t, })
 
 
 def building_details(request, tribe, building):
     b = get_object_or_404(Building, tribe__name=tribe, name=building)
     t = Tribe.objects.get(name=tribe)
 
-    return render_to_response('wlhelp/building_details.html',
-                              context_instance=RequestContext(request,
-                                                              {'building': b, 'tribe': t}))
+    return render(request, 'wlhelp/building_details.html',
+                  {'building': b,
+                   'tribe': t, })
 
 
 def worker_details(request, tribe, worker):
     w = get_object_or_404(Worker, tribe__name=tribe, name=worker)
     t = Tribe.objects.get(name=tribe)
 
-    return render_to_response('wlhelp/worker_details.html',
-                              context_instance=RequestContext(request,
-                                                              {'worker': w, 'tribe': t}))
+    return render(request, 'wlhelp/worker_details.html',
+                  {'worker': w,
+                   'tribe': t, })
 
 
 def workers(request, tribe='barbarians'):
     t = get_object_or_404(Tribe, name=tribe)
-    return render_to_response('wlhelp/workers.html', context_instance=RequestContext(request,
-                                                                                     {'workers': Worker.objects.filter(tribe=t).order_by('displayname'),
-                                                                                      'tribe': t}))
+    return render(request, 'wlhelp/workers.html',
+                  {'workers': Worker.objects.filter(tribe=t).order_by('displayname'),
+                   'tribe': t, })
 
 
 def wares(request, tribe='barbarians'):
     t = get_object_or_404(Tribe, name=tribe)
-    return render_to_response('wlhelp/wares.html', context_instance=RequestContext(request,
-                                                                                   {'wares': Ware.objects.filter(tribe=t).order_by('displayname'),
-                                                                                    'tribe': t}))
+    return render(request, 'wlhelp/wares.html',
+                  {'wares': Ware.objects.filter(tribe=t).order_by('displayname'),
+                   'tribe': t, })
 
 
 def buildings(request, tribe='barbarians'):
@@ -98,5 +89,6 @@
     buildings['port'] = port.filter(enhanced_from=None)
     buildings['port_enhanced'] = port.exclude(enhanced_from=None)
 
-    return render_to_response('wlhelp/buildings.html', context_instance=RequestContext(request,
-                                                                                       {'buildings': buildings, 'tribe': t}))
+    return render(request, 'wlhelp/buildings.html',
+                  {'buildings': buildings,
+                   'tribe': t, })


Follow ups