forked from openlp/openlp
Converted the impromptu page to a dialog for better usability and more translation flexibility.
This commit is contained in:
parent
de56462c8f
commit
09d63871d8
@ -33,11 +33,16 @@
|
||||
<script type="text/javascript" src="/files/jquery.js"></script>
|
||||
<script type="text/javascript" src="/files/openlp.js"></script>
|
||||
<script type="text/javascript" src="/files/jquery.mobile.js"></script>
|
||||
<script type="text/javascript">
|
||||
translationStrings = {
|
||||
"go_live": "${go_live}",
|
||||
"add_to_service": "${add_to_service}",
|
||||
"no_results": "${no_results}",
|
||||
"back": "${back}"
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input type="hidden" id="go-live" value="${go_live}" />
|
||||
<input type="hidden" id="add-to-service" value="${add_to_service}" />
|
||||
<input type="hidden" id="no-results" value="${no_results}" />
|
||||
<div data-role="page" id="home">
|
||||
<div data-role="header">
|
||||
<h1>${app_title}</h1>
|
||||
@ -116,5 +121,15 @@
|
||||
<ul data-role="listview" data-inset="true">
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="page" id="options">
|
||||
<div data-role="header" data-position="inline" data-theme="b">
|
||||
<h1>${options}</h1>
|
||||
</div>
|
||||
<div data-role="content">
|
||||
<input type="hidden" id="selected-item" value="" />
|
||||
<a href="#" id="go-live" data-role="button">${go_live}</a>
|
||||
<a href="#" id="add-to-service" data-role="button">${add_to_service}</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -215,16 +215,12 @@ window.OpenLP = {
|
||||
var ul = $("#search > div[data-role=content] > ul[data-role=listview]");
|
||||
ul.html("");
|
||||
if (data.results.items.length == 0) {
|
||||
var li = $("<li data-icon=\"false\">").text($("#no-results").val());
|
||||
var li = $("<li data-icon=\"false\">").text(translationStrings["no_results"]);
|
||||
ul.append(li);
|
||||
}
|
||||
else {
|
||||
$.each(data.results.items, function (idx, value) {
|
||||
var item = $("<li>").text(value[1]);
|
||||
var golive = $("<a href=\"#\">").attr("value", value[0]).click(OpenLP.goLive).text($("#go-live").val());
|
||||
var additem = $("<a href=\"#\">").attr("value", value[0]).click(OpenLP.addToService).text($("#add-to-service").val());
|
||||
item.append($("<ul>").append($("<li>").append(golive)).append($("<li>").append(additem)));
|
||||
ul.append(item);
|
||||
ul.append($("<li>").append($("<a>").attr("href", "#options").attr("data-rel", "dialog").attr("data-transition", "pop").attr("value", value[0]).click(OpenLP.showOptions).text(value[1])));
|
||||
});
|
||||
}
|
||||
ul.listview("refresh");
|
||||
@ -232,20 +228,24 @@ window.OpenLP = {
|
||||
);
|
||||
return false;
|
||||
},
|
||||
showOptions: function (event) {
|
||||
var element = OpenLP.getElement(event);
|
||||
console.log(element);
|
||||
$("#selected-item").val(element.attr("value"));
|
||||
},
|
||||
goLive: function (event) {
|
||||
var item = OpenLP.getElement(event);
|
||||
var id = item.attr("value");
|
||||
var id = $("#selected-item").val();
|
||||
var text = JSON.stringify({"request": {"id": id}});
|
||||
$.getJSON(
|
||||
"/api/" + $("#search-plugin").val() + "/live",
|
||||
{"data": text})
|
||||
$.mobile.changePage("slide-controller");
|
||||
{"data": text}
|
||||
);
|
||||
$.mobile.changePage("#slide-controller");
|
||||
return false;
|
||||
},
|
||||
addToService: function (event) {
|
||||
var item = OpenLP.getElement(event);
|
||||
var id = item.attr("value");
|
||||
var text = JSON.stringify({"request": {"id": id}});
|
||||
var id = $("#selected-item").val();
|
||||
var text = JSON.stringify({"request": {"id": parseInt(id, 10)}});
|
||||
$.getJSON(
|
||||
"/api/" + $("#search-plugin").val() + "/add",
|
||||
{"data": text},
|
||||
@ -253,6 +253,7 @@ window.OpenLP = {
|
||||
history.back();
|
||||
}
|
||||
);
|
||||
$("#options").dialog("close");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -274,6 +275,8 @@ $("#controller-unblank").live("click", OpenLP.unblankDisplay);
|
||||
$("#alert-submit").live("click", OpenLP.showAlert);
|
||||
// Search
|
||||
$("#search-submit").live("click", OpenLP.search);
|
||||
$("#go-live").live("click", OpenLP.goLive);
|
||||
$("#add-to-service").live("click", OpenLP.addToService);
|
||||
// Poll the server twice a second to get any updates.
|
||||
OpenLP.getSearchablePlugins();
|
||||
$.ajaxSetup({ cache: false });
|
||||
|
@ -302,7 +302,8 @@ class HttpConnection(object):
|
||||
'show_alert': translate('RemotePlugin.Mobile', 'Show Alert'),
|
||||
'go_live': translate('RemotePlugin.Mobile', 'Go Live'),
|
||||
'add_to_service': translate('RemotePlugin.Mobile', 'Add To Service'),
|
||||
'no_results': translate('RemotePlugin.Mobile', 'No Results')
|
||||
'no_results': translate('RemotePlugin.Mobile', 'No Results'),
|
||||
'options': translate('RemotePlugin.Mobile', 'Options')
|
||||
}
|
||||
|
||||
def ready_read(self):
|
||||
|
Loading…
Reference in New Issue
Block a user