about summary refs log tree commit diff
path: root/users/grfn/bbbg/src
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/bbbg/src')
-rw-r--r--users/grfn/bbbg/src/bbbg/handlers/events.clj19
-rw-r--r--users/grfn/bbbg/src/bbbg/styles.clj34
2 files changed, 42 insertions, 11 deletions
diff --git a/users/grfn/bbbg/src/bbbg/handlers/events.clj b/users/grfn/bbbg/src/bbbg/handlers/events.clj
index d41caec39bc7..6f6d6f3585ae 100644
--- a/users/grfn/bbbg/src/bbbg/handlers/events.clj
+++ b/users/grfn/bbbg/src/bbbg/handlers/events.clj
@@ -89,8 +89,15 @@
    [:div.page-header
     [:h1 (format-date (::event/date event)
                       FormatStyle/FULL)]
-    [:a {:href (str "/signup-forms/" (::event/id event) )}
-     "Go to Signup Form"]]
+    [:div.spacer]
+    [:a.button {:href (str "/signup-forms/" (::event/id event) )}
+     "Go to Signup Form"]
+    [:form#delete-event
+     {:method :post
+      :action (str "/events/" (::event/id event) "/delete")
+      :data-confirm "Are you sure you want to delete this event?"}
+     [:input.error {:type "submit"
+                    :value "Delete Event"}]]]
    [:div.stats
     [:p (pluralize (:num-rsvps event) "RSVP")]
     [:p (num-attendees event)]]
@@ -220,6 +227,14 @@
                           :attendees attendees})))
           (not-found "Event Not Found")))
 
+      (POST "/delete" []
+        (db/delete! db :event_attendee [:= :event-id id])
+        (db/delete! db :event [:= :id id])
+        (-> (redirect "/events")
+            (flash/add-flash
+             #:flash {:type :success
+                      :message "Successfully deleted event"})))
+
       (GET "/attendees/import" []
         (if-let [event (db/get db :event id)]
           (page-response
diff --git a/users/grfn/bbbg/src/bbbg/styles.clj b/users/grfn/bbbg/src/bbbg/styles.clj
index f10bf04f09d9..a860ae607626 100644
--- a/users/grfn/bbbg/src/bbbg/styles.clj
+++ b/users/grfn/bbbg/src/bbbg/styles.clj
@@ -80,15 +80,15 @@
      :color black
      :text-decoration :none}
 
-     [(& hover)
-      {:color blue}]]
+    [(& hover)
+     {:color blue}]]
 
    [:li.active
     {:font-weight "bold"
-     :border-bottom [["1px" "solid" black]]}]
+     :border-bottom [["1px" "solid" black]]}]]
 
-   [:.spacer
-    {:flex 1}]])
+  [:.spacer
+   {:flex 1}])
 
 (def link-conditional-styles
   (list
@@ -165,18 +165,29 @@
     :border [[(px 1) "solid" (color/lighten blue 30)]]
     :cursor :pointer
     :display :inline-block}
+
    [(& hover)
     {:border-color blue
      :text-decoration :none
      :box-shadow [[0 "1px" "5px" "rgba(0,0,0,0.075)"]]}
-    [(& :a)
+    [(:a &)
      {:text-decoration :none}]]
+
    [(& active)
     {:background-color blue
      :color :white
      :box-shadow :none}
     [(& :a)
-     {:text-decoration :none}]]]
+     {:text-decoration :none}]]
+
+   (for [[context color] contextual-colors]
+     [(& (keyword (str "." (name context))))
+      {:background-color (color/lighten color 30)
+       :border-color (color/lighten color 30)
+       :color black}
+
+      [(& hover)
+       {:border-color color}]])]
 
   [:label
    {:font-weight 600
@@ -377,8 +388,13 @@
     :padding-bottom "0.7rem"
     :margin-bottom "1rem"
     :border-bottom [["1px" "solid" silver]]
-    :align-items :center
-    :justify-content :space-between}]
+    :align-items :center}
+
+   [:*+*
+    {:margin-left "0.5rem"}]
+
+   [:form
+    {:margin-block-end 0}]]
 
   [(attr= "role" "button")
    {:cursor :pointer}]