Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DDCA9626 for ; Tue, 11 Oct 2011 10:16:48 +0000 (UTC) Received: (qmail 80938 invoked by uid 500); 11 Oct 2011 10:16:48 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 80794 invoked by uid 500); 11 Oct 2011 10:16:47 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 80782 invoked by uid 99); 11 Oct 2011 10:16:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 10:16:46 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,T_FRT_PROFIT2 X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 10:16:39 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9BAGH1F028288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Oct 2011 06:16:18 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9BAGGcL001146 for ; Tue, 11 Oct 2011 06:16:17 -0400 From: mfojtik@redhat.com To: deltacloud-dev@incubator.apache.org Subject: [PATCH core] UI: Improved hardware profile selection Date: Tue, 11 Oct 2011 12:17:38 +0200 Message-Id: <1318328258-10019-2-git-send-email-mfojtik@redhat.com> In-Reply-To: <1318328258-10019-1-git-send-email-mfojtik@redhat.com> References: <1318328258-10019-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik Signed-off-by: Michal fojtik --- server/public/javascripts/application.js | 5 ++++ server/public/stylesheets/new.css | 4 +++ server/views/instances/new.html.haml | 33 ++++++++++++++++------------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/server/public/javascripts/application.js b/server/public/javascripts/application.js index dc23e34..937690a 100644 --- a/server/public/javascripts/application.js +++ b/server/public/javascripts/application.js @@ -30,6 +30,11 @@ $(document).ready(function() { }) +function expandHWP(id) { + $('div.hwp_properties .property_block').appendTo('.hidden_content'); + $('div#hwp_properties_'+id).hide().appendTo('div#property_container_'+id).fadeIn(); +} + // NOTE: This code was copied from http://phpjs.org/functions/base64_encode:358 // phpjs.org license it under the MIT and GPL licenses diff --git a/server/public/stylesheets/new.css b/server/public/stylesheets/new.css index 4590a46..085c382 100644 --- a/server/public/stylesheets/new.css +++ b/server/public/stylesheets/new.css @@ -51,3 +51,7 @@ form.link { p.right-float { float : right; } + +.hidden_content { + display : none; +} diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml index 7b98341..2347022 100644 --- a/server/views/instances/new.html.haml +++ b/server/views/instances/new.html.haml @@ -1,6 +1,22 @@ =header "Launch new instance" =subheader "#{@image.id}" +.hidden_content + - @hardware_profiles.each do |profile| + %div{ :'data-role' => :fieldcontain, :id => "hwp_properties_#{profile.name}", :class => 'property_block'} + - profile.properties.reject { |prop| prop.fixed? }.each do |prop| + %label{ :for => "#{prop.param}_#{profile.name}", :class => 'ui-input-text' }=prop.name + %span.radio-group-details + - if prop.kind == :enum + %select{ :size => 1, :name => prop.param } + - for v in prop.values + %option= v + = prop.unit + - elsif prop.kind == :range + %input{ :type => :range, :value => prop.first, :min => prop.first, :max => prop.last, :name => prop.param} + - else + %input{ :name => prop.param, :size => 10, :value => "#{prop.default}" }= prop.unit + %div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'} %form{ :action => instances_url, :method => :post, :class => :new_instance, :'data-ajax' => 'false'} %input{ :name => :image_id, :type => :hidden, :value => @instance.image_id }/ @@ -59,21 +75,8 @@ %fieldset{ :'data-role' => :fieldcontain} - @hardware_profiles.each do |profile| %input{ :type => :radio, :name => 'hwp_id', :value => profile.name, :id => profile.name, :'data-theme' => 'b'}/ - %label{ :for => profile.name}=profile.name - - profile.properties.reject { |prop| prop.fixed? }.each do |prop| - %div{ :'data-role' => :fieldcontain} - %label{ :for => "#{prop.param}_#{profile.name}", :class => 'ui-input-text' }=prop.name - %span.radio-group-details - - if prop.kind == :enum - %select{ :size => 1, :name => prop.param } - - for v in prop.values - %option= v - = prop.unit - - elsif prop.kind == :range - %input{ :type => :range, :value => prop.first, :min => prop.first, :max => prop.last, :name => prop.param} - - else - %input{ :name => prop.param, :size => 10, :value => "#{prop.default}" } - = prop.unit + %label{ :for => profile.name, :onclick => "expandHWP('#{profile.name}');"}=profile.name + %div{ :'data-role' => :fieldcontain, :id => "property_container_#{profile.name}", :class => 'hwp_properties'} - if !@realms.empty? %div{ 'data-role' => :fieldcontain } -- 1.7.4.4