Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Jonobennett/openstreetmap-website
...
head fork: Jonobennett/openstreetmap-website
  • 11 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
View
12 app/controllers/application_controller.rb
@@ -25,8 +25,16 @@ def authorize_web
@user = nil
end
- def require_user
- redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri unless @user
+ def require_user(layout = nil)
+ if layout
+ redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri , :layout => layout unless @user
+ else
+ redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri unless @user
+ end
+ end
+
+ def require_user_slim
+ require_user('slim')
end
##
View
4 app/controllers/oauth_controller.rb
@@ -1,9 +1,9 @@
class OauthController < ApplicationController
- layout 'site'
+ layout 'slim'
before_filter :authorize_web, :only => [:oauthorize, :revoke]
before_filter :set_locale, :only => [:oauthorize, :revoke]
- before_filter :require_user, :only => [:oauthorize]
+ before_filter :require_user_slim, :only => [:oauthorize]
before_filter :verify_oauth_consumer_signature, :only => [:request_token]
before_filter :verify_oauth_request_token, :only => [:access_token]
# Uncomment the following if you are using restful_open_id_authentication
View
17 app/controllers/user_controller.rb
@@ -160,6 +160,9 @@ def lost_password
flash.now[:error] = t 'user.lost_password.notice email cannot find'
end
end
+ if params[:layout] == 'slim'
+ render( :layout => 'slim' ) and return
+ end
end
def reset_password
@@ -196,6 +199,10 @@ def new
# The user is logged in already, so don't show them the signup
# page, instead send them to the home page
redirect_to :controller => 'site', :action => 'index' if session[:user]
+ if params[:layout] == 'slim'
+ @url_additional_params = {:layout => :slim}
+ render( :layout => 'slim' ) and return
+ end
end
def login
@@ -214,11 +221,11 @@ def login
# them to that unless they've also got a block on them, in
# which case redirect them to the block so they can clear it.
if user.blocked_on_view
- redirect_to user.blocked_on_view, :referer => params[:referer]
+ redirect_to user.blocked_on_view, :referer => params[:referer] and return
elsif params[:referer]
- redirect_to params[:referer]
+ redirect_to params[:referer] and return
else
- redirect_to :controller => 'site', :action => 'index'
+ redirect_to :controller => 'site', :action => 'index' and return
end
elsif user = User.authenticate(:username => email_or_display_name, :password => pass, :pending => true)
flash.now[:error] = t 'user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name)
@@ -231,6 +238,10 @@ def login
elsif flash[:notice].nil?
flash.now[:notice] = t 'user.login.notice'
end
+ if params[:layout] == 'slim'
+ @url_additional_params = {:layout => :slim}
+ render( :layout => 'slim' ) and return
+ end
end
def logout
View
23 app/helpers/user_helper.rb
@@ -1,2 +1,23 @@
module UserHelper
-end
+
+ # Taken from stackoverflow http://stackoverflow.com/questions/4216906/automatically-append-parameters-to-url-or-path-methods-rails/4228338#4228338
+ # and adapted slightly to remove dependency on Addressable module. I'm not convined it all works though
+ def url_for(options={})
+ @url_additional_params = {} unless @url_additional_params
+ options = case options
+ when String
+ query = []
+ @url_additional_params.each do |k,v|
+ query << URI::encode(k) + "=" + URI::encode(v)
+ end
+
+ options + (options.index('?').nil? ? '?' : '&') + query.join('&')
+ when Hash
+ options.reverse_merge(@url_additional_params)
+ else
+ options
+ end
+
+ super
+ end
+end
View
17 app/views/layouts/site.html.erb
@@ -10,7 +10,7 @@
<%= stylesheet_link_tag 'common' %>
<!--[if IE]><%= stylesheet_link_tag 'large', :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
<%= stylesheet_link_tag 'small', :media => "only screen and (max-width: 481px)" %>
- <%= stylesheet_link_tag 'large', :media => "screen and (min-width: 482px)" %>
+ <%= stylesheet_link_tag 'large', :media => "screen and (min-width: 482px)" %>
<%= stylesheet_link_tag 'print', :media => "print" %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
@@ -35,10 +35,9 @@
<span id="greeting">
<% if @user and @user.id %>
- <span id="full-greeting"><%= t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), {:controller => 'user', :action => 'view', :display_name => @user.display_name}, :title => t('layouts.welcome_user_link_tooltip')) %></span>
- <span id="small-greeting"><%= link_to t('layouts.welcome_user_link_tooltip'), {:controller => 'user', :action => 'view', :display_name => @user.display_name} %></span> |
+ <span id="full-greeting"><%= t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), {:controller => 'user', :action => 'view', :display_name => @user.display_name}, :title => t('layouts.welcome_user_link_tooltip')) %></span>
+ <span id="small-greeting"><%= link_to t('layouts.welcome_user_link_tooltip'), {:controller => 'user', :action => 'view', :display_name => @user.display_name} %></span> |
<%= yield :greeting %>
- <%= render :partial => "layouts/inbox" %> |
<%= link_to t('layouts.logout'), {:controller => 'user', :action => 'logout', :session => request.session_options[:id], :referer => request.request_uri}, {:id => 'logoutanchor', :title => t('layouts.logout_tooltip'), :method => :post, :href => url_for(:controller => 'user', :action => 'logout', :referer => request.request_uri)}%>
<% else %>
<%= link_to t('layouts.log_in'), {:controller => 'user', :action => 'login', :referer => request.request_uri}, {:id => 'loginanchor', :title => t('layouts.log_in_tooltip')} %> |
@@ -54,9 +53,9 @@
historyclass = ''
exportclass = ''
traceclass = ''
- viewclass = 'active' if params['controller'] == 'site' and params['action'] == 'index'
- editclass = 'active' if params['controller'] == 'site' and params['action'] == 'edit'
- historyclass = 'active' if params['controller'] == 'changeset' and params['action'] == 'list'
+ viewclass = 'active' if params['controller'] == 'site' and params['action'] == 'index'
+ editclass = 'active' if params['controller'] == 'site' and params['action'] == 'edit'
+ historyclass = 'active' if params['controller'] == 'changeset' and params['action'] == 'list'
exportclass = 'active' if params['controller'] == 'site' and params['action'] == 'export'
traceclass = 'active' if params['controller'] == 'trace'
diaryclass = 'active' if params['controller'] == 'diary_entry'
@@ -105,8 +104,8 @@
<%= t 'layouts.intro_2' %>
</p>
<p>
- <%= t 'layouts.intro_3',
- :ucl => link_to(t('layouts.intro_3_ucl'), "http://www.vr.ucl.ac.uk"),
+ <%= t 'layouts.intro_3',
+ :ucl => link_to(t('layouts.intro_3_ucl'), "http://www.vr.ucl.ac.uk"),
:bytemark => link_to(t('layouts.intro_3_bytemark'), "http://www.bytemark.co.uk"),
:partners => link_to(t('layouts.intro_3_partners'), t('layouts.intro_3_partners_url')) %>
</p>
View
44 app/views/layouts/slim.html.erb
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= I18n.locale %>" lang="<%= I18n.locale %>" dir="<%= t'html.dir' %>">
+ <head>
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
+ <%= javascript_strings %>
+ <%= javascript_include_tag 'prototype' %>
+ <%= javascript_include_tag 'site' %>
+ <%= javascript_include_tag 'menu' %>
+ <!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
+ <%= stylesheet_link_tag 'common' %>
+ <!--[if IE]><%= stylesheet_link_tag 'large', :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
+ <%= stylesheet_link_tag 'small', :media => "only screen and (max-width: 481px)" %>
+ <%= stylesheet_link_tag 'large', :media => "screen and (min-width: 482px)" %>
+ <%= stylesheet_link_tag 'print', :media => "print" %>
+ <%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %>
+ <%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
+ <%= style_rules %>
+ <%= yield :head %>
+ <title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
+ </head>
+ <body>
+
+ <div id="slim_content">
+ <% if flash[:error] %>
+ <div id="error"><%= flash[:error] %></div>
+ <% end %>
+ <% if flash[:warning] %>
+ <div id="warning"><%= flash[:warning] %></div>
+ <% end %>
+ <% if flash[:notice] %>
+ <div id="notice"><%= flash[:notice] %></div>
+ <% end %>
+
+ <%= yield %>
+ </div>
+
+ <div id="slim_header">
+ <h1><%= image_tag("osm_logo.png", :size => "60x60", :border => 0, :alt => t('layouts.logo.alt_text')) %><%= t 'layouts.project_name.h1' %></h1>
+ </div>
+
+
+
+ </body>
+</html>
View
2  app/views/user/login.html.erb
@@ -2,7 +2,7 @@
<div id="login_login">
<h1><%= t 'user.login.heading' %></h1>
- <p><%= t 'user.login.already got' %></p>
+ <p><%= t 'user.login.already have' %></p>
<% form_tag :action => 'login' do %>
<%= hidden_field_tag('referer', h(params[:referer])) %>
View
2  config/locales/en.yml
@@ -1504,7 +1504,7 @@ en:
lost password link: "Lost your password?"
login_button: "Login"
register now: Register now
- already got: Already got an OpenStreetMap account? Please login.
+ already have: Already have an OpenStreetMap account? Please login.
new to osm: New to OpenStreetMap?
to make changes: To make changes to the OpenStreetMap data, you must have an account.
create account minute: Create an account. It only takes a minute.
View
18 public/stylesheets/common.css
@@ -543,6 +543,24 @@ hr {
text-align: left;
}
+#slim_content {
+ margin: 10px;
+ position: absolute;
+ top: 90px;
+ max-width: 50em;
+}
+
+#slim_header {
+ margin: 10px;
+ background: url('../images/tab_bottom.gif') repeat-x bottom;
+}
+
+#slim_header img {
+ vertical-align: middle;
+ margin-right: 5px;
+ margin-bottom: 5px;
+}
+
/* Rules for the changeset list shown by the history tab etc */
#changeset_list, #keyvalue {

No commit comments for this range

Something went wrong with that request. Please try again.