Permalink
Browse files

Add show oauth service key and secret.

  • Loading branch information...
1 parent 499066e commit 073955c396ebc5a575b489319171c42980030b8b @llun committed Feb 23, 2013
Showing with 36 additions and 22 deletions.
  1. +2 −5 public/css/blog.less
  2. +21 −5 public/js/blog.js
  3. +13 −12 views/admin.jade
@@ -367,11 +367,8 @@ section#login {
}
- .view-service {
- display: none;
- }
-
- .add-service {
+ .view-service, .add-service,
+ .btn-delete-service, .btn-cancel {
display: none;
}
}
View
@@ -292,7 +292,9 @@ var AdminView = Backbone.View.extend({
el: 'body',
events: {
'click .select-service .btn-add-service': 'showAddService',
- 'click .add-service .cancel': 'cancelAddService'
+ 'click .add-service .btn-cancel': 'cancelAddService',
+ 'click .view-service.btn-cancel': 'cancelViewService',
+ 'change #service_selector': 'showService'
},
initialize: function () {
@@ -312,10 +314,6 @@ var AdminView = Backbone.View.extend({
this.$('#social .add-service').show();
},
- submitNewService: function (e) {
-
- },
-
cancelAddService: function (e) {
e.preventDefault();
@@ -325,5 +323,23 @@ var AdminView = Backbone.View.extend({
this.$('#input_oauth_service').select2('val', '');
this.$('#input_oauth_key').val('');
this.$('#input_oauth_secret').val('');
+ },
+
+ showService: function (e) {
+ this.$('.view-service').hide();
+ this.$('.btn-add-service').hide();
+ this.$('.btn-delete-service').show();
+ this.$('.btn-cancel').show();
+
+ var service = this.$('#service_selector').val();
+ this.$('.view-' + service).show();
+ },
+
+ cancelViewService: function (e) {
+ this.$('.view-service').hide();
+ this.$('.btn-delete-service').hide();
+ this.$('.btn-add-service').show();
+
+ this.$('#service_selector').select2('val', '');
}
});
View
@@ -67,24 +67,25 @@ block content
.control-group
label.control-label(for='service') Service
.controls
- select.adv-select(name='service', data-placeholder='Authorized service')
+ select.adv-select#service_selector(name='service', data-placeholder='Authorized service')
option
each service in services
option(value='#{service.name}')= _.str.capitalize(service.name)
- .control-group.view-service
- label.control-label(for='oauth_key') Key
- .controls
- input.uneditable-input#preview_oauth_key(name='oauth_key', value='key')
- .control-group.view-service
- label.control-label(for='oauth_secret') Secret
- .controls
- input.uneditable-input#preview_oauth_secret(name='oauth_secret', value='secret')
+ each service in services
+ .control-group.view-service(class='view-#{service.name}')
+ label.control-label(for='oauth_key') Key
+ .controls
+ input.uneditable-input#preview_oauth_key(name='oauth_key', value='#{service.key}')
+ .control-group.view-service(class='view-#{service.name}')
+ label.control-label(for='oauth_secret') Sercret
+ .controls
+ input.uneditable-input#preview_oauth_secret(name='oauth_secret', value='#{service.secret}')
.form-actions
button.btn.btn-primary.btn-add-service Add new service
= ' '
- button.btn.btn-danger.view-service Remove service
+ button.btn.btn-danger.btn-delete-service Remove service
= ' '
- button.btn.cancel Cancel
+ button.btn.view-service.btn-cancel Cancel
form.form-horizontal.add-service(method='post', action='/admin/services')
.control-group
@@ -111,6 +112,6 @@ block content
.form-actions
button.btn.btn-primary(type='submit') Add service
= ' '
- button.btn.cancel(type='button') Cancel
+ button.btn.add-service.btn-cancel(type='button') Cancel

0 comments on commit 073955c

Please sign in to comment.