[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/tag/templates/ -> taglist.mustache (source)

   1  {{!
   2      This file is part of Moodle - http://moodle.org/
   3  
   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.
   8  
   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.
  13  
  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_tag/taglist
  19  
  20      Displays a tag list, usually the list of tags some entry is tagged with
  21  
  22      Classes required for JS:
  23      * hideoverlimit
  24      * tagmorelink
  25      * taglesslink
  26  
  27      Data attributes required for JS:
  28      * none
  29  
  30      Context variables required for this template:
  31      * none
  32  
  33      Example context (json):
  34      {
  35      "tags": [
  36          {"id":1,"name":"Cats","viewurl":"http://moodle.org/tag/index.php?tag=Cats","isstandard":"1","flag":0},
  37          {"id":1,"name":"Dogs","viewurl":"http://moodle.org/tag/index.php?tag=Dogs","isstandard":"0","flag":1},
  38          {"id":1,"name":"Mice","viewurl":"http://moodle.org/tag/index.php?tag=Mice","isstandard":"0","flag":0}
  39      ],
  40          "label": "Tags",
  41          "tagscount": 3,
  42          "overflow": 1,
  43          "classes": "someadditionalclass"
  44      }
  45  
  46  }}
  47  {{#tagscount}}
  48      <div class="tag_list hideoverlimit {{classes}}">
  49      {{#label}}
  50      <b>{{label}}:</b>
  51      {{/label}}
  52      <ul class="inline-list">
  53          {{#tags}}
  54              <li {{#overlimit}}class="overlimit"{{/overlimit}}>
  55                  <a href="{{viewurl}}" class="label label-info {{#isstandard}}standardtag{{/isstandard}}" >
  56                  {{#flag}}
  57                      <span class="flagged-tag">{{name}}</span></a>
  58                  {{/flag}}
  59                  {{^flag}}
  60                      {{name}}</a>
  61                  {{/flag}}
  62              </li>
  63          {{/tags}}
  64          {{#overflow}}
  65              <li class="visibleifjs">
  66                  <a href="#" class="tagmorelink">{{#str}}moretags, core_tag{{/str}}</a>
  67              </li>
  68              <li class="visibleifjs">
  69                  <a href="#" class="taglesslink">{{#str}}lesstags, core_tag{{/str}}</a>
  70              </li>
  71          {{/overflow}}
  72      </ul>
  73      </div>
  74  {{/tagscount}}
  75  
  76  {{#js}}
  77  require(['jquery'], function($) {
  78      $('.tag_list .tagmorelink').click(function() {
  79          $(this).closest('.tag_list').removeClass('hideoverlimit');
  80      });
  81      $('.tag_list .taglesslink').click(function() {
  82          $(this).closest('.tag_list').addClass('hideoverlimit');
  83      });
  84  });
  85  {{/js}}


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1