summaryrefslogtreecommitdiff
path: root/chef-server-api/app
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2011-02-05 12:23:07 -0800
committerDaniel DeLeo <dan@opscode.com>2011-02-05 12:23:07 -0800
commit0002e3d7e9289a917693066af32355862bec8a20 (patch)
tree60c310eca5181f1f3624b0f848895bf3937db118 /chef-server-api/app
parent77d94fcfe632256f930ed2caa9197dc2cf6f6262 (diff)
downloadchef-0002e3d7e9289a917693066af32355862bec8a20.tar.gz
fix html page at root for chef-server-api
Diffstat (limited to 'chef-server-api/app')
-rw-r--r--chef-server-api/app/controllers/main.rb21
-rw-r--r--chef-server-api/app/views/layout/application.html.erb46
-rw-r--r--chef-server-api/app/views/layout/chef_server_api.html.haml23
-rw-r--r--chef-server-api/app/views/main/index.html.erb0
-rw-r--r--chef-server-api/app/views/main/index.html.haml5
5 files changed, 57 insertions, 38 deletions
diff --git a/chef-server-api/app/controllers/main.rb b/chef-server-api/app/controllers/main.rb
index f29919d31a..baae8d35bc 100644
--- a/chef-server-api/app/controllers/main.rb
+++ b/chef-server-api/app/controllers/main.rb
@@ -1,18 +1,19 @@
class Main < Application
- before :authenticate_every
provides :html, :json
def index
- display(
- {
- absolute_url(:nodes) => "Manage Nodes",
- absolute_url(:roles) => "Manage Roles",
- absolute_url(:cookbooks) => "Manage Cookbooks",
- absolute_url(:data) => "Manage Data Bags",
- absolute_url(:search) => "Search"
- }
- )
+ case content_type
+ when :json
+ display absolute_url(:nodes) => "Manage Nodes",
+ absolute_url(:roles) => "Manage Roles",
+ absolute_url(:cookbooks) => "Manage Cookbooks",
+ absolute_url(:data) => "Manage Data Bags",
+ absolute_url(:search) => "Search"
+ else
+ @webui_host_with_port = request.host[/(.*):4000/, 1] << ':4040'
+ render
+ end
end
end
diff --git a/chef-server-api/app/views/layout/application.html.erb b/chef-server-api/app/views/layout/application.html.erb
new file mode 100644
index 0000000000..33f79eaac5
--- /dev/null
+++ b/chef-server-api/app/views/layout/application.html.erb
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta content='text/html; charset=utf-8' http-equiv='content-type' />
+ <title>Chef Server</title>
+ <link href="/stylesheets/base.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
+ <link href="/stylesheets/themes/djime-cerulean/style.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
+ <link href="/stylesheets/chef.css" type="text/css" rel="Stylesheet" charset="utf-8" media="all" />
+ </head>
+ <body>
+ <div id='container'>
+ <div id='header'>
+ <h1><a href="<%= absolute_url(:top) -%>">Chef REST API</a></h1>
+ </div>
+ <div id='main-navigation'>
+ <div class='clear'></div>
+ </div>
+ <div id='wrapper'>
+ <div id='main'>
+ <div class='block' id='block-text'>
+ <div class='content'>
+ <h2 class='title'>The REST API</h2>
+ <div class='inner'>
+ This is the Chef API Server. <a href="<%= absolute_url(:top, :host => @webui_host_with_port) -%>">If you are running the WebUI with the default configuration, you can access it on port 4040.</a>
+ </div>
+ <div class='inner'>
+ For more information about Chef, head on over to the <a href="http://wiki.opscode.com/">wiki.</a>
+ </div>
+ </div>
+ </div>
+ <div id='footer'>
+ <div class='block'>
+ <p>Copyright &copy; 2009-2011 Opscode, Inc.</p>
+ </div>
+ </div>
+ </div>
+ <div id='sidebar'>
+ <div class='block notice' id='sidebar_block_notice'></div>
+ <div class='block' id='sidebar_block'></div>
+ </div>
+ <div class='clear'></div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/chef-server-api/app/views/layout/chef_server_api.html.haml b/chef-server-api/app/views/layout/chef_server_api.html.haml
deleted file mode 100644
index 3dfa4a9002..0000000000
--- a/chef-server-api/app/views/layout/chef_server_api.html.haml
+++ /dev/null
@@ -1,23 +0,0 @@
-!!! XML
-!!!
-%html
- %head
- %meta{ "http-equiv" => "content-type", :content => "text/html; charset=utf-8" }
- %title Chef Server
- = css_include_tag "base", "themes/djime-cerulean/style", "chef"
- %body
- #container
- #header
- %h1= link_to "Chef REST API", absolute_url(:top)
- #main-navigation
- .clear
- #wrapper
- #main
- = catch_content :for_layout
- #footer
- .block
- %p Copyright &copy; 2009 Opscode, Inc.
- #sidebar
- .block.notice#sidebar_block_notice= catch_content :sidebar_block_notice
- .block#sidebar_block= catch_content :sidebar_block
- .clear
diff --git a/chef-server-api/app/views/main/index.html.erb b/chef-server-api/app/views/main/index.html.erb
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/chef-server-api/app/views/main/index.html.erb
diff --git a/chef-server-api/app/views/main/index.html.haml b/chef-server-api/app/views/main/index.html.haml
deleted file mode 100644
index 4697d483f0..0000000000
--- a/chef-server-api/app/views/main/index.html.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-.block#block-text
- .content
- %h2.title The REST API
- .inner
- This is the top of the Chef Server REST API. It's not really explorable via a web browser.