Permalink
Browse files

文字パラメータの変更に対応

  • Loading branch information...
1 parent 3495b42 commit fb0ccc122e8ed2e82c10f55657e54a78848a62bb hisaichi5518 committed Jan 17, 2013
Showing with 33 additions and 12 deletions.
  1. +2 −5 lib/Iyemon/Web.pm
  2. +18 −4 views/index.tx
  3. +13 −3 views/layout/base.tx
View
@@ -25,8 +25,8 @@ get '/search' => sub {
my $opts = {limit => 100};
my $criteria = {};
- my @num_keys = @{config->param('num_keys')};
- my @str_keys = qw/type/;
+ my @num_keys = @{config->param('num_keys') || [qw/uid/]};
+ my @str_keys = @{config->param('str_keys') || [qw/type/]};
for my $key (@num_keys) {
$criteria->{$key} = $c->req->param($key) + 0
@@ -107,7 +107,4 @@ sub _jsonize_log {
$obj;
}
-
-
-
1;
View
@@ -16,8 +16,13 @@
<input type="text" class="span3" placeholder="12345" id="query-uid">
: }
- <label>行動タイプ</label>
- <input type="text" class="span3" placeholder="access_board" id="query-action-type">
+ : for $config['str_keys'] -> $key {
+ <label><: $key :></label>
+ <input type="text" class="span3" placeholder="12345" id="query-<: $key :>">
+ : } else {
+ <label>行動タイプ</label>
+ <input type="text" class="span3" placeholder="access_board" id="query-action-type">
+ : }
<label>ページ番号(必須)</label>
<input type="text" class="span3" placeholder="1(指定してください)" id="page" value="1">
@@ -45,7 +50,11 @@
: } else {
<th>uid</th>
: }
- <th>行動タイプ</th>
+ : for $config['str_keys'] -> $key {
+ <th><: $key :></th>
+ : } else {
+ <th>行動タイプ</th>
+ : }
<th>その他のデータ</th>
</tr>
</thead>
@@ -81,7 +90,12 @@
<td>${uid}</td>
: }
- <td>${type}</td>
+ : for $config['str_keys'] -> $key {
+ <td>${<: $key :>}</td>
+ : } else {
+ <td>${type}</td>
+ : }
+
<td>
<div id="open-${_id}">
<p><a href="#" onclick="openData('${_id}');return false;">表示する</a></p>
View
@@ -96,28 +96,38 @@
}
query.end_date = $('#query-end-date').val();
- query.type = $('#query-action-type').val();
: for $config['num_keys'] -> $key {
query.<: $key :> = $('#query-<: $key :>').val();
: } else {
query.uid = $('#query-uid').val();
: }
+ : for $config['str_keys'] -> $key {
+ query.<: $key :> = $('#query-<: $key :>').val();
+ : } else {
+ query.type = $('#query-action-type').val();
+ : }
+
query.page = parseInt($("#page").val(), 10);
$("#result-body").html('<p>読み込み中です…</p>');
var printValues = function (data) {
// _id, uid, type, time は無視してその他を出す。
delete data._id;
+ delete data.time;
: for $config['num_keys'] -> $key {
delete data.<: $key :>;
: } else {
delete data.uid;
: }
- delete data.time;
- delete data.type;
+
+ : for $config['str_keys'] -> $key {
+ delete data.<: $key :>;
+ : } else {
+ delete data.type;
+ : }
return JSON.stringify(data, null, 2);
};

0 comments on commit fb0ccc1

Please sign in to comment.