|
|
|
|
|
|
|
|
import './polyfills.js'; |
|
|
import './polyfills.js'; |
|
|
|
|
|
|
|
|
import Vue from 'vue'; |
|
|
import Vue from 'vue'; |
|
|
|
|
|
import {htmlEscape} from 'escape-goat'; |
|
|
import 'jquery.are-you-sure'; |
|
|
import 'jquery.are-you-sure'; |
|
|
import './vendor/semanticdropdown.js'; |
|
|
import './vendor/semanticdropdown.js'; |
|
|
import {svg} from './utils.js'; |
|
|
import {svg} from './utils.js'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; |
|
|
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; |
|
|
|
|
|
|
|
|
function htmlEncode(text) { |
|
|
|
|
|
return jQuery('<div />').text(text).html(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let previewFileModes; |
|
|
let previewFileModes; |
|
|
const commentMDEditors = {}; |
|
|
const commentMDEditors = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (input_id) { |
|
|
switch (input_id) { |
|
|
case '#milestone_id': |
|
|
case '#milestone_id': |
|
|
$list.find('.selected').html(`<a class="item" href=${$(this).data('href')}>${ |
|
|
$list.find('.selected').html(`<a class="item" href=${$(this).data('href')}>${ |
|
|
htmlEncode($(this).text())}</a>`); |
|
|
|
|
|
|
|
|
htmlEscape($(this).text())}</a>`); |
|
|
break; |
|
|
break; |
|
|
case '#assignee_id': |
|
|
case '#assignee_id': |
|
|
$list.find('.selected').html(`<a class="item" href=${$(this).data('href')}>` + |
|
|
$list.find('.selected').html(`<a class="item" href=${$(this).data('href')}>` + |
|
|
`<img class="ui avatar image" src=${$(this).data('avatar')}>${ |
|
|
`<img class="ui avatar image" src=${$(this).data('avatar')}>${ |
|
|
htmlEncode($(this).text())}</a>`); |
|
|
|
|
|
|
|
|
htmlEscape($(this).text())}</a>`); |
|
|
} |
|
|
} |
|
|
$(`.ui${select_id}.list .no-select`).addClass('hide'); |
|
|
$(`.ui${select_id}.list .no-select`).addClass('hide'); |
|
|
$(input_id).val($(this).data('id')); |
|
|
$(input_id).val($(this).data('id')); |
|
|
|
|
|
|
|
|
$.each(response.data, (_i, item) => { |
|
|
$.each(response.data, (_i, item) => { |
|
|
let title = item.login; |
|
|
let title = item.login; |
|
|
if (item.full_name && item.full_name.length > 0) { |
|
|
if (item.full_name && item.full_name.length > 0) { |
|
|
title += ` (${htmlEncode(item.full_name)})`; |
|
|
|
|
|
|
|
|
title += ` (${htmlEscape(item.full_name)})`; |
|
|
} |
|
|
} |
|
|
items.push({ |
|
|
items.push({ |
|
|
title, |
|
|
title, |
|
|
|
|
|
|
|
|
// Parse the response from the api to work with our dropdown |
|
|
// Parse the response from the api to work with our dropdown |
|
|
$.each(response.data, (_r, repo) => { |
|
|
$.each(response.data, (_r, repo) => { |
|
|
filteredResponse.results.push({ |
|
|
filteredResponse.results.push({ |
|
|
name: htmlEncode(repo.full_name), |
|
|
|
|
|
|
|
|
name: htmlEscape(repo.full_name), |
|
|
value: repo.id |
|
|
value: repo.id |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
filteredResponse.results.push({ |
|
|
filteredResponse.results.push({ |
|
|
name: `#${issue.number} ${htmlEncode(issue.title) |
|
|
|
|
|
}<div class="text small dont-break-out">${htmlEncode(issue.repository.full_name)}</div>`, |
|
|
|
|
|
|
|
|
name: `#${issue.number} ${htmlEscape(issue.title) |
|
|
|
|
|
}<div class="text small dont-break-out">${htmlEscape(issue.repository.full_name)}</div>`, |
|
|
value: issue.id |
|
|
value: issue.id |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |