From 2e6ec3711b8e2e0d043edb2ea1ba5e4096bacadc Mon Sep 17 00:00:00 2001 From: Richard Taylor Date: Tue, 28 Oct 2008 14:22:12 +0000 Subject: [PATCH] implemented create and delete security group - added new lightbox code --- public/style.css | 27 +++++++++++++++++++++++++++ snail.rb | 9 ++++++++- views/_layout_header.erb | 2 +- views/groups.erb | 20 ++++++++++++++++++-- 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/public/style.css b/public/style.css index 59ccb2f..c4eb2d7 100644 --- a/public/style.css +++ b/public/style.css @@ -30,3 +30,30 @@ body { #images .image {margin-bottom:10px;} #images .odd {background-color:#A6CDDE;} + +.lightbox_overlay { + display: none; + position: absolute; + top: 0%; + left: 0%; + width: 100%; + height: 100%; + background-color: black; + z-index:1001; + -moz-opacity: 0.8; + opacity:.80; + filter: alpha(opacity=80); +} +.lightbox { + display: none; + position: absolute; + top: 15%; + left: 25%; + width: 50%; + height: 50%; + padding: 16px; + border: 10px solid orange; + background-color: white; + z-index:1002; + overflow: auto; +} \ No newline at end of file diff --git a/snail.rb b/snail.rb index e94748a..150d804 100755 --- a/snail.rb +++ b/snail.rb @@ -118,6 +118,11 @@ erb :groups end +get '/group/:group_name/delete' do + @ec2.delete_security_group(params[:group_name]) + redirect '/groups' +end + get '/group/:group_name/revoke' do if params[:group] @ec2.revoke_security_group_named_ingress(params[:group_name], params[:owner], params[:group]) @@ -127,7 +132,9 @@ redirect '/groups' end -post '/group/:group_name' do +post '/group' do + @ec2.create_security_group(params[:name], params[:description]) + redirect '/groups' end # SSH Key Pairs diff --git a/views/_layout_header.erb b/views/_layout_header.erb index ab23579..99013bc 100644 --- a/views/_layout_header.erb +++ b/views/_layout_header.erb @@ -1 +1 @@ -

Snail

\ No newline at end of file +

Snail - The Amazon Web Services Manager

\ No newline at end of file diff --git a/views/groups.erb b/views/groups.erb index 8b0a8b9..926ac77 100644 --- a/views/groups.erb +++ b/views/groups.erb @@ -1,11 +1,11 @@ <% @title = 'Security Groups' %> -

<%= link_to image_tag('add.png', :alt => 'Create a new Security Group'), '#' %> Create a new Secutiry Group

+

<%= link_to image_tag('add.png', :alt => 'Create a new Security Group'), '#', :onclick => "$('#group_create').toggle();$('#overlay').toggle()" %> Create a new Security Group


<% @groups.each do |group| %>
<%= group[:aws_group_name] %> <%= group[:aws_description] %> - <%= link_to image_tag('minus.png', :alt => 'Delete Security Group'), '#' %> + <%= link_to image_tag('minus.png', :alt => 'Delete Security Group'), "/group/#{group[:aws_group_name]}/delete", :onclick => "return confirm('Delete Security Group: Are you sure?')" %>
<% group[:aws_perms].each do |perm| %> @@ -26,4 +26,20 @@ <%= link_to '+ Add new rule', '#' %>
+ <% end %> + + + + + +