Skip to content

Commit

Permalink
Update to layout files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoernecke committed Apr 5, 2014
1 parent e8773b8 commit 68929b4
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 79 deletions.
1 change: 1 addition & 0 deletions app/controllers/ensnare/configuration_controller.rb
Expand Up @@ -2,6 +2,7 @@

module Ensnare
class ConfigurationController < ApplicationController
layout 'ensnare/dashboard'

def change_mode
if( %w[enforce disabled log].include?(params[:mode]))
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/ensnare/dashboard_controller.rb
Expand Up @@ -2,6 +2,8 @@

module Ensnare
class DashboardController < ApplicationController
layout 'ensnare/dashboard'

def mode
#render mode erb, read config file and toggle switches
@mode = Ensnare.mode
Expand Down
1 change: 1 addition & 0 deletions app/controllers/ensnare/violations_controller.rb
Expand Up @@ -6,6 +6,7 @@ module Ensnare
class ViolationsController < ApplicationController
before_filter :ensnare, :only=>:routing_error
skip_before_filter :check_privileges
layout 'ensnare/application'

def redirect
redirect_to redir_url(:id=>Random.rand(1000000))
Expand Down
78 changes: 1 addition & 77 deletions app/views/layouts/ensnare/application.html.erb
@@ -1,77 +1 @@
<!DOCTYPE html>
<!-- saved from url=(0060)http://getbootstrap.com/2.3.2/examples/starter-template.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) : "Ensnare" %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Ensnare">
<meta name="author" content="Andy Hoernecke and Scott Behrens">


<%= stylesheet_link_tag "ensnare/application", :media => "all" %>
<%= javascript_include_tag "ensnare/application" %>

<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>



<!-- Fav and touch icons -->
<!-- Size should be 144 x 144 pixels -->
<%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>

<!-- For iPhone with high-resolution Retina display: -->
<!-- Size should be 114 x 114 pixels -->
<%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>

<!-- For first- and second-generation iPad: -->
<!-- Size should be 72 x 72 pixels -->
<%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>

<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<!-- Size should be 57 x 57 pixels -->
<%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>

<!-- For all other devices -->
<!-- Size should be 32 x 32 pixels -->
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">

<a class="brand" href="http://getbootstrap.com/2.3.2/examples/starter-template.html#">Ensnare</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><%= link_to('Mode', mode_path) %> </li>
<li class=""><%= link_to('Configuration', configs_path) %> </li>
<li class=""><%= link_to('Metrics', metrics_path) %> </li>
<li class=""><%= link_to('Violations', dashboard_violations_path) %> </li>
<li class=""></li>

</ul>
<div class="pull-right">
<% if Ensnare.mode == :enforce %>
<button type="button" class="btn btn-success disabled" id="activated" value="Save">
<span class="glyphicon icon-thumbs-up" id="iconed"> Ensnare Activated</span>
<% elsif Ensnare.mode == :log %>
<button type="button" class="btn btn-warning disabled" id="activated" value="Save">
<span class="glyphicon icon-pencil" id="iconed"> Log Only</span>
<% elsif Ensnare.mode == :disabled %>
<button type="button" class="btn btn-danger disabled" id="activated" value="Save">
<span class="glyphicon icon-thumbs-down" id="iconed"> Ensnare Disabled</span>
<% end %>
</button>
</div>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
</div>
<%= yield %>
</body></html>
<%= yield %>
77 changes: 77 additions & 0 deletions app/views/layouts/ensnare/dashboard.html.erb
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<!-- saved from url=(0060)http://getbootstrap.com/2.3.2/examples/starter-template.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title><%= content_for?(:title) ? yield(:title) : "Ensnare" %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Ensnare">
<meta name="author" content="Andy Hoernecke and Scott Behrens">


<%= stylesheet_link_tag "ensnare/application", :media => "all" %>
<%= javascript_include_tag "ensnare/application" %>

<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>



<!-- Fav and touch icons -->
<!-- Size should be 144 x 144 pixels -->
<%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>

<!-- For iPhone with high-resolution Retina display: -->
<!-- Size should be 114 x 114 pixels -->
<%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>

<!-- For first- and second-generation iPad: -->
<!-- Size should be 72 x 72 pixels -->
<%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>

<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<!-- Size should be 57 x 57 pixels -->
<%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>

<!-- For all other devices -->
<!-- Size should be 32 x 32 pixels -->
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">

<a class="brand" href="http://getbootstrap.com/2.3.2/examples/starter-template.html#">Ensnare</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><%= link_to('Mode', mode_path) %> </li>
<li class=""><%= link_to('Configuration', configs_path) %> </li>
<li class=""><%= link_to('Metrics', metrics_path) %> </li>
<li class=""><%= link_to('Violations', dashboard_violations_path) %> </li>
<li class=""></li>

</ul>
<div class="pull-right">
<% if Ensnare.mode == :enforce %>
<button type="button" class="btn btn-success disabled" id="activated" value="Save">
<span class="glyphicon icon-thumbs-up" id="iconed"> Ensnare Activated</span>
<% elsif Ensnare.mode == :log %>
<button type="button" class="btn btn-warning disabled" id="activated" value="Save">
<span class="glyphicon icon-pencil" id="iconed"> Log Only</span>
<% elsif Ensnare.mode == :disabled %>
<button type="button" class="btn btn-danger disabled" id="activated" value="Save">
<span class="glyphicon icon-thumbs-down" id="iconed"> Ensnare Disabled</span>
<% end %>
</button>
</div>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
</div>
<%= yield %>
</body></html>
2 changes: 1 addition & 1 deletion test/dummy/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: ../../
specs:
ensnare (0.0.1)
ensnare (0.1beta)
rails (~> 3.2.14)
twitter-bootstrap-rails

Expand Down
3 changes: 2 additions & 1 deletion test/dummy/config/initializers/ensnare.rb
Expand Up @@ -229,7 +229,8 @@
# Example 1:
config.thresholds << {:timer=>60, :trap_count=>1,
:traps=>[
{:trap=>"flash_error" }
{:trap=>"random_content", :weight=>10, :min_size=>500, :max_size=>5000 },
{:trap=>"captcha", :persist=>true }
]}

# This violation threshold group will run first and for 600 seconds if the violation count reaches 5 or higher. Each time a trap is triggered,
Expand Down

0 comments on commit 68929b4

Please sign in to comment.