From: Tom Hughes Date: Tue, 20 Nov 2012 19:08:30 +0000 (+0000) Subject: Merge branch 'master' into notes X-Git-Tag: live~6181^2~71 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/7599f98957334d1924550205f7ba12a726de7eb0?hp=9f560df39d21a82b7c34e203c555da7fab01a3ae Merge branch 'master' into notes Conflicts: Gemfile Gemfile.lock app/assets/stylesheets/common.css.scss app/helpers/application_helper.rb --- diff --git a/Gemfile b/Gemfile index ce13c6532..4b2d2ba9e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'http://rubygems.org' # Require rails -gem 'rails', '3.2.8' +gem 'rails', '3.2.9' # Require things which have moved to gems in ruby 1.9 gem 'bigdecimal', :platforms => :ruby_19 @@ -13,6 +13,9 @@ gem 'pg' # Load jquery support gem 'jquery-rails' +# Load R2 for RTL conversion +gem 'r2' + # Load rails plugins gem 'rails-i18n', ">= 0.6.3" gem 'dynamic_form' @@ -25,6 +28,7 @@ gem 'http_accept_language', '>= 1.0.2' gem 'paperclip', '~> 2.0' gem 'deadlock_retry', '>= 1.2.0' gem 'i18n-js', '>= 3.0.0.rc2' +gem 'rack-cors' gem 'jsonify-rails' # We need ruby-openid 2.2.0 or later for ruby 1.9 support diff --git a/Gemfile.lock b/Gemfile.lock index 23eeceb19..eafd5d341 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,44 +2,44 @@ GEM remote: http://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (3.2.8) - actionpack (= 3.2.8) + actionmailer (3.2.9) + actionpack (= 3.2.9) mail (~> 2.4.4) - actionpack (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + actionpack (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) rack (~> 1.4.0) rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.3) - activemodel (3.2.8) - activesupport (= 3.2.8) + sprockets (~> 2.2.1) + activemodel (3.2.9) + activesupport (= 3.2.9) builder (~> 3.0.0) - activerecord (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + activerecord (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - activesupport (3.2.8) + activeresource (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) + activesupport (3.2.9) i18n (~> 0.6) multi_json (~> 1.0) arel (3.0.2) bigdecimal (1.1.0) - builder (3.0.3) - cocaine (0.4.0) + builder (3.0.4) + cocaine (0.4.2) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.3.3) + coffee-script-source (1.4.0) composite_primary_keys (5.0.9) activerecord (~> 3.2.0, >= 3.2.8) deadlock_retry (1.2.0) @@ -56,7 +56,7 @@ GEM httpauth (0.2.0) httpclient (2.3.0.1) i18n (0.6.1) - i18n-js (3.0.0.rc2) + i18n-js (3.0.0.rc3) i18n iconv (0.1) journey (1.0.4) @@ -79,8 +79,8 @@ GEM treetop (~> 1.4.8) memcached (1.4.6) mime-types (1.19) - minitest (4.1.0) - multi_json (1.3.6) + minitest (4.3.0) + multi_json (1.3.7) multipart-post (1.1.5) nokogiri (1.5.5) oauth (0.4.7) @@ -104,9 +104,12 @@ GEM mime-types pg (0.14.1) polyglot (0.3.3) + r2 (0.0.3) rack (1.4.1) rack-cache (1.2) rack (>= 0.4) + rack-cors (0.2.7) + rack rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) @@ -114,49 +117,50 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.8) - actionmailer (= 3.2.8) - actionpack (= 3.2.8) - activerecord (= 3.2.8) - activeresource (= 3.2.8) - activesupport (= 3.2.8) + rails (3.2.9) + actionmailer (= 3.2.9) + actionpack (= 3.2.9) + activerecord (= 3.2.9) + activeresource (= 3.2.9) + activesupport (= 3.2.9) bundler (~> 1.0) - railties (= 3.2.8) - rails-i18n (0.6.6) + railties (= 3.2.9) + rails-i18n (0.7.0) i18n (~> 0.5) - railties (3.2.8) - actionpack (= 3.2.8) - activesupport (= 3.2.8) + railties (3.2.9) + actionpack (= 3.2.9) + activesupport (= 3.2.9) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (0.9.2.2) + rake (10.0.2) rdoc (3.12) json (~> 1.4) - redcarpet (2.2.1) + redcarpet (2.2.2) rinku (1.7.2) - ruby-openid (2.2.1) + ruby-openid (2.2.2) sanitize (2.0.3) nokogiri (>= 1.4.4, < 1.6) - sass (3.2.1) + sass (3.2.3) sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - sprockets (2.1.3) + sprockets (2.2.1) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) therubyracer (0.10.2) libv8 (~> 3.3.10) thor (0.16.0) tilt (1.3.3) - timecop (0.5.2) - treetop (1.4.11) + timecop (0.5.3) + treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.33) + tzinfo (0.3.35) uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -187,7 +191,9 @@ DEPENDENCIES open_id_authentication (>= 1.1.0) paperclip (~> 2.0) pg - rails (= 3.2.8) + r2 + rack-cors + rails (= 3.2.9) rails-i18n (>= 0.6.3) redcarpet rinku (>= 1.2.2) diff --git a/README.md b/README.md index 4579b9b80..c59f9f0ef 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ helpful as a reference. ## Coding style When writing code it is generally a good idea to try and match your -formatting to hat of any existing code in the same file, or to other +formatting to that of any existing code in the same file, or to other similar files if you are writing new code. Consistency of layout is far more important that the layout itself as it makes reading code much easier. @@ -107,7 +107,7 @@ and why it should be the way it is. When you submit patches, the project maintainer has to read them and understand them. This is difficult enough at the best of times, and misunderstanding patches can lead to them being more difficult to -merge. To help wit this, when submitting you should: +merge. To help with this, when submitting you should: * Split up large patches into smaller units of functionality. * Keep your commit messages relevant to the changes in each individual diff --git a/app/assets/images/sprite.png b/app/assets/images/sprite.png index f422d70c4..d13dbaa8f 100644 Binary files a/app/assets/images/sprite.png and b/app/assets/images/sprite.png differ diff --git a/app/assets/images/sprite.svg b/app/assets/images/sprite.svg index f6c1209ef..a70a7532b 100644 --- a/app/assets/images/sprite.svg +++ b/app/assets/images/sprite.svg @@ -17,7 +17,7 @@ inkscape:export-filename="/Users/tmcw/src/openstreetmap-website/app/assets/images/sprite.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" - sodipodi:docname="New document 1"> + sodipodi:docname="sprite.svg"> + showgrid="true" + inkscape:window-width="1289" + inkscape:window-height="904" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0"> + + diff --git a/app/assets/images/users/images/large.png b/app/assets/images/users/images/large.png index ae33d8a87..ec0a7fde6 100644 Binary files a/app/assets/images/users/images/large.png and b/app/assets/images/users/images/large.png differ diff --git a/app/assets/images/users/images/small.png b/app/assets/images/users/images/small.png index cfaeb24c0..19fd092cc 100644 Binary files a/app/assets/images/users/images/small.png and b/app/assets/images/users/images/small.png differ diff --git a/app/assets/javascripts/edit.js b/app/assets/javascripts/edit.js index 0b2b329b5..30823d49e 100644 --- a/app/assets/javascripts/edit.js +++ b/app/assets/javascripts/edit.js @@ -1,13 +1,12 @@ function maximiseMap() { $("#left").hide(); - $("#greeting").hide(); - $("#tabnav").hide(); + $("#top-bar").hide(); $("#content").css("top", "0px"); if ($("html").attr("dir") == "ltr") { - $("#content").css("left", "0px"); + $("#content").css("margin-left", "0px"); } else { - $("#content").css("right", "0px"); + $("#content").css("margin-right", "0px"); } handleResize(); @@ -15,14 +14,13 @@ function maximiseMap() { function minimiseMap() { $("#left").show(); - $("#greeting").show(); - $("#tabnav").show(); + $("#top-bar").show(); $("#content").css("top", "30px"); if ($("html").attr("dir") == "ltr") { - $("#content").css("left", "185px"); + $("#content").css("margin-left", "185px"); } else { - $("#content").css("right", "185px"); + $("#content").css("margin-right", "185px"); } handleResize(); diff --git a/app/assets/javascripts/osm.js.erb b/app/assets/javascripts/osm.js.erb index 33f190412..e8428da3a 100644 --- a/app/assets/javascripts/osm.js.erb +++ b/app/assets/javascripts/osm.js.erb @@ -23,7 +23,7 @@ OSM = { mapParams: function (search) { var params = {}, mapParams = {}, loc; - search = (search || window.location.search).replace('?', '').split('&'); + search = (search || window.location.search).replace('?', '').split(/&|;/); for (var i = 0; i < search.length; ++i) { var pair = search[i], diff --git a/app/assets/openlayers/theme/openstreetmap/SimplePanZoom.css.scss b/app/assets/openlayers/theme/openstreetmap/SimplePanZoom.css.scss index ad6a63223..2788221b0 100644 --- a/app/assets/openlayers/theme/openstreetmap/SimplePanZoom.css.scss +++ b/app/assets/openlayers/theme/openstreetmap/SimplePanZoom.css.scss @@ -30,6 +30,7 @@ top: 13px; width: 25px; height: 24px; + left: 0px; background-position: -5px -17px; } diff --git a/app/assets/openlayers/theme/openstreetmap/style.css.scss b/app/assets/openlayers/theme/openstreetmap/style.css.scss index b082c9933..bd755a53a 100644 --- a/app/assets/openlayers/theme/openstreetmap/style.css.scss +++ b/app/assets/openlayers/theme/openstreetmap/style.css.scss @@ -51,9 +51,14 @@ div.olControlZoom a { color: black; background: #ffffff; border: 1px solid #cccccc; + margin: 0 !important; // remove filter } +div.olControlZoom a.olControlZoomIn { + border-bottom: 0; +} + div.olControlZoom a:hover { background: #f5f5f5; } diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss index d41dd5481..ec06997f8 100644 --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@ -10,6 +10,7 @@ body { background-color: #fff; margin: 0px; padding: 0px; + text-align: left; } body.slim { @@ -48,20 +49,23 @@ h2 { #left { position: absolute; - top: 0px; + top: 30px; + bottom: 0; width: 185px; font-size: 11px; line-height: 12px; + border-right: 1px solid #ccc; } /* Rules for the OpenStreetMap logo in the top left corner */ #logo { + display: block; width: 170px; min-width: 170px; padding: 5px; text-align: center; - margin: 25px 0 5px 0; + margin: auto; } #logo img { @@ -94,7 +98,7 @@ h2 { /* Rules for the introductory text displayed in the left sidebar to new users */ .sidebar-copy { - padding: 0px 10px; + padding: 5px 10px; } .sidebar-copy p { @@ -150,38 +154,35 @@ h2 { /* Rules for the menu displayed in the left sidebar */ .left_menu { + left: 0px; + margin: 0; padding: 5px 10px; - margin: 4px 0; + line-height: 15px; + font-size: 12px; + list-style-type: none; + border-bottom: 1px solid #ccc; border-top: 1px solid #ccc; - line-height: 20px; - font-size: 14px; - font-weight: bold; -} - -.left_menu h1 { - font-style: normal; - font-size: 15px; } .left_menu ul { - margin: 0px; - list-style-type: none; + padding: 0; + margin: 0; } .left_menu li { - margin: 0px; - padding: 0px; + list-style-type: none; + padding: 0; + margin: 0; } -/* submenus */ -.left_menu ul li ul { - font-weight: normal; - line-height: 15px; +.left_menu h4 { + padding: 5px 0 5px 0; font-size: 12px; + margin: 0; } -.left_menu a { - color: #000; +.left_menu li:last-child h4 { + padding-top: 0; } /* Rules for SOTM advert */ @@ -205,8 +206,10 @@ h2 { */ .optionalbox { + left: 0px; padding: 5px 10px; - margin: 4px 0; + margin: 5px 0; + text-align: left; } .optionalbox h1 { @@ -223,21 +226,21 @@ h2 { } #search_field form { - width: 100%; + width: 165px; margin: 0px; padding: 0px; } #search_field { - position:relative; + position: relative; } #search_field input[type="text"] { width: 165px; - padding: 5px; font-size: 14px; line-height: 15px; height: 25px; + padding: 2px 0px 2px 5px; box-shadow: inset #DDD 0px 1px 3px; box-sizing: border-box; -webkit-box-sizing: border-box; @@ -253,19 +256,21 @@ h2 { #search_field input[type="submit"] { width: 15px; height: 15px; - border:0; - text-indent:-1000px; + border: 0px; + text-indent: -1000px; + overflow: hidden; + text-transform: capitalize; padding-left: 0px; padding-right: 0px; - background: url(sprite.png); - position:absolute; - right:2px; - top:5px; - cursor:pointer; + background: image-url("sprite.png"); + position: absolute; + top: 5px; + right: 4px; + cursor: pointer; } .search_help { - margin:0; + margin: 5px 0 0 0; } .deemphasize { @@ -279,8 +284,10 @@ h2 { /* Rules for donation request box */ .donate { + display: block; + position: relative; width: 153px; - margin: 10px 10px; + margin: 10px 10px 0px 10px; padding: 5px; border: 1px solid #AED1A0; background: #cbeea7; @@ -289,10 +296,29 @@ h2 { font-size: 14px; border-radius: 2px; -moz-border-radius: 2px; + color: #222; } -.donate a { - color:#222; +.donate:hover { + background: #9ed485; + text-decoration: none; +} + +.donate p { + text-indent: 20px; + margin: 0; +} + +.donate .donate-icon { + width: 15px; + height: 15px; + border: 0px; + padding-left: 0px; + padding-right: 0px; + background: image-url("sprite.png") 0 -30px no-repeat; + position: absolute; + top: 8px; + left: 17px; } /* Rules for Creative Commons logo button */ @@ -305,8 +331,13 @@ h2 { /* Rules for tabbed navigation bar */ #top-bar { - border-bottom: 1px solid #ccc; + position: absolute; + top: 0; + left: 185px; + right: 0; height: 29px; + border-bottom: 1px solid #ccc; + background: white; } #tabnav { @@ -323,11 +354,13 @@ h2 { } #tabnav a, #tabnav a:link, #tabnav a:visited { + float: left; background: #fff; font-size: 14px; line-height: 19px; font-weight: bold; padding: 5px 10px; + margin-right: 1px; text-decoration: none; color: #333; -webkit-transition: color 200ms ease-in; @@ -376,8 +409,10 @@ body.site-export #tabnav a#exportanchor { /* Rules for greeting bar in the top right corner */ #greeting { + float: right; height: 28px; margin: 0px; + padding-right: 10px; font-size: 13px; line-height: 28px; } @@ -392,6 +427,7 @@ body.site-export #tabnav a#exportanchor { z-index: 20000000; position: absolute; top: 15px; + left: 15px; } /* Rules for OpenLayers maps */ @@ -430,6 +466,18 @@ body.site-export #tabnav a#exportanchor { text-decoration: none; } +.site-index #map .SimpleLayerSwitcher, +.site-index #map .olControlSimplePanZoom, +.site-export #map .SimpleLayerSwitcher, +.site-export #map .olControlSimplePanZoom { + top: 40px !important; +} + +.site-index #map .olControlScaleLine, +.site-export #map .olControlScaleLine { + left: 10px !important; +} + /* Rules for edit menu */ .menuicon { @@ -469,20 +517,30 @@ body.site-export #tabnav a#exportanchor { display: none; } +.attribution_license { + text-align: left; +} + .attribution_notice { text-align: center; } +.attribution_project { + text-align: right; +} + /* Rules for the popout map sidebar */ #sidebar { display: none; position: absolute; - margin: 0px; + margin: 30px 0px 0px 0px; padding: 0px; + border-right: 1px solid #ccc; width: 30%; top: 0px; bottom: 0px; + left: 0px; } #sidebar #sidebar_content { @@ -502,7 +560,15 @@ body.site-export #tabnav a#exportanchor { height: 29px; font-size: 14px; line-height: 15px; - background: #bbb; + background: #ccc; +} + +#sidebar #sidebar_title { + text-align: left; +} + +#sidebar #sidebar_close { + text-align: right; } /* Rules for the map key which appears in the popout sidebar */ @@ -614,19 +680,28 @@ body.site-export #tabnav a#exportanchor { /* Rules for the main content area */ #content { - padding: 10px; - margin: 0px; - position: absolute; - bottom: 0px; + padding: 20px; + margin: 30px 0px 0px 185px; + border-left: 1px solid #ccc; + text-align: left; } -.site-index #content, .site-edit #content, +.site-index #content, .site-export #content { - border: 0px; + position: fixed; + margin-top: 0px; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; padding: 0px; } +.site-edit #content { + top: 30px; +} + #slim_container { width: 100%; } @@ -656,6 +731,7 @@ body.site-export #tabnav a#exportanchor { #slim_header img { vertical-align: middle; margin-bottom: 5px; + margin-right: 5px; } /* Rules for text content pages */ @@ -706,6 +782,7 @@ body.site-export #tabnav a#exportanchor { border-width: 0px; margin-top: 1px; margin-bottom: 1px; + text-align: left; } #changeset_list td { @@ -732,8 +809,10 @@ body.site-export #tabnav a#exportanchor { #changeset_list_map { position: absolute; + float: right; top: 0px; bottom: 0px; + right: 0px; width: 49%; min-height: 400px; border: solid 1px black; @@ -742,7 +821,9 @@ body.site-export #tabnav a#exportanchor { /* Rules for the data browser */ #browse_navigation { + float: right; width: 250px; + margin-left: 10px; text-align: center; } @@ -768,7 +849,10 @@ td.browse_comments table td span.by { } #browse_map { + float: right; width: 250px; + text-align: right; + margin-left: 10px; } #browse_map #small_map { @@ -787,6 +871,7 @@ td.browse_comments table td span.by { font-size: small; border-collapse: collapse; border-width: 0px; + text-align: right; } #trace_list .trace_summary { @@ -831,9 +916,30 @@ td.browse_comments table td span.by { } #user_list_actions { + float: right; margin-top: 10px; } +/* Rules for the diary list */ + +.diary_entry-list img.user_image { + float: right; +} + +.diary_entry-list img.user_thumbnail { + float: right; +} + +/* Rules for the diary entry view */ + +.diary_entry-view img.user_image { + float: right; +} + +.diary_entry-view img.user_thumbnail { + float: right; +} + /* Rules for the new diary entry page */ .diary_entry div#map { @@ -922,6 +1028,14 @@ form#termsForm { margin-bottom: 3em; } +form#termsForm div#buttons { + float: right; +} + +form#termsForm input#agree { + margin-left: 50px; +} + div#slim_content form#termsForm { width: auto; } @@ -947,12 +1061,23 @@ p#contributorGuidance { #accountForm .user_map { position: relative; width: 500px; - height: 400px; + height: 400px; border: 1px solid #ccc; } -#accountImage td { - padding-bottom: 0px; +#accountForm td.accountImage { + img { + vertical-align: top; + margin-top: 3px; + } + + table { + display: inline-block; + + td { + padding-bottom: 0px; + } + } } .nohome .location { @@ -973,10 +1098,15 @@ p#contributorGuidance { /* Rules for the user view */ +.user-view img.user_image { + float: right; +} + .user-view .user_map { + float: right; position: relative; width: 400px; - height: 400px; + height: 400px; border: 1px solid #ccc; } @@ -1113,9 +1243,11 @@ p#contributorGuidance { #errorExplanation h2 { font-weight: bold; font-size: 12px; + padding: 5px 5px 5px 15px; margin: -7px; background-color: #c00; color: #fff; + text-align: left; } #errorExplanation p { @@ -1136,6 +1268,11 @@ p#contributorGuidance { font-weight: bold; font-size: 12px; line-height: 20px; + text-align: right; +} + +.submitButton { + text-align: right; } .minorNote { @@ -1150,6 +1287,11 @@ textarea { border: 1px solid #ccc; } +input.openid_url { + background: image-url('openid_input.png') repeat-y left white; + padding-left: 16px; +} + /* Rules for user images */ img.user_image { @@ -1239,6 +1381,7 @@ abbr.geo { display: inline-block; vertical-align: top; background-color: #ddd; + margin-left: 15px; padding: 5px 10px 10px 10px; font-size: 12px; @@ -1248,9 +1391,12 @@ abbr.geo { th { vertical-align: top; + text-align: left; + padding: 0px 15px 0px 0px !important; } td { + text-align: left; font-family: fixed; line-height: 16px; padding: 0px !important; @@ -1258,10 +1404,12 @@ abbr.geo { input.richtext_doedit { margin-top: 5px !important; + margin-right: 10px !important; } input.richtext_dopreview { margin-top: 5px !important; + margin-left: 10px !important; } } } diff --git a/app/assets/stylesheets/large-ltr.css b/app/assets/stylesheets/large-ltr.css index 00ce0910b..20cacea02 100644 --- a/app/assets/stylesheets/large-ltr.css +++ b/app/assets/stylesheets/large-ltr.css @@ -1,5 +1,4 @@ /* - *= require common - *= require ltr + *= require ltr/common *= require large */ diff --git a/app/assets/stylesheets/large-rtl.css b/app/assets/stylesheets/large-rtl.css index 5919290ed..7f0edf072 100644 --- a/app/assets/stylesheets/large-rtl.css +++ b/app/assets/stylesheets/large-rtl.css @@ -1,5 +1,4 @@ /* - *= require common - *= require rtl + *= require rtl/common *= require large */ diff --git a/app/assets/stylesheets/large.css b/app/assets/stylesheets/large.css index 05da4445f..ca58badc4 100644 --- a/app/assets/stylesheets/large.css +++ b/app/assets/stylesheets/large.css @@ -6,12 +6,6 @@ display: none; } -/* Rules for the main content area */ - -#content { - top: 30px; -} - /* Rules for OpenLayers maps */ .olControlZoom { diff --git a/app/assets/stylesheets/ltr.css.scss b/app/assets/stylesheets/ltr.css.scss deleted file mode 100644 index eb72ff9d1..000000000 --- a/app/assets/stylesheets/ltr.css.scss +++ /dev/null @@ -1,240 +0,0 @@ -/* Styles for LTR languages */ - -/* Default rules for the body of every page */ - -html body { - text-align: left; -} - -/* Rules for the menu displayed in the left sidebar */ - -.left_menu { - left: 0px; -} - -.left_menu td { - padding-right: 4px; -} - -.left_menu h1 { - text-align: left; - padding: 0em 0em 0em 1em; -} - -.left_menu ul { - padding-left: 0px; -} - -.left_menu img { - margin: 2px 8px 0px 0px; -} - -/* - * Rules for "optional boxes" which appear in the left sidebar on - * certain pages. Current users are the seach box on the main page - * and the tag cloud on the traces pages. - */ - -.optionalbox { - left: 0px; - text-align: left; -} - -/* Rules for tabbed navigation bar */ - -#top-bar { - margin-left: 185px; -} - -#tabnav a, -#tabnav a:link, -#tabnav a:visited { - float: left; - margin-right: 1px; -} - -/* Rules for greeting bar in the top right corner */ - -#greeting { - float: right; - padding-right: 10px; -} - -/* Rules for the message shown in place of the map when javascript is disabled */ - -#noscript { - left: 15px -} - -/* Rules for OpenLayers maps */ - -#map { - border-left: 1px solid #ccc; -} - -/* Rules for attribution text under the main map shown on printouts */ - -.attribution_license { - text-align: left; -} - -.attribution_project { - text-align: right; -} - -/* Rules for the popout map sidebar */ - -#sidebar { - left: 0px; - border-left: 1px solid #ccc; -} - -#sidebar #sidebar_title { - text-align: left; -} - -#sidebar #sidebar_close { - text-align: right; -} - -/* Rules for the main content area */ - -#content { - border-left: 1px solid #ccc; - left: 185px; - right: 0px; - text-align: left; -} - -#slim_header img { - margin-right: 5px; -} - -/* Rules for the copyright page */ - -#cc_logo { - float: right; -} - -/* Rules for the changeset list shown by the history tab etc */ - -#changeset_list { - text-align: left; -} - -#changeset_list_map { - float: right; - right: 0px; -} - -/* Rules for the data browser */ - -#browse_navigation { - float: right; - margin-left: 10px; -} - -#browse_map { - float: right; - text-align: right; - margin-left: 10px; -} - -/* Rules for the trace list shown by the traces tab etc */ - -#trace_list { - text-align: right; -} - -/* Rules for the diary list */ - -.diary_entry-list img.user_image { - float: right; -} - -.diary_entry-list img.user_thumbnail { - float: right; -} - -/* Rules for the diary entry view */ - -.diary_entry-view img.user_image { - float: right; -} - -.diary_entry-view img.user_thumbnail { - float: right; -} - -/* Rules for the user list */ - -#user_list_actions { - float: right; -} - -/* Rules for the account confirmation page */ - -form#termsForm div#buttons { - float: right; -} - -form#termsForm input#agree { - margin-left: 50px; -} - -/* Rules for the user view */ - -.user-view img.user_image { - float: right; -} - -.user-view .user_map { - float: right; -} - -/* Rules for rails validation error boxes */ - -#errorExplanation h2 { - text-align: left; - padding: 5px 5px 5px 15px; -} - -/* Rules for forms */ - -.fieldName { - text-align: right; -} - -.submitButton { - text-align: right; -} - -input.openid_url { - background: image-url('openid_input.png') repeat-y left white; - padding-left: 16px; -} - -/* Rules for rich text editors */ - -.richtext_container { - .richtext_help { - margin-left: 15px; - - th { - text-align: left; - padding: 0px 15px 0px 0px !important; - } - - td { - text-align: left; - } - - input.richtext_doedit { - margin-right: 10px !important; - } - - input.richtext_dopreview { - margin-left: 10px !important; - } - } -} diff --git a/app/assets/stylesheets/ltr/common.css.scss b/app/assets/stylesheets/ltr/common.css.scss new file mode 120000 index 000000000..b8c328296 --- /dev/null +++ b/app/assets/stylesheets/ltr/common.css.scss @@ -0,0 +1 @@ +../common.css.scss \ No newline at end of file diff --git a/app/assets/stylesheets/ltr/small.css.scss b/app/assets/stylesheets/ltr/small.css.scss new file mode 120000 index 000000000..f08fdd55f --- /dev/null +++ b/app/assets/stylesheets/ltr/small.css.scss @@ -0,0 +1 @@ +../small.css.scss \ No newline at end of file diff --git a/app/assets/stylesheets/print-ltr.css b/app/assets/stylesheets/print-ltr.css index 5f3ae8f7c..162c6f23c 100644 --- a/app/assets/stylesheets/print-ltr.css +++ b/app/assets/stylesheets/print-ltr.css @@ -1,4 +1,3 @@ /* *= require print - *= require ltr */ diff --git a/app/assets/stylesheets/print-rtl.css b/app/assets/stylesheets/print-rtl.css index 5ef840645..162c6f23c 100644 --- a/app/assets/stylesheets/print-rtl.css +++ b/app/assets/stylesheets/print-rtl.css @@ -1,4 +1,3 @@ /* *= require print - *= require rtl */ diff --git a/app/assets/stylesheets/rtl.css.scss b/app/assets/stylesheets/rtl.css.scss deleted file mode 100644 index 8dd38834b..000000000 --- a/app/assets/stylesheets/rtl.css.scss +++ /dev/null @@ -1,240 +0,0 @@ -/* Styles for RTL languages */ - -/* Default rules for the body of every page */ - -html body { - text-align: right; -} - -/* Rules for the menu displayed in the left sidebar */ - -.left_menu { - right: 0px; -} - -.left_menu td { - padding-left: 4px; -} - -.left_menu h1 { - text-align: right; - padding: 0em 1em 0em 0em; -} - -.left_menu ul { - padding-right: 0px; -} - -.left_menu img { - margin: 2px 0px 0px 8px; -} - -/* - * Rules for "optional boxes" which appear in the left sidebar on - * certain pages. Current users are the seach box on the main page - * and the tag cloud on the traces pages. - */ - -.optionalbox { - right: 0px; - text-align: right; -} - -/* Rules for tabbed navigation bar */ - -#top-bar { - margin-right: 185px -} - -#tabnav a, -#tabnav a:link, -#tabnav a:visited { - float: right; - margin-left: 1px; -} - -/* Rules for greeting bar in the top right corner */ - -#greeting { - float: left; - padding-left: 10px; -} - -/* Rules for the message shown in place of the map when javascript is disabled */ - -#noscript { - right: 15px -} - -/* Rules for OpenLayers maps */ - -#map { - border-right: 1px solid #ccc; -} - -/* Rules for attribution text under the main map shown on printouts */ - -.attribution_license { - text-align: right; -} - -.attribution_project { - text-align: left; -} - -/* Rules for the popout map sidebar */ - -#sidebar { - right: 0px; - border-right: 1px solid #ccc; -} - -#sidebar #sidebar_title { - text-align: right; -} - -#sidebar #sidebar_close { - text-align: left; -} - -/* Rules for the main content area */ - -#content { - border-right: 1px solid #ccc; - right: 185px; - left: 0px; - text-align: right; -} - -#slim_header img { - margin-left: 5px; -} - -/* Rules for the copyright page */ - -#cc_logo { - float: left; -} - -/* Rules for the changeset list shown by the history tab etc */ - -#changeset_list { - text-align: right; -} - -#changeset_list_map { - float: left; - left: 0px; -} - -/* Rules for the data browser */ - -#browse_navigation { - float: left; - margin-right: 10px; -} - -#browse_map { - float: left; - text-align: left; - margin-right: 10px; -} - -/* Rules for the trace list shown by the traces tab etc */ - -#trace_list { - text-align: right; -} - -/* Rules for the diary list */ - -.diary_entry-list img.user_image { - float: left; -} - -.diary_entry-list img.user_thumnbail { - float: left; -} - -/* Rules for the diary entry view */ - -.diary_entry-view img.user_image { - float: left; -} - -.diary_entry-view img.user_thumbnail { - float: left; -} - -/* Rules for the user list */ - -#user_list_actions { - float: left; -} - -/* Rules for the account confirmation page */ - -form#termsForm div#buttons { - float: left; -} - -form#termsForm input#agree { - margin-right: 50px; -} - -/* Rules for the user view */ - -.user-view img.user_image { - float: left; -} - -.user-view .user_map { - float: left; -} - -/* Rules for rails validation error boxes */ - -#errorExplanation h2 { - text-align: right; - padding: 5px 15px 5px 5px; -} - -/* Rules for forms */ - -.fieldName { - text-align: left; -} - -.submitButton { - text-align: left; -} - -input.openid_url { - background: image-url('openid_input.png') repeat-y right white; - padding-right: 16px; -} - -/* Rules for rich text editors */ - -.richtext_container { - .richtext_help { - margin-right: 15px; - - th { - text-align: right; - padding: 0px 0px 0px 15px !important; - } - - td { - text-align: right; - } - - input.richtext_doedit { - margin-left: 10px !important; - } - - input.richtext_dopreview { - margin-right: 10px !important; - } - } -} diff --git a/app/assets/stylesheets/rtl/common.css.r2.scss b/app/assets/stylesheets/rtl/common.css.r2.scss new file mode 120000 index 000000000..b8c328296 --- /dev/null +++ b/app/assets/stylesheets/rtl/common.css.r2.scss @@ -0,0 +1 @@ +../common.css.scss \ No newline at end of file diff --git a/app/assets/stylesheets/rtl/small.css.r2.scss b/app/assets/stylesheets/rtl/small.css.r2.scss new file mode 120000 index 000000000..f08fdd55f --- /dev/null +++ b/app/assets/stylesheets/rtl/small.css.r2.scss @@ -0,0 +1 @@ +../small.css.scss \ No newline at end of file diff --git a/app/assets/stylesheets/small-ltr.css b/app/assets/stylesheets/small-ltr.css index 2526d2585..838c9198f 100644 --- a/app/assets/stylesheets/small-ltr.css +++ b/app/assets/stylesheets/small-ltr.css @@ -1,5 +1,4 @@ /* - *= require common - *= require ltr - *= require small + *= require ltr/common + *= require ltr/small */ diff --git a/app/assets/stylesheets/small-rtl.css b/app/assets/stylesheets/small-rtl.css index 4d3a5e1fc..91d9fa3ed 100644 --- a/app/assets/stylesheets/small-rtl.css +++ b/app/assets/stylesheets/small-rtl.css @@ -1,5 +1,4 @@ /* - *= require common - *= require rtl - *= require small + *= require rtl/common + *= require rtl/small */ diff --git a/app/assets/stylesheets/small.css.scss b/app/assets/stylesheets/small.css.scss index daacb5a7f..ba9e59d96 100644 --- a/app/assets/stylesheets/small.css.scss +++ b/app/assets/stylesheets/small.css.scss @@ -17,16 +17,19 @@ h1 { } /* Rules for tabbed navigation bar */ + #top-bar { + left: 0; margin: 0px; - height: 19px; + height: 39px; + padding: 0; } #tabnav { height: 14px; margin: 0px; padding-top: 5px; - margin-top: 18px; + margin-top: 20px; font-size: 10px; line-height: 10px; } @@ -46,7 +49,8 @@ h1 { height: 16px; display: block; position: absolute; - top: 0; + left: 5px; + top: 5px; padding: 2px; width: 110px; /* TODO: find better fix for overlap */ background-color: #fff; @@ -61,15 +65,15 @@ h1 { position: absolute; left: 18px; font-size: 12px; - margin: 2px; + margin: 0; } /* Rules for greeting bar in the top right corner */ #greeting { position: absolute; - top: 0px; - right: 0px; + right: 5px; + top: 5px; height: 14px; font-size: 12px; line-height: 12px; @@ -95,24 +99,26 @@ h1 { display: none; } +.site-index #map .olControlZoom, +.site-index #map .SimpleLayerSwitcher, +.site-export #map .olControlZoom, +.site-export #map .SimpleLayerSwitcher { + top: 8px !important; +} + /* Rules for the main content area */ #content { - left: 0px; - right: 0px; - top: 38px; margin-left: 0px; margin-right: 0px; border-left: 0px; border-right: 0px; } +.site-export #content, +.site-edit #content, .site-index #content { - left: 0px; - right: 0px; - top: 38px; - bottom: 0px; - padding-bottom: 0px; + margin-top: 40px; } /* Rules for search sidebar when shown */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8f9ae2948..4b2c70825 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base protect_from_forgery + before_filter :fetch_body + if STATUS == :database_readonly or STATUS == :database_offline def self.cache_sweeper(*sweepers) end @@ -278,7 +280,7 @@ class ApplicationController < ActionController::Base end end - I18n.locale = request.compatible_language_from(I18n.available_locales) || I18n.default_locale + I18n.locale = params[:locale] || request.compatible_language_from(I18n.available_locales) || I18n.default_locale response.headers['Content-Language'] = I18n.locale.to_s end @@ -404,7 +406,20 @@ class ApplicationController < ActionController::Base format.all { render :nothing => true, :status => :not_found } end end - + + ## + # Unfortunately if a PUT or POST request that has a body fails to + # read it then Apache will sometimes fail to return the response it + # is given to the client properly, instead erroring: + # + # https://issues.apache.org/bugzilla/show_bug.cgi?id=44782 + # + # To work round this we call rewind on the body here, which is added + # as a filter, to force it to be fetched from Apache into a file. + def fetch_body + request.body.rewind + end + private # extract authorisation credentials from headers, returns user = nil if none diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 05f97bf0d..4b138bdae 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -368,7 +368,7 @@ private filename = "/tmp/#{rand}" # ...and save the uploaded file to that location - File.open(filename, "w") { |f| f.write(file.read) } + File.open(filename, "wb") { |f| f.write(file.read) } # Create the trace object, falsely marked as already # inserted to stop the import daemon trying to load it diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 9e1585243..321b61918 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -32,12 +32,14 @@ class UserController < ApplicationController # the open_id_authentication function @user = session.delete(:new_user) - openid_verify(nil, @user) do |user| + openid_verify(nil, @user) do |user,verified_email| + user.status = "active" if user.email == verified_email end if @user.openid_url.nil? or @user.invalid? render :action => 'new' else + session[:new_user] = @user render :action => 'terms' end elsif params[:user] and Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last) @@ -51,11 +53,13 @@ class UserController < ApplicationController if params[:user] and params[:user][:openid_url] and @user.pass_crypt.empty? # We are creating an account with OpenID and no password # was specified so create a random one - @user.pass_crypt = SecureRandom.base64(16) - @user.pass_crypt_confirmation = @user.pass_crypt + @user.pass_crypt = SecureRandom.base64(16) + @user.pass_crypt_confirmation = @user.pass_crypt end if @user + @user.status = "pending" + if @user.invalid? if @user.new_record? # Something is wrong with a new user, so rerender the form @@ -72,6 +76,9 @@ class UserController < ApplicationController # Verify OpenID before moving on session[:new_user] = @user openid_verify(params[:user][:openid_url], @user) + elsif @user.new_record? + # Save the user record + session[:new_user] = @user end else # Not logged in, so redirect to the login page @@ -114,28 +121,40 @@ class UserController < ApplicationController else redirect_to :action => :account, :display_name => @user.display_name end - elsif Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last) - render :action => 'blocked' else - @user = User.new(params[:user]) - - @user.status = "pending" - @user.data_public = true - @user.description = "" if @user.description.nil? - @user.creation_ip = request.remote_ip - @user.languages = request.user_preferred_languages - @user.terms_agreed = Time.now.getutc - @user.terms_seen = true - @user.openid_url = nil if @user.openid_url and @user.openid_url.empty? - - if @user.save - flash[:piwik_goal] = PIWIK_SIGNUP_GOAL if defined?(PIWIK_SIGNUP_GOAL) - flash[:notice] = t 'user.new.flash create success message', :email => @user.email - Notifier.signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer))).deliver - session[:token] = @user.tokens.create.token - redirect_to :action => 'login', :referer => params[:referer] + @user = session.delete(:new_user) + + if Acl.no_account_creation(request.remote_ip, @user.email.split("@").last) + render :action => 'blocked' else - render :action => 'new', :referer => params[:referer] + @user.data_public = true + @user.description = "" if @user.description.nil? + @user.creation_ip = request.remote_ip + @user.languages = request.user_preferred_languages + @user.terms_agreed = Time.now.getutc + @user.terms_seen = true + @user.openid_url = nil if @user.openid_url and @user.openid_url.empty? + + if @user.save + flash[:piwik_goal] = PIWIK_SIGNUP_GOAL if defined?(PIWIK_SIGNUP_GOAL) + + if @user.status == "active" + flash[:notice] = t 'user.new.flash welcome', :email => @user.email + + Notifier.signup_confirm(@user, nil).deliver + + successful_login(@user) + else + flash[:notice] = t 'user.new.flash create success message', :email => @user.email + session[:token] = @user.tokens.create.token + + Notifier.signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer))).deliver + + redirect_to :action => 'login', :referer => params[:referer] + end + else + render :action => 'new', :referer => params[:referer] + end end end end @@ -299,7 +318,7 @@ class UserController < ApplicationController referer = token.referer token.destroy - if session[:token] + if session[:token] token = UserToken.find_by_token(session[:token]) session.delete(:token) else @@ -551,6 +570,7 @@ private # the simple registration protocol. nickname = sreg["nickname"] || ax["http://axschema.org/namePerson/friendly"].first email = sreg["email"] || ax["http://axschema.org/contact/email"].first + redirect_to :controller => 'user', :action => 'new', :nickname => nickname, :email => email, :openid => identity_url end elsif result.missing? @@ -568,8 +588,18 @@ private def openid_verify(openid_url, user) user.openid_url = openid_url - authenticate_with_open_id(openid_expand_url(openid_url), :method => :get) do |result, identity_url| + authenticate_with_open_id(openid_expand_url(openid_url), :method => :get, :required => [:email, "http://axschema.org/contact/email"]) do |result, identity_url, sreg, ax| if result.successful? + # Do we trust the emails this provider returns? + if openid_email_verified(identity_url) + # Guard against not getting any extension data + sreg = Hash.new if sreg.nil? + ax = Hash.new if ax.nil? + + # Get the verified email + verified_email = sreg["email"] || ax["http://axschema.org/contact/email"].first + end + # We need to use the openid url passed back from the OpenID provider # rather than the one supplied by the user, as these can be different. # @@ -577,7 +607,7 @@ private # than a user specific url. Only once it comes back from the provider # provider do we know the unique address for the user. user.openid_url = identity_url - yield user + yield user, verified_email elsif result.missing? flash.now[:error] = t 'user.login.openid missing provider' elsif result.invalid? @@ -603,7 +633,15 @@ private else return openid_url end - end + end + + ## + # check if we trust an OpenID provider to return a verified + # email, so that we can skpi verifying it ourselves + def openid_email_verified(openid_url) + openid_url.match(/https:\/\/www.google.com\/accounts\/o8\/id?(.*)/) or + openid_url.match(/https:\/\/me.yahoo.com\/(.*)/) + end ## # process a successful login @@ -663,8 +701,15 @@ private user.languages = params[:user][:languages].split(",") case params[:image_action] - when "new" then user.image = params[:user][:image] - when "delete" then user.image = nil + when "new" then + user.image = params[:user][:image] + user.image_use_gravatar = false + when "delete" then + user.image = nil + user.image_use_gravatar = false + when "gravatar" then + user.image = nil + user.image_use_gravatar = true end user.home_lat = params[:user][:home_lat] @@ -755,7 +800,7 @@ private ## # def disable_terms_redirect - # this is necessary otherwise going to the user terms page, when + # this is necessary otherwise going to the user terms page, when # having not agreed already would cause an infinite redirect loop. # it's .now so that this doesn't propagate to other pages. flash.now[:skip_terms] = true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fb422cc17..18f233e50 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -88,6 +88,14 @@ module ApplicationHelper end end + def dir + if dir = params[:dir] + dir == "rtl" ? "rtl" : "ltr" + else + I18n.t("html.dir") + end + end + def friendly_date(date) content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly)) end diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb new file mode 100644 index 000000000..4b2cd2a06 --- /dev/null +++ b/app/helpers/notifier_helper.rb @@ -0,0 +1,5 @@ +module NotifierHelper + def fp(text) + format_paragraph(text, 72, 0) + end +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb index 70125e804..7113cf1b2 100644 --- a/app/helpers/user_helper.rb +++ b/app/helpers/user_helper.rb @@ -1,22 +1,46 @@ module UserHelper + # User images + def user_image(user, options = {}) options[:class] ||= "user_image" - image_tag user.image.url(:large), options + if user.image_use_gravatar + user_gravatar_tag(user, options) + else + image_tag user.image.url(:large), options + end end def user_thumbnail(user, options = {}) options[:class] ||= "user_thumbnail" - image_tag user.image.url(:small), options + if user.image_use_gravatar + user_gravatar_tag(user, options) + else + image_tag user.image.url(:small), options + end end def user_thumbnail_tiny(user, options = {}) options[:class] ||= "user_thumbnail_tiny" - image_tag user.image.url(:small), options + if user.image_use_gravatar + user_gravatar_tag(user, options) + else + image_tag user.image.url(:small), options + end + end + + def user_image_url(user, options = {}) + if user.image_use_gravatar + user_gravatar_url(user, options) + else + "http://#{SERVER_URL}#{image_path(user.image.url)}" + end end + # OpenID support + def openid_logo image_tag "openid_small.png", :alt => t('user.login.openid_logo_alt'), :class => "openid_logo" end @@ -29,4 +53,20 @@ module UserHelper :title => t("user.login.openid_providers.#{name}.title") ) end + + # Gravatar support + + # See http://en.gravatar.com/site/implement/images/ for details. + def user_gravatar_url(user, options = {}) + size = options[:size] || 100 + hash = Digest::MD5::hexdigest(user.email.downcase) + default_image_url = "http://#{SERVER_URL}#{image_path("users/images/large.png")}" + url = "http://www.gravatar.com/avatar/#{hash}.jpg?s=#{size}&d=#{u(default_image_url)}" + end + + def user_gravatar_tag(user, options = {}) + url = user_gravatar_url(user, options) + options.delete(:size) + image_tag url, options + end end diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 1107a0da6..a4eb0d4c3 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -6,11 +6,20 @@ class Notifier < ActionMailer::Base def signup_confirm(user, token) @locale = user.preferred_language_from(I18n.available_locales) - @url = url_for(:host => SERVER_URL, - :controller => "user", :action => "confirm", - :display_name => user.display_name, - :confirm_string => token.token) - + + # If we are passed an email address verification token, create + # the confirumation URL for account activation. + # + # Otherwise the email has already been verified e.g. through + # a trusted openID provider and the account is active and a + # confirmation URL is not needed. + if token + @url = url_for(:host => SERVER_URL, + :controller => "user", :action => "confirm", + :display_name => user.display_name, + :confirm_string => token.token) + end + mail :to => user.email, :subject => I18n.t('notifier.signup_confirm.subject', :locale => @locale) end diff --git a/app/models/relation.rb b/app/models/relation.rb index ce19f7b98..e402d0d08 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -167,13 +167,9 @@ class Relation < ActiveRecord::Base # FIXME is this really needed? def members - unless @members - @members = Array.new - self.relation_members.each do |member| - @members += [[member.member_type,member.member_id,member.member_role]] - end + @members ||= self.relation_members.map do |member| + [member.member_type, member.member_id, member.member_role] end - @members end def tags @@ -194,9 +190,9 @@ class Relation < ActiveRecord::Base @tags = t end - def add_member(type,id,role) - @members = Array.new unless @members - @members += [[type,id.to_i,role]] + def add_member(type, id, role) + @members ||= [] + @members << [type, id.to_i, role] end def add_tag_keyval(k, v) diff --git a/app/models/user.rb b/app/models/user.rb index 889c40451..33f01c06b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,12 +47,13 @@ class User < ActiveRecord::Base validates_inclusion_of :preferred_editor, :in => Editors::ALL_EDITORS, :allow_nil => true attr_accessible :display_name, :email, :email_confirmation, :openid_url, - :pass_crypt, :pass_crypt_confirmation, :consider_pd + :pass_crypt, :pass_crypt_confirmation, :consider_pd, + :image_use_gravatar after_initialize :set_defaults before_save :encrypt_password - has_attached_file :image, + has_attached_file :image, :default_url => "/assets/:class/:attachment/:style.png", :styles => { :large => "100x100>", :small => "50x50>" } @@ -84,7 +85,7 @@ class User < ActiveRecord::Base token.update_column(:expiry, 1.week.from_now) if token and user return user - end + end def to_xml doc = OSM::API.new.get_xml_doc @@ -127,7 +128,7 @@ class User < ActiveRecord::Base end def nearby(radius = NEARBY_RADIUS, num = NEARBY_USERS) - if self.home_lon and self.home_lat + if self.home_lon and self.home_lat gc = OSM::GreatCircle.new(self.home_lat, self.home_lon) bounds = gc.bounds(radius) sql_for_distance = gc.sql_for_distance("home_lat", "home_lon") @@ -184,7 +185,7 @@ class User < ActiveRecord::Base end ## - # returns the first active block which would require users to view + # returns the first active block which would require users to view # a message, or nil if there are none. def blocked_on_view blocks.active.detect { |b| b.needs_view? } @@ -208,8 +209,8 @@ class User < ActiveRecord::Base ## # return a spam score for a user def spam_score - changeset_score = self.changesets.limit(10).length * 50 - trace_score = self.traces.limit(10).length * 50 + changeset_score = self.changesets.size * 50 + trace_score = self.traces.size * 50 diary_entry_score = self.diary_entries.inject(0) { |s,e| s += e.body.spam_score } diary_comment_score = self.diary_comments.inject(0) { |s,c| s += c.body.spam_score } diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index b5110bbf5..f10d0a3f9 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -6,6 +6,8 @@ class UserPreference < ActiveRecord::Base validates_length_of :k, :within => 1..255 validates_length_of :v, :within => 1..255 + attr_accessible :k, :v + # Turn this Node in to an XML Node without the wrapper. def to_xml_node el1 = XML::Node.new 'preference' diff --git a/app/views/diary_entry/rss.rss.builder b/app/views/diary_entry/rss.rss.builder index 7ee36e9bd..35f05028d 100644 --- a/app/views/diary_entry/rss.rss.builder +++ b/app/views/diary_entry/rss.rss.builder @@ -6,24 +6,24 @@ xml.rss("version" => "2.0", xml.channel do xml.title @title xml.description @description - xml.link url_for(:action => "list", :only_path => false) + xml.link url_for(:action => "list", :host => SERVER_URL) xml.image do xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png" xml.title "OpenStreetMap" xml.width "100" xml.height "100" - xml.link url_for(:action => "list", :only_path => false) + xml.link url_for(:action => "list", :host=> SERVER_URL) end for entry in @entries xml.item do xml.title h(entry.title) - xml.link url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false) - xml.guid url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false) + xml.link url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :host => SERVER_URL) + xml.guid url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :host => SERVER_URL) xml.description entry.body.to_html xml.author entry.user.display_name xml.pubDate entry.created_at.to_s(:rfc822) - xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :only_path => false) + xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :host => SERVER_URL) if entry.latitude and entry.longitude xml.geo :lat, entry.latitude.to_s diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index c85594189..88ad3eb39 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -2,10 +2,10 @@ <%= javascript_include_tag "application" %> - <%= stylesheet_link_tag "small-#{t 'html.dir'}", :media => "only screen and (max-width:641px)" %> - <%= stylesheet_link_tag "large-#{t 'html.dir'}", :media => "screen and (min-width: 642px)" %> - <%= stylesheet_link_tag "print-#{t 'html.dir'}", :media => "print" %> - + <%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:641px)" %> + <%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 642px)" %> + <%= stylesheet_link_tag "print-#{dir}", :media => "print" %> + <%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "osm_logo.png", :rel => "apple-touch-icon", :type => "image/png" %> <%= tag("link", { :rel => "publisher", :href => "https://plus.google.com/111953119785824514010" }) %> diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index 383941685..f1ae440e7 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -1,5 +1,5 @@ - + <%= render :partial => "layouts/head" %>
@@ -13,8 +13,8 @@
<% if @user and @user.id %> - <%= raw(t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), user_path(:display_name => @user.display_name), :title => t('layouts.welcome_user_link_tooltip'))) %> - <%= link_to t('layouts.welcome_user_link_tooltip'), user_path(:display_name => @user.display_name) %> | + <%= raw(t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), user_path(:display_name => @user.display_name), :title => t('layouts.welcome_user_link_tooltip'))) %> + <%= link_to t('layouts.welcome_user_link_tooltip'), user_path(:display_name => @user.display_name) %> | <%= yield :greeting %> <%= render :partial => "layouts/inbox" %> | <%= link_to t('layouts.logout'), logout_path(:session => request.session_options[:id], :referer => request.fullpath), {:id => 'logoutanchor', :title => t('layouts.logout_tooltip')}%> @@ -70,7 +70,7 @@ <%= link_to(image_tag("osm_logo.png", :size => "120x120", :alt => t('layouts.logo.alt_text')), - root_path) %>
+ root_path) %>

<%= t 'layouts.project_name.h1' %>

<%= t('layouts.tag_line') %>

@@ -102,34 +102,36 @@

<%= raw t 'layouts.donate', :link => "#{t('layouts.donate_link_text')}" %>

<% end %> -
-
    -
  • <%= t'layouts.help' %> -
      +
        +
      • +

        <%= t'layouts.help' %>

        +
        • <%= link_to(t('layouts.help_centre'), t('layouts.help_url'), :title => t('layouts.help_title')) %>
        • <%= link_to(t('layouts.documentation'), t('layouts.wiki_url'), :title => t('layouts.documentation_title')) %>
        • <%= link_to t('layouts.copyright'), copyright_path %>
        • -
        -
      • -
      • <%= t'layouts.community' %> -
          +
        +
      • +
      • +

        <%= t'layouts.community' %>

        + -
      • -
      • <%= link_to t('layouts.gps_traces'), traces_path, { +
      + +
    • +

      <%= link_to t('layouts.gps_traces'), traces_path, { :id => 'traceanchor', :title => t('layouts.gps_traces_tooltip') - } %>

    • - <%= yield :left_menu %> -
    -
- + } %> + + <%= yield :left_menu %> + +