philomena/lib/philomena_web/templates/comment/index.html.slime

115 lines
3.5 KiB
Text
Raw Normal View History

2019-12-01 02:06:08 +01:00
h1 Comments
2019-11-12 04:10:41 +01:00
2019-12-01 02:06:08 +01:00
= form_for :comments, Routes.comment_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
.field
2019-12-02 15:37:01 +01:00
= text_input f, :cq, name: :cq, value: @conn.params["cq"], class: "input hform__text", placeholder: "Search comments", autocapitalize: "none"
2019-12-08 15:43:47 +01:00
= submit "Search", class: "hform__button button"
2019-11-12 04:10:41 +01:00
2019-12-01 02:06:08 +01:00
.fieldlabel
' For more information, see the
a href="/pages/search_syntax" search syntax documentation
' . Search results are sorted by creation date.
2019-11-17 22:30:20 +01:00
2019-12-01 02:06:08 +01:00
h2 Search Results
2019-11-17 22:30:20 +01:00
2019-12-01 02:06:08 +01:00
= cond do
- Enum.any?(@comments) ->
- route = fn p -> Routes.comment_path(@conn, :index, p) end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @comments, route: route, params: [cq: @conn.params["cq"]], conn: @conn
2019-11-17 22:30:20 +01:00
2019-12-01 02:06:08 +01:00
= for {body, comment} <- @comments, comment.image.hidden_from_users == false do
= render PhilomenaWeb.CommentView, "_comment_with_image.html", body: body, comment: comment, conn: @conn
2019-11-17 22:30:20 +01:00
.block
2019-12-01 02:06:08 +01:00
.block__header.block__header--light.flex
2019-11-17 22:30:20 +01:00
= pagination
2019-12-01 02:06:08 +01:00
span.block__header__title
= render PhilomenaWeb.PaginationView, "_pagination_info.html", page: @comments, conn: @conn
2019-11-17 22:30:20 +01:00
2019-12-01 02:06:08 +01:00
- assigns[:error] ->
p
' Oops, there was an error evaluating your query:
pre = assigns[:error]
- true ->
p
' No comments found!
2019-11-17 22:30:20 +01:00
2019-12-01 02:06:08 +01:00
h3 Default search
p
' If you do not specify a field to search over, the search engine will
' search for comments with a body that is similar to the query's
em word stems
' . For example, comments containing the words
code winged humanization
' ,
code wings
' , and
code> spread wings
' would all be found by a search for
code wing
' , but
code> sewing
' would not be.
h3 Allowed fields
table.table
thead
tr
th Field Selector
th Type
th Description
th Example
tbody
tr
td
code author
td Literal
td Matches the author of this comment. Anonymous authors will never match this term.
td
code = link "author:Joey", to: Routes.comment_path(@conn, :index, cq: "author:Joey")
tr
td
code body
td Full Text
td Matches the body of this comment. This is the default field.
td
code = link "body:test", to: Routes.comment_path(@conn, :index, cq: "body:test")
tr
td
code created_at
td Date/Time Range
td Matches the creation time of this comment.
td
code = link "created_at:2015", to: Routes.comment_path(@conn, :index, cq: "created_at:2015")
tr
td
code id
td Numeric Range
td Matches the numeric surrogate key for this comment.
td
code = link "id:1000000", to: Routes.comment_path(@conn, :index, cq: "id:1000000")
tr
td
code image_id
td Literal
td Matches the numeric surrogate key for the image this comment belongs to.
td
code = link "image_id:1000000", to: Routes.comment_path(@conn, :index, cq: "image_id:1000000")
tr
td
code my
td Meta
td
code> my:comments
' matches comments you have posted if you are signed in.
td
code = link "my:comments", to: Routes.comment_path(@conn, :index, cq: "my:comments")
tr
td
code user_id
td Literal
td Matches comments with the specified user_id. Anonymous users will never match this term.
td
2019-12-13 18:14:34 +01:00
code = link "user_id:211190", to: Routes.comment_path(@conn, :index, cq: "user_id:211190")