Skip to content

Commit

Permalink
delete working
Browse files Browse the repository at this point in the history
  • Loading branch information
gerad committed Jul 30, 2010
1 parent 972d6ed commit 2b2a930
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
17 changes: 9 additions & 8 deletions nodeko.coffee
Expand Up @@ -72,6 +72,7 @@ request = (type) ->
get = request 'get'
post = request 'post'
put = request 'put'
del = request 'del'

get /.*/, ->
[host, path] = [@req.header('host'), @req.url]
Expand Down Expand Up @@ -168,14 +169,14 @@ put '/teams/:id', ->
if @req.body.emails
team.setMembers @req.body.emails, save
else save()
# # #
# # # # delete team
# # # app.del '/teams/:id', -> # delete not working
# # # Team.first @param('id'), (error, team) =>
# # # @ensurePermitted team, =>
# # # team.remove (error, result) =>
# # # @redirect '/'
# # #

# delete team
del '/teams/:id', ->
Team.first @req.param('id'), (error, team) =>
@ensurePermitted team, =>
team.remove (error, result) =>
@redirect '/'

# # # # resend invitation
# # # get '/teams/:teamId/invite/:personId', ->
# # # Team.first @param('teamId'), (error, team) =>
Expand Down
3 changes: 3 additions & 0 deletions public/stylesheets/application.css
Expand Up @@ -77,6 +77,9 @@ input.error {
font-size: small;
color: hsla(0, 0%, 0%, 0.4);}

form#delete {
display: inline;}

#page {
width: 70ex;
text-align: left;
Expand Down
3 changes: 3 additions & 0 deletions public/stylesheets/application.sass
Expand Up @@ -82,6 +82,9 @@ input.error
:font-size small
:color hsla(0, 0%, 0%, 0.4)

form#delete
:display inline

#page
:width 70ex
:text-align left
Expand Down
5 changes: 3 additions & 2 deletions views/teams/show.html.haml
Expand Up @@ -51,6 +51,7 @@
= ctx.invites.length === 1 ? ' invitation.' : ' invitations.'

- if (ctx.editAllowed)
%p
%form{ method: 'POST', action: '/teams/' + ctx.team.id() }#delete
%a.button{ href: '/teams/' + ctx.team.id() + '/edit' } Edit
%a.delete.button{ href: '/teams/' + ctx.team.id() + '?_method=DELETE' } Delete
%input{ type: 'hidden', name: '_method', value: 'delete' }
%input.button{ type: 'submit', value: 'Delete' }

0 comments on commit 2b2a930

Please sign in to comment.