1
0
Fork 0

Added link to external profile in account view (#125)

* Added link to external profile in account view

* Used helpers

* Added boolean parameter for accountLink / accountAvatarLink
This commit is contained in:
Nicolas Lœuillet 2017-05-03 15:08:10 +02:00 committed by GitHub
parent 3b67a20909
commit ab5e7bfbaf
5 changed files with 45 additions and 25 deletions

View File

@ -77,7 +77,7 @@ followButton currentUser relationship account =
followView : CurrentUser -> Maybe Relationship -> Account -> Html Msg followView : CurrentUser -> Maybe Relationship -> Account -> Html Msg
followView currentUser relationship account = followView currentUser relationship account =
div [ class "follow-entry" ] div [ class "follow-entry" ]
[ Common.accountAvatarLink account [ Common.accountAvatarLink False account
, div [ class "userinfo" ] , div [ class "userinfo" ]
[ strong [] [ strong []
[ a [ a
@ -152,9 +152,9 @@ accountView currentUser account relationship panelContent =
] ]
[ div [ class "opacity-layer" ] [ div [ class "opacity-layer" ]
[ followButton currentUser relationship account [ followButton currentUser relationship account
, img [ src account.avatar ] [] , Common.accountAvatarLink True account
, span [ class "account-display-name" ] [ text account.display_name ] , span [ class "account-display-name" ] [ text account.display_name ]
, span [ class "account-username" ] [ text ("@" ++ account.username) ] , span [ class "account-username" ] [ Common.accountLink True account ]
, span [ class "account-note" ] (formatContent account.note []) , span [ class "account-note" ] (formatContent account.note [])
] ]
] ]

View File

@ -14,23 +14,43 @@ import Types exposing (..)
import View.Events exposing (..) import View.Events exposing (..)
accountLink : Account -> Html Msg accountLink : Bool -> Account -> Html Msg
accountLink account = accountLink external account =
a let
[ href account.url accountHref =
, onClickWithPreventAndStop (LoadAccount account.id) if external then
] target "_blank"
[ text <| "@" ++ account.username ] else
onClickWithPreventAndStop (LoadAccount account.id)
in
a
[ href account.url
, accountHref
]
[ text <| "@" ++ account.username ]
accountAvatarLink : Account -> Html Msg accountAvatarLink : Bool -> Account -> Html Msg
accountAvatarLink account = accountAvatarLink external account =
a let
[ href account.url accountHref =
, onClickWithPreventAndStop (LoadAccount account.id) if external then
, title <| "@" ++ account.username target "_blank"
] else
[ img [ class "avatar", src account.avatar ] [] ] onClickWithPreventAndStop (LoadAccount account.id)
avatarClass =
if external then
""
else
"avatar"
in
a
[ href account.url
, accountHref
, title <| "@" ++ account.username
]
[ img [ class avatarClass, src account.avatar ] [] ]
closeablePanelheading : String -> String -> String -> Msg -> Html Msg closeablePanelheading : String -> String -> String -> Msg -> Html Msg

View File

@ -78,8 +78,8 @@ currentUserView currentUser =
case currentUser of case currentUser of
Just currentUser -> Just currentUser ->
div [ class "current-user" ] div [ class "current-user" ]
[ Common.accountAvatarLink currentUser [ Common.accountAvatarLink False currentUser
, div [ class "username" ] [ Common.accountLink currentUser ] , div [ class "username" ] [ Common.accountLink False currentUser ]
, p [ class "status-text" ] <| formatContent currentUser.note [] , p [ class "status-text" ] <| formatContent currentUser.note []
] ]

View File

@ -46,11 +46,11 @@ filterNotifications filter notifications =
notificationHeading : List Account -> String -> String -> Html Msg notificationHeading : List Account -> String -> String -> Html Msg
notificationHeading accounts str iconType = notificationHeading accounts str iconType =
div [ class "status-info" ] div [ class "status-info" ]
[ div [ class "avatars" ] <| List.map Common.accountAvatarLink accounts [ div [ class "avatars" ] <| List.map (Common.accountAvatarLink False) accounts
, p [ class "status-info-text" ] <| , p [ class "status-info-text" ] <|
List.intersperse (text " ") List.intersperse (text " ")
[ Common.icon iconType [ Common.icon iconType
, span [] <| List.intersperse (text ", ") (List.map Common.accountLink accounts) , span [] <| List.intersperse (text ", ") (List.map (Common.accountLink False) accounts)
, text str , text str
] ]
] ]
@ -78,8 +78,8 @@ notificationFollowView currentUser { accounts } =
let let
profileView account = profileView account =
div [ class "status follow-profile" ] div [ class "status follow-profile" ]
[ Common.accountAvatarLink account [ Common.accountAvatarLink False account
, div [ class "username" ] [ Common.accountLink account ] , div [ class "username" ] [ Common.accountLink False account ]
, p , p
[ class "status-text" [ class "status-text"
, onClick <| LoadAccount account.id , onClick <| LoadAccount account.id

View File

@ -217,7 +217,7 @@ statusView context ({ account, content, media_attachments, reblog, mentions } as
Nothing -> Nothing ->
div [ class "status" ] div [ class "status" ]
[ Common.accountAvatarLink account [ Common.accountAvatarLink False account
, div [ class "username" ] , div [ class "username" ]
[ a accountLinkAttributes [ a accountLinkAttributes
[ text account.display_name [ text account.display_name