created breadcrumb

This commit is contained in:
Senad Uka
2016-02-22 03:34:10 +01:00
parent ae6f798d0f
commit 19663d6293
8 changed files with 27 additions and 11 deletions

View File

@@ -2,4 +2,5 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end

View File

@@ -1,6 +1,10 @@
class ServersController < ApplicationController
active_scaffold :server do |conf|
conf.columns = [:name, :operating_system]
conf.columns[:operating_system].form_ui = :select
end
end

View File

@@ -6,6 +6,22 @@ module ApplicationHelper
def push_command(file)
url = push_file_url(file)
%Q{ curl -F "content=@#{file.file_path}" #{url} }
%( curl -F "content=@#{file.file_path}" #{url} )
end
def breadcrumb(record)
links = [link_to('CHUB',root_path)]
case record
when Server
links << link_to(record.name,server_path(record))
when ConfigurationFile
links << link_to(record.server.name, server_path(record.server))
links << record.file_path
when FileVersion
links << link_to(record.configuration_file.server.name, server_path(record.configuration_file.server))
links << link_to( record.configuration_file.file_path,edit_configuration_file_path(record.configuration_file))
links << "v#{record.number}"
end rescue NoMethodError # i know this is wrong, but it's too late now
links.join(" > ")
end
end

View File

@@ -66,7 +66,7 @@
<td>v<%= version.number %></td>
<td><%= distance_of_time_in_words(version.updated_at, Time.now) %></td>
<td><%= button_to(file_version_path(version), method: :get, class: "btn btn-default inline") do %>
View
View Diff
<% end %>
</td>
</tr>

View File

@@ -9,8 +9,11 @@
</head>
<body>
<h1 id="logo">
CHUB
<%= raw(breadcrumb(@record)) %>
</h1>
<div>
</div>
<div class="container-fluid">
<%= yield %>
</div>

View File

@@ -18,11 +18,6 @@
<% end %><br/><br/>
</p>
<p>Or you can initialize server with chub and upload the existing files from server by pasting this into your server's terminal:</p>
<% command = "sudo wget -O /usr/local/bin/chub http://chub.saburly.com/chub && sudo chub init #{@record.namehash}" %>
<p><%= text_field_tag 'command', command, readonly: true, class: 'form-control-sm', size: command.length %></p>
</div>
<% else %>