fixed problems in search

This commit is contained in:
Suraj 2016-02-29 07:34:58 +05:30
parent 7c494ec40d
commit 49c91632e0
4 changed files with 70 additions and 36 deletions

View File

@ -107,7 +107,7 @@ Navbar
margin-left: 25px; margin-left: 25px;
font-size:1.5em; font-size:1.5em;
color:white; color:white;
max-width: 2000px;
} }
.btn-action{ .btn-action{

View File

@ -70,6 +70,7 @@
{{ else if eq .Navigation "completed"}} {{ else if eq .Navigation "completed"}}
{{ else if eq .Navigation "deleted"}} {{ else if eq .Navigation "deleted"}}
{{ else if eq .Navigation "edit"}} {{ else if eq .Navigation "edit"}}
{{ else if eq .Navigation "search"}}
{{else }} {{else }}
<a href="/del-category/{{.Navigation}}"> <button data-original-title="Delete Category" data-placement="bottom" data-toggle="tooltip" title="" class="btn btn-action glyphicon glyphicon-trash" type="button"></button></a> <a href="/del-category/{{.Navigation}}"> <button data-original-title="Delete Category" data-placement="bottom" data-toggle="tooltip" title="" class="btn btn-action glyphicon glyphicon-trash" type="button"></button></a>
<button data-original-title="Edit Category" data-placement="bottom" data-toggle="tooltip" id="editCatFrmBtn" title="" class="btn btn-action glyphicon glyphicon-pencil" type="button"></button> <button data-original-title="Edit Category" data-placement="bottom" data-toggle="tooltip" id="editCatFrmBtn" title="" class="btn btn-action glyphicon glyphicon-pencil" type="button"></button>

View File

@ -1,43 +1,71 @@
{{template "_head.html" .}} {{template "_head.html" .}}
<div class="timeline">
{{ if .Tasks}}
{{range .Tasks}}
<div class="note">
<p class="noteHeading">{{.Title}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<span class="noteContent">{{.Content}}</span>
<span class="notefooter">
<ul class="menu">
<li role="presentation">Priority: {{.Priority}}</li>
<li role="presentation">
<span class="glyphicon glyphicon-time"></span> {{.Created}}</li>
<!-- <li role="presentation">
<a role="menuitem" tabindex="-1" href="/mask/{{.Id}}">
<span class="glyphicon glyphicon-lock"></span> Mask</a></li> !-->
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/trash/{{.Id}}">
<span class="glyphicon glyphicon-trash"></span></a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/complete/{{.Id}}">
<span class="glyphicon glyphicon-check"></span></a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/edit/{{.Id}}">
<span class="glyphicon glyphicon-pencil"></span></a>
</li>
</ul> <div class="timeline">
</span> {{ if .Tasks}} {{range $key, $value := .Tasks}}
</div> <div class="note" id="{{$value.Id}}">
{{end}} {{else}} <p class="noteHeading">{{ $value.Title}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<div class="note">
<p class="noteHeading">No results found</p> <span class="noteContent">
<p class="notefooter">Go to home page <a href="/">here</a> </p> {{$value.Content}}
<div class="commentslist">
{{range $value.Comments}}
<div class="comment">
<span>{{.Content}}</span>
<span class="timestamp">{{.Created}}</span>
<a href="/del-comment/{{.ID}}"><span class="glyphicon glyphicon-trash timestamp"></span></a>
</div> </div>
{{end}} {{end}}
</div>
{{template "_footer.html"}}
<div class="comment">
<form method="POST" action="/add-comment/">
<textarea rows="1" cols="75" name="commentText" placeholder="Add Comment"></textarea>
<input type="text" class="hidden" name="taskID" value="{{$value.Id}}">
<input type="submit" value="Comment" class="btn btn-primary" />
</form>
</div>
</div>
</span>
<span class="notefooter">
<ul class="menu">
<li role="presentation">Priority: {{$value.Priority}}</li>
<li role="presentation">
<span class="glyphicon glyphicon-time"></span> {{$value.Created}}</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/mask/{{.Id}}">
<span class="glyphicon glyphicon-lock"></span></a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/trash/{{.Id}}">
<span class="glyphicon glyphicon-trash"></span></a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/complete/{{.Id}}">
<span class="glyphicon glyphicon-check"></span></a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="/edit/{{.Id}}">
<span class="glyphicon glyphicon-pencil"></span></a>
</li>
<li role="presentation">
<a href="/category/{{$value.Category}}"> {{$value.Category}}</a>
</li>
</ul>
</span>
</div>
{{end}} {{else}}
<div class="note">
<p class="noteHeading">No Tasks here</p>
<p class="notefooter">Create new task
<button class="floating-action-icon-add">
here </button>
</p>
</div>
{{end}}
</div>
{{template "_footer.html"}}
</body> </body>

View File

@ -79,7 +79,12 @@ func SearchTaskFunc(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" { if r.Method == "POST" {
r.ParseForm() r.ParseForm()
query := r.Form.Get("query") query := r.Form.Get("query")
context := db.SearchTask(query) context := db.SearchTask(query)
categories := db.GetCategories()
context.Categories = categories
searchTemplate.Execute(w, context) searchTemplate.Execute(w, context)
} else { } else {
message = "Method not allowed" message = "Method not allowed"