6d39ae8d97ee417271b36d4d6ca36576fce09736
[moodle.git] / search / templates / result.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16 }}
17 {{!
18     @template core_search/result
20     Template which shows a search result.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * courseurl
30     * coursefullname
31     * title
32     * docurl
33     * contexturl
35     Optional context variables for this template:
36     * content
37     * userurl
38     * userfullname
39     * description1
40     * description2
42     Example context (json):
43     {
44         "courseurl": "https://example.com/course/view.php?id=2",
45         "coursefullname": "Example course",
46         "title": "Example title",
47         "docurl": "https://example.com/mod/example/view.php?id=4",
48         "content": "I am content",
49         "contexturl": "https://example.com/mod/example/view.php?id=2"
50         "userurl": "https://example.com/user/profile.php?id=3",
51         "userfullname": "Example User Full Name",
52     }
53 }}
54 <div class="result">
55     <h4 class="result-title">
56         <a href="{{{docurl}}}">{{title}}</a>
57     </h4>
58     {{#content}}
59         <div class="result-content">{{{content}}}</div>
60     {{/content}}
61     {{#description1}}
62         <div class="result-content">{{{description1}}}</div>
63     {{/description1}}
64     {{#description2}}
65         <div class="result-content">{{{description2}}}</div>
66     {{/description2}}
67     <div class="result-context-info">
68         <a href="{{{contexturl}}}">{{#str}}viewresultincontext, search{{/str}}</a> -
69         <a href="{{{courseurl}}}">{{#str}}incourse, search, {{coursefullname}}{{/str}}</a>
70         {{#userfullname}}
71             - <a href="{{{userurl}}}">{{#str}}byname, moodle, {{userfullname}}{{/str}}</a>
72         {{/userfullname}}
73     </div>
74 </div>