Go live/add to service via list

This commit is contained in:
Jonathan Corwin 2011-05-20 23:30:20 +01:00
parent d4e83ae45a
commit bbbf0d3435
3 changed files with 15 additions and 11 deletions

View File

@ -757,7 +757,7 @@ class ServiceManager(QtGui.QWidget):
"""
Called by a signal to select a specific item.
"""
self.setItem(int(message[0]))
self.setItem(int(message))
def setItem(self, index):
"""

View File

@ -109,7 +109,7 @@
<input type="search" name="search-text" id="search-text" value="" />
</div>
<a href="#" id="search-submit" data-role="button">Search</a>
<ul data-role="listview" data-inset="true" data-split-icon="plus">
<ul data-role="listview" data-inset="true">
</div>
</div>
</body>

View File

@ -219,22 +219,23 @@ window.OpenLP = {
}
else {
$.each(data.results.items, function (idx, value) {
var li = $("<li>");
li.append($("<a href=\"#\">").text(value[1]).click(function () {
OpenLP.goLive(value[0]);
}));
li.append($("<a href=\"#\">").click(function () {
OpenLP.addToService(value[0]);
}));
var li = $("<li><ul>").text(value[1]);
li.append($("<ul><li><a id=\"go-live\" href=\"#\">Go Live</a></li>" +
"<li><a id =\"add-service\" href=\"#\">Add To Service</a></li></ul>"));
li.find("a").attr("value", value[0]);
ul.append(li);
});
ul.find("#go-live").click(OpenLP.goLive);
ul.find("#add-service").click(OpenLP.addToService);
}
ul.listview("refresh");
}
);
return false;
},
goLive: function (id) {
goLive: function (event) {
var item = OpenLP.getElement(event);
var id = item.attr("value");
var text = JSON.stringify({"request": {"id": id}});
$.getJSON(
"/api/" + $("#search-plugin").val() + "/live",
@ -242,11 +243,14 @@ window.OpenLP = {
$.mobile.changePage("slide-controller");
return false;
},
addToService: function (id) {
addToService: function (event) {
var item = OpenLP.getElement(event);
var id = item.attr("value");
var text = JSON.stringify({"request": {"id": id}});
$.getJSON(
"/api/" + $("#search-plugin").val() + "/add",
{"data": text})
history.back();
return false;
}
}