summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2015-03-17 11:36:01 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2015-03-17 11:36:01 +0000
commitfd5f7f5d65c881b7236f01bde441f04d0d231588 (patch)
tree00e1d3e4af623ada6aba30e63c3353e56ace7ac5
parentf4e245a58f87fc6604359c0a30018310d366aef0 (diff)
downloadaports-turbo-fd5f7f5d65c881b7236f01bde441f04d0d231588.tar.bz2
aports-turbo-fd5f7f5d65c881b7236f01bde441f04d0d231588.tar.xz
remember correct selected for arch
-rwxr-xr-xaports.lua7
-rw-r--r--tpl/contents.tpl6
-rw-r--r--tpl/packages.tpl6
3 files changed, 10 insertions, 9 deletions
diff --git a/aports.lua b/aports.lua
index 02ef622..b80bf4d 100755
--- a/aports.lua
+++ b/aports.lua
@@ -9,11 +9,11 @@ local tpl = turbo.web.Mustache.TemplateHelper("./tpl")
local ContentsRenderer = class("ContentsRenderer", turbo.web.RequestHandler)
function ContentsRenderer:get()
- local table = {}
local args = {
filename = self:get_argument("filename","", true),
arch = self:get_argument("arch", "x86", true),
}
+ local table = { [args.arch] = true }
if args.filename ~= "" then
local result = QueryContents(args)
if next(result) ~= nil then
@@ -31,10 +31,11 @@ end
local PackagesRenderer = class("PackagesRenderer", turbo.web.RequestHandler)
function PackagesRenderer:get()
- local table = {}
local args = {
- package = self:get_argument("package","", true)
+ package = self:get_argument("package","", true),
+ arch = self:get_argument("arch", "x86", true),
}
+ local table = { [args.arch] = true }
if args.package == "" then
args.package = "%"
end
diff --git a/tpl/contents.tpl b/tpl/contents.tpl
index f3084d8..3eaaf3f 100644
--- a/tpl/contents.tpl
+++ b/tpl/contents.tpl
@@ -11,9 +11,9 @@
<div class="form-group">
<label for="arch">Architecture</label>
<select name="arch" class="form-control" id="arch">
- <option>x86</option>
- <option>x86_64</option>
- <option>armhf</option>
+ <option {{#x86}}selected{{/x86}} >x86</option>
+ <option {{#x86_64}}selected{{/x86_64}} >x86_64</option>
+ <option {{#armhf}}selected{{/armhf}} >armhf</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Search</button>
diff --git a/tpl/packages.tpl b/tpl/packages.tpl
index 4008ff0..8d381d3 100644
--- a/tpl/packages.tpl
+++ b/tpl/packages.tpl
@@ -11,9 +11,9 @@
<div class="form-group">
<label for="arch">Architecture</label>
<select name="arch" class="form-control" id="arch">
- <option>x86</option>
- <option>x86_64</option>
- <option>armhf</option>
+ <option {{#x86}}selected{{/x86}} >x86</option>
+ <option {{#x86_64}}selected{{/x86_64}} >x86_64</option>
+ <option {{#armhf}}selected{{/armhf}} >armhf</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Search</button>