Skip to content

Commit

Permalink
Show the unallocated space in select partition step
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedKamal1432 committed Aug 18, 2015
1 parent 5410807 commit 215512e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 27 deletions.
37 changes: 24 additions & 13 deletions app/views/disk_wizard/manage_disk.html.erb
Expand Up @@ -29,24 +29,35 @@
</div>
</div>
</li>
<li class="list-group-item">
<div class="checkbox">
<%= radio_button_tag('option[]', "1", !!((user_selections['option'].include? '1') rescue false), class: 'mount_check') %>
<div class="alert alert-info">
<label for="option_"> Mount this drive automatically.</label>
<div style="<%= !!((user_selections['option'].include? '1') rescue false) ? nil : 'display: none' %>" id="label_input" class="input-group input-group-sm">
<span class="input-group-addon">Enter a label</span>
<input style="margin: auto;" type="text" name="label" id="label" class="form-control" placeholder="Label" value="<%= user_selections['label'] || nil %>">
<% unless (user_selections['path'].match(/^\/dev/).blank?) %> <!-- the selected partition is allocated -->
<li class="list-group-item">
<div class="checkbox">
<%= radio_button_tag('option[]', "1", !!((user_selections['option'].include? '1') rescue false), class: 'mount_check') %>
<div class="alert alert-info">
<label for="option_"> Mount this drive automatically.</label>
<div style="<%= !!((user_selections['option'].include? '1') rescue false) ? nil : 'display: none' %>" id="label_input" class="input-group input-group-sm">
<span class="input-group-addon">Enter a label</span>
<input style="margin: auto;" type="text" name="label" id="label" class="form-control" placeholder="Label" value="<%= user_selections['label'] || nil %>">
</div>
</div>
</div>
</li>
<% if user_selections['format'].blank?%>
<li class="list-group-item">
<div class="checkbox">
<%= radio_button_tag('option[]', "2", !!((user_selections['option'].include? '2') rescue false)) %>
<div class="alert alert-info">
<label > Delete this partition</label>
</div>
</div>
</div>
</li>
<% if user_selections['format'].blank?%>
</li>
<% end %>
<% else %>
<li class="list-group-item">
<div class="checkbox">
<%= radio_button_tag('option[]', "2", !!((user_selections['option'].include? '2') rescue false)) %>
<%= radio_button_tag('option[]', "3", !!((user_selections['option'].include? '2') rescue false)) %>
<div class="alert alert-info">
<label > Delete this partition</label>
<label > create new partition</label>
</div>
</div>
</li>
Expand Down
38 changes: 24 additions & 14 deletions app/views/disk_wizard/select_fs.html.erb
Expand Up @@ -204,21 +204,31 @@

<%
unless device.partitions.blank?
for partition in device.partitions %>
<tr style="position: relative;cursor: pointer;" path="<%= partition.path %>" data-toggle="context" data-target="#contextMenu" class=<%= !!(user_selections['path'] == partition.path rescue false) ? "info context" : "context" %>>
<td title="Mount point"> <%= partition.mountpoint || "No mount point" %> </td>
<td title="Disk name"> <%= partition.label %> </td>
<td>
<% if partition.fstype.nil? %> <span class='glyphicon glyphicon-warning-sign'></span> Unknown
<% else %>
<%= partition.fstype %>
<% end %> </td>
device.partitions.each.with_index do |partition, idx| %>
<% if partition.allocated %>
<tr style="position: relative;cursor: pointer;" path="<%= partition.path %>" data-toggle="context" data-target="#contextMenu" class=<%= !!(user_selections['path'] == partition.path rescue false) ? "info context" : "context" %>>
<td title="Mount point"> <%= partition.mountpoint || "No mount point" %> </td>
<td title="Disk name"> <%= partition.label %> </td>
<td>
<% if partition.fstype.nil? %> <span class='glyphicon glyphicon-warning-sign'></span> Unknown
<% else %>
<%= partition.fstype %>
<% end %> </td>

<td title="Total size"> <%= number_to_human_size partition.size %> </td>
<td>
<label> <%= check_box_tag(:format, 1, !!(user_selections['format'] && (user_selections['path'] == partition.path) rescue false), class: 'format') %> </label>
</td>
</tr>
<td title="Total size"> <%= number_to_human_size partition.size %> </td>
<td>
<label> <%= check_box_tag(:format, 1, !!(user_selections['format'] && (user_selections['path'] == partition.path) rescue false), class: 'format') %> </label>
</td>
</tr>
<% else %>
<tr style="position: relative;cursor: pointer;" data-toggle="context" data-target="#contextMenu" path="<%= partition.identifier %>" class=<%= !!(user_selections['path'] == partition.path rescue false) ? "info context" : "context" %>>
<td> <span class="text-info"> Free space </span></td>
<td> <span class="text-info"> Free space </span></td>
<td> <span class="text-info"> Free space </span></td>
<td title="Total size"> <%= number_to_human_size partition.size %> </td>
<td></td>
</tr>
<% end %>
<% end %>
<% end %>
<tr style="position: relative;cursor: pointer;" class=<%= !!(user_selections['format'] && (user_selections['partition'] == device.path) rescue false) ? "danger" : "warning" %> path="<%= device.path %>" >
Expand Down

0 comments on commit 215512e

Please sign in to comment.