all repos — litestore @ b3dae462cc3601faa78f84b779a6f40814b35bdf

A minimalist nosql document store.

Added doclist component.
h3rald h3rald@h3rald.com
Mon, 04 May 2015 21:08:58 +0200
commit

b3dae462cc3601faa78f84b779a6f40814b35bdf

parent

25332dab65c393245545c4cd49442c37991d37be

2 files changed, 47 insertions(+), 2 deletions(-)

jump to
A admin/js/components/doclist.js

@@ -0,0 +1,45 @@

+(function(){ + 'use strict'; + var app = window.LS || (window.LS = {}); + var u = app.utils; + + app.doclist = {}; + + /* + * - id + * - tags + * - content + */ + app.doclist.panel = function(item){ + var obj = {}; + var path = (item.id.match(/\.html?$/)) ? "/html/" : "/document/view/"; + obj.title = m("a", {href: path+item.id, config: m.route}, [item.id]); + obj.content = m("div", [ + m("p", [item.content]), + m("p", item.tags.map(function(tag){ + return u.taglink(tag); + })) + ] + ); + return m(".row.search-result", m(".col-md-12", [u.panel(obj)])); + }; + + /* + * - items (id, tags, content) + * - title + * - subtitle + * - querydata (total, limit, offset, baseurl) + */ + app.doclist.view = function(obj){ + var results = m(".row", [m(".col-md-12", obj.items.map(app.doclist.panel))]); + + return m("section", [ + m(".row", [obj.title]), + m(".row", [obj.subtitle]), + m(".row.text-center", [u.paginator(obj.querydata)]), + results, + m(".row.text-center", [u.paginator(obj.querydata)]) + ]); + }; + +}());
M admin/md/api.mdadmin/md/api.md

@@ -1,4 +1,4 @@

-## REST API Reference +## HTTP API Reference ### info - LiteStore Information

@@ -126,4 +126,4 @@ #### PUT docs/:id

#### PATCH docs/:id -#### DELETE docs/:id +#### DELETE docs/:id