Skip to content

Commit

Permalink
adding fix to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed May 16, 2017
1 parent f176e7d commit cc0f765
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions system/admin/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2520,22 +2520,40 @@ func searchHandler(res http.ResponseWriter, req *http.Request) {
return
}

script := `
<script>
$(function() {
var del = $('.quick-delete-post.__ponzu span');
del.on('click', function(e) {
if (confirm("[Ponzu] Please confirm:\n\nAre you sure you want to delete this post?\nThis cannot be undone.")) {
$(e.target).parent().submit();
}
});
});
// disable link from being clicked if parent is 'disabled'
$(function() {
$('ul.pagination li.disabled a').on('click', function(e) {
e.preventDefault();
});
});
</script>
`

btn := `<div class="col s3">
<a href="/admin/edit?type=` + t + `" class="btn new-post waves-effect waves-light">
New ` + t + `
</a>`
html = html + b.String() + btn
<a href="/admin/edit?type=` + t + `" class="btn new-post waves-effect waves-light">
New ` + t + `
</a>`

if _, ok := post.(format.CSVFormattable); ok {
btn = `<br/>
btn += `<br/>
<a href="/admin/contents/export?type=` + t + `&format=csv" class="green darken-4 btn export-post waves-effect waves-light">
<i class="material-icons left">system_update_alt</i>
CSV
</a>`
html = html + b.String() + btn
}

html += `</div></div>`
html += b.String() + script + btn + `</div></div>`

adminView, err := Admin([]byte(html))
if err != nil {
Expand Down

0 comments on commit cc0f765

Please sign in to comment.