Repository navigation
Expand file tree
/
Copy pathStackOverflowQuery.cshtml
More file actions
95 lines (91 loc) · 4.15 KB
/
Copy pathStackOverflowQuery.cshtml
File metadata and controls
95 lines (91 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@model QueryResponse<Question>
@{
ViewBag.Title = "ServiceStack StackOverflow questions";
}
<div class="panel">
<div class="panel-body">
<div class="col-sm-6 col-md-3 col-lg-3">
<form style="margin-top:32px">
<div>
<div class="form-group">
<select id="filterScoreBySelect" class="form-control">
<option value="GreaterThan">Score greater than</option>
<option value="LessThan">Score less than</option>
</select>
</div>
<div class="form-group">
<input id="scoreInput" class="form-control" type="text" placeholder="Score" />
</div>
<div class="form-group">
<select id="filterViewsBySelect" class="form-control">
<option value="GreaterThan">Views greater than</option>
<option value="LessThan">Views less than</option>
</select>
</div>
<div class="form-group">
<input id="viewsInput" class="form-control" type="text" placeholder="Views" />
</div>
<div class="form-group">
<select id="filterAnswersBySelect" class="form-control">
<option value="GreaterThan">Answers greater than</option>
<option value="LessThan">Answers less than</option>
</select>
</div>
<div class="form-group">
<input id="answerInput" class=" form-control" type="text" placeholder="Views" />
</div>
<div class="form-group">
<label>Order by <select id="orderByDescSelect">
<option value="score">Score</option>
<option value="view_count">Views</option>
<option value="answer_count">Answers</option>
</select> descending</label>
</div>
</div>
<div class="form-group">
<input id="filterBtn" class="form-control" type="button" name="filterPage" value="Filter"/>
</div>
</form>
</div>
<div class="col-sm-6 col-md-9 col-lg-9">
<table class="table">
<thead>
<tr>
<th>Score</th>
<th>Answers</th>
<th>Title</th>
<th>Total Views</th>
</tr>
</thead>
<tbody>
@foreach (var m in @Model.Results.Take(25))
{
<tr>
<td>@m.Score</td>
<td>@m.AnswerCount</td>
<td><a href="@m.Link">@m.Title</a></td>
<td>@m.ViewCount</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<script>
$('#filterBtn').click(function () {
var scoreVal = $('#scoreInput').val() || 0;
var viewsVal = $('#viewsInput').val() || 0;
var answersVal = $('#answerInput').val() || 0;
var scoreOperator = $('#filterScoreBySelect').val() || 'GreaterThan';
var viewsOperator = $('#filterViewsBySelect').val() || 'GreaterThan';
var answersOperator = $('#filterAnswersBySelect').val() || 'GreaterThan';
var orderByDescVal = $('#orderByDescSelect').val() || 'scoore';
var path = '@(new StackOverflowQuery().ToGetUrl())' +
'?score' + scoreOperator + '=' + scoreVal +
'&view_count' + viewsOperator + '=' + viewsVal +
'&answer_count' + answersOperator + '=' + answersVal +
'&orderByDesc=' + orderByDescVal;
window.location.href = path;
});
</script>
</div>