ported to Web SQL
[ReadingsJQM.git] / js / app / models.js
1 // Generated by CoffeeScript 1.3.3
2 (function() {
3   var url_to_slug;
4
5   url_to_slug = function(url) {
6     var slug_in_url;
7     slug_in_url = /([a-z0-9-]+)[/]?$/;
8     return slug_in_url.exec(url)[1];
9   };
10
11   Readings.Book = (function() {
12
13     function Book(record) {
14       $.extend(this, record);
15     }
16
17     Book.prototype.render = function() {
18       var wlurl;
19       wlurl = Readings.config.get('wlurl');
20       return "<li>      <a href=\"reader.html?book_id=" + this.id + "\">        <img src=\"" + wlurl + this.cover + "\">        <h3> " + this.title + "</h3>       </a>     </li>";
21     };
22
23     Book.prototype.group = function() {
24       return this.authors;
25     };
26
27     return Book;
28
29   })();
30
31   Readings.Tag = (function() {
32
33     function Tag(record, category) {
34       this.category = category;
35       $.extend(this, record);
36     }
37
38     Tag.prototype.render = function() {
39       return "<li><a href=\"books.html?tag_id=" + this.id + "\">" + this.name + "</a></li>";
40     };
41
42     Tag.prototype.group = function() {
43       return this.sort_key[0].toUpperCase();
44     };
45
46     return Tag;
47
48   })();
49
50 }).call(this);