• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Add relevant multi toggle classes to rows so equipment are hidden when not available for filtered day
Line 97: Line 97:  
resources = Formatting:format_resources(item:improvement_resources() or {devmat = false, screw = false}),  
 
resources = Formatting:format_resources(item:improvement_resources() or {devmat = false, screw = false}),  
 
edit_link = edit_link,
 
edit_link = edit_link,
}, row = {}}
+
}, row = {classes = {}}} --The classes table will be mutated by this item's various rows as a set of css classes for the multi toggle.
 
table.insert(result, item:name())
 
table.insert(result, item:name())
 
end
 
end
Line 179: Line 179:     
for _, stars in ipairs(item:improvement_brackets(product)) do
 
for _, stars in ipairs(item:improvement_brackets(product)) do
table.insert(result, {item = item, classes = {}, product = product, stars = stars, ships = ships, ship_data = ship_data, ship_names = ship_names, initials = initials, availability = availability, resources = item:improvement_resources(false, product, stars), resources_x = item:improvement_resources(true, product, stars)})
+
table.insert(result, {item = item, classes = self._custom_rows[item:name()].row.classes, product = product, stars = stars, ships = ships, ship_data = ship_data, ship_names = ship_names, initials = initials, availability = availability, resources = item:improvement_resources(false, product, stars), resources_x = item:improvement_resources(true, product, stars)})
 
end
 
end
 
end
 
end
 
else
 
else
table.insert(result, {item = item, classes = {}})
+
table.insert(result, {item = item, classes = self._custom_rows[item:name()].row.classes})
 
end
 
end
 
else
 
else
Line 377: Line 377:  
bg_color = self._unavailable_color
 
bg_color = self._unavailable_color
 
else
 
else
table.insert(row_data.classes, day_of_week_class)
+
row_data.classes[day_of_week_class] = true
 
end
 
end
 
--values.ships is not displayed in the table (cell template string doesn't ask for ships).
 
--values.ships is not displayed in the table (cell template string doesn't ask for ships).
Line 406: Line 406:     
function ImprovementTableKai:row(row_data)
 
function ImprovementTableKai:row(row_data)
return {classes = table.concat(row_data.classes, " ")}
+
--Thi
 +
return {classes = row_data.classes}
 
end
 
end
    
function ImprovementTableKai:start_rows()
 
function ImprovementTableKai:start_rows()
 +
--Render class string for normal rows
 +
for index, row_values in ipairs(self._data_rows) do
 +
if type(row_values) == "table" then
 +
if row_values._row and row_values._row.classes then
 +
--create list from set
 +
local classes = {}
 +
for key, _ in pairs(row_values._row.classes) do
 +
table.insert(classes, key)
 +
end
 +
--create class string
 +
row_values._row.classes = table.concat(classes, " ")
 +
end
 +
end
 +
end
 +
--Render class string for custom rows
 +
for key, value in pairs(self._custom_rows) do
 +
--create list from set
 +
local classes = {}
 +
for key, _ in pairs(value.row.classes) do
 +
table.insert(classes, key)
 +
end
 +
--create class string
 +
value.row.classes = table.concat(classes, " ")
 +
end
 
if self._single_item then
 
if self._single_item then
 
self._rows = {self._table_start, self._title_row, self._header}
 
self._rows = {self._table_start, self._title_row, self._header}
Anonymous user

Navigation menu