Change the paths stored on the database

The paths in the database now are relative of the config BOOKS_PATH and COVER_PATH

For updating the database this query should be use:
for (var i = db.books.find(); i.hasNext(); ) {
        var book = i.next();
        db.books.update({_id: book["_id"]}, {$set: {path: book["path"].slice(6), cover: book["cover"].slice(7), coversmall: book["coversmall"].slice(7)}});
}
This commit is contained in:
Las Zenow 2012-10-28 20:21:46 +01:00
parent 34b48f411c
commit 93bd567f8d
9 changed files with 41 additions and 35 deletions

View file

@ -14,7 +14,7 @@
{{with .B}}
<div class="row">
<div class="span1">
<p class="pull-right">{{if .CoverSmall}}<img src="{{.CoverSmall}}" alt="{{.Title}}" />{{end}}</p>
<p class="pull-right">{{if .CoverSmall}}<img src="/cover/{{.CoverSmall}}" alt="{{.Title}}" />{{end}}</p>
</div>
<div class="span9">
<p><a href="/search/?q=title:{{.Title}}"><strong>{{.Title}}</strong></a> <small>({{$titleFound}})</small><br />
@ -34,7 +34,7 @@
</div>
<div class="row"><p></p></div>
<div class="row btn-group pull-right">
<a href="/{{.Path}}" class="btn btn-inverse"><i class="icon-download-alt icon-white"></i> download</a>
<a href="/new/{{.Path}}" class="btn btn-inverse"><i class="icon-download-alt icon-white"></i> download</a>
<a href="/read/{{.Id}}" class="btn btn-warning"><i class="icon-eye-open icon-white"></i> read it!</a>
</div>
</div>