-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
index.html.erb
92 lines (84 loc) · 3.75 KB
/
index.html.erb
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
<div class="col-lg-12">
<% if params[:action] == 'answered' %>
<h2>Recently Commented <small class="d-md-none d-lg-inline">Recently commented questions</small></h2>
<% elsif params[:action] == 'popular' %>
<h2>Popular Questions <small class="d-md-none d-lg-inline">Most viewed questions</small></h2>
<% elsif params[:action] == 'unanswered' %>
<h2>Unanswered Questions <small class="d-md-none d-lg-inline">Unanswered questions</small></h2>
<% elsif params[:action] == 'liked' %>
<h2>Liked Questions <small class="d-md-none d-lg-inline">Most liked questions</small></h2>
<% else %>
<div class="text-center">
<% cache('feature_questions-header', skip_digest: true) do %>
<%= feature('questions-header') %>
<% end %>
</div>
<% end %>
<hr />
<div class="row">
<div class="col-lg-6">
<h4>Ask a question here</h4>
<% if !current_user %>
<p>To ask a question, please <a href="/login?return_to=/questions">log in</a> or <a href="/signup?return_to=/questions">sign up</a> first.</p>
<% end %>
<form id="questions_searchform" role="search" autocomplete="off" action="/post">
<div class="input-group">
<input aria-label="Type your question" tabindex="1" id="questions_searchform_input" type="text" name="title" class="<%= "disabled " if !current_user %>form-control search-query typeahead" qryType="questions" placeholder="type your question">
<input type="hidden" name="tags" value="question:general">
<input type="hidden" name="template" value="question">
<input type="hidden" name="redirect" value="question">
<div class="input-group-append">
<button id="question_search" type="submit" rel="tooltip" title="Ask a question with the entered title" class="btn btn-primary">Continue</button>
</div>
</div>
</form>
</div>
<div class="col-lg-6">
<% if params[:controller] == 'questions' %>
<%= render partial: 'tag/sorting' %>
<% end %>
</div>
</div>
<hr />
<%= render :partial => "notes/format_toggle" %>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link <% if params[:action] == "index" %> active <% end %>" href="/questions/">
<i class="fa fa-refresh"></i> <span class="d-none d-lg-inline"> Recently Asked</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <% if params[:action] == "answered" %> active <% end %>" href="/questions/answered/">
<i class="fa fa-check"></i> <span class="d-none d-lg-inline"> Recently Commented</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <% if params[:action] == "popular" %> active <% end %>" href="/questions/popular/">
<i class="fa fa-bolt"></i> <span class="d-none d-lg-inline"> Popular</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <% if params[:action] == "unanswered" %> active <% end %>" href="/questions/unanswered/">
<i class="fa fa-question-circle"></i> <span class="d-none d-lg-inline"> Unanswered</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <% if params[:action] == "liked" %> active <%end %>" href="/questions/liked/">
<i class="fa fa-star-o"></i> <span class="d-none d-lg-inline"> Liked</span>
</a>
</li>
</ul>
<%= render :partial => "questions/questions" %>
</div>
<% if !current_user %>
<script>
$('#question_search').on('click', function(e) {
e.preventDefault();
$('#loginModal').modal();
var postQuery = '/post?tags=question:general&template=question&title=' + encodeURI($('#questions_searchform_input').val()) + '&redirect=question';
//console.log(postQuery);
$.getJSON(postQuery);
});
</script>
<% end %>
<%= stylesheet_link_tag "dashboard" %>