Closed tomconnors closed 7 years ago
In a Reagent project, I need to be able to handle clicks on an anchor differently depending upon whether the resource at the anchor's href is "locked". This change would allow me to change some code that looks like this:
[:a {:href "#" :on-click (fn [e] (if lock (do (.preventDefault e) (dispatch [:lock/show-remittance-dialog (:entity lock)])) (history/go! (routes/url-for :resource entity))))} "Edit"]
into code that looks like this:
[:a {:href (routes/url-for :resource entity) :data-pushy-ignore (boolean lock) :on-click (fn [e] (when lock (.preventDefault e) (dispatch [:lock/show-remittance-dialog (:entity lock)])))} "Edit"]
I think the latter is superior because users can right click + open in new tab. I also think it reads a bit better.
In a Reagent project, I need to be able to handle clicks on an anchor differently depending upon whether the resource at the anchor's href is "locked". This change would allow me to change some code that looks like this:
into code that looks like this:
I think the latter is superior because users can right click + open in new tab. I also think it reads a bit better.