From af68536f35dd5f0a45e2daec1a4aa45ac819f31a Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Tue, 18 Oct 2011 14:06:09 -0700 Subject: [PATCH] twaks, fixes --- app/controllers/hosts_controller.rb | 4 ++++ app/models/a.rb | 2 +- app/views/devise/registrations/edit.html.erb | 2 ++ app/views/fragments/_bottom.html.erb | 4 +++- app/views/fragments/_top.html.erb | 3 --- config/locales/en.yml | 3 +++ 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 376314c..ff48fae 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -25,6 +25,10 @@ class HostsController < ApplicationController record end + def beginning_of_chain + super.includes(:domain).where(:domains => {:name => Settings.host_domains}) + end + def before_create_save(record) record.user = current_user end diff --git a/app/models/a.rb b/app/models/a.rb index 39be01f..0b58de7 100644 --- a/app/models/a.rb +++ b/app/models/a.rb @@ -15,7 +15,7 @@ class A < Record validates :content, :presence => true, :ip => {:ip_type => :v4} # Only accept valid IPv4 addresses attr_accessor :host_domain - validates :host_domain, :inclusion => {:in => Settings.host_domains} + validates :host_domain, :inclusion => {:in => Settings.host_domains}, :allow_blank => true before_validation do if host_domain.present? && Settings.host_domains.include?(host_domain) diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index f7ffeba..685fa99 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -32,6 +32,8 @@ <%= link_to "Back", :back %>
+
+

Danger zone

diff --git a/app/views/fragments/_bottom.html.erb b/app/views/fragments/_bottom.html.erb index 49dd432..1c787c6 100644 --- a/app/views/fragments/_bottom.html.erb +++ b/app/views/fragments/_bottom.html.erb @@ -1,10 +1,12 @@

diff --git a/app/views/fragments/_top.html.erb b/app/views/fragments/_top.html.erb index c7fabdd..8e5b371 100644 --- a/app/views/fragments/_top.html.erb +++ b/app/views/fragments/_top.html.erb @@ -19,9 +19,6 @@
    <% if user_signed_in? %> -
  • <%= link_to('About', page_path('about'), :data => {:pjax => '#main'}) %>
  • -
  • <%= link_to('Team', page_path('team'), :data => {:pjax => '#main'}) %>
  • -
  • <%= link_to('Contact', page_path('contact'), :data => {:pjax => '#main'}) %>
  • <%= link_to('Help & Support', page_path('help'), :data => {:pjax => '#main'}) %>
  • <%= link_to(current_user.email, edit_user_registration_path, :title => "IP: #{client_remote_ip}", :data => {:pjax => '#main'}) %>
  • <%= link_to('Sign out', destroy_user_session_path, :method => :delete) %>
  • diff --git a/config/locales/en.yml b/config/locales/en.yml index 91a7231..324e227 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,6 +4,9 @@ en: errors: action_not_allowed: "Action not allowed" + messages: + ipv4: "must be a valid IPV4" + ipv6: "must be a valid IPV6" activerecord: models: soa: "SOA Record"