diff --git a/api_taster.gemspec b/api_taster.gemspec
index 4405d68..5728a79 100644
--- a/api_taster.gemspec
+++ b/api_taster.gemspec
@@ -16,8 +16,9 @@ Gem::Specification.new do |s|
s.add_dependency 'rails', '>= 3.1.0'
s.add_dependency 'jquery-rails'
- s.add_dependency 'sass-rails'
- s.add_dependency 'bootstrap-sass', '~> 2.1'
+ s.add_dependency 'sass-rails', '~> 3.2'
+ s.add_dependency 'bootstrap-sass', '~> 2.2.2.0'
+
s.add_dependency 'redcarpet'
s.add_dependency 'remotipart', '~> 1.0'
diff --git a/app/controllers/api_taster/routes_controller.rb b/app/controllers/api_taster/routes_controller.rb
index e5d8678..414aa99 100644
--- a/app/controllers/api_taster/routes_controller.rb
+++ b/app/controllers/api_taster/routes_controller.rb
@@ -1,11 +1,10 @@
module ApiTaster
class RoutesController < ApiTaster::ApplicationController
before_filter :map_routes
+ helper_method :missing_definitions?, :obsolete_definitions?
def index
@routes = Route.grouped_routes
- @has_missing_definitions = Route.missing_definitions.present?
- @has_obsolete_definitions = Route.obsolete_definitions.present?
end
def show
@@ -27,5 +26,13 @@ def obsolete_definitions
def map_routes
Route.map_routes
end
+
+ def missing_definitions?
+ Route.missing_definitions.present? && ApiTaster.config.include_missing_definitions
+ end
+
+ def obsolete_definitions?
+ Route.obsolete_definitions.present? && ApiTaster.config.include_obsolete_definitions
+ end
end
end
diff --git a/app/views/api_taster/routes/index.html.erb b/app/views/api_taster/routes/index.html.erb
index 8e99942..e09c9a2 100644
--- a/app/views/api_taster/routes/index.html.erb
+++ b/app/views/api_taster/routes/index.html.erb
@@ -2,19 +2,17 @@
- <% if @has_missing_definitions || @has_obsolete_definitions %>
+ <% if missing_definitions? || obsolete_definitions? %>
- <% if @has_missing_definitions %>
+ <% if missing_definitions? %>
<%= render 'information_warning_li',
:text => 'Missing Definitions Detected',
- :path => missing_definitions_routes_path
- %>
+ :path => missing_definitions_routes_path %>
<% end %>
- <% if @has_obsolete_definitions %>
+ <% if obsolete_definitions? %>
<%= render 'information_warning_li',
:text => 'Obsolete Definitions Detected',
- :path => obsolete_definitions_routes_path
- %>
+ :path => obsolete_definitions_routes_path %>
<% end %>
<% end %>
<% @routes.each do |controller, routes| %>
@@ -23,7 +21,9 @@
-
- <%= route[:verb] %>
+
+ <%= route[:verb] %>
+
<%= route[:path] %>
@@ -36,7 +36,7 @@
-
Select an API endpoint on the left to get started. :)
+ <%= ApiTaster.config.call_to_action %>
diff --git a/app/views/layouts/api_taster/application.html.erb b/app/views/layouts/api_taster/application.html.erb
index 3251c50..dfa8ce9 100644
--- a/app/views/layouts/api_taster/application.html.erb
+++ b/app/views/layouts/api_taster/application.html.erb
@@ -11,12 +11,17 @@
- - API Taster
+ -
+ <%= link_to ApiTaster.config.title, root_path, class: 'brand' %>
+
diff --git a/lib/api_taster.rb b/lib/api_taster.rb
index 7add34f..5b0f7e8 100644
--- a/lib/api_taster.rb
+++ b/lib/api_taster.rb
@@ -2,6 +2,7 @@
require 'bootstrap-sass'
require 'remotipart'
require 'active_support/dependencies'
+require 'api_taster/config'
require 'api_taster/engine'
require 'api_taster/route'
require 'api_taster/mapper'
diff --git a/lib/api_taster/config.rb b/lib/api_taster/config.rb
new file mode 100644
index 0000000..e1d9c47
--- /dev/null
+++ b/lib/api_taster/config.rb
@@ -0,0 +1,45 @@
+require 'active_support/configurable'
+
+module ApiTaster
+ # Configures global settings for ApiTaster
+ # ApiTaster.configure do |config|
+ # config.title = 'My Application Name'
+ # end
+ def self.configure(&block)
+ yield @config ||= ApiTaster::Configuration.new
+ end
+
+ # Global settings for ApiTaster
+ def self.config
+ @config
+ end
+
+ class Configuration
+ include ActiveSupport::Configurable
+
+ config_accessor :title
+ config_accessor :call_to_action
+ config_accessor :app_title
+ config_accessor :app_url
+ config_accessor :include_missing_definitions
+ config_accessor :include_obsolete_definitions
+
+ def param_name
+ config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
+ end
+
+ # define param_name writer (copied from AS::Configurable)
+ writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
+ singleton_class.class_eval writer, __FILE__, line
+ class_eval writer, __FILE__, line
+ end
+
+ configure do |config|
+ config.title = 'API Taster'
+ config.call_to_action = 'Select an API endpoint on the left to get started. :)'
+ config.app_title = 'Application'
+ config.app_url = '/'
+ config.include_missing_definitions = true
+ config.include_obsolete_definitions = true
+ end
+end