From 98f1e2a21dd7dd4ab0c95ffcd8827cc6489d3925 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 8 Aug 2023 17:36:02 +0300 Subject: [PATCH 1/4] Update diary entry styling user_ class was kept because https://github.com/openstreetmap/openstreetmap-website/pull/2266 --- app/assets/stylesheets/common.scss | 13 ------------- app/views/diary_entries/_diary_entry.html.erb | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 5a033bd0b..abee14c39 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1047,19 +1047,6 @@ tr.turn:hover { width: 100%; } -/* Rules for the diary list page */ - -.diary_post { - position: relative; - padding-top: $lineheight; - padding-bottom: $lineheight/2; - border-top: 1px solid $grey; - - &.deleted { - background-color: #fee; - } -} - /* Rules for the diary entry page */ .diary_entries { diff --git a/app/views/diary_entries/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb index 37420cdf1..52f500b1c 100644 --- a/app/views/diary_entries/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -1,4 +1,4 @@ -
+
<% if @user %>

<%= link_to diary_entry.title, diary_entry_path(diary_entry.user, diary_entry) %>

From 9d95d548e8be3d7c4428d3b350836fcb1a40de24 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 8 Aug 2023 18:29:05 +0300 Subject: [PATCH 2/4] Update diary comments styling --- app/assets/stylesheets/common.scss | 11 ----------- app/views/diary_entries/_diary_comment.html.erb | 4 ++-- app/views/diary_entries/show.html.erb | 2 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index abee14c39..7b3bfde36 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1060,23 +1060,12 @@ tr.turn:hover { } .diary-comment { border-top: 1px dashed $grey; - padding-top: $lineheight/2; - padding-bottom: $lineheight/2; &:first-child { - margin-top: $lineheight/2; - padding-top: $lineheight; border-top: 1px solid $grey; } - &.deleted { - background-color: #fee; - } p { margin-bottom: $lineheight/2; } - .comment-heading { - margin-bottom: 0; - margin-top: 0; - } } } diff --git a/app/views/diary_entries/_diary_comment.html.erb b/app/views/diary_entries/_diary_comment.html.erb index 403d30742..238f4d43c 100644 --- a/app/views/diary_entries/_diary_comment.html.erb +++ b/app/views/diary_entries/_diary_comment.html.erb @@ -1,9 +1,9 @@ -
"> +
">
<%= user_thumbnail diary_comment.user %>
-

<%= t(".comment_from_html", :link_user => (link_to diary_comment.user.display_name, user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}")) %> +

<%= t(".comment_from_html", :link_user => (link_to diary_comment.user.display_name, user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}")) %> <% if current_user and diary_comment.user.id != current_user.id %> | <%= report_link(t(".report"), diary_comment) %> <% end %> diff --git a/app/views/diary_entries/show.html.erb b/app/views/diary_entries/show.html.erb index 879207495..ab45a24b6 100644 --- a/app/views/diary_entries/show.html.erb +++ b/app/views/diary_entries/show.html.erb @@ -13,7 +13,7 @@ <%= render @entry %> -

+
<%= render :partial => "diary_comment", :collection => @comments %>
From 6fcaa0e53c955c2c1057313a9939ca158c706194 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 8 Aug 2023 18:43:41 +0300 Subject: [PATCH 3/4] Update diary edit form styling --- app/assets/stylesheets/common.scss | 1 - app/views/diary_entries/_form.html.erb | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 7b3bfde36..5b15fcc5d 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1053,7 +1053,6 @@ tr.turn:hover { #map { height: 400px; display: none; - margin-bottom: $lineheight; } .comments { max-width: 740px; diff --git a/app/views/diary_entries/_form.html.erb b/app/views/diary_entries/_form.html.erb index e07971089..bfb1c1823 100644 --- a/app/views/diary_entries/_form.html.erb +++ b/app/views/diary_entries/_form.html.erb @@ -5,13 +5,13 @@
<%= t ".location" -%> - <%= tag.div "", :id => "map", :class => "border border-grey rounded", :data => { :lat => @lat, :lon => @lon, :zoom => @zoom } %> + <%= tag.div "", :id => "map", :class => "border border-grey rounded mb-3", :data => { :lat => @lat, :lon => @lon, :zoom => @zoom } %>
<%= f.text_field :latitude, :wrapper_class => "col-sm-4", :id => "latitude" %> <%= f.text_field :longitude, :wrapper_class => "col-sm-4", :id => "longitude" %> -
- +
+
From 41f8607810c3d2fdba66d964d2b591bbdc78abea Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 8 Aug 2023 19:14:33 +0300 Subject: [PATCH 4/4] Use article html elements for diary posts --- app/views/diary_entries/_diary_entry.html.erb | 4 ++-- test/controllers/diary_entries_controller_test.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/diary_entries/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb index 52f500b1c..276b3eae7 100644 --- a/app/views/diary_entries/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -1,4 +1,4 @@ -
+
<% if @user %>

<%= link_to diary_entry.title, diary_entry_path(diary_entry.user, diary_entry) %>

@@ -65,4 +65,4 @@ <% end %> -
+
diff --git a/test/controllers/diary_entries_controller_test.rb b/test/controllers/diary_entries_controller_test.rb index c9464ffed..6365d46e5 100644 --- a/test/controllers/diary_entries_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -563,35 +563,35 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest # Try and get the index get diary_entries_path assert_response :success - assert_select "div.diary_post", :count => 20 + assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1 # Try and get the second page get css_select("li.page-item a.page-link").first["href"] assert_response :success - assert_select "div.diary_post", :count => 20 + assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Try and get the third page get css_select("li.page-item a.page-link").first["href"] assert_response :success - assert_select "div.diary_post", :count => 10 + assert_select "article.diary_post", :count => 10 assert_select "li.page-item.disabled span.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Go back to the second page get css_select("li.page-item a.page-link").last["href"] assert_response :success - assert_select "div.diary_post", :count => 20 + assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item a.page-link", :text => "Newer Entries", :count => 1 # Go back to the first page get css_select("li.page-item a.page-link").last["href"] assert_response :success - assert_select "div.diary_post", :count => 20 + assert_select "article.diary_post", :count => 20 assert_select "li.page-item a.page-link", :text => "Older Entries", :count => 1 assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1 end @@ -997,7 +997,7 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "index" assert_no_missing_translations - assert_select "div.diary_post", entries.count + assert_select "article.diary_post", entries.count entries.each do |entry| assert_select "a[href=?]", "/user/#{ERB::Util.u(entry.user.display_name)}/diary/#{entry.id}"