                                  (= view :login) (login-form)
                                  :else (discussion-elements data)))))
            (when (get-in data [:layout :add?])
-             (add-element data))))
-
-(defn main-view [data]
+             (add-element data owner))))
+
+(defn main-view [data owner]
   (reify om/IRender
     (render [_]
       (dom/div #js {:id (lib/prefix-name "dialogue-main")}

                          (logo #(om/set-state! owner :show (toggle-show show))))
                (dom/span nil (:dom-post data))))))

(defn sidebar-view [data]
  (reify om/IRender
    (render [_]
      (dom/div nil
               (logo #(sidebar/toggle!))
               (main-content-view data)
               (dom/h5 nil "Reference")
               (dom/div #js {:className "well well-sm"}
                        (get-in @lib/app-state [:layout :reference]))))))

(defn add-element
  "Show form to add a new statement."
  [data owner]
  (dom/div #js {:className "panel panel-default"}
           (dom/div #js {:className "panel-body"}
                    (dom/h4 #js {:className "text-center"} (get-in data [:layout :add-text]))
