Skip to content

Commit

Permalink
Merge pull request globaleaks#30 from globaleaks/refactor/notification
Browse files Browse the repository at this point in the history
Refactor/notification
  • Loading branch information
hellais committed Feb 28, 2013
2 parents ab22ab4 + fc3cde7 commit e28b88b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
34 changes: 18 additions & 16 deletions api/specification.js
Expand Up @@ -80,23 +80,24 @@ describe("Node Admin API functionality", function(){
var dummyReceiver = {
name: 'dummyName',
description: 'dummyDescription',
can_postpone_expiration: true,
tags: ['tag1', 'tag2', 'tag3'],
//can_postpone_expiration: true,
//tags: ['tag1', 'tag2', 'tag3'],

contexts: [],
//context_gus_list: [],

can_configure_notification: true,
can_configure_delivery: true,
//can_configure_notification: true,
//can_configure_delivery: true,
can_delete_submission: true,
password: '',
old_password: '',

receiver_level: 1,
languages: ['en', 'it'],
notification_selected: 'email',
notification_fields: 'admin@example.com',
//languages: ['en', 'it'],
//notification_selected: 'email',
notification_fields: {'mail_address': 'admin@example.com'},

delivery_selected: 'local',
delivery_fields: ''
//delivery_selected: 'local',
//delivery_fields: ''

};

Expand All @@ -105,17 +106,17 @@ describe("Node Admin API functionality", function(){
var dummyTipID = 'someRandomString';

var dummySubmission = {
real_receipt: 'foobar',
//real_receipt: 'foobar',
creation_time: 'globaleaks.rest.base.timeType',
receiver_gus_list: [dummyReceiverID],
receivers: [dummyReceiverID],
// XXX perhaps this should go as a paramater
submission_gus: 'XXX',
fields: [
wb_fields: [
{'someFancyName': 'Some Fancy Content'}
],
expiration_time: 'XXX',
context_gus: 'XXX',
file_gus_list: ['']
// files: ['']
};

var getSomeContextID = function(fn) {
Expand Down Expand Up @@ -180,8 +181,9 @@ describe("Node Admin API functionality", function(){
response.should.have.property('hidden_service');

response.should.have.property('public_site');
response.should.have.property('public_stats_update_time');
response.should.have.property('private_stats_update_time');
response.should.have.property('stats_update_time');
//response.should.have.property('public_stats_update_time');
//response.should.have.property('private_stats_update_time');

response.should.have.property('languages');

Expand Down
3 changes: 3 additions & 0 deletions app/scripts/services.js
Expand Up @@ -351,10 +351,12 @@ angular.module('resourceServices', ['ngResource', 'resourceServices.authenticati
{method: 'PUT'}
}),
adminNodeResource = $resource('/admin/node', {}, {update: {method: 'PUT'}});
adminNotificationResource = $resource('/admin/notification', {}, {update: {method: 'PUT'}});

adminContextsResource.prototype.toString = function() { return "Admin Context"; };
adminReceiversResource.prototype.toString = function() { return "Admin Receiver"; };
adminNodeResource.prototype.toString = function() { return "Admin Node"; };
adminNotificationResource.prototype.toString = function() { return "Admin Notification"; };

self.context = adminContextsResource;
self.contexts = adminContextsResource.query();
Expand Down Expand Up @@ -389,6 +391,7 @@ angular.module('resourceServices', ['ngResource', 'resourceServices.authenticati
self.node.old_password = '';
});

self.notification = adminNotificationResource.get();
}
return Admin;

Expand Down
25 changes: 17 additions & 8 deletions app/views/admin/mail.html
Expand Up @@ -29,28 +29,37 @@

<label>SMTP server address</label>
<input type="text"
ng-model="admin.node.notification_settings.server" required>
ng-model="admin.notification.server" required>

<label>SMTP server port</label>
<input type="text"
ng-model="admin.node.notification_settings.port" required>
ng-model="admin.notification.port" required>

<label>Username</label>
<input type="text"
ng-model="admin.node.notification_settings.username" required>
ng-model="admin.notification.username" required>

<label>Password</label>
<input type="password"
ng-model="admin.node.notification_settings.password" required>
ng-model="admin.notification.password" required>

<label>Transport Security</label>
<select ng-model="admin.node.notification_settings.security">
<select ng-model="admin.notification.security" required>
<option value='tls'>TLS</option>
<option value='ssl'>SSL</option>
</select>

<label>Email template</label>
<textarea ng-model="admin.node.notification_settings.email_template"></textarea>
<label>Tip Email template</label>
<textarea ng-model="admin.notification.tip_template"></textarea>

<label>Comment Email template</label>
<textarea ng-model="admin.notification.comment_template"></textarea>

<label>File Email template</label>
<textarea ng-model="admin.notification.file_template"></textarea>

<label>Activation Email template</label>
<textarea ng-model="admin.notification.activation_template"></textarea>

</div>
</form>
Expand All @@ -61,7 +70,7 @@
<!-- end Notification -->
<button class="btn btn-success"
ng-disabled="notificationForm.$invalid || notificationForm.$pristine"
ng-click="updateNode(admin.node)">Save</button>
ng-click="update(admin.notification)">Save</button>

</div>
</div>
Expand Down

0 comments on commit e28b88b

Please sign in to comment.