   (html/at enlive-m
            [:.clj--delete-account__link] (html/set-attr :href (r/path :show-delete-account-confirmation))))
 
-(defn hide-admin-span [request enlive-m]
+(defn hide-admin-span [enlive-m request]
   (let [role (get-in request [:context :role])]
     (html/at enlive-m [:.clj--admin__span]
              (when (= role (:admin config/roles)) identity))))
 
-(defn diplay-email-unconfirmed-message [request enlive-m]
+(defn diplay-email-unconfirmed-message [enlive-m request]
   (if (= false (get-in request [:context :confirmed?]))
     enlive-m
     (vh/remove-element enlive-m [:.clj--unconfirmed-email-message-container])))
 
-(defn set-flash-message [request enlive-m]
+(defn set-flash-message [enlive-m request]
   (case (:flash request)
     :password-changed (html/at enlive-m [:.clj--flash-message-text] (html/set-attr :data-l8n "content:flash/password-changed"))
     :email-confirmed (html/at enlive-m [:.clj--flash-message-text] (html/set-attr :data-l8n "content:flash/email-confirmed"))

    (vh/remove-element enlive-m [:.clj--flash-message-container])))

(defn profile [request]
  (->> (vh/load-template "public/profile.html")
       (set-flash-message request)
       (diplay-email-unconfirmed-message request)
       (add-username request)
       (add-application-list request)
       set-sign-out-link
       set-change-password-link
       set-delete-account-link
       (hide-admin-span request)
       vh/remove-work-in-progress))

                                                                                     "?client_id="
                                                                                     (:client-id client))))))

(defn add-application-list [enlive-m request library-m]
  (let [authorised-clients (get-in request [:context :authorised-clients])]
    (if-not (empty? authorised-clients)
      (html/at enlive-m [:.clj--app__list] (html/content (application-list-items authorised-clients library-m)))
      (html/at enlive-m [:.clj--app__list] (html/content (empty-application-list-item library-m))))))

(defn set-sign-out-link [enlive-m]
  (html/at enlive-m
