Class: Components::SearchHelp

Inherits:
Base
  • Object
show all
Defined in:
app/components/search_help.rb

Instance Method Summary collapse

Instance Method Details

#federation ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'app/components/search_help.rb', line 120

def federation
  return unless SiteSettings.federation_enabled?
  tr do
    td do
      code { "@[email protected]" }
    end
    td { t("components.search_help.federation") }
  end
end

#filenames ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'app/components/search_help.rb', line 77

def filenames
  tr do
    td do
      code { "filename = cat.stl" }
      br
      code { "filename ~ cat" }
    end
    td { t("components.search_help.filename") }
  end
end

#help_table ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/components/search_help.rb', line 30

def help_table
  table class: "table table-striped" do
    tr do
      td { code { "cat hat" } }
      td { t("components.search_help.simple") }
    end
    tr do
      td { code { "cat or hat" } }
      td { t("components.search_help.boolean") }
    end
    negation
    tr do
      td { code { '"cat hat"' } }
      td { t("components.search_help.quotes") }
    end
    tr do
      td { code { "(cat or hat) and not bat" } }
      td { t("components.search_help.parentheses") }
    end
    tr do
      td { code { "tag = cat" } }
      td { t("components.search_help.tag") }
    end
    tr do
      td { code { "!tag = cat" } }
      td { t("components.search_help.without_tag") }
    end
    specific_fields
    tr do
      td { code { "not set? tag" } }
      td { t("components.search_help.unset") }
    end
    path
    filenames
    federation
  end
end


18
19
20
21
22
23
24
25
26
27
28
# File 'app/components/search_help.rb', line 18

def modal
  Modal(id: "search-help", title: t("components.search_help.title")) do
    p do
      t("components.search_help.intro")
    end
    help_table
    p do
      t("components.search_help.more_details_html")
    end
  end
end

#negation ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
# File 'app/components/search_help.rb', line 107

def negation
  tr do
    td do
      code { "cat -hat" }
      br
      code { "cat !hat" }
      br
      code { "cat not hat" }
    end
    td { t("components.search_help.negation") }
  end
end

#path ⇒ Object



68
69
70
71
72
73
74
75
# File 'app/components/search_help.rb', line 68

def path
  tr do
    td do
      code { "path ~ tools" }
    end
    td { t("components.search_help.path") }
  end
end

#specific_fields ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'app/components/search_help.rb', line 88

def specific_fields
  tr do
    td do
      code { "creator ~ cat" }
      br
      code { "collection ~ cat" }
      br
      code { "caption ~ cat" }
      br
      code { "description ~ cat" }
      if SiteSettings.show_libraries?
        br
        code { "library = #{Library.first.name}" }
      end
    end
    td { t("components.search_help.specific_fields") }
  end
end

#view_template ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/components/search_help.rb', line 2

def view_template
  div class: "text-start" do
    a class: "link-underline link-underline-opacity-0",
      aria: {
        haspopup: true
      },
      data: {
        bs_toggle: "modal",
        bs_target: "#search-help"
      }, tabindex: 0, href: "#" do
      yield
    end
    modal
  end
end