From: Tom Hughes Date: Wed, 15 Sep 2021 17:44:23 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/3297' X-Git-Tag: live~2042 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e91c02f2ceb2b72a77846a0c31f5eca22b9b0a65?hp=5652e9f6b95c1e44db597c0136a985aef5e28ad5 Merge remote-tracking branch 'upstream/pull/3297' --- diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index 018ce0096..769fbca47 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -42,6 +42,7 @@ class Ability can [:index, :new, :create, :show, :edit, :update, :destroy], :oauth2_application can [:index, :destroy], :oauth2_authorized_application can [:new, :show, :create, :destroy], :oauth2_authorization + can [:show], :dashboard can [:new, :create, :edit, :update, :comment, :subscribe, :unsubscribe], DiaryEntry can [:make_friend, :remove_friend], Friendship can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 0023286bf..e0eec7bda 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1096,47 +1096,11 @@ tr.turn:hover { /* Rules for the user profile page */ -#userinformation { - min-height: 100px; - .userinformation-inner { - float: left; - } - .user-description { - width: 100%; - clear: both; - } -} - -.admin-user-info small { - margin-bottom: $lineheight/2; - display: inline; - margin-right: $lineheight; -} - .contact-activity { margin-top: $lineheight; width: 100%; } -.activity-details p { - margin-left: 70px; - margin-bottom: 0; -} - -.users-show { - // Silly exception; remove when user page is redesigned. - .content-inner { - max-width: none; - } - p#no_home_location { - margin: $lineheight; - } - .user_thumbnail { - margin-top: $lineheight/4; - float: left; - } -} - /* Rules for the user map */ .content_map .leaflet-popup-content { @@ -1466,6 +1430,12 @@ img.user_image { margin-right: $lineheight; } +img.user_image_no_margins { + max-width: 100px; + max-height: 100px; + border: 1px solid $grey; +} + img.user_thumbnail { max-width: 50px; max-height: 50px; @@ -1473,6 +1443,12 @@ img.user_thumbnail { margin-right: $lineheight; } +img.user_thumbnail_no_margins { + max-width: 50px; + max-height: 50px; + border: 1px solid $grey; +} + img.user_thumbnail_tiny { width: auto; height: auto; @@ -1489,28 +1465,28 @@ abbr.geo { /* General styles for action lists / subnavs / pager navs */ -ul.secondary-actions { - font-style: normal; - margin-bottom: 0; - margin-left: 0; - padding: 0; - &.pager { - display: inline-block; - margin-right: 60px; - } - > li { - display: block; - float: left; - list-style: none; - border-left: 1px solid $grey; - padding-left: $lineheight/2; - margin-right: $lineheight/2; - &:first-child { - border-left: 0; - padding-left: 0; + +nav.secondary-actions { + margin-left: -11px; + overflow: hidden; + > ul { + display: flex; + flex-direction: row; + flex-wrap: wrap; + margin-bottom: 0; + margin-left: -1px; + padding: 0; + &.pager { + display: inline-block; + margin-right: 60px; } - &:last-child { - margin-right: 0px; + > li { + flex-basis: auto; + list-style: none; + border-left: 1px solid $grey; + padding-left: $lineheight/2; + margin-right: $lineheight/2; + margin-bottom: $lineheight/8; } } } @@ -1574,6 +1550,17 @@ div.secondary-actions { } } +/* Create a single-line dl */ + +dl.dl-inline { + dt, dd { + display: inline-block; + } + dd { + margin-right: 1em; + } +} + /* Customise the background colour of striped tables */ .table-striped > tbody > tr:nth-child(2n+1) > td, diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb new file mode 100644 index 000000000..540683d25 --- /dev/null +++ b/app/controllers/dashboards_controller.rb @@ -0,0 +1,14 @@ +class DashboardsController < ApplicationController + layout "site" + + before_action :authorize_web + before_action :set_locale + + authorize_resource :class => false + + before_action :check_database_readable + + def show + @user = current_user + end +end diff --git a/app/views/users/_contact.html.erb b/app/views/dashboards/_contact.html.erb similarity index 54% rename from app/views/users/_contact.html.erb rename to app/views/dashboards/_contact.html.erb index c7e10c060..7614c0c4d 100644 --- a/app/views/users/_contact.html.erb +++ b/app/views/dashboards/_contact.html.erb @@ -4,21 +4,23 @@ :icon => image_path(type == "friend" ? "marker-blue.png" : "marker-green.png"), :description => render(:partial => "popup", :object => contact, :locals => { :type => type }) } %> -<%= tag.div :class => "contact-activity clearfix", :data => { :user => user_data } do %> - <%= user_thumbnail contact %> -
-

+<%= tag.div :class => "contact-activity clearfix row", :data => { :user => user_data } do %> +

+ <%= user_thumbnail contact, :class => "user_thumbnail_no_margins" %> +
+
+

<%= link_to contact.display_name, user_path(contact) %> <% if @user.home_lon and @user.home_lat and contact.home_lon and contact.home_lat %> <% distance = @user.distance(contact) %> <% if distance < 1 %> - (<%= t "users.show.m away", :count => (distance * 1000).round %>) + (<%= t ".m away", :count => (distance * 1000).round %>) <% else %> - (<%= t "users.show.km away", :count => distance.round %>) + (<%= t ".km away", :count => distance.round %>) <% end %> <% end %>

-

+

<% changeset = contact.changesets.first %> <% if changeset %> <%= t("users.show.latest edit", :ago => time_ago_in_words(changeset.created_at, :scope => :"datetime.distance_in_words_ago")) %> @@ -31,15 +33,17 @@ <% end %>

-
    -
  • <%= link_to t("users.show.send message"), new_message_path(contact) %>
  • -
  • - <% if current_user.is_friends_with?(contact) %> - <%= link_to t("users.show.remove as friend"), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %> - <% else %> - <%= link_to t("users.show.add as friend"), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %> - <% end %> -
  • -
+
<% end %> diff --git a/app/views/users/_popup.html.erb b/app/views/dashboards/_popup.html.erb similarity index 100% rename from app/views/users/_popup.html.erb rename to app/views/dashboards/_popup.html.erb diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb new file mode 100644 index 000000000..9aa4abed4 --- /dev/null +++ b/app/views/dashboards/show.html.erb @@ -0,0 +1,65 @@ +<% content_for :heading do %> +

<%= t ".title" %>

+<% end %> + +
+ <% if current_user and @user.id == current_user.id %> +
+ <% if @user.home_lat.nil? or @user.home_lon.nil? %> +
+

<%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %>

+
+ <% else %> + <% content_for :head do %> + <%= javascript_include_tag "user" %> + <% end %> + <% user_data = { + :lon => current_user.home_lon, + :lat => current_user.home_lat, + :icon => image_path("marker-red.png"), + :description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" }) + } %> + <%= tag.div "", :id => "map", :class => "content_map", :data => { :user => user_data } %> + <% end %> + + <% friends = @user.friends %> + <% nearby = @user.nearby - friends %> +
+ +
+

<%= t ".my friends" %>

+ + <% if friends.empty? %> + <%= t ".no friends" %> + <% else %> + +
+ <%= render :partial => "contact", :collection => friends, :locals => { :type => "friend" } %> +
+ <% end %> + +
+ +

<%= t ".nearby users" %>

+ + <% if nearby.empty? %> + <%= t ".no nearby users" %> + <% else %> + +
+ <%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %> +
+ <% end %> +
+ <% end %> +
diff --git a/app/views/diary_entries/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb index 946c6ce17..4080b8f95 100644 --- a/app/views/diary_entries/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -23,31 +23,33 @@ <%= render :partial => "location", :object => diary_entry %> <% end %> - +
diff --git a/app/views/diary_entries/index.html.erb b/app/views/diary_entries/index.html.erb index 80561cbbf..6803c761e 100644 --- a/app/views/diary_entries/index.html.erb +++ b/app/views/diary_entries/index.html.erb @@ -6,19 +6,21 @@ <% end %>

<%= @title %>

- + <% end %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a20474b57..192b07614 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -90,6 +90,7 @@