Changes

no edit summary
Line 2: Line 2:  
local Data = require('Module:Data')
 
local Data = require('Module:Data')
 
local View = require('Module:View')
 
local View = require('Module:View')
 +
 +
-- [[Category:Todo]]:
 +
-- * Support render : Args -> UI tree in Module:View, currently Args -> String
 +
-- * Module:View/Table for table UI tree construction
 +
 +
local table_header = [=[{|style="width:100%;text-align:center"
 +
|style="width:4%"|ID
 +
|style="width:{{{requirements_width|35%}}}"|Requirements
 +
|style="width:0.5%"|
 +
|style="width:20%"|[[File:Fuel.png|30px|link=Tutorial: FAQ#How do resources work in this game?]][[File:Ammunition.png|30px|link=Tutorial: FAQ#How do resources work in this game?]][[File:Steel.png|30px|link=Tutorial: FAQ#How do resources work in this game?]][[File:Bauxite.png|30px|link=Tutorial: FAQ#How do resources work in this game?]]
 +
|style="width:0.5%"|
 +
|style="width:20%"|Rewards
 +
|style="width:0.5%"|
 +
|style="width:30%"|Note
 +
|-]=]
 +
 +
local table_footer = '|}'
 +
 +
local table_row = [=[|- id="${label}" class="quest_A"
 +
|rowspan="2"|'''${label}'''
 +
|colspan="11"|'''<span lang="ja">${title}</span>'''<br>''${title_en}''
 +
|- class="quest_details_A"
 +
|${detail_en}
 +
|
 +
|${reward_fuel} / ${reward_ammo} / ${reward_steel} / ${reward_bauxite}
 +
|
 +
|''${reward_other}''
 +
|
 +
|${note}]=]
    
local function render(args)
 
local function render(args)
 
   local category = args.explicit[1]
 
   local category = args.explicit[1]
 
   local data = Data.load('Quest', category)
 
   local data = Data.load('Quest', category)
   return data[1].title
+
  local result = {}
 +
  table.insert(result, table_header)
 +
  for _, q in ipairs(data) do
 +
    table.insert(result, _.format(table_row, q))
 +
  end
 +
  table.insert(result, table_footer)
 +
   return _.join(result, '\n')
 
end
 
end
    
return View(render)
 
return View(render)
cssedit, gkautomate
7,064

edits