Fix #133: Show status visibility. (#135)

Also revisits the way we expose visibility choices (and their hierarchy) in the draft form.
This commit is contained in:
Nicolas Perriault 2017-05-05 19:18:20 +02:00 committed by GitHub
parent 5cbd759ae3
commit 072991520c
3 changed files with 30 additions and 14 deletions

View File

@ -348,6 +348,15 @@ body {
color: #555; color: #555;
} }
.btn-vis {
overflow: hidden;
text-overflow: ellipsis;
}
.btn-vis > span {
margin-left: 6px;
}
/* Status text content rules */ /* Status text content rules */
.attachment, .hashtag, .ellipsis { .attachment, .hashtag, .ellipsis {

View File

@ -20,12 +20,12 @@ type alias CurrentUser =
Account Account
visibilities : List ( String, String, String ) visibilities : List ( String, String, String, String )
visibilities = visibilities =
[ ( "unlisted", "do not show in public timelines", "eye-close" ) [ ( "direct", "Mentioned", "Visible to mentioned users only", "envelope" )
, ( "private", "post to followers only", "user" ) , ( "private", "Followers", "Visible to followers only", "lock" )
, ( "direct", "post to mentioned users only", "lock" ) , ( "unlisted", "Unlisted", "Do not show in public timelines", "eye-close" )
, ( "public", "post to public timelines", "globe" ) , ( "public", "Public", "Visible in public timelines", "globe" )
] ]
@ -113,20 +113,20 @@ visibilitySelector { visibility } =
let let
btnClass v = btnClass v =
if v == visibility then if v == visibility then
"btn btn-sm btn-primary active" "btn btn-sm btn-vis btn-primary active"
else else
"btn btn-sm btn-default" "btn btn-sm btn-vis btn-default"
in in
visibilities visibilities
|> List.map |> List.map
(\( v, t, i ) -> (\( v, d, t, i ) ->
a a
[ href "" [ href ""
, class <| btnClass v , class <| btnClass v
, onClickWithPreventAndStop <| DraftEvent (UpdateVisibility v) , onClickWithPreventAndStop <| DraftEvent (UpdateVisibility v)
, title t , title t
] ]
[ Common.icon i, text " ", text v ] [ Common.icon i, span [] [ text d ] ]
) )
|> Common.justifiedButtonGroup "draft-visibilities" |> Common.justifiedButtonGroup "draft-visibilities"

View File

@ -123,11 +123,18 @@ statusActionsView status currentUser =
DraftEvent (UpdateReplyTo status) DraftEvent (UpdateReplyTo status)
] ]
[ Common.icon "share-alt" ] [ Common.icon "share-alt" ]
, a , if status.visibility == "private" then
[ class reblogClasses span [ class <| reblogClasses ++ " disabled" ]
, onClickWithPreventAndStop reblogEvent [ span [ title "Private" ] [ Common.icon "lock" ] ]
] else if status.visibility == "direct" then
[ Common.icon "fire", text (toString sourceStatus.reblogs_count) ] span [ class <| reblogClasses ++ " disabled" ]
[ span [ title "Direct" ] [ Common.icon "envelope" ] ]
else
a
[ class reblogClasses
, onClickWithPreventAndStop reblogEvent
]
[ Common.icon "fire", text (toString sourceStatus.reblogs_count) ]
, a , a
[ class favClasses [ class favClasses
, onClickWithPreventAndStop favEvent , onClickWithPreventAndStop favEvent