mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-12 18:44:38 +00:00
Toggle checkbox for forked repositories
* add toggle checkbox for filtering forked repositories * cleanup, add TODO Fixes: #47
This commit is contained in:
parent
bc27ec000f
commit
32dbc257aa
@ -4,8 +4,6 @@
|
||||
[secretary.core :as secretary]
|
||||
[goog.events :as events]
|
||||
[goog.history.EventType :as HistoryEventType]
|
||||
[markdown.core :refer [md->html]]
|
||||
[ajax.core :refer [GET POST]]
|
||||
[commiteth.ajax :refer [load-interceptors!]]
|
||||
[commiteth.handlers]
|
||||
[commiteth.subscriptions]
|
||||
@ -171,6 +169,8 @@
|
||||
|
||||
(defonce active-user (r/atom nil))
|
||||
|
||||
|
||||
;; TODO: update-tokens is unnecessarily getting dispatched on every timer tick
|
||||
(defn load-user []
|
||||
(if-let [login js/user]
|
||||
(if (= login @active-user)
|
||||
|
@ -1,5 +1,6 @@
|
||||
(ns commiteth.repos
|
||||
(:require [re-frame.core :as rf]
|
||||
[reagent.core :as r]
|
||||
[commiteth.svg :as svg]))
|
||||
|
||||
|
||||
@ -40,19 +41,36 @@
|
||||
group)])
|
||||
|
||||
|
||||
(defn show-forks-checkbox [show-atom]
|
||||
[:div.ui.container
|
||||
[:div.ui.checkbox.commiteth-toggle
|
||||
[:input (merge {:type :checkbox
|
||||
:on-change #(swap! show-atom not)}
|
||||
(when @show-atom
|
||||
{:checked :checked}))]
|
||||
[:label "Show forks"]]])
|
||||
|
||||
|
||||
(defn repos-list []
|
||||
(let [repos (rf/subscribe [:repos])
|
||||
user (rf/subscribe [:user])]
|
||||
user (rf/subscribe [:user])
|
||||
show-atom (r/atom false)]
|
||||
(fn []
|
||||
(let [repo-groups (sort-by identity (fn [a _] (= a (:login @user)))
|
||||
(keys @repos))]
|
||||
(into [:div]
|
||||
(keys @repos))
|
||||
filter-fn (if @show-atom
|
||||
identity
|
||||
(fn [repo]
|
||||
(not (:fork repo))))]
|
||||
(into [:div
|
||||
[show-forks-checkbox show-atom]]
|
||||
(for [[group group-repos]
|
||||
(map (fn [group] [group (get @repos group)])
|
||||
repo-groups)]
|
||||
[:div.repo-group-title [repo-group-title group (:login @user)]
|
||||
(into [:div.ui.cards]
|
||||
(map repo-card group-repos))]))))))
|
||||
(map repo-card
|
||||
(filter filter-fn group-repos)))]))))))
|
||||
|
||||
(defn repos-page-token-ok []
|
||||
(println "repos-token-ok")
|
||||
|
@ -304,6 +304,11 @@
|
||||
padding-left: .5em;
|
||||
}
|
||||
|
||||
.commiteth-toggle {
|
||||
padding-bottom: .5em;
|
||||
}
|
||||
|
||||
|
||||
.flash-message {
|
||||
&.success {
|
||||
background-color: #61deb0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user