Permalink
Browse files

Add FeedRel. Add feed selection to article-form.

  • Loading branch information...
1 parent 337e167 commit e527ee15d1e9e2c2a47686f30430d3164880cf43 @thorwil committed Oct 19, 2011
Showing with 38 additions and 8 deletions.
  1. +10 −1 src/tlog/conf.clj
  2. +9 −5 src/tlog/models/backing.clj
  3. +1 −1 src/tlog/models/models.clj
  4. +13 −0 src/tlog/views/html.clj
  5. +5 −1 todo.txt
View
@@ -27,8 +27,17 @@
(def copyright "Copyright 2011 Thorsten Wilms, unless otherwise noted.")
(def feed-url "http://www.thorstenwilms.com/atom")
+
;; Used in atom-feed.clj:
(def articles-per-feed-page 10)
(def domain "http://www.thorstenwilms.com/")
-(def author-email "self@thorstenwilms.com")
+(def author-email "self@thorstenwilms.com")
+
+
+;; Used in html.clj:
+;; Feeds of selected articles will change rarely, if ever, so they are hard-coded:
+(def feeds '[journal
+ planet-ubuntu ;; http://planet.ubuntu.com/
+ planet-linuxaudio ;; http://planet.linuxaudio.org/
+ graphicsplanet]) ;; http://www.graphicsplanet.org/
@@ -10,9 +10,6 @@
;; Entities
-(ds/defentity SlugRel [^:key slug, article-id])
-;; Use datastore given ID of the Article as article-id, and thus as parent for 1st level Comments.
-
(ds/defentity Article [title, body, created, updated])
;; Letting the datastore generate keys allows referencing Articles from Comments, independent of
;; slugs.
@@ -22,8 +19,15 @@
(ds/defentity DeletionQueueItem [^:key identifier])
;; Use queued tasks for cancelable, delayed deletion (instead of asking: are you sure?).
;; Initially, there was no programmatic way to delete queued tasks, and there is still none
-;; accessible via appengine-magic. So instead have the tasks execute deletion only if there still
-;; is a matching DeletionQueueItem.
+;; accessible via appengine-magic. So instead have the tasks execute deletion only if there's
+;; a matching DeletionQueueItem.
+
+;; Map a slug to an Article:
+(ds/defentity SlugRel [^:key slug, article-id])
+;; Use datastore given ID of the Article as article-id, and thus as parent for 1st level Comments.
+
+;; Map an Article to a feed, one Article can be in several feeds:
+(ds/defentity FeedRel [article-id, feed])
;; Pagination functions used for both Article and BlobInfo
@@ -15,7 +15,7 @@
(defn add-article!
[{:strs [title slug body]}]
- (let [body-t (-> body ds/as-text)
+ (let [body-t (ds/as-text body)
now (System/currentTimeMillis)
id (ds/key-id (ds/save! (Article. title body-t now now)))]
(ds/save! (SlugRel. slug id))))
View
@@ -398,6 +398,18 @@
(admin-articles-table-row (:slug i) (:delete-queued i) (:title i)))]
(maybe-page-navigation ((juxt :headwards :tailwards) data) "/admin/"))
+(def true-before-falses
+ "Lazy list of true followed by infinte times false."
+ (lazy-cat [true] (repeat false)))
+
+(defn feed-selection
+ []
+ [:fieldset
+ [:legend "Include in the following feeds:"]
+ (mapcat #(html [:input (into {:type "checkbox"}
+ (when %1 {:checked "checked"}))
+ %2]) true-before-falses conf/feeds)])
+
(defhtml article-form-rendition
[_]
[:h2 "Write Article"]
@@ -408,6 +420,7 @@
[:tr
[:td [:label "Slug"]]
[:td [:input {:type "text" :name "slug" :required "required" :pattern "[a-zäöüß0-9_-]*"}]]]]
+ (feed-selection)
[:div {:id "slug" :class "article-body hyphenate admin-editable start-blank"} ""]
[:input {:type "submit" :value "Add new article" :disabled "disabled"}])
View
@@ -1,8 +1,12 @@
+Feeds:
+ Add feed checkboxes to Article form and view
+ Style fieldset and checkboxes
+ Adjust route
+
Decide on home page content and journal URL
Features
--------
-Channels
Tags
Series
Pingbacks

0 comments on commit e527ee1

Please sign in to comment.