2014-05-27 18:18:57 +00:00
|
|
|
app.controller('CampaignCtrl', function($scope, $modal, CampaignService, GroupService, TemplateService, ngTableParams, $http) {
|
2014-02-20 01:40:23 +00:00
|
|
|
$scope.flashes = []
|
2014-02-18 20:22:16 +00:00
|
|
|
$scope.mainTableParams = new ngTableParams({
|
2014-02-10 15:44:15 +00:00
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
|
|
|
name: 'asc' // initial sorting
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
|
|
|
CampaignService.query(function(campaigns) {
|
|
|
|
$scope.campaigns = campaigns
|
|
|
|
params.total(campaigns.length)
|
|
|
|
$defer.resolve(campaigns.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
2014-02-18 02:46:57 +00:00
|
|
|
|
2014-03-13 02:49:10 +00:00
|
|
|
GroupService.query(function(groups) {
|
|
|
|
$scope.groups = groups;
|
|
|
|
})
|
|
|
|
|
2014-03-28 05:21:42 +00:00
|
|
|
TemplateService.query(function(templates) {
|
|
|
|
$scope.templates = templates;
|
|
|
|
})
|
|
|
|
|
2014-05-27 18:18:57 +00:00
|
|
|
$scope.addGroup = function(group) {
|
|
|
|
if (group.name != "") {
|
2014-02-18 02:46:57 +00:00
|
|
|
$scope.campaign.groups.push({
|
2014-05-27 18:18:57 +00:00
|
|
|
name: group.name
|
2014-02-18 02:46:57 +00:00
|
|
|
});
|
2014-05-27 18:18:57 +00:00
|
|
|
group.name = ""
|
2014-02-18 02:46:57 +00:00
|
|
|
$scope.editGroupTableParams.reload()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.removeGroup = function(group) {
|
|
|
|
$scope.campaign.groups.splice($scope.campaign.groups.indexOf(group), 1);
|
|
|
|
$scope.editGroupTableParams.reload()
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.newCampaign = function() {
|
|
|
|
$scope.campaign = {
|
|
|
|
name: '',
|
|
|
|
groups: []
|
|
|
|
};
|
2014-05-27 18:18:57 +00:00
|
|
|
$scope.editCampaign($scope.campaign)
|
|
|
|
};
|
|
|
|
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.editCampaign = function(campaign) {
|
2014-05-27 18:18:57 +00:00
|
|
|
var modalInstance = $modal.open({
|
|
|
|
templateUrl: '/js/app/partials/modals/campaignModal.html',
|
|
|
|
controller: CampaignModalCtrl,
|
|
|
|
scope: $scope
|
|
|
|
});
|
|
|
|
|
|
|
|
modalInstance.result.then(function(selectedItem) {
|
|
|
|
$scope.selected = selectedItem;
|
|
|
|
}, function() {
|
|
|
|
console.log('closed')
|
|
|
|
});
|
2014-02-18 02:46:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.editGroupTableParams = new ngTableParams({
|
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
|
|
|
name: 'asc' // initial sorting
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
|
|
|
params.total($scope.campaign.groups.length)
|
|
|
|
$defer.resolve($scope.campaign.groups.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.saveCampaign = function(campaign) {
|
2014-02-20 01:40:23 +00:00
|
|
|
$scope.flashes = []
|
2014-03-28 05:21:42 +00:00
|
|
|
$scope.validated = true
|
2014-02-18 02:46:57 +00:00
|
|
|
var newCampaign = new CampaignService(campaign);
|
|
|
|
newCampaign.$save({}, function() {
|
2014-03-28 05:21:42 +00:00
|
|
|
$scope.successFlash("Campaign added successfully")
|
2014-02-18 02:46:57 +00:00
|
|
|
$scope.campaigns.push(newCampaign);
|
|
|
|
$scope.mainTableParams.reload()
|
2014-05-28 23:46:56 +00:00
|
|
|
}, function(response) {
|
2014-02-20 01:40:23 +00:00
|
|
|
$scope.errorFlash(response.data)
|
2014-02-18 02:46:57 +00:00
|
|
|
});
|
2014-02-20 01:40:23 +00:00
|
|
|
$scope.campaign = {
|
|
|
|
groups: [],
|
2014-02-18 02:46:57 +00:00
|
|
|
};
|
|
|
|
$scope.editGroupTableParams.reload()
|
|
|
|
}
|
2014-02-18 20:22:16 +00:00
|
|
|
|
|
|
|
$scope.deleteCampaign = function(campaign) {
|
|
|
|
var deleteCampaign = new CampaignService(campaign);
|
|
|
|
deleteCampaign.$delete({
|
|
|
|
id: deleteCampaign.id
|
|
|
|
}, function() {
|
2014-06-03 18:27:20 +00:00
|
|
|
$scope.successFlash("Campaign deleted successfully")
|
2014-02-18 20:22:16 +00:00
|
|
|
$scope.mainTableParams.reload();
|
|
|
|
});
|
|
|
|
}
|
2014-02-20 01:40:23 +00:00
|
|
|
|
|
|
|
$scope.errorFlash = function(message) {
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "danger",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-exclamation-circle"
|
|
|
|
})
|
2014-02-20 01:40:23 +00:00
|
|
|
}
|
2014-03-28 05:21:42 +00:00
|
|
|
|
|
|
|
$scope.successFlash = function(message) {
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "success",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-check-circle"
|
|
|
|
})
|
2014-03-28 05:21:42 +00:00
|
|
|
}
|
2014-02-08 01:40:16 +00:00
|
|
|
});
|
|
|
|
|
2014-05-28 23:46:56 +00:00
|
|
|
var CampaignModalCtrl = function($scope, $modalInstance) {
|
|
|
|
$scope.cancel = function() {
|
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
};
|
|
|
|
};
|
2014-05-27 18:18:57 +00:00
|
|
|
|
2014-03-13 20:12:03 +00:00
|
|
|
app.controller('CampaignResultsCtrl', function($scope, CampaignService, GroupService, ngTableParams, $http, $window) {
|
2014-05-28 23:46:56 +00:00
|
|
|
id = $window.location.hash.split('/')[2];
|
2014-03-13 20:12:03 +00:00
|
|
|
$scope.flashes = []
|
|
|
|
$scope.mainTableParams = new ngTableParams({
|
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
|
|
|
name: 'asc' // initial sorting
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
2014-05-28 23:46:56 +00:00
|
|
|
CampaignService.get({
|
|
|
|
"id": id
|
|
|
|
}, function(campaign) {
|
2014-03-13 20:12:03 +00:00
|
|
|
$scope.campaign = campaign
|
2014-06-11 23:23:16 +00:00
|
|
|
var result_series = []
|
|
|
|
angular.forEach(campaign.results, function(result, key) {
|
|
|
|
var new_entry = true;
|
|
|
|
for (var i = 0; i < result_series.length; i++) {
|
|
|
|
if (result_series[i].name == result.status) {
|
|
|
|
result_series[i].y++;
|
|
|
|
new_entry = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (new_entry) {
|
|
|
|
result_series.push({
|
|
|
|
name: result.status,
|
|
|
|
y: 1
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$scope.email_chart = {
|
|
|
|
options: {
|
|
|
|
chart: {
|
|
|
|
type: 'pie'
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
formatter: function() {
|
|
|
|
return this.point.name + " : " + this.point.y
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
padding: 10,
|
|
|
|
fontWeight: 'bold'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plotOptions: {
|
|
|
|
pie: {
|
|
|
|
allowPointSelect: true,
|
|
|
|
cursor: 'pointer',
|
|
|
|
dataLabels: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
showInLegend: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: result_series
|
|
|
|
}],
|
|
|
|
title: {
|
|
|
|
text: 'Email Status'
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
height: 300
|
|
|
|
},
|
|
|
|
credits : {
|
|
|
|
enabled : false
|
|
|
|
},
|
|
|
|
loading: false,
|
|
|
|
}
|
2014-03-13 20:12:03 +00:00
|
|
|
params.total(campaign.results.length)
|
|
|
|
$defer.resolve(campaign.results.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.errorFlash = function(message) {
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "danger",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-exclamation-circle"
|
|
|
|
})
|
2014-03-13 20:12:03 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-05-29 03:29:30 +00:00
|
|
|
app.controller('GroupCtrl', function($scope, $modal, GroupService, ngTableParams) {
|
2014-06-03 18:27:20 +00:00
|
|
|
$scope.errorFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "danger",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-exclamation-circle"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.successFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "success",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-check-circle"
|
|
|
|
})
|
|
|
|
}
|
2014-02-10 15:44:15 +00:00
|
|
|
$scope.mainTableParams = new ngTableParams({
|
2014-02-10 07:15:36 +00:00
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
2014-02-10 15:44:15 +00:00
|
|
|
name: 'asc' // initial sorting
|
2014-02-10 07:15:36 +00:00
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
|
|
|
GroupService.query(function(groups) {
|
|
|
|
$scope.groups = groups
|
|
|
|
params.total(groups.length)
|
|
|
|
$defer.resolve(groups.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
2014-02-08 01:40:16 +00:00
|
|
|
|
2014-02-10 15:44:15 +00:00
|
|
|
$scope.editGroupTableParams = new ngTableParams({
|
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
|
|
|
name: 'asc' // initial sorting
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
|
|
|
params.total($scope.group.targets.length)
|
|
|
|
$defer.resolve($scope.group.targets.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-02-08 01:40:16 +00:00
|
|
|
$scope.editGroup = function(group) {
|
|
|
|
if (group === 'new') {
|
|
|
|
$scope.newGroup = true;
|
|
|
|
$scope.group = {
|
|
|
|
name: '',
|
2014-02-08 21:16:36 +00:00
|
|
|
targets: [],
|
2014-02-08 01:40:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$scope.newGroup = false;
|
|
|
|
$scope.group = group;
|
2014-02-10 15:44:15 +00:00
|
|
|
$scope.editGroupTableParams.reload()
|
2014-02-08 01:40:16 +00:00
|
|
|
}
|
2014-05-29 03:29:30 +00:00
|
|
|
$scope.newTarget = {};
|
|
|
|
var modalInstance = $modal.open({
|
|
|
|
templateUrl: '/js/app/partials/modals/userModal.html',
|
|
|
|
controller: GroupModalCtrl,
|
|
|
|
scope: $scope
|
|
|
|
});
|
2014-02-08 01:40:16 +00:00
|
|
|
};
|
2014-02-08 21:16:36 +00:00
|
|
|
|
|
|
|
$scope.addTarget = function() {
|
|
|
|
if ($scope.newTarget.email != "") {
|
|
|
|
$scope.group.targets.push({
|
|
|
|
email: $scope.newTarget.email
|
|
|
|
});
|
|
|
|
$scope.newTarget.email = ""
|
2014-02-10 15:44:15 +00:00
|
|
|
$scope.editGroupTableParams.reload()
|
2014-02-08 21:16:36 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
$scope.removeTarget = function(target) {
|
|
|
|
$scope.group.targets.splice($scope.group.targets.indexOf(target), 1);
|
2014-02-10 15:44:15 +00:00
|
|
|
$scope.editGroupTableParams.reload()
|
2014-02-08 21:16:36 +00:00
|
|
|
};
|
2014-02-10 01:34:47 +00:00
|
|
|
$scope.saveGroup = function(group) {
|
2014-02-13 18:05:22 +00:00
|
|
|
var newGroup = new GroupService(group);
|
2014-02-10 01:34:47 +00:00
|
|
|
if ($scope.newGroup) {
|
2014-02-18 02:46:57 +00:00
|
|
|
newGroup.$save({}, function() {
|
2014-02-10 01:34:47 +00:00
|
|
|
$scope.groups.push(newGroup);
|
2014-02-10 19:02:44 +00:00
|
|
|
$scope.mainTableParams.reload()
|
2014-02-10 01:34:47 +00:00
|
|
|
});
|
2014-02-10 07:15:36 +00:00
|
|
|
} else {
|
2014-02-18 02:46:57 +00:00
|
|
|
newGroup.$update({
|
|
|
|
id: newGroup.id
|
|
|
|
})
|
2014-02-10 01:34:47 +00:00
|
|
|
}
|
2014-02-10 19:02:44 +00:00
|
|
|
$scope.group = {
|
2014-02-18 02:46:57 +00:00
|
|
|
name: '',
|
|
|
|
targets: [],
|
|
|
|
};
|
2014-02-10 19:02:44 +00:00
|
|
|
$scope.editGroupTableParams.reload()
|
2014-02-10 01:34:47 +00:00
|
|
|
}
|
2014-02-13 18:05:22 +00:00
|
|
|
$scope.deleteGroup = function(group) {
|
|
|
|
var deleteGroup = new GroupService(group);
|
2014-02-18 02:46:57 +00:00
|
|
|
deleteGroup.$delete({
|
|
|
|
id: deleteGroup.id
|
|
|
|
}, function() {
|
2014-02-13 18:05:22 +00:00
|
|
|
$scope.mainTableParams.reload();
|
|
|
|
});
|
|
|
|
}
|
2014-02-08 01:40:16 +00:00
|
|
|
})
|
2014-03-18 20:20:34 +00:00
|
|
|
|
2014-05-29 03:29:30 +00:00
|
|
|
var GroupModalCtrl = function($scope, $modalInstance) {
|
|
|
|
$scope.cancel = function() {
|
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
};
|
2014-06-03 18:27:20 +00:00
|
|
|
$scope.ok = function(group) {
|
|
|
|
$modalInstance.dismiss('')
|
|
|
|
$scope.saveGroup(group)
|
|
|
|
};
|
2014-05-29 03:29:30 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 18:18:57 +00:00
|
|
|
app.controller('TemplateCtrl', function($scope, $modal, TemplateService, ngTableParams) {
|
2014-06-03 18:27:20 +00:00
|
|
|
$scope.errorFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "danger",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-exclamation-circle"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.successFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "success",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-check-circle"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2014-03-18 20:20:34 +00:00
|
|
|
$scope.mainTableParams = new ngTableParams({
|
|
|
|
page: 1, // show first page
|
|
|
|
count: 10, // count per page
|
|
|
|
sorting: {
|
|
|
|
name: 'asc' // initial sorting
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
total: 0, // length of data
|
|
|
|
getData: function($defer, params) {
|
|
|
|
TemplateService.query(function(templates) {
|
|
|
|
$scope.templates = templates
|
|
|
|
params.total(templates.length)
|
|
|
|
$defer.resolve(templates.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.editTemplate = function(template) {
|
|
|
|
if (template === 'new') {
|
|
|
|
$scope.newTemplate = true;
|
|
|
|
$scope.template = {
|
|
|
|
name: '',
|
|
|
|
html: '',
|
|
|
|
text: '',
|
|
|
|
};
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$scope.newTemplate = false;
|
|
|
|
$scope.template = template;
|
|
|
|
}
|
2014-05-27 18:18:57 +00:00
|
|
|
var modalInstance = $modal.open({
|
|
|
|
templateUrl: '/js/app/partials/modals/templateModal.html',
|
|
|
|
controller: TemplateModalCtrl,
|
|
|
|
scope: $scope
|
|
|
|
});
|
|
|
|
|
|
|
|
modalInstance.result.then(function(selectedItem) {
|
|
|
|
$scope.selected = selectedItem;
|
|
|
|
}, function() {
|
|
|
|
console.log('closed')
|
|
|
|
});
|
2014-03-18 20:20:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.saveTemplate = function(template) {
|
|
|
|
var newTemplate = new TemplateService(template);
|
|
|
|
if ($scope.newTemplate) {
|
|
|
|
newTemplate.$save({}, function() {
|
|
|
|
$scope.templates.push(newTemplate);
|
|
|
|
$scope.mainTableParams.reload()
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
newTemplate.$update({
|
|
|
|
id: newTemplate.id
|
|
|
|
})
|
|
|
|
}
|
|
|
|
$scope.template = {
|
2014-05-28 23:46:56 +00:00
|
|
|
name: '',
|
|
|
|
html: '',
|
|
|
|
text: '',
|
2014-03-18 20:20:34 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
$scope.deleteTemplate = function(template) {
|
|
|
|
var deleteTemplate = new TemplateService(template);
|
|
|
|
deleteTemplate.$delete({
|
|
|
|
id: deleteTemplate.id
|
2014-06-03 18:27:20 +00:00
|
|
|
}, function(response) {
|
|
|
|
if (response.success) {
|
|
|
|
$scope.successFlash(response.message)
|
|
|
|
} else {
|
|
|
|
$scope.errorFlash(response.message)
|
|
|
|
}
|
2014-03-18 20:20:34 +00:00
|
|
|
$scope.mainTableParams.reload();
|
|
|
|
});
|
|
|
|
}
|
2014-03-20 16:58:24 +00:00
|
|
|
})
|
|
|
|
|
2014-05-28 23:46:56 +00:00
|
|
|
var TemplateModalCtrl = function($scope, $modalInstance) {
|
|
|
|
$scope.cancel = function() {
|
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
};
|
|
|
|
};
|
2014-05-27 18:18:57 +00:00
|
|
|
|
2014-05-29 03:29:30 +00:00
|
|
|
app.controller('SettingsCtrl', function($scope, $http, $window) {
|
2014-05-27 18:18:57 +00:00
|
|
|
$scope.flashes = [];
|
2014-05-27 01:29:12 +00:00
|
|
|
$scope.user = user;
|
2014-05-27 18:18:57 +00:00
|
|
|
$scope.errorFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "danger",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-exclamation-circle"
|
|
|
|
})
|
2014-05-27 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$scope.successFlash = function(message) {
|
|
|
|
$scope.flashes = [];
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.flashes.push({
|
|
|
|
"type": "success",
|
|
|
|
"message": message,
|
|
|
|
"icon": "fa-check-circle"
|
|
|
|
})
|
2014-05-27 18:18:57 +00:00
|
|
|
}
|
2014-05-27 01:29:12 +00:00
|
|
|
$scope.form_data = {
|
2014-05-29 04:29:41 +00:00
|
|
|
username: user.username,
|
2014-05-28 23:46:56 +00:00
|
|
|
csrf_token: csrf_token
|
2014-05-27 01:29:12 +00:00
|
|
|
}
|
2014-05-28 23:46:56 +00:00
|
|
|
$scope.api_reset = function() {
|
2014-05-27 01:29:12 +00:00
|
|
|
$http({
|
2014-05-28 23:46:56 +00:00
|
|
|
method: 'POST',
|
|
|
|
url: '/api/reset',
|
|
|
|
data: $.param($scope.form_data), // pass in data as strings
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
} // set the headers so angular passing info as form data (not request payload)
|
2014-05-27 01:29:12 +00:00
|
|
|
})
|
2014-06-03 18:27:20 +00:00
|
|
|
.success(function(response) {
|
|
|
|
if (response.success) {
|
|
|
|
$scope.user.api_key = response.data;
|
|
|
|
$window.user.api_key = response.data;
|
|
|
|
$scope.successFlash(response.message)
|
|
|
|
}
|
2014-05-28 23:46:56 +00:00
|
|
|
})
|
2014-05-27 01:29:12 +00:00
|
|
|
}
|
2014-06-11 23:23:16 +00:00
|
|
|
$scope.save_settings = function() {
|
2014-05-29 04:29:41 +00:00
|
|
|
$http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/settings',
|
|
|
|
data: $.param($scope.form_data),
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.success(function(data) {
|
|
|
|
if (data.success) {
|
|
|
|
$scope.successFlash(data.message)
|
2014-06-11 23:23:16 +00:00
|
|
|
} else {
|
2014-05-29 04:29:41 +00:00
|
|
|
$scope.errorFlash(data.message)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2014-05-28 23:46:56 +00:00
|
|
|
})
|