2013-01-29 13:47:40 +01:00
|
|
|
angular
|
2013-01-29 18:52:30 +01:00
|
|
|
.module('webui.ctrls.nav', [
|
|
|
|
'webui.services.constants', 'webui.services.modals',
|
2013-02-20 14:12:55 +01:00
|
|
|
'webui.services.rpc', 'webui.services.rpc.helpers',
|
|
|
|
'webui.services.settings'
|
2013-01-29 18:52:30 +01:00
|
|
|
])
|
|
|
|
.controller('NavCtrl', [
|
2013-02-20 14:12:55 +01:00
|
|
|
'$scope', '$name', '$modals', '$rpc', '$rpchelpers', '$settings',
|
|
|
|
function(scope, name, modals, rpc, rhelpers, settings) {
|
2013-01-29 18:52:30 +01:00
|
|
|
|
2013-01-15 09:24:09 +01:00
|
|
|
scope.name = name;
|
2013-01-28 15:18:21 +01:00
|
|
|
|
|
|
|
// initially collapsed in mobile resolution
|
|
|
|
scope.collapsed = true;
|
2013-01-29 18:52:30 +01:00
|
|
|
|
|
|
|
scope.addUris = function() {
|
2013-01-30 07:13:38 +01:00
|
|
|
modals.invoke(
|
|
|
|
'getUris', _.bind(rhelpers.addUris, rhelpers)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.addTorrents = function() {
|
|
|
|
modals.invoke(
|
|
|
|
'getTorrents', _.bind(rhelpers.addTorrents, rhelpers)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.addMetalinks = function() {
|
|
|
|
modals.invoke(
|
|
|
|
'getMetalinks', _.bind(rhelpers.addMetalinks, rhelpers)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.addTorrent = function() {
|
|
|
|
modals.invoke(
|
|
|
|
'getTorrent', _.bind(rhelpers.addTorrents, rhelpers)
|
|
|
|
);
|
2013-01-29 18:52:30 +01:00
|
|
|
};
|
|
|
|
|
2013-02-20 01:13:06 +01:00
|
|
|
scope.changeGSettings = function() {
|
2013-02-20 14:12:55 +01:00
|
|
|
rpc.once('getGlobalOption', [], function(data) {
|
|
|
|
var vals = data[0];
|
|
|
|
for (var i in vals) {
|
|
|
|
if (!(i in settings)) {
|
|
|
|
settings[i] = { name: i, val: vals[i], desc: '' };
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings[i].val = vals[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
modals.invoke('globalSettings', settings, function(settings) {
|
|
|
|
var sets = {};
|
|
|
|
for (var i in settings) { sets[i] = settings[i].val };
|
|
|
|
|
|
|
|
rpc.once('changeGlobalOption', [sets]);
|
|
|
|
});
|
2013-02-20 01:13:06 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2013-01-15 09:24:09 +01:00
|
|
|
}]);
|