0

I made a Jira servlet that executes a search in an issue, but I want to be able to add a filter to that search, so I need to be able to get text as a parameter before I execute the search.

Is there a way for me to make it so a dialog window with a text field and an OK button pops up when I press the servlet button, and the request executes after I press the said button, with an empty string or the current string as a parameter?

Actually any way of dynamically setting a parameter before the request executes might help.

4

1 回答 1

3

听起来您想使用 InlineDialog 模式。以Atlassian 的 AUI 沙箱为例。

在最新版本的 JIRA 中,这样的东西应该可以解决问题

按钮 HTML:

<button class="aui-button " href="#" id="popupLink">
    <span class="aui-icon aui-icon-small aui-iconfont-search-small">Search</span> Search on this issue
</button>

行为 JavaScript:

AJS.InlineDialog(AJS.$("#popupLink"), 1,
    function(content, trigger, showPopup) {
        content.css({"padding":"20px"}).html(
            '<h2>Search something</h2>'
            + '<form action="/path/to/your/servlet" method="get">'
            +   '<input name="q" placeholder="Search query..." >'
            +   '<input type="submit" value="Search">'
            + '</form>'
        );
        showPopup();
        return false;
    }
);

这应该会给你一个类似于下图的 InlineDialog:

在此处输入图像描述

此外,通过向data-default-value按钮添加属性,您可以轻松地预填充 InlineDialog 中的搜索字段。

于 2013-11-17T17:13:15.797 回答