Skip to content

Commit

Permalink
Merge pull request #126 from kkasai/feature/schedule
Browse files Browse the repository at this point in the history
add checkbox
  • Loading branch information
kkasai authored Sep 28, 2017
2 parents de1182f + 963ad48 commit 8df0a0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/clj/job_streamer/console/style.clj
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
[:#calendar-detail-view-content [:.k-days {:pointer-events "none"}]]
[:#job-query {:border {:radius 0
:bottom "0.3px solid"
:color "#fff !important"}}]])
:color "#fff !important"}}]
[:#substitution-div {:margin-top "10px"}]])


(defn build []
Expand Down
16 changes: 14 additions & 2 deletions src/cljs/job_streamer/console/components/job_detail.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
""))

(defn to-cron-expression-weekly [hour day-of-weeks]
(println (pr-str day-of-weeks))
(if (and (not-empty hour) (not-empty day-of-weeks))
(letfn [(get-week-day-sort-key [day-of-week] (get {"Sun" 0 "Mon" 1 "Tue" 2 "Wed" 3 "Thu" 4 "Fri" 5 "Sat" 6} day-of-week))]
(str "0 0 " hour " ? * " (->> day-of-weeks (sort-by get-week-day-sort-key) (clojure.string/join ","))))
Expand Down Expand Up @@ -383,7 +382,20 @@
(om/set-state! owner [:schedule :schedule/calendar :calendar/name] value)))}
[:option {:value "" :key ""} ""]
(for [{:keys [calendar/name]} calendars]
[:option {:value name :key name} name])]])]
[:option {:value name :key name} name])]
(when-not (empty? (om/get-state owner [:schedule :schedule/calendar :calendar/name]))
[:div
[:div
[:label "Substitution"]]
[:div.ui.fitted.toggle.checkbox {:id "substitution-div"}
[:input (merge {:id "substitution"
:type "checkbox"
:on-change (fn [e]
(let [value (.. e -target -checked)]
(om/set-state! owner [:schedule :schedule/substitution?] value)))}
(when (:schedule/substitution? schedule)
{:checked "checked"}))]
[:label]]])])]
[:div.ui.buttons
[:button.ui.button
{:type "button"
Expand Down

0 comments on commit 8df0a0a

Please sign in to comment.