Project

General

Profile

Feature #33425 » 33425.patch

Go MAEDA, 2020-05-11 04:23

View differences:

public/javascripts/application.js
1049 1049
    };
1050 1050

  
1051 1051
    const tribute = new Tribute({
1052
      trigger: '#',
1053
      values: function (text, cb) {
1054
        if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
1055
          $(element).attr('autocomplete', 'off');
1052
      collection: [
1053
        {
1054
          // issues
1055
          trigger: '#',
1056
          values: function (text, cb) {
1057
            if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
1058
              $(element).attr('autocomplete', 'off');
1059
            }
1060
            remoteSearch(issuesUrl + text, function (issues) {
1061
              return cb(issues);
1062
            });
1063
          },
1064
          lookup: 'label',
1065
          fillAttr: 'label',
1066
          requireLeadingSpace: true,
1067
          selectTemplate: function (issue) {
1068
            return '#' + issue.original.id;
1069
          },
1070
          noMatchTemplate: function () {
1071
            return '<span style:"visibility: hidden;"></span>';
1072
          }
1073
        },
1074
        // macros
1075
        {
1076
          trigger: '{{',
1077
          values: [
1078
            {name: 'collapse', value: '{{collapse\nThis is a block of text that is collapsed by default.\n}}'},
1079
            {name: 'child_pages', value: '{{child_pages}}'},
1080
            {name: 'include', value: '{{include(WikiPageName)}}'},
1081
            {name: 'thumbnail', value: '{{thumbnail(image.png, size=300, title=Thumbnail)}}'},
1082
            {name: 'issue', value: '{{issue(123, subject=true, project=true)}}'}
1083
          ],
1084
          lookup: 'name',
1085
          fillAttr: 'value',
1086
          requireLeadingSpace: true,
1087
          selectTemplate: function(item) {
1088
            return item.original.value;
1089
          },
1090
          noMatchTemplate: function () {
1091
            return '<span style:"visibility: hidden;"></span>';
1092
          }
1056 1093
        }
1057
        remoteSearch(issuesUrl + text, function (issues) {
1058
          return cb(issues);
1059
        });
1060
      },
1061
      lookup: 'label',
1062
      fillAttr: 'label',
1063
      requireLeadingSpace: true,
1064
      selectTemplate: function (issue) {
1065
        return '#' + issue.original.id;
1066
      },
1067
      noMatchTemplate: function () {
1068
        return '<span style:"visibility: hidden;"></span>';
1069
      }
1094
      ]
1070 1095
    });
1071 1096

  
1072 1097
    tribute.attach(element);
(2-2/5)