Merge branch 'MDL-53515-master' of git://github.com/merrill-oakland/moodle
[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
41     * filename
42     * multiplefiles
43     * filenames
45     Example context (json):
46     {
47         "courseurl": "https://example.com/course/view.php?id=2",
48         "coursefullname": "Example course",
49         "title": "Example title",
50         "docurl": "https://example.com/mod/example/view.php?id=4",
51         "content": "I am content",
52         "contexturl": "https://example.com/mod/example/view.php?id=2"
53         "userurl": "https://example.com/user/profile.php?id=3",
54         "userfullname": "Example User Full Name",
55     }
56 }}
57 <div class="result">
58     <h4 class="result-title">
59         <a href="{{{docurl}}}">{{{title}}}</a>
60     </h4>
61     {{#content}}
62         <div class="result-content">{{{content}}}</div>
63     {{/content}}
64     {{#description1}}
65         <div class="result-content">{{{description1}}}</div>
66     {{/description1}}
67     {{#description2}}
68         <div class="result-content">{{{description2}}}</div>
69     {{/description2}}
70     {{#filename}}
71         <div class="result-content-filename">
72             {{#str}}matchingfile, search, {{filename}}{{/str}}
73         </div>
74     {{/filename}}
75     {{#multiplefiles}}
76         <div class="result-content-filenames">
77             {{#str}}matchingfiles, search{{/str}}<br>
78             <ul class="list">
79             {{#filenames}}
80                 <li><span class="filename">{{.}}</span></li>
81             {{/filenames}}
82             </ul>
83         </div>
84     {{/multiplefiles}}
85     <div class="result-context-info">
86         <a href="{{{contexturl}}}">{{#str}}viewresultincontext, search{{/str}}</a> -
87         <a href="{{{courseurl}}}">{{#str}}incourse, search, {{coursefullname}}{{/str}}</a>
88         {{#userfullname}}
89             - <a href="{{{userurl}}}">{{#str}}byname, moodle, {{userfullname}}{{/str}}</a>
90         {{/userfullname}}
91     </div>
92 </div>