Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set default visibility and language. README install instructions about git submodules. #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ $ lein deps
$ ./bootstrap.sh
```

Get CodeMirror and mousetrap by updating git submodules (you need to have the actual refheap repo):

```bash
$ git submodule update --init`
```

Start the Mongo daemon, and in a separate terminal start the RefHeap server using lein. The server will host content from [http://localhost:3000](http://localhost:3000).

```bash
Expand Down
8 changes: 6 additions & 2 deletions config.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{:db-name "refheap"
{
:db-name "refheap"
:db-port 27017
:db-host "localhost"
:hosts #{"localhost"}
:port 8080}
:port 8080
:default-language "Clojure"
:default-private? false
}
5 changes: 3 additions & 2 deletions src/refheap/views/paste.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns refheap.views.paste
(:require [refheap.models.paste :as paste]
[refheap.config :refer [config]]
[refheap.models.users :as users]
[refheap.highlight :refer [lexers]]
[refheap.utilities :refer [to-booleany escape-string pluralize safe-parse-long]]
Expand Down Expand Up @@ -31,13 +32,13 @@
(for [lang (sort #(.compareToIgnoreCase % %2)
(keys (dissoc lexers lang)))]
(l/on node (l/attr :value lang) (l/content lang))))
(l/attr? :selected) (let [lang (or lang (:language old) (session/get :last-lang) "Clojure")]
(l/attr? :selected) (let [lang (or lang (:language old) (session/get :last-lang) (:default-language config) "Clojure")]
(comp (l/attr :value lang)
(l/content lang)))
(l/element= :form) (l/attr :action (if old
(paste-url old "/edit")
"/create"))
(when (:private old)
(when (or (:private old) (:default-private? config) )
[(l/attr= :name :private) (l/attr :checked "")])
(when old
[(l/element= :textarea) (l/content (:raw-contents old))])
Expand Down