Permalink
Browse files

Environment dialogs working (create/update)

  • Loading branch information...
1 parent a89809e commit 71d3014ce946ea6c35a7414db8de378b3f3a5fe6 @winton committed Oct 26, 2010
@@ -1,5 +1,12 @@
Application.class_eval do
+ delete '/categories.json' do
+ ABPlugin::API.delete_category(
+ :name => params[:name],
+ :token => current_user.single_access_token
+ ).to_json
+ end
+
post '/categories.json' do
ABPlugin::API.create_category(
:name => params[:name],
@@ -8,23 +15,26 @@
).to_json
end
- delete '/categories.json' do
- ABPlugin::API.delete_category(
+ delete '/envs.json' do
+ ABPlugin::API.delete_env(
:name => params[:name],
:token => current_user.single_access_token
).to_json
end
post '/envs.json' do
ABPlugin::API.create_env(
+ :domains => params[:domains].select { |d| !d.empty? }.join(','),
:name => params[:name],
:site_id => params[:site_id],
:token => current_user.single_access_token
).to_json
end
- delete '/envs.json' do
- ABPlugin::API.delete_env(
+ put '/envs.json' do
+ ABPlugin::API.update_env(
+ :domains => params[:domains].select { |d| !d.empty? }.join(','),
+ :id => params[:id],
:name => params[:name],
:token => current_user.single_access_token
).to_json
@@ -46,6 +56,13 @@
).to_json
end
+ delete '/tests.json' do
+ ABPlugin::API.delete_test(
+ :id => params[:id],
+ :token => current_user.single_access_token
+ ).to_json
+ end
+
post '/tests.json' do
ABPlugin::API.create_test(
:category => params[:category],
@@ -76,11 +93,4 @@
:variants => params[:variants]
).to_json
end
-
- delete '/tests.json' do
- ABPlugin::API.delete_test(
- :id => params[:id],
- :token => current_user.single_access_token
- ).to_json
- end
end
@@ -6,6 +6,7 @@
.header
Sites 
%img{ :class => 'add', :src => '/image/add.png' }
+ /%img{ :class => 'edit hide', :src => '/image/edit.png' }
%img{ :class => 'remove hide', :src => '/image/remove.png' }
- @sites.each do |site|
.selectable= site['name']
@@ -14,28 +15,51 @@
Environments 
%img{ :class => 'add', :src => '/image/add.png' }
%img{ :class => 'remove hide', :src => '/image/remove.png' }
+ %img{ :class => 'edit hide', :src => '/image/edit.png' }
.span-24.last.hide.filter#categories
.header
Categories 
%img{ :class => 'add', :src => '/image/add.png' }
+ /%img{ :class => 'edit hide', :src => '/image/edit.png' }
%img{ :class => 'remove hide', :src => '/image/remove.png' }
.span-24.last.hide.filter#tests
.header
Tests 
%img{ :class => 'add', :src => '/image/add.png' }
+ %img{ :class => 'edit hide', :src => '/image/edit.png' }
%img{ :class => 'remove hide', :src => '/image/remove.png' }
+%textarea.hide#envs_form_template
+ .dialog.span-8.last
+ %form{ :action => '/envs', :method => 'post' }
+ .span-3
+ %label{ :for => 'env_name' } Environment
+ .span-4.last
+ <% if (typeof(env) != "undefined") { %>
+ <input name='id' type='hidden' value='<%= env.id %>' />
+ <% } %>
+ <input name='site_id' type='hidden' value='<%= site.id %>' />
+ <input id='env_name' name='name' type='text' value='<%= (typeof(env) != "undefined") ? env.name : "" %>' />
+ .submit
+ %input{ :type => 'submit', :value => 'Submit' }
+ %input{ :class => 'cancel', :type => 'reset', :value => 'Cancel' }
+
+%textarea.hide#envs_form_domain_template
+ .span-3
+ %label Domain name
+ .span-4.last
+ <input class='domains' name='domains[]' type='text' value='<%= (typeof(domain) != "undefined") ? domain : "" %>' />
+
%textarea.hide#tests_form_template
.dialog.span-7.last
%form{ :action => '/tests', :method => 'post' }
.span-2
- %label{ :for => 'test_name' } Name
- .span-4
+ %label{ :for => 'test_name' } Test
+ .span-4.last
<% if (typeof(test) != "undefined") { %>
<input name='id' type='hidden' value='<%= test.id %>' />
<% } %>
<input id='test_name' name='name' type='text' value='<%= (typeof(test) != "undefined") ? test.name : "" %>' />
- .clear
.submit
%input{ :type => 'submit', :value => 'Submit' }
%input{ :class => 'cancel', :type => 'reset', :value => 'Cancel' }
@@ -48,7 +72,7 @@
<% } else { %>
Variant
<% } %>
- .span-4
+ .span-4.last
<input class='variants' name='<%= (typeof(id) != "undefined") ? "old_variants[" + id + "]" : "variants[]" %>' type='text' value='<%= (typeof(name) != "undefined") ? name : "" %>' />
%textarea.hide#test_template
Oops, something went wrong.

0 comments on commit 71d3014

Please sign in to comment.