Merge remote-tracking branch 'upstream/pull/4144'

This commit is contained in:
Tom Hughes 2023-08-13 10:50:33 +01:00
commit e2cb2327f9
6 changed files with 14 additions and 39 deletions

View file

@ -1047,49 +1047,24 @@ tr.turn:hover {
width: 100%; 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 */ /* Rules for the diary entry page */
.diary_entries { .diary_entries {
#map { #map {
height: 400px; height: 400px;
display: none; display: none;
margin-bottom: $lineheight;
} }
.comments { .comments {
max-width: 740px; max-width: 740px;
} }
.diary-comment { .diary-comment {
border-top: 1px dashed $grey; border-top: 1px dashed $grey;
padding-top: $lineheight/2;
padding-bottom: $lineheight/2;
&:first-child { &:first-child {
margin-top: $lineheight/2;
padding-top: $lineheight;
border-top: 1px solid $grey; border-top: 1px solid $grey;
} }
&.deleted {
background-color: #fee;
}
p { p {
margin-bottom: $lineheight/2; margin-bottom: $lineheight/2;
} }
.comment-heading {
margin-bottom: 0;
margin-top: 0;
}
} }
} }

View file

@ -1,9 +1,9 @@
<div class="row diary-comment<%= " text-muted deleted" unless diary_comment.visible? %>"> <div class="row diary-comment py-3<%= " text-muted bg-danger bg-opacity-10" unless diary_comment.visible? %>">
<div class="col-auto"> <div class="col-auto">
<%= user_thumbnail diary_comment.user %> <%= user_thumbnail diary_comment.user %>
</div> </div>
<div class="col"> <div class="col">
<p class="text-muted comment-heading" id="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}")) %> <p class="text-muted m-0" id="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 %> <% if current_user and diary_comment.user.id != current_user.id %>
| <%= report_link(t(".report"), diary_comment) %> | <%= report_link(t(".report"), diary_comment) %>
<% end %> <% end %>

View file

@ -1,4 +1,4 @@
<div class='diary_post<%= " text-muted px-3 deleted" unless diary_entry.visible %> user_<%= diary_entry.user.id %>'> <article class='diary_post border-top border-grey pt-3 pb-2<%= " text-muted px-3 bg-danger bg-opacity-10" unless diary_entry.visible %> user_<%= diary_entry.user.id %>'>
<div class='mb-3'> <div class='mb-3'>
<% if @user %> <% if @user %>
<h2><%= link_to diary_entry.title, diary_entry_path(diary_entry.user, diary_entry) %></h2> <h2><%= link_to diary_entry.title, diary_entry_path(diary_entry.user, diary_entry) %></h2>
@ -65,4 +65,4 @@
<% end %> <% end %>
</ul> </ul>
</nav> </nav>
</div> </article>

View file

@ -5,13 +5,13 @@
<fieldset> <fieldset>
<legend><%= t ".location" -%></legend> <legend><%= t ".location" -%></legend>
<%= 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 } %>
<div class="row mb-3"> <div class="row mb-3">
<%= f.text_field :latitude, :wrapper_class => "col-sm-4", :id => "latitude" %> <%= f.text_field :latitude, :wrapper_class => "col-sm-4", :id => "latitude" %>
<%= f.text_field :longitude, :wrapper_class => "col-sm-4", :id => "longitude" %> <%= f.text_field :longitude, :wrapper_class => "col-sm-4", :id => "longitude" %>
<div class="col-sm-4"> <div class="col-sm-4 align-self-end pt-2">
<label><a href="#" id="usemap"><%= t ".use_map_link" -%></a></label> <button type="button" id="usemap" class="btn btn-outline-primary"><%= t ".use_map_link" -%></button>
</div> </div>
</div> </div>
</fieldset> </fieldset>

View file

@ -13,7 +13,7 @@
<%= render @entry %> <%= render @entry %>
<a id="comments"></a> <a id="comments"></a>
<div class='comments'> <div class='comments mt-2'>
<%= render :partial => "diary_comment", :collection => @comments %> <%= render :partial => "diary_comment", :collection => @comments %>
</div> </div>

View file

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