MDL-64506 templates: BS2 pull-x -> BS4 float-x
[moodle.git] / mod / book / tool / print / templates / print_book.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 comments.
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 booktool_print/print_book
20     Print book page.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     * printdialoglink string The URL pointing to the print book chapter popup window.
29     * booktitle string The HTML of the book title.
30     * bookintro string The book description.
31     * sitelink string The HTML link pointing to the site's dashboard.
32     * coursename string The name of the course.
33     * modulename string The name of the module.
34     * username string The user name.
35     * printdate string The print date.
36     * chaptertitle string The title of the chapter.
37     * toc object The HTML of the table of contents.
38     * chapters array The array of book chapters, their content and visibility information.
40     Example context (json):
41     {
42         "printdialoglink": "<a>Print book</a>",
43         "booktitle": "<h2>Book title</h2>",
44         "bookintro": "Book description",
45         "sitelink" : "<a>Site title</a>",
46         "coursename" : "Course name",
47         "modulename" : "Module name",
48         "username" : "User name",
49         "printdate" : "Tuesday, 22 January 2019, 10:17 AM",
50         "chaptertitle": "Chapter title",
51         "toc" : "<div>Table of contents</div>",
52         "chapters": [
53             {
54                 "content": "<div>Chapter1 content</div>",
55                 "visible": "true"
56             },
57             {
58                 "content": "<div>Chapter2 content</div>",
59                 "visible": "false"
60             }
61         ]
62     }
63 }}
64 <div class="book p-4">
65     <div class="text-right">{{{ printdialoglink }}}</div>
66     <div class="text-center p-b-1 book_title">{{{ booktitle }}}</div>
67     <div class="book_info w-100 p-t-3 d-inline-block">
68         <div class="w-50 float-left">
69             <table>
70                 <tr>
71                     <td>
72                         {{# str }} site {{/ str }}:
73                     </td>
74                     <td class="p-l-1">
75                         {{{ sitelink }}}
76                     </td>
77                 </tr>
78                 <tr>
79                     <td>
80                         {{# str }} course {{/ str }}:
81                     </td>
82                     <td class="p-l-1">
83                         {{{ coursename }}}
84                     </td>
85                 </tr>
86                 <tr>
87                     <td>
88                         {{# str }} modulename, mod_book {{/ str }}:
89                     </td>
90                     <td class="p-l-1">
91                         {{{ modulename }}}
92                     </td>
93                 </tr>
94             </table>
95         </div>
96         <div class="w-50 float-left">
97             <table class="float-right">
98                 <tr>
99                     <td>
100                         {{# str }} printedby, booktool_print {{/ str }}:
101                     </td>
102                     <td class="p-l-1">
103                         {{{ username }}}
104                     </td>
105                 </tr>
106                 <tr>
107                     <td>
108                         {{# str }} printdate, booktool_print {{/ str }}:
109                     </td>
110                     <td class="p-l-1">
111                         {{{ printdate }}}
112                     </td>
113                 </tr>
114             </table>
115         </div>
116     </div>
117     {{#bookintro}}
118     <div class="w-100 book_description">
119         <div class="p-b-2 p-t-2">
120             <h2 class="text-center p-b-2">{{#str}} description {{/str}}</h2>
121              <p class="book_summary">{{{ bookintro }}}</p>
122         </div>
123     </div>
124     {{/bookintro}}
125     <div class="w-100">
126         <div class="p-b-2 p-t-2">{{{ toc }}}</div>
127     </div>
128     <div class="w-100">
129      {{#chapters}}
130         {{#visible }}
131             <div class="p-b-2">
132             {{{ content }}}
133             </div>
134         {{/visible}}
135     {{/chapters}}
136     </div>
137 </div>