Cleaning the code.
parent
1a0b48134e
commit
c017dc1b05
|
@ -145,7 +145,7 @@ render { addUserForm, searchUserForm, page, wsUp }
|
|||
|
||||
routing_search_button = Bulma.btn "Search" $ Routing Search
|
||||
routing_add_button = Bulma.btn "Add" $ Routing Add
|
||||
cancel_button = Bulma.modal_cancel_button CancelModal
|
||||
cancel_button = Bulma.cancel_button CancelModal
|
||||
|
||||
generic_button :: forall w. Action -> Boolean -> HH.HTML w Action
|
||||
generic_button action active =
|
||||
|
|
|
@ -32,11 +32,9 @@ import Data.Maybe (Maybe(..), fromMaybe, maybe)
|
|||
import Effect.Aff.Class (class MonadAff)
|
||||
import Halogen as H
|
||||
import Halogen.HTML as HH
|
||||
import Halogen.HTML.Events as HE
|
||||
import Halogen.HTML.Properties as HP
|
||||
|
||||
import Bulma as Bulma
|
||||
import CSSClasses as C
|
||||
|
||||
import App.AcceptedRRTypes (AcceptedRRTypes(..))
|
||||
import App.ResourceRecord (ResourceRecord)
|
||||
|
@ -266,15 +264,12 @@ render state
|
|||
|
||||
modal_rr_delete :: forall w. Int -> HH.HTML w Action
|
||||
modal_rr_delete rr_id = Bulma.modal "Deleting a resource record"
|
||||
[warning_message] [modal_delete_button, Bulma.modal_cancel_button CancelModal]
|
||||
[warning_message] [modal_delete_button, Bulma.cancel_button CancelModal]
|
||||
where
|
||||
modal_delete_button
|
||||
= HH.button [ HP.classes (C.button <> C.is_success)
|
||||
, HE.onClick \_ -> RemoveRR rr_id
|
||||
] [HH.text "Delete the resource record."]
|
||||
modal_delete_button = Bulma.alert_btn "Delete the resource record." (RemoveRR rr_id)
|
||||
warning_message
|
||||
= HH.p [] [ HH.text $ "You are about to delete a resource record, this actions is "
|
||||
, HH.strong_ [ HH.text "irreversible" ]
|
||||
= HH.p [] [ HH.text "You are about to delete a resource record, this actions is "
|
||||
, Bulma.strong "irreversible"
|
||||
, HH.text "."
|
||||
]
|
||||
|
||||
|
@ -381,7 +376,7 @@ render state
|
|||
NewRRModal t_ -> "New " <> show_accepted_type t_ <> " resource record"
|
||||
UpdateRRModal -> "Update RR " <> show state._currentRR.rrid <> " resource record"
|
||||
RemoveRRModal rr_id -> "Error: should display removal modal instead (for RR " <> show rr_id <> ")"
|
||||
foot = foot_ <> [Bulma.modal_cancel_button CancelModal]
|
||||
foot = foot_ <> [Bulma.cancel_button CancelModal]
|
||||
|
||||
handleAction :: forall m. MonadAff m => Action -> H.HalogenM State Action () Output m Unit
|
||||
handleAction = case _ of
|
||||
|
|
|
@ -6,7 +6,7 @@ import Halogen.HTML as HH
|
|||
import DOM.HTML.Indexed as DHI
|
||||
import Halogen.HTML.Properties as HP
|
||||
import Halogen.HTML.Events as HE
|
||||
import MissingHTMLProperties as MissingProperties
|
||||
-- import MissingHTMLProperties as MissingProperties
|
||||
|
||||
import CSSClasses as C
|
||||
|
||||
|
@ -181,6 +181,13 @@ btn title action
|
|||
, HP.classes $ btn_classes true
|
||||
] [ HH.text title ]
|
||||
|
||||
alert_btn :: forall w action. String -> action -> HH.HTML w action
|
||||
alert_btn title action
|
||||
= HH.button
|
||||
[ HE.onClick \_ -> action
|
||||
, HP.classes $ btn_classes false
|
||||
] [ HH.text title ]
|
||||
|
||||
render_input :: forall w i.
|
||||
Boolean -> String -> String -> (String -> i) -> String -> (HP.IProp DHI.HTMLinput i) -> HH.HTML w i
|
||||
render_input password id placeholder action value cond
|
||||
|
@ -330,36 +337,12 @@ modal_body = HH.section [HP.classes C.modal_card_body]
|
|||
modal_foot :: forall w i. Array (HH.HTML w i) -> HH.HTML w i
|
||||
modal_foot = HH.div [HP.classes C.modal_card_foot]
|
||||
|
||||
modal_cancel_button :: forall w i. i -> HH.HTML w i
|
||||
modal_cancel_button action
|
||||
cancel_button :: forall w i. i -> HH.HTML w i
|
||||
cancel_button action
|
||||
= HH.button [ HP.classes C.button
|
||||
, HE.onClick \_ -> action
|
||||
] [HH.text "Cancel"]
|
||||
|
||||
modal_domain_delete :: forall w i. String -> HH.HTML w i
|
||||
modal_domain_delete domain =
|
||||
modal_
|
||||
[ modal_background
|
||||
, modal_card [modal_header "Deleting a domain", modal_body]
|
||||
, modal_foot [modal_delete_button, modal_cancel_button]
|
||||
]
|
||||
where
|
||||
-- modal_header = HH.header [HP.classes C.modal_card_head]
|
||||
-- [ HH.p [HP.classes C.modal_card_title] [HH.text "Deleting a domain"]
|
||||
-- --, HH.button [HP.classes C.delete, ARIA.label "close"] []
|
||||
-- ]
|
||||
modal_body = HH.section [HP.classes C.modal_card_body] [ warning_message ]
|
||||
-- modal_foot = HH.div [HP.classes C.modal_card_foot]
|
||||
modal_delete_button = HH.button [HP.classes (C.button <> C.is_success)] [HH.text "Delete the domain."]
|
||||
modal_cancel_button = HH.button [HP.classes C.button] [HH.text "Cancel"]
|
||||
warning_message
|
||||
= HH.p [] [ HH.text $ "You are about to delete your domain '"
|
||||
<> domain
|
||||
<> "'. Are you sure you want to do this? This is "
|
||||
, HH.strong_ [ HH.text "irreversible" ]
|
||||
, HH.text "."
|
||||
]
|
||||
|
||||
strong :: forall w i. String -> HH.HTML w i
|
||||
strong str = HH.strong_ [ HH.text str ]
|
||||
|
||||
|
|
Loading…
Reference in New Issue