From: Jozef Zigmund <[email protected]>
---
src/app/views/instance/create.haml | 2 +
src/app/views/instance/create.html.erb | 2 -
src/app/views/instance/delete.haml | 2 +
src/app/views/instance/delete.html.erb | 2 -
src/app/views/instance/index.haml | 1 +
src/app/views/instance/index.html.erb | 1 -
src/app/views/instance/new.haml | 78 +++++++++++++++++++++++++++++++
src/app/views/instance/new.html.erb | 79 --------------------------------
src/app/views/instance/show.haml | 2 +
src/app/views/instance/show.html.erb | 2 -
10 files changed, 85 insertions(+), 86 deletions(-)
create mode 100644 src/app/views/instance/create.haml
delete mode 100644 src/app/views/instance/create.html.erb
create mode 100644 src/app/views/instance/delete.haml
delete mode 100644 src/app/views/instance/delete.html.erb
create mode 100644 src/app/views/instance/index.haml
delete mode 100644 src/app/views/instance/index.html.erb
create mode 100644 src/app/views/instance/new.haml
delete mode 100644 src/app/views/instance/new.html.erb
create mode 100644 src/app/views/instance/show.haml
delete mode 100644 src/app/views/instance/show.html.erb
diff --git a/src/app/views/instance/create.haml
b/src/app/views/instance/create.haml
new file mode 100644
index 0000000..6fd9474
--- /dev/null
+++ b/src/app/views/instance/create.haml
@@ -0,0 +1,2 @@
+%h1 Instance#create
+%p Find me in app/views/instance/create.html.erb
diff --git a/src/app/views/instance/create.html.erb
b/src/app/views/instance/create.html.erb
deleted file mode 100644
index 4f6287a..0000000
--- a/src/app/views/instance/create.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<h1>Instance#create</h1>
-<p>Find me in app/views/instance/create.html.erb</p>
diff --git a/src/app/views/instance/delete.haml
b/src/app/views/instance/delete.haml
new file mode 100644
index 0000000..63de29b
--- /dev/null
+++ b/src/app/views/instance/delete.haml
@@ -0,0 +1,2 @@
+%h1 Instance#delete
+%p Find me in app/views/instance/delete.html.erb
diff --git a/src/app/views/instance/delete.html.erb
b/src/app/views/instance/delete.html.erb
deleted file mode 100644
index 2afa7f3..0000000
--- a/src/app/views/instance/delete.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<h1>Instance#delete</h1>
-<p>Find me in app/views/instance/delete.html.erb</p>
diff --git a/src/app/views/instance/index.haml
b/src/app/views/instance/index.haml
new file mode 100644
index 0000000..fa8a917
--- /dev/null
+++ b/src/app/views/instance/index.haml
@@ -0,0 +1 @@
+= render :partial => 'instance/instances'
diff --git a/src/app/views/instance/index.html.erb
b/src/app/views/instance/index.html.erb
deleted file mode 100644
index 7c00833..0000000
--- a/src/app/views/instance/index.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render :partial => 'instance/instances' %>
diff --git a/src/app/views/instance/new.haml b/src/app/views/instance/new.haml
new file mode 100644
index 0000000..d797d57
--- /dev/null
+++ b/src/app/views/instance/new.haml
@@ -0,0 +1,78 @@
+:javascript
+ $(document).ready(function() {
+ $(".select_image").click(function() {
+ var wrapper = $("#select_template_dialog");
+ if (wrapper.length == 0) wrapper = $('<div
id="select_template_dialog"></div>');
+ wrapper.dialog({
+ title: "Select template for new instance",
+ width: 600,
+ height: 500,
+ modal: true,
+ overlay: {opacity: 0.2, background: "black"}
+ });
+ wrapper.load('#{url_for :action => 'select_image'}', null, function() {
+ $(":submit[name=select]").click(function() {
+ var checkbox = $("input[name='ids[]']:checked").first();
+ var id = checkbox.val();
+ if (id !== undefined) {
+ var name = $(".image_name", checkbox.parent().parent()).text();
+ $(".select_image").text(name);
+ $("input[name='instance[image_id]']").val(id);
+ }
+ $("#select_template_dialog").dialog('close');
+ return false;
+ });
+ });
+ return false;
+ });
+
+ $("select[name='instance[pool_id]']").change(function() {
+ location.href = '#{url_for(:action => "new")}?' +
$("#instance_form").serialize();
+ });
+ });
+.dcloud_form
+ = error_messages_for 'instance'
+ %h2 Add a New Instance
+ %br/
+ - form_tag({:action => 'create'}, :id => "instance_form") do
+ %ul
+ %li
+ %label
+ Name
+ %span Name for this new Instance
+ = text_field :instance, :name, :class => "txtfield"
+ %li
+ %label
+ Template
+ %span Choose a template to use
+ = link_to(@instance.image ? @instance.image.name : "Select
template...", {:action => 'select_image'}, {:class => 'actionlink
select_image'})
+ %input{:name => "instance[image_id]", :type => "hidden", :value =>
@instance.image ? @instance.image.id : ''}/
+ - if @instance.pool
+ %input{:name => "instance[pool_id]", :type => "hidden", :value =>
@instance.pool_id}/
+ - if (@pools.size > 1)
+ %li
+ %label Pool
+ = @instance.pool.name
+ - else
+ %li
+ %label
+ Pool
+ %span Pick your pool
+ = select("instance", "pool_id", |
+ @pools.collect {|p| [ p.name, p.id ] }, |
+ { :include_blank => true }) |
+ - if @instance.pool and @instance.pool.hardware_profiles.size > 0
+ %li
+ %label
+ Hardware Profile
+ %span Pick your hardware profile
+ = select("instance", "hardware_profile_id", |
+ @instance.pool.hardware_profiles.collect {|p| [ p.name, p.id ] }, |
+ { :include_blank => true }) |
+ - if @instance.pool and @instance.pool.realms.size > 0
+ %li
+ %label
+ Realm
+ %span Choose a realm
+ = select("instance", "front_end_realm", @instance.pool.realms, {
:include_blank => true })
+ = submit_tag "Save", :class => "submit"
diff --git a/src/app/views/instance/new.html.erb
b/src/app/views/instance/new.html.erb
deleted file mode 100644
index 499b2cf..0000000
--- a/src/app/views/instance/new.html.erb
+++ /dev/null
@@ -1,79 +0,0 @@
-<script type="text/javascript">
- $(document).ready(function() {
- $(".select_image").click(function() {
- var wrapper = $("#select_template_dialog");
- if (wrapper.length == 0) wrapper = $('<div
id="select_template_dialog"></div>');
- wrapper.dialog({
- title: "Select template for new instance",
- width: 600,
- height: 500,
- modal: true,
- overlay: {opacity: 0.2, background: "black"}
- });
- wrapper.load('<%= url_for :action => 'select_image' %>', null,
function() {
- $(":submit[name=select]").click(function() {
- var checkbox = $("input[name='ids[]']:checked").first();
- var id = checkbox.val();
- if (id !== undefined) {
- var name = $(".image_name", checkbox.parent().parent()).text();
- $(".select_image").text(name);
- $("input[name='instance[image_id]']").val(id);
- }
- $("#select_template_dialog").dialog('close');
- return false;
- });
- });
- return false;
- });
-
- $("select[name='instance[pool_id]']").change(function() {
- location.href = '<%= url_for(:action => "new") %>?' +
$("#instance_form").serialize();
- });
- });
-</script>
-
-<div class="dcloud_form">
- <%= error_messages_for 'instance' %>
-
- <h2>Add a New Instance</h2><br />
- <% form_tag({:action => 'create'},
- :id => "instance_form") do-%>
- <ul>
- <li><label>Name<span>Name for this new Instance</span></label><%=
text_field :instance, :name, :class => "txtfield" %></li>
-
- <li><label>Template<span>Choose a template to use</span></label>
- <%= link_to(@instance.image ? @instance.image.name : "Select template...",
{:action => 'select_image'}, {:class => 'actionlink select_image'}) %>
- </li>
- <input type=hidden name="instance[image_id]" value="<%= @instance.image ?
@instance.image.id : '' %>">
-
- <% if @instance.pool %>
- <input type=hidden name="instance[pool_id]" value="<%= @instance.pool_id
%>">
- <% if (@pools.size > 1) %>
- <li><label>Pool</label>
- <%= @instance.pool.name %>
- </li>
- <% end %>
- <% else %>
- <li><label>Pool<span>Pick your pool</span></label>
- <%= select("instance", "pool_id",
- @pools.collect {|p| [ p.name, p.id ] },
- { :include_blank => true }) %>
- </li>
- <% end %>
-
- <% if @instance.pool and @instance.pool.hardware_profiles.size > 0 %>
- <li><label>Hardware Profile<span>Pick your hardware
profile</span></label>
- <%= select("instance", "hardware_profile_id",
- @instance.pool.hardware_profiles.collect {|p| [ p.name,
p.id ] },
- { :include_blank => true }) %>
- </li>
- <% end %>
- <% if @instance.pool and @instance.pool.realms.size > 0 %>
- <li><label>Realm<span>Choose a realm</span></label>
- <%= select("instance", "front_end_realm", @instance.pool.realms, {
:include_blank => true }) %>
- </li>
- <% end %>
- </ul>
- <%= submit_tag "Save", :class => "submit" %>
- <% end %>
-</div>
diff --git a/src/app/views/instance/show.haml b/src/app/views/instance/show.haml
new file mode 100644
index 0000000..8036db2
--- /dev/null
+++ b/src/app/views/instance/show.haml
@@ -0,0 +1,2 @@
+= render :partial => 'instance/instances'
+= link_to "Add a new instance", :controller => "instance", :action => "new",
:id => @pool
diff --git a/src/app/views/instance/show.html.erb
b/src/app/views/instance/show.html.erb
deleted file mode 100644
index 689ead1..0000000
--- a/src/app/views/instance/show.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<%= render :partial => 'instance/instances' %>
-<%= link_to "Add a new instance", :controller => "instance", :action => "new",
:id => @pool %>
--
1.7.2.2
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel