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

Fix w3c validator errors #161

Open
wants to merge 5 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
19 changes: 19 additions & 0 deletions src/statuses/views/form.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns statuses.views.form
(:require [hiccup.def :refer [defelem]]
[hiccup.util :refer [to-uri]]))

(defelem form-to
"Create a form that points to a particular method and route.
e.g. (form-to [:put \"/post\"]
...)"
[[method action] & body]
(let [method-str (.toUpperCase (name method))
action-uri (to-uri action)]
(-> (if (contains? #{:get :post} method)
[:form {:method method-str, :action action-uri}]
[:form {:method "POST", :action action-uri}
[:input {:type "hidden"
:name "_method"
:value method-str}]])
(concat body)
(vec))))
32 changes: 17 additions & 15 deletions src/statuses/views/layout.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
[statuses.views.common :refer [icon]]))

(defn preference [id title iconname]
[:li [:a {:name id}
(icon iconname)
[:label {:for (str "pref-" id)} title]
(check-box {:class "pref" :disabled "disabled"} (str "pref-" id))]])
[:li [:p.navbar-text
(icon iconname)
[:label {:for (str "pref-" id)} title]
(check-box {:class "pref" :disabled "disabled"} (str "pref-" id))]])

(defn nav-link [url title iconname]
[:li (link-to url (icon iconname) title)])
Expand All @@ -27,6 +27,7 @@
([title username content footer]
(html5
[:head
[:meta {:charset "utf-8"}]
[:meta {:name "viewport"
:content "width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"}]
[:title (str title " - innoQ Statuses")]
Expand All @@ -39,17 +40,18 @@
:type "application/atom+xml"}]
[:style "body { }"]]
[:body
[:header.navbar.navbar-default.navbar-fixed-top {:role "navigation"}
[:div.container-fluid
[:div.navbar-header
[:button.navbar-toggle.collapsed {:type "button" :data-target ".navbar-collapse" :data-toggle "collapse"}
[:span.sr-only "Toggle navigation"]
[:span.icon-bar]
[:span.icon-bar]
[:span.icon-bar]]
[:a {:class "navbar-brand", :href "/statuses/updates"} "Statuses"]]
[:div.collapse.navbar-collapse
[:ul.nav.navbar-nav (nav-links username)]]]]
[:header
[:nav.navbar.navbar-default.navbar-fixed-top {:role "navigation"}
[:div.container-fluid
[:div.navbar-header
[:button.navbar-toggle.collapsed {:type "button" :data-target ".navbar-collapse" :data-toggle "collapse"}
[:span.sr-only "Toggle navigation"]
[:span.icon-bar]
[:span.icon-bar]
[:span.icon-bar]]
[:a {:class "navbar-brand", :href "/statuses/updates"} "Statuses"]]
[:div.collapse.navbar-collapse
[:ul.nav.navbar-nav (nav-links username)]]]]]
[:main.container-fluid.tweet-wrapper content]
[:footer footer]
(include-js "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
Expand Down
7 changes: 4 additions & 3 deletions src/statuses/views/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
(:require [clj-time.local :refer [format-local-time]]
[hiccup.core :refer [html]]
[hiccup.element :refer [link-to]]
[hiccup.form :refer [form-to hidden-field text-field]]
[hiccup.form :refer [hidden-field text-field]]
[statuses.configuration :refer [config]]
[statuses.routes :refer [avatar-path update-path
updates-path profile-path]]
[statuses.views.common :as common :refer [icon]]
[statuses.views.form :refer [form-to]]
[statuses.views.layout :as layout]))

(defn- button
Expand Down Expand Up @@ -46,9 +47,9 @@
[:span.author (link-to (str (updates-path) "?author=" author) author)]
(if in-reply-to
[:span.reply (link-to (update-path in-reply-to) in-reply-to)])
[:span.actions (button "reply" "Reply" "reply")
[:div.actions (button "reply" "Reply" "reply")
(if can-delete?
[:span.delete (delete-form id)])]
[:div.delete (delete-form id)])]
[:span.time [:a.permalink {:href (update-path id)} (format-time time)]]
]
[:div.post-content (common/linkify text)]
Expand Down