fix ssh-key displays

This commit is contained in:
Lisa Passing 2015-07-20 17:11:59 +02:00
parent 2accdd5626
commit b32ce35a05
5 changed files with 25 additions and 17 deletions

View File

@ -4,7 +4,20 @@ SshKeyComponent = Ember.Component.extend
classNames: ['settings-sshkey']
isCustom: () ->
false
isDeleting: false
actions:
delete: ->
console.log('isDeleting')
# return if @get('isDeleting')
# @set('isDeleting', true)
# deletingDone = => @set('isDeleting', false)
# @get('model').deleteRecord()
# @get('model').save().then(deletingDone, deletingDone).then =>
# @set('model', null)
`export default SshKeyComponent`

View File

@ -5,5 +5,6 @@ SshKey = Model.extend
value: DS.attr()
description: DS.attr()
fingerprint: DS.attr()
isCustom: true
`export default SshKey`

View File

@ -12,7 +12,7 @@ Route = TravisRoute.extend
repo = @modelFor('repo')
repo.get('envVars.promise')
fetchSshKey: () ->
fetchCustomSshKey: () ->
repo = @modelFor('repo')
self = this
@store.find('sshKey', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
@ -22,7 +22,7 @@ Route = TravisRoute.extend
# ssh_key.new or ssh_key.no_key
return false
fetchCustomSshKey: () ->
fetchSshKey: () ->
repo = @modelFor('repo')
Ajax.get "/repos/#{repo.get('id')}/key", (data) =>
Ember.Object.create(fingerprint: data.fingerprint)

View File

@ -1,4 +1,4 @@
{{#if isCustom}}
{{#if key.isCustom}}
<div class="ssh-key-name">
<span class="icon-key"></span>
<span>{{key.description}}</span>
@ -6,11 +6,10 @@
<div class="ssh-key-value">
<span class="icon-fingerprint"></span>
<span>{{key.fingerprint}}</span>
<span>{{fingerprint}}</span>
</div>
<div class="ssh-key-action">
<div class="tooltip">
<a href="#" title="">
<a href="#" title="" {{action "delete"}}>
<span class="icon-delete"></span>
</a>
<div class="tooltip-bubble">Delete</div>
@ -24,13 +23,10 @@
<div class="ssh-key-value">
<span class="icon-fingerprint"></span>
<span>{{key.fingerprint}}</span>
<span>{{fingerprint}}</span>
</div>
<div class="ssh-key-action">
<div class="tooltip--height">
<a href="#" title="">
<span class="icon-delete-disabled"></span>
</a>
<span class="icon-delete-disabled"></span>
<div class="tooltip-bubble">Default keys <br>cannot be deleted</div>
</div>
</div>

View File

@ -31,11 +31,11 @@
<section class="settings-section">
<h2 class="small-title">SSH Key</h2>
{{#if sshKey}}
{{ssh-key key=sshKey}}
{{#if model.customSshKey}}
{{ssh-key key=model.customSshKey}}
{{else}}
{{ssh-key key=model.sshKey}}
<div class="form--sshkey">
<a href="" class="button">Add custom SSH Key</a>
<form action="">
<div class="form-elem">
<input type="text" placeholder="Description">
@ -48,8 +48,6 @@
</div>
</form>
</div>
{{else}}
{{ssh-key key=customSshKey}}
{{/if}}