diff options
author | Yorhel <git@yorhel.nl> | 2020-05-28 16:39:38 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-05-28 16:39:40 +0200 |
commit | e36bfde55478f4ae5d83ee73845a348a92386bca (patch) | |
tree | 932eea74bd2b29dbac5065c810691c731ef30e63 /elm | |
parent | 002f165ed4823b7563e7443526d907d27b5b431b (diff) |
Drop ReleaseExtLinks.elm in favor of pure CSS solution
It's the only Elm module used on VN pages for not-logged-in visitors, so
doing this in CSS makes it possible to not load an Elm bundle on those
pages (when I get to splitting up the JS files).
This solution also simplifies code reuse with the producer pages, but a
v2rw migration of that page would have taken care of that as well.
Diffstat (limited to 'elm')
-rw-r--r-- | elm/Lib/DropDown.elm | 2 | ||||
-rw-r--r-- | elm/ReleaseExtLinks.elm | 31 |
2 files changed, 1 insertions, 32 deletions
diff --git a/elm/Lib/DropDown.elm b/elm/Lib/DropDown.elm index 95063e3b..286a61cb 100644 --- a/elm/Lib/DropDown.elm +++ b/elm/Lib/DropDown.elm @@ -12,7 +12,7 @@ import Lib.Html exposing (..) type alias Config msg = { id : String , opened : Bool - , hover : Bool -- if true, the dropdown opens on mouse-over rather than click + , hover : Bool -- if true, the dropdown opens on mouse-over rather than click (not currently used) , toggle : Bool -> msg } diff --git a/elm/ReleaseExtLinks.elm b/elm/ReleaseExtLinks.elm deleted file mode 100644 index 754b9d69..00000000 --- a/elm/ReleaseExtLinks.elm +++ /dev/null @@ -1,31 +0,0 @@ --- Helper for VNWeb::Releases::Lib::release_extlinks_() -module ReleaseExtLinks exposing (main) - -import Html exposing (..) -import Html.Attributes exposing (..) -import Browser -import Lib.Api as Api -import Lib.DropDown as DD - -type alias Links = List (String, String, Maybe String) -type alias Model = { lnk : Links, dd : DD.Config Bool } - -main : Program (String,Links) Model Bool -main = Browser.element - { init = \(id,l) -> - let dd = DD.init ("relextlink_"++id) identity - in ({ lnk = l, dd = { dd | hover = True } }, Cmd.none) - , view = view - , update = \b m -> ({ m | dd = DD.toggle m.dd b }, Cmd.none) - , subscriptions = \model -> DD.sub model.dd - } - -view : Model -> Html Bool -view model = - div [ class "elm_dd_noarrow", class "elm_dd_left", class "elm_dd_relextlink" ] - [ DD.view model.dd Api.Normal - (span [ class "fake_link" ] [ text <| String.fromInt (List.length model.lnk), abbr [ class "icons external", title "External link" ] [] ]) - (\_ -> [ ul [ class "rllinks_dd" ] <| List.map (\(lbl,url,price) -> - li [] [ a [ href url ] [ Maybe.withDefault (text "") (Maybe.map (\p -> span [] [ text p ]) price), text lbl ] ] - ) model.lnk ]) - ] |