Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixos-search
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ce9900d58098
Choose a base ref
...
head repository: NixOS/nixos-search
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5edd944dc418
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jan 25, 2021

  1. Unverified

    No user is associated with the committer email.
    Copy the full SHA
    5edd944 View commit details
Showing with 24 additions and 8 deletions.
  1. +23 −7 src/Search.elm
  2. +1 −1 src/index.less
30 changes: 23 additions & 7 deletions src/Search.elm
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ type alias Model a b =
, size : Int
, buckets : Maybe String
, sort : Sort
, showSort : Bool
, showNixOSDetails : Bool
}

@@ -174,6 +175,7 @@ init args maybeModel =
|> Maybe.withDefault ""
|> fromSortId
|> Maybe.withDefault Relevance
, showSort = False
, showNixOSDetails = False
}
|> ensureLoading
@@ -213,6 +215,7 @@ elementId str =
type Msg a b
= NoOp
| SortChange Sort
| ToggleSort
| BucketsChange String
| ChannelChange String
| QueryInput String
@@ -258,6 +261,13 @@ update toRoute navKey msg model =
|> ensureLoading
|> pushUrl toRoute navKey

ToggleSort ->
( { model
| showSort = not model.showSort
}
, Cmd.none
)

BucketsChange buckets ->
{ model
| buckets =
@@ -781,7 +791,7 @@ viewResults model result viewSuccess toRoute outMsg categoryName =
String.fromInt result.hits.total.value
in
[ div []
[ Html.map outMsg <| viewSortSelection toRoute model
[ Html.map outMsg <| viewSortSelection model
, div []
(List.append
[ text "Showing results "
@@ -812,20 +822,26 @@ viewResults model result viewSuccess toRoute outMsg categoryName =


viewSortSelection :
Route.SearchRoute
-> Model a b
Model a b
-> Html (Msg a b)
viewSortSelection toRoute model =
div [ class "btn-group dropdown pull-right" ]
viewSortSelection model =
div
[ class "btn-group dropdown pull-right"
, classList
[ ( "open", model.showSort )
]
]
[ button
[ class "btn"
, attribute "data-toggle" "dropdown"
, onClick ToggleSort
]
[ span [] [ text <| "Sort: " ]
, span [ class "selected" ] [ text <| toSortTitle model.sort ]
, span [ class "caret" ] []
]
, ul [ class "dropdown-menu pull-right" ]
, ul
[ class "pull-right dropdown-menu"
]
(List.append
[ li [ class " header" ] [ text "Sort options" ]
, li [ class "divider" ] []
2 changes: 1 addition & 1 deletion src/index.less
Original file line number Diff line number Diff line change
@@ -292,7 +292,7 @@ header .navbar.navbar-static-top {

& > ul > li.header {
font-weight: bold;
padding: 3px 10px;
padding: 3px 10px 0 10px;
}

& > ul > li.header:before,