basic mark export

This commit is contained in:
Dan Ballard 2015-05-14 08:29:01 -07:00
parent fd673de247
commit b7d5f08978
4 changed files with 25 additions and 5 deletions

View File

@ -0,0 +1,13 @@
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
ALTER TABLE news DROP COLUMN exported;
ALTER TABLE news ADD COLUMN exported timestamp DEFAULT NULL;
CREATE INDEX ON news (exported);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
ALTER TABLE news DROP COLUMN exported;
ALTER TABLE news ADD COLUMN exported boolean DEFAULT false;

View File

@ -1,3 +1,11 @@
$(document).ready( function () {
$( "#datepicker" ).datepicker();
$("#datepicker").datepicker();
$("confirm-export").confirm({
"text": "Mark current batch exported?",
"title": "Export confrimation",
confirm: function() {
alert('exported!');
},
});
});

View File

@ -60,7 +60,7 @@ func addContainer(category_id int, flat, tree map[int]*NewsContainer) {
func Unexported(db *sql.DB) (map[int]*NewsContainer, error) {
categories.LoadCategories(db)
rows, err := db.Query("SELECT url, title, category_id, timestamp, notes FROM news WHERE exported=false order by category_id ASC")
rows, err := db.Query("SELECT url, title, category_id, timestamp, notes FROM news WHERE exported is null order by category_id ASC")
if err != nil {
fmt.Println("DB errpr reading unexported news: ", err)
return nil, err

View File

@ -2,7 +2,6 @@
<h2 class="form-add-heading">List</h2>
{{template "flashes" .}}
<form class="form-add" action="/" method="post" role="form" class="container col-form">
<div class="row">
<div class="col-xs-2">
<a class="btn btn-lg btn-primary btn-block" href="{{template "launch-add" .}}">Add to transmet</a>
@ -11,7 +10,7 @@
<div class="col-xs-4"></div>
<div class="col-xs-2">
<input class="btn btn-lg btn-primary btn-block" type="submit" value="Export" />
<button class="confirm-export btn btn-lg btn-primary btn-block" type="submit">Export</button>
</div>
<div class="col-xs-6">
@ -24,7 +23,7 @@ Click this to mark the current queue of news items as exported (clearing them)
<div class="col-xs-12">&nbsp;</div>
</div>
</form>
<textarea class="form-control" name="template" placeholder="Template" rows="16" cols="80">{{.template}}</textarea>