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%;
}
/* 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 {
#map {
height: 400px;
display: none;
margin-bottom: $lineheight;
}
.comments {
max-width: 740px;
}
.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;
}
}
}

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">
<%= user_thumbnail diary_comment.user %>
</div>
<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 %>
| <%= report_link(t(".report"), diary_comment) %>
<% 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'>
<% if @user %>
<h2><%= link_to diary_entry.title, diary_entry_path(diary_entry.user, diary_entry) %></h2>
@ -65,4 +65,4 @@
<% end %>
</ul>
</nav>
</div>
</article>

View file

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

View file

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

View file

@ -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}"