Changes

m
unhardcode colspan for name custom rows, add base colspan data to multi toggle element
Line 45: Line 45:  
},
 
},
 
_caption_template = [[|+ style="position: relative;" | ${icon}${name}<span style="position: absolute; right: 5px; font-weight: normal;">${edit_link}</span>]],
 
_caption_template = [[|+ style="position: relative;" | ${icon}${name}<span style="position: absolute; right: 5px; font-weight: normal;">${edit_link}</span>]],
_name_custom_row_template = [[! colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" class="custom-row" | <div style="position: relative; padding: 0px 40px 0px 0px;">${icon}${name}: ${resources}<span style="position: absolute; right: 5px; font-weight: normal;">${edit_link}</span></div>]],
+
_name_custom_row_template = [[! colspan="${colspan}" style="text-align: center; padding:5px 5px 5px 5px;" class="custom-row" | <div style="position: relative; padding: 0px 40px 0px 0px;">${icon}${name}: ${resources}<span style="position: absolute; right: 5px; font-weight: normal;">${edit_link}</span></div>]],
 
_edit_link_text = "Edit",
 
_edit_link_text = "Edit",
 
_equipment_data_documentation = "Template:EquipmentDataDocumentation/EditIntro",
 
_equipment_data_documentation = "Template:EquipmentDataDocumentation/EditIntro",
Line 62: Line 62:  
_consumed_equip_category_template = "Category:Equipment that consume ${equip_name} during improvement",
 
_consumed_equip_category_template = "Category:Equipment that consume ${equip_name} during improvement",
 
_single_screw_improvement_category = "Category:Equipment that can be improved using only one improvement material",
 
_single_screw_improvement_category = "Category:Equipment that can be improved using only one improvement material",
_detail_toggle = [[<div class="hidden multi-toggle" data-target="improvementtablekai-day" data-states='["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]' data-filter="true" style="display: none;">]]
+
_detail_toggle = [[<div class="hidden multi-toggle" data-target="improvementtablekai-day" data-states='["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]' data-base-colspan="${colspan}" data-filter="true" style="display: none;">]]
 
.. '<span class="multi-toggle-button" data-state="none"><span class="multi-toggle-active">Filter by day:</span><span class="multi-toggle-inactive" style="cursor: pointer; color: #006cb0;">Show all</span></span>'
 
.. '<span class="multi-toggle-button" data-state="none"><span class="multi-toggle-active">Filter by day:</span><span class="multi-toggle-inactive" style="cursor: pointer; color: #006cb0;">Show all</span></span>'
 
.. ' <span class="multi-toggle-button" data-state="Sunday"><span class="multi-toggle-active" style="cursor: pointer; color: #006cb0; text-decoration: underline;">Sunday</span><span class="multi-toggle-inactive" style="cursor: pointer; color: #006cb0;">Sunday</span></span>'
 
.. ' <span class="multi-toggle-button" data-state="Sunday"><span class="multi-toggle-active" style="cursor: pointer; color: #006cb0; text-decoration: underline;">Sunday</span><span class="multi-toggle-inactive" style="cursor: pointer; color: #006cb0;">Sunday</span></span>'
Line 93: Line 93:  
else
 
else
 
self._custom_rows[item:name()] = {content = format{self._name_custom_row_template,  
 
self._custom_rows[item:name()] = {content = format{self._name_custom_row_template,  
 +
    colspan = #self._columns,
 
icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())},  
 
icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())},  
 
name = Formatting:format_link(item:link()),  
 
name = Formatting:format_link(item:link()),  
Line 438: Line 439:  
self._rows = {self._table_start, self._title_row, self._header}
 
self._rows = {self._table_start, self._title_row, self._header}
 
elseif #self._data_rows > 0 and type(self._data_rows[1]) ~= "table" then
 
elseif #self._data_rows > 0 and type(self._data_rows[1]) ~= "table" then
self._rows = {self._detail_toggle, self._table_start}
+
self._rows = {format{self._detail_toggle, colspan = #self._columns}, self._table_start}
 
else
 
else
 
self._rows = {self._table_start, self._header}
 
self._rows = {self._table_start, self._header}
Anonymous user