<commit_before>(ns kanban.components.board-dialog
  (:require [goog.object :as gobj]
            [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [kanban.components.card :refer [Assignee assignee]]
            [kanban.components.sortable-list :refer [sortable-list]]))

(defui BoardDialog
  static om/Ident
  (ident [this props]
    [:board/by-id (:id props)])
  static om/IQuery
  (query [this]
    [:id :name :description :lanes])
  Object
  (update [this prop value]
    (let [{:keys [update-fn]} (om/get-computed this)]
      (update-fn (om/get-ident this) {prop value})))

  (render [this]
    (let [{:keys [id name description lanes]} (om/props this)
          {:keys [close-fn]} (om/get-computed this)]
      (dom/div #js {:className "dialog"}
        (dom/div #js {:className "dialog-closer" :onClick close-fn})
        (dom/div #js {:className "dialog-content"}
          (dom/h1 #js {:className "dialog-title"}
            "Edit board" (dom/span #js {:className "board-name"} name))
          (dom/form #js {:onSubmit #(.preventDefault %)}
            (dom/div #js {:className "form-row"}
              (dom/label nil "Name:")
              (dom/input
                #js {:value name
                     :placeholder "Enter the name of the board here..."
                     :onChange #(.update this :name (.. % -target -value))}))
            (dom/div #js {:className "form-row"}
              (dom/label nil "Description:")
              (dom/textarea
                #js {:value description
                     :placeholder "Enter a description for the board here..."
                     :onChange
                     #(.update this :description (.. % -target -value))}))
            (dom/div #js {:className "form-row"}
              (dom/label nil "Lanes:")
              (sortable-list
                {:update-fn (fn [lanes]
                              (->> lanes
                                   (map #(-> [:lane/by-id (:id %)]))
                                   (.update this :lanes)))
                 :items
                  (for [lane lanes]
                    {:key (:id lane)
                     :data lane
                     :element
                     (dom/span #js {:className "lane-name"} (:name lane))})})))
          (dom/p #js {:className "dialog-buttons"}
            (dom/button #js {:onClick close-fn} "Close"))
          (dom/div #js {:className "help"}
            (dom/h3 #js {:className "help-title"} "Help")
            (dom/ul #js {:className "instructions"}
              (dom/li nil "Change the board name via the name field")<commit_msg>Fix alignment of sortable list properties<commit_after>(ns kanban.components.board-dialog
  (:require [goog.object :as gobj]
            [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [kanban.components.card :refer [Assignee assignee]]
            [kanban.components.sortable-list :refer [sortable-list]]))

(defui BoardDialog
  static om/Ident
  (ident [this props]
    [:board/by-id (:id props)])
  static om/IQuery
  (query [this]
    [:id :name :description :lanes])
  Object
  (update [this prop value]
    (let [{:keys [update-fn]} (om/get-computed this)]
      (update-fn (om/get-ident this) {prop value})))

  (render [this]
    (let [{:keys [id name description lanes]} (om/props this)
          {:keys [close-fn]} (om/get-computed this)]
      (dom/div #js {:className "dialog"}
        (dom/div #js {:className "dialog-closer" :onClick close-fn})
        (dom/div #js {:className "dialog-content"}
          (dom/h1 #js {:className "dialog-title"}
            "Edit board" (dom/span #js {:className "board-name"} name))
          (dom/form #js {:onSubmit #(.preventDefault %)}
            (dom/div #js {:className "form-row"}
              (dom/label nil "Name:")
              (dom/input
                #js {:value name
                     :placeholder "Enter the name of the board here..."
                     :onChange #(.update this :name (.. % -target -value))}))
            (dom/div #js {:className "form-row"}
              (dom/label nil "Description:")
              (dom/textarea
                #js {:value description
                     :placeholder "Enter a description for the board here..."
                     :onChange
                     #(.update this :description (.. % -target -value))}))
            (dom/div #js {:className "form-row"}
              (dom/label nil "Lanes:")
              (sortable-list
                {:update-fn (fn [lanes]
                              (->> lanes
                                   (map #(-> [:lane/by-id (:id %)]))
                                   (.update this :lanes)))
                 :items
                 (for [lane lanes]
                   {:key (:id lane)
                    :data lane
                    :element
                    (dom/span #js {:className "lane-name"} (:name lane))})})))
          (dom/p #js {:className "dialog-buttons"}
            (dom/button #js {:onClick close-fn} "Close"))
          (dom/div #js {:className "help"}
            (dom/h3 #js {:className "help-title"} "Help")
            (dom/ul #js {:className "instructions"}
              (dom/li nil "Change the board name via the name field")
{'fraction_non_alphanumeric': 0.15029339390497823, 'fraction_numerical': 0.0007571455612341472, 'mean_word_length': 1.5965601965601965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4215151', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1476, 'n_words': 430}