diff --git a/web/Gemfile b/web/Gemfile index 6c01f86..86fb28c 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -26,7 +26,6 @@ gem 'active_scaffold' gem 'bootstrap', '~> 4.0.0.alpha3' gem 'ace-rails-ap' gem 'puma' -gem 'breadcrumbs_on_rails' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' diff --git a/web/Gemfile.lock b/web/Gemfile.lock index f227892..da41155 100644 --- a/web/Gemfile.lock +++ b/web/Gemfile.lock @@ -50,7 +50,6 @@ GEM bootstrap (4.0.0.alpha3) autoprefixer-rails (>= 6.0.3) sass (>= 3.4.19) - breadcrumbs_on_rails (2.3.1) builder (3.2.2) byebug (8.2.2) coffee-rails (4.1.1) @@ -171,7 +170,6 @@ DEPENDENCIES ace-rails-ap active_scaffold bootstrap (~> 4.0.0.alpha3) - breadcrumbs_on_rails byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) diff --git a/web/app/controllers/application_controller.rb b/web/app/controllers/application_controller.rb index d83690e..2ec37e2 100644 --- a/web/app/controllers/application_controller.rb +++ b/web/app/controllers/application_controller.rb @@ -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 diff --git a/web/app/controllers/servers_controller.rb b/web/app/controllers/servers_controller.rb index 3d96d9a..7e2f2ec 100644 --- a/web/app/controllers/servers_controller.rb +++ b/web/app/controllers/servers_controller.rb @@ -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 diff --git a/web/app/helpers/application_helper.rb b/web/app/helpers/application_helper.rb index 20dafa1..45005fd 100644 --- a/web/app/helpers/application_helper.rb +++ b/web/app/helpers/application_helper.rb @@ -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 diff --git a/web/app/views/configuration_files/update.html.erb b/web/app/views/configuration_files/update.html.erb index 6d9e9da..89a1617 100644 --- a/web/app/views/configuration_files/update.html.erb +++ b/web/app/views/configuration_files/update.html.erb @@ -66,7 +66,7 @@ v<%= version.number %> <%= distance_of_time_in_words(version.updated_at, Time.now) %> <%= button_to(file_version_path(version), method: :get, class: "btn btn-default inline") do %> - View + View Diff <% end %> diff --git a/web/app/views/layouts/application.html.erb b/web/app/views/layouts/application.html.erb index fa9b2c0..4b53c14 100644 --- a/web/app/views/layouts/application.html.erb +++ b/web/app/views/layouts/application.html.erb @@ -9,8 +9,11 @@

-CHUB + <%= raw(breadcrumb(@record)) %>

+
+ +
<%= yield %>
diff --git a/web/app/views/servers/show.html.erb b/web/app/views/servers/show.html.erb index 73a0aa7..87a0eb6 100644 --- a/web/app/views/servers/show.html.erb +++ b/web/app/views/servers/show.html.erb @@ -18,11 +18,6 @@ <% end %>

-

Or you can initialize server with chub and upload the existing files from server by pasting this into your server's terminal:

- - <% command = "sudo wget -O /usr/local/bin/chub http://chub.saburly.com/chub && sudo chub init #{@record.namehash}" %> - -

<%= text_field_tag 'command', command, readonly: true, class: 'form-control-sm', size: command.length %>

<% else %>