when wrong channel is selected (via url) show error (#178)
This commit is contained in:
parent
c12f4dfb6c
commit
2a441c95d9
|
@ -117,7 +117,11 @@ submitQuery :
|
|||
submitQuery old ( new, cmd ) =
|
||||
let
|
||||
triggerSearch _ newModel msg makeRequest =
|
||||
if newModel.query /= Nothing && newModel.query /= Just "" then
|
||||
if
|
||||
(newModel.query /= Nothing)
|
||||
&& (newModel.query /= Just "")
|
||||
&& List.member newModel.channel Search.channels
|
||||
then
|
||||
( new
|
||||
, Cmd.batch
|
||||
[ cmd
|
||||
|
|
|
@ -6,6 +6,7 @@ module Search exposing
|
|||
, SearchResult
|
||||
, Sort(..)
|
||||
, channelDetailsFromId
|
||||
, channels
|
||||
, decodeResult
|
||||
, fromSortId
|
||||
, init
|
||||
|
@ -463,6 +464,20 @@ view path title model viewSuccess outMsg =
|
|||
[ form [ onSubmit (outMsg QueryInputSubmit) ]
|
||||
[ p
|
||||
[]
|
||||
([]
|
||||
|> List.append
|
||||
(if List.member model.channel channels then
|
||||
[]
|
||||
|
||||
else
|
||||
[ p [ class "alert alert-error" ]
|
||||
[ h4 [] [ text "Wrong channel selected!" ]
|
||||
, text <| "Please select one of the channels above!"
|
||||
]
|
||||
]
|
||||
)
|
||||
|> List.append
|
||||
[ p []
|
||||
[ strong []
|
||||
[ text "Channel: " ]
|
||||
, div
|
||||
|
@ -488,6 +503,8 @@ view path title model viewSuccess outMsg =
|
|||
channels
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
, p
|
||||
[ class "input-append"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue