Fix #85 : Add a link to column headings for scrolling to top. (#88)

gg @nicosomb
This commit is contained in:
Nicolas Perriault 2017-04-28 14:06:00 +02:00 committed by GitHub
parent cd50e6a59a
commit 56932df177
3 changed files with 27 additions and 15 deletions

View File

@ -47,6 +47,15 @@ body {
max-height: calc(100vh - 60px);
}
.panel > a {
text-decoration: none;
color: #c8c8c8;
}
.panel > a:hover {
text-decoration: none;
}
.status, .follow-profile, .current-user {
min-height: 50px;
clear: both;

View File

@ -11,6 +11,7 @@ import Mastodon.Model
import Mastodon.WebSocket
import Ports
import Task
import Dom.Scroll
type alias Flags =
@ -62,6 +63,7 @@ type Msg
= AddFavorite Int
| ClearOpenedAccount
| CloseThread
| DomResult (Result Dom.Error ())
| DraftEvent DraftMsg
| LoadAccount Int
| MastodonEvent MastodonMsg
@ -77,6 +79,7 @@ type Msg
| Unreblog Int
| ViewerEvent ViewerMsg
| WebSocketEvent WebSocketMsg
| ScrollColumn String
type alias Draft =
@ -660,6 +663,9 @@ update msg model =
NoOp ->
model ! []
DomResult result ->
model ! []
MastodonEvent msg ->
let
( newModel, commands ) =
@ -800,6 +806,9 @@ update msg model =
ClearOpenedAccount ->
{ model | currentView = preferredTimeline model } ! []
ScrollColumn context ->
model ! [ Task.attempt DomResult <| Dom.Scroll.toTop context ]
subscriptions : Model -> Sub Msg
subscriptions model =

View File

@ -322,11 +322,10 @@ timelineView : String -> String -> String -> List Mastodon.Model.Status -> Html
timelineView label iconName context statuses =
div [ class "col-md-3" ]
[ div [ class "panel panel-default" ]
[ div [ class "panel-heading" ]
[ icon iconName
, text label
]
, ul [ class "list-group timeline" ] <|
[ a
[ href "", onClickWithPreventAndStop <| ScrollColumn context ]
[ div [ class "panel-heading" ] [ icon iconName, text label ] ]
, ul [ id context, class "list-group timeline" ] <|
List.map (statusEntryView context "") statuses
]
]
@ -399,11 +398,10 @@ notificationListView : List Mastodon.Model.NotificationAggregate -> Html Msg
notificationListView notifications =
div [ class "col-md-3" ]
[ div [ class "panel panel-default" ]
[ div [ class "panel-heading" ]
[ icon "bell"
, text "Notifications"
]
, ul [ class "list-group timeline" ] <|
[ a
[ href "", onClickWithPreventAndStop <| ScrollColumn "notifications" ]
[ div [ class "panel-heading" ] [ icon "bell", text "Notifications" ] ]
, ul [ id "notifications", class "list-group timeline" ] <|
List.map notificationEntryView notifications
]
]
@ -596,11 +594,7 @@ optionsView model =
, div [ class "panel-body" ]
[ div [ class "checkbox" ]
[ label []
[ input
[ type_ "checkbox"
, onCheck UseGlobalTimeline
]
[]
[ input [ type_ "checkbox", onCheck UseGlobalTimeline ] []
, text " 4th column renders the global timeline"
]
]