Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added embedding of pastes, closes #28.

  • Loading branch information...
commit 3583c2897072adb4486f7e13291eddf7321e315c 1 parent 8d6a5c4
@amcnamara amcnamara authored
Showing with 21 additions and 1 deletion.
  1. +4 −0 resources/public/css/native.css
  2. +17 −1 src/refheap/views/paste.clj
View
4 resources/public/css/native.css
@@ -1,3 +1,7 @@
+pre {
+ font-family: 'Bitstream Vera Sans Mono', monospace;
+ font-size: 13px;
+}
.linenos {float: left;}
.syntax .hll { background-color: #404040 }
.syntax { background: #202020; color: #d0d0d0 }
View
18 src/refheap/views/paste.clj
@@ -58,6 +58,7 @@
" on "
(date-string date)
[:div#edit
+ (ph/link-to (str "/paste/" id "/embed") "embed")
(ph/link-to (str "/paste/" id "/raw") "raw")
(ph/link-to (str "/paste/" id "/fullscreen") "maximize")
(when (and user (= user (:id (session/get :user))))
@@ -93,7 +94,18 @@
[:div.syntax summary
(if (> lines 5) [:div.more (ph/link-to (str "/paste/" paste-id) "more...")])]
[:br])))
-
+
+(defn render-embed-page [paste]
+ (let [{:keys [paste-id content]} paste]
+ (layout
+ (list
+ [:p {:style "font-size: 13px;"}
+ "Please copy the following html element onto your webpage, and change the inline size/styling as needed:"]
+ [:p {:style "font-size: 13px; margin-bottom: 25px;"}
+ "<iframe style=\"width: 648px; height: 400px; border: 0px;\" src=\"http://refheap.com/paste/" paste-id "/fullscreen\" />"]
+ [:iframe {:style "width: 648px; height: 400px; border: 0px;"
+ :src (str "http://refheap.com/paste/" paste-id "/fullscreen")}]))))
+
(defn pastes [ps]
[:div#preview-container
(for [paste ps]
@@ -131,6 +143,10 @@
(when-let [content (:raw-contents (paste/get-paste id))]
(content-type "text/plain" content)))
+(defpage "/paste/:id/embed" {:keys [id]}
+ (let [paste (paste/get-paste id)]
+ (render-embed-page paste)))
+
(defpage [:post "/paste/:id/edit"] {:keys [id paste language private]}
(let [paste (paste/update-paste
(paste/get-paste id)
Please sign in to comment.
Something went wrong with that request. Please try again.