This commit is contained in:
kyg516 2016-09-28 17:41:32 +09:00
commit e62a1eed16
2 changed files with 48 additions and 33 deletions

View File

@ -13,4 +13,50 @@ module VolumeHelper
html << "</div>" html << "</div>"
raw(html) raw(html)
end end
end
def mount_table(dir = @current_dir, id = "mount_table", class_option = "table table-striped table-bordered jambo_table")
html = String.new
html << "<table id='#{id}' class='#{class_option}'>"
html << "<thead>"
html << "<tr class='headings'>"
html << "<th>Name</th>"
html << "<th>auth</th>"
#html << "<th>Size</th>"
#html << "<th>Date</th>"
html << "<th></th>"
html << "</tr>"
html << "</thead>"
html << "<tbody id='#{id}_body'>"
html << "<tr>"
html << "<td>"
#html << "<a class='chupper' style='cursor: pointer'><i class='fa fa-reply'></i></a>"
html << "<i class='fa fa-reply'></i> <a style='cursor: pointer'> ..</a>"
html << "</td>"
html << "<td></td>"
html << "<td></td>"
#html << "<td></td>"
html << "</tr>"
files(dir).each do |file|
if file["auth"][0]=='d'
html << "<td style='color:#0d8ade;'><i class='fa fa-folder-open-o'></i>"
html << "<a class='chdir' style='cursor: pointer'> #{file['name']}</a>"
html << "</td>"
html << "<td>#{file['auth']}"
html << "</td>"
html << "<td>"
html << "<form data-parsley-validate>"
hmtl << "<input type='hidden' value='#{@current_dir}/#{file["name"]}'>"
html << "<button type='submit' class='btn btn-primary pull-right'>select</button>"
html << "</form>"
html << "</td>"
html << "</tr>"
end
end
html << "</tbody>"
html << "</table>"
return html
end
end

View File

@ -69,38 +69,7 @@
<div class="popup"> <div class="popup">
<h2> Choose mount point </h2> <h2> Choose mount point </h2>
<a class="close" href="#">&times;</a> <a class="close" href="#">&times;</a>
<table id="datatable" class="table table-striped jambo_table"> <%= raw mount_table %>
<thead>
<tr class="headings">
<th>Name</th>
<th>auth</th>
<th></th>
</tr>
</thead>
<tbody id="datatable_body">
<tr>
<td><i class="fa fa-reply"></i> <a style="cursor: pointer" onclick="change_upper('<%= @current_dir %>')"> ..</a></td>
<td></td>
<td></td>
</tr>
<% (files @current_dir).each do |t| %>
<% if t["auth"][0]=='d' %>
<tr>
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
<a style="cursor: pointer" onclick="change_directory('<%= @current_dir + "/" + t["name"] %>')"> <%= t["name"] %></a>
</td>
<td><%=t["auth"]%></td>
<td>
<form data-parsley-validate>
<input type="hidden" value='<%= @current_dir + "/" + t["name"] %>'>
<button type="submit" class="btn btn-primary pull-right">select</botton>
</form>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div> </div>
</div> </div>
<!-- page content --> <!-- page content -->