Permalink
Browse files

Add url field to services form.

  • Loading branch information...
1 parent 3466ccf commit 4754151f20b6f1ef7c34db6b71d63ff699462d8a @llun committed Mar 2, 2013
Showing with 19 additions and 9 deletions.
  1. +3 −3 app.js
  2. +5 −4 models/service.js
  3. +1 −0 public/js/blog.js
  4. +10 −2 views/admin.jade
View
6 app.js
@@ -131,9 +131,9 @@ app.get('/cards/tag/:tag.html', routes.tag);
app.get('/cards/:cid/comments', comments.list);
app.post('/cards/:cid/comments', comments.create);
-app.post('/admin/services', services.authorize);
-app.get('/admin/services/:service/callback', services.callback);
-app.delete('/admin/services/:service', services.remove);
+app.post('/admin/services', security.requiredLogin, services.authorize);
+app.get('/admin/services/:service/callback', security.requiredLogin, services.callback);
+app.delete('/admin/services/:service', security.requiredLogin, services.remove);
// server codes
http.createServer(app).listen(app.get('port'), function(){
View
9 models/service.js
@@ -2,10 +2,11 @@ var database = require('./database'),
mongoose = require('mongoose');
var schema = mongoose.Schema({
- name: { type: String, required: true, index: true, unique: true },
- key: { type: String, required: true },
- secret: { type: String, required: true },
- token: { type: String }
+ name: { type: String, required: true, index: true, unique: true },
+ key: { type: String, required: true },
+ secret: { type: String, required: true },
+ accountUrl: { type: String, required: true },
+ token: { type: String }
});
var Service = database.model('Service', schema);
View
1 public/js/blog.js
@@ -329,6 +329,7 @@ var AdminView = Backbone.View.extend({
this.$('#input_oauth_service').select2('val', '');
this.$('#input_oauth_key').val('');
this.$('#input_oauth_secret').val('');
+ this.$('#input_url').val('');
},
showService: function (e) {
View
12 views/admin.jade
@@ -75,11 +75,15 @@ block content
.control-group.view-service(class='view-#{service._id}')
label.control-label(for='oauth_key') Key
.controls
- input.uneditable-input#preview_oauth_key(name='oauth_key', value='#{service.key}')
+ input.uneditable-input(name='oauth_key', value='#{service.key}')
.control-group.view-service(class='view-#{service._id}')
label.control-label(for='oauth_secret') Sercret
.controls
- input.uneditable-input#preview_oauth_secret(name='oauth_secret', value='#{service.secret}')
+ input.uneditable-input(name='oauth_secret', value='#{service.secret}')
+ .control-group.view-service(class='view-#{service._id}')
+ label.control-label(for='url') Sercret
+ .controls
+ input.uneditable-input(name='url', value='#{service.accountUrl}')
.form-actions
button.btn.btn-primary.btn-add-service Add new service
= ' '
@@ -109,6 +113,10 @@ block content
label.control-label(for='oauth_secret') Secret
.controls
input#input_oauth_secret(name='oauth_secret', placeholder='OAuth Secret from service')
+ .control-group
+ label.control-label(for='url') Account URL
+ .controls
+ input#input_url(name='url', placeholder='Account URL in service')
.form-actions
button.btn.btn-primary(type='submit') Add service
= ' '

0 comments on commit 4754151

Please sign in to comment.