diff --git a/market/config/appmarket-server.conf b/market/config/appmarket-server.conf
index cd9d300310..5df7d4dcef 100644
--- a/market/config/appmarket-server.conf
+++ b/market/config/appmarket-server.conf
@@ -21,6 +21,18 @@
db_host: localhost
db_port: 27017
+# Define this parameter if the AppMarket is running under a reverse proxy
+# Example: Apache
+#
+# ...
+# ProxyPass /market/ http://localhost:6242/
+# ProxyPassReverse /market/ http://localhost:6242/
+#
+#
+# :proxy_path: '/market/'
+#
+:proxy_path: '/'
+
# Admin credentials. This will be the user that will be used in the
# bootstrap process the first time the server is started
user:
diff --git a/market/controllers/appmarket-server.rb b/market/controllers/appmarket-server.rb
index 36db0a4d4e..ca600eaf00 100644
--- a/market/controllers/appmarket-server.rb
+++ b/market/controllers/appmarket-server.rb
@@ -63,6 +63,8 @@ configure do
set :bind, CONF[:host]
set :port, CONF[:port]
+ set :root_path, (CONF[:proxy_path]||'/')
+
set :config, CONF
end
@@ -84,7 +86,7 @@ end
before do
if request.env['PATH_INFO'] == '/'
- redirect '/appliance'
+ redirect to(settings.root_path + 'appliance')
end
if request.path != '/login' && request.path != '/logout'
@@ -98,7 +100,7 @@ before do
if request.env["HTTP_ACCEPT"] && request.env["HTTP_ACCEPT"].split(',').grep(/text\/html/).empty?
error 401, "User not authorized"
else
- redirect '/appliance'
+ redirect to(settings.root_path + 'appliance')
end
end
end
@@ -115,7 +117,7 @@ end
post '/logout' do
session.clear
- redirect '/appliance'
+ redirect to(settings.root_path + 'appliance')
end
#
diff --git a/market/views/appliance_index.haml b/market/views/appliance_index.haml
index 11f06afb7a..4b8377df5f 100644
--- a/market/views/appliance_index.haml
+++ b/market/views/appliance_index.haml
@@ -87,7 +87,7 @@
"sDom": "t<'row'<'span6'i><'span6'p>>",
"bProcessing": false,
"sPaginationType": "bootstrap",
- "sAjaxSource": "/appliance",
+ "sAjaxSource": "appliance",
"sAjaxDataProp": "appliances",
"bAutoWidth": false,
"iDisplayLength": 50,
diff --git a/market/views/appliance_show.haml b/market/views/appliance_show.haml
index 2be5279569..447ed90994 100644
--- a/market/views/appliance_show.haml
+++ b/market/views/appliance_show.haml
@@ -16,7 +16,7 @@
.navbar.navbar-static
.navbar-inner
.container
- %a.brand{'href' => "/"} Appliances
+ %a.brand{'href' => "#{settings.root_path}appliance"} Appliances
= haml :nav_login
.container-fluid
@@ -24,7 +24,7 @@
.span8
.brand= @app['name']
.span4
- %a.pull-right{'href' => "/"}
+ %a.pull-right{'href' => "#{settings.root_path}appliance"}
%i.icon-search.icon-arrow-left
Click to go back
.row-fluid
@@ -157,7 +157,7 @@
url: "#",
type: "DELETE",
success: function(){
- window.location.href = "/";
+ window.location.reload();
},
error: function(){
return true;
diff --git a/market/views/custom/banner.haml b/market/views/custom/banner.haml
index 5f242917f9..79ff2577a1 100644
--- a/market/views/custom/banner.haml
+++ b/market/views/custom/banner.haml
@@ -29,15 +29,13 @@
%p
%a{'data-toggle' => 'modal', 'href' => '#post_your_appliance_banner'} Learn more
.span4
- :plain
-
Integrated in OpenNebula
-
+ %h1
+ %i.icon-retweet.icon-white
+ Integrated in OpenNebula
+ %ul.thumbnails
+ %li
+ %a.thumbnail.span10{'target'=>'blank', 'href'=>'http://www.opennebula.org/documentation:documentation:marketplace'}
+ %img{'src'=>"#{settings.root_path}img/marketsunstone.png", 'alt'=>''}
.modal.hide.fade#appliance_banner
.modal-header
diff --git a/market/views/custom/logos.haml b/market/views/custom/logos.haml
index 5f4b8b55e3..b8d71641fc 100644
--- a/market/views/custom/logos.haml
+++ b/market/views/custom/logos.haml
@@ -14,6 +14,6 @@
//--------------------------------------------------------------------------//
%a.span4{'href' => "http://www.opennebula.org/"}
- %img{'src' => "/img/opennebula_gray.png"}
+ %img{'src' => "#{settings.root_path}img/opennebula_gray.png"}
%a.pull-right{'href' => "http://www.c12g.com/"}
- %img{'src' => "/img/c12g.png"}
\ No newline at end of file
+ %img{'src' => "#{settings.root_path}img/c12g.png"}
\ No newline at end of file
diff --git a/market/views/layout.haml b/market/views/layout.haml
index 27f241b42f..c3c66100c7 100644
--- a/market/views/layout.haml
+++ b/market/views/layout.haml
@@ -17,14 +17,14 @@
%html{:lang => "en"}
%head
%meta{:charset => "utf-8"}
- %script{:type => "text/javascript", :src => "/js/jquery-1.7.2.min.js"}
- %script{:type => "text/javascript", :src => "/js/jquery.dataTables.min.js"}
- %script{:type => "text/javascript", :src => "/js/bootstrap.min.js"}
- %script{:type => "text/javascript", :src => "/js/market.js"}
- %link{:rel=>'stylesheet', :href=>'/css/bootstrap.min.css', :type => "text/css"}
- %link{:rel=>'stylesheet', :href=>'/css/market.css', :type => "text/css"}
- %link{:rel=>'stylesheet', :href=>'/css/font-awesome.css', :type => "text/css"}
- %link{:rel => "icon", :type => "image/png", :href => "/favicon.ico"}
+ %script{:type => "text/javascript", :src => "#{settings.root_path}js/jquery-1.7.2.min.js"}
+ %script{:type => "text/javascript", :src => "#{settings.root_path}js/jquery.dataTables.min.js"}
+ %script{:type => "text/javascript", :src => "#{settings.root_path}js/bootstrap.min.js"}
+ %script{:type => "text/javascript", :src => "#{settings.root_path}js/market.js"}
+ %link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/bootstrap.min.css", :type => "text/css"}
+ %link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/market.css", :type => "text/css"}
+ %link{:rel=>'stylesheet', :href=>"#{settings.root_path}css/font-awesome.css", :type => "text/css"}
+ %link{:rel => "icon", :type => "#{settings.root_path}image/png", :href => "/favicon.ico"}
%body
.container
diff --git a/market/views/nav_login.haml b/market/views/nav_login.haml
index f4d94a19a5..28e017b9cf 100644
--- a/market/views/nav_login.haml
+++ b/market/views/nav_login.haml
@@ -53,7 +53,7 @@
%a{'data-toggle' => 'modal', 'href' => '#create_app'} Create new Appliance
- if @session.admin?
%li
- %a{'href' => '/user'} Manage Users
+ %a{'href' => 'user'} Manage Users
%li.divider
%li
%input.btn.btn-danger.pull-right#logout_btn{'type' => 'button', "value" => "Sign out"}
@@ -105,11 +105,11 @@
$(document).ready(function() {
$("#create_app_form").submit(function (){
$.ajax({
- url: "/appliance",
+ url: "appliance",
type: "POST",
data: JSON.stringify($("#create_app_form").serializeObject()),
success: function(){
- window.location.href = "/";
+ window.location.reload();
},
error: function(response){
alert(response.responseText);
@@ -137,7 +137,7 @@
}
$.ajax({
- url: "/user",
+ url: "user",
type: "POST",
data: JSON.stringify($("form").serializeObject()),
success: function(){
@@ -160,14 +160,14 @@
var remember = $("#user_remember_me").is(":checked");
$.ajax({
- url: "/login",
+ url: "login",
type: "POST",
data: {remember: remember},
beforeSend : function(req) {
req.setRequestHeader( "Authorization", "Basic " + btoa(username + ":" + password))
},
success: function(){
- window.location.href = "/";
+ window.location.reload();
},
error: function(response){
alert("The username or password you entered is incorrect");
@@ -181,10 +181,10 @@
$("#logout_btn").click(function (){
$.ajax({
- url: "/logout",
+ url: "logout",
type: "POST",
success: function(){
- window.location.href = "/";
+ window.location.reload();
},
error: function(){
return true;
diff --git a/market/views/user_index.haml b/market/views/user_index.haml
index 28ccd3165a..455ad926a4 100644
--- a/market/views/user_index.haml
+++ b/market/views/user_index.haml
@@ -16,7 +16,7 @@
.navbar.navbar-static
.navbar-inner
.container
- %a.brand{'href' => "/"} Appliances
+ %a.brand{'href' => "#{settings.root_path}appliance"} Appliances
= haml :nav_login
%table{'class' => "table table-striped", 'id' => "users"}
@@ -38,7 +38,7 @@
"sDom": "t<'row'<'span6'i><'span6'p>>",
"bProcessing": false,
"sPaginationType": "bootstrap",
- "sAjaxSource": "/user",
+ "sAjaxSource": "user",
"sAjaxDataProp": "users",
"bAutoWidth": false,
"iDisplayLength": 50,
@@ -51,7 +51,7 @@
{ "mDataProp": "status" },
{ "mDataProp": "_id.$oid",
"fnRender": function ( o ) {
- more_info = ''+
+ more_info = ''+
''+
' More Info'
return more_info
diff --git a/market/views/user_show.haml b/market/views/user_show.haml
index 676aa20513..739f02fa92 100644
--- a/market/views/user_show.haml
+++ b/market/views/user_show.haml
@@ -16,12 +16,12 @@
.navbar.navbar-static
.navbar-inner
.container
- %a.brand{'href' => "/user"} Users
+ %a.brand{'href' => "#{settings.root_path}user"} Users
= haml :nav_login
.container-fluid
.row-fluid
- %a.pull-right{'href' => "/user"}
+ %a.pull-right{'href' => "#{settings.root_path}user"}
%i.icon-search.icon-arrow-left
Click to go back
.row-fluid
@@ -108,7 +108,7 @@
url: "#",
type: "DELETE",
success: function(){
- window.location.href = "/user";
+ history.go(-1)
},
error: function(response){
alert(response.responseText);