From a567f51e6b37b489e1f4a76329a1de2975d21944 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Mon, 26 May 2025 16:23:38 +0200 Subject: [PATCH] Store diary icons separately --- app/assets/images/diary/comment.svg | 3 +++ app/assets/images/diary/date.svg | 4 ++++ app/assets/images/diary/entry.svg | 4 ++++ app/assets/images/diary/new.svg | 3 +++ app/views/diary_entries/_navigation.html.erb | 4 +--- app/views/diary_entries/_profile_diaries.html.erb | 10 ++++------ test/controllers/users_controller_test.rb | 12 ++++++------ 7 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 app/assets/images/diary/comment.svg create mode 100644 app/assets/images/diary/date.svg create mode 100644 app/assets/images/diary/entry.svg create mode 100644 app/assets/images/diary/new.svg diff --git a/app/assets/images/diary/comment.svg b/app/assets/images/diary/comment.svg new file mode 100644 index 000000000..53c65fc49 --- /dev/null +++ b/app/assets/images/diary/comment.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/images/diary/date.svg b/app/assets/images/diary/date.svg new file mode 100644 index 000000000..dc9d5d0f6 --- /dev/null +++ b/app/assets/images/diary/date.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/assets/images/diary/entry.svg b/app/assets/images/diary/entry.svg new file mode 100644 index 000000000..4aff8dbd2 --- /dev/null +++ b/app/assets/images/diary/entry.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/images/diary/new.svg b/app/assets/images/diary/new.svg new file mode 100644 index 000000000..ad13175d7 --- /dev/null +++ b/app/assets/images/diary/new.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/views/diary_entries/_navigation.html.erb b/app/views/diary_entries/_navigation.html.erb index 01f37f27c..b7cbc329b 100644 --- a/app/views/diary_entries/_navigation.html.erb +++ b/app/views/diary_entries/_navigation.html.erb @@ -15,9 +15,7 @@ <% if @user && @user == current_user || !@user && current_user %>
  • <%= link_to new_diary_entry_path, :class => "icon-link", :title => t(".new_title") do %> - - - + <%= inline_svg_tag "diary/new.svg" %> <%= t(".new") %> <% end %>
  • diff --git a/app/views/diary_entries/_profile_diaries.html.erb b/app/views/diary_entries/_profile_diaries.html.erb index 43359e43d..562a906b3 100644 --- a/app/views/diary_entries/_profile_diaries.html.erb +++ b/app/views/diary_entries/_profile_diaries.html.erb @@ -6,20 +6,18 @@

    - "> + <%= inline_svg_tag "diary/entry.svg", :title => t(".title_label") %> <%= link_to entry.title, diary_entry_path(@user, entry) %>

    <%= truncate(strip_tags(entry.body.to_html), :length => 150) %>

    - "> - <%= link_to diary_entry_path(@user, entry, :anchor => "comments"), :class => "text-body-secondary" do %> - <%= t(".comments", :count => entry.comments.size) %> - <% end %> + <%= inline_svg_tag "diary/comment.svg", :class => "me-1", :title => t(".comments_label") %> + <%= link_to t(".comments", :count => entry.comments.size), diary_entry_path(@user, entry, :anchor => "comments"), :class => "text-body-secondary" %> - "> + <%= inline_svg_tag "diary/date.svg", :class => "me-1", :title => t(".date_label") %> <%= l(entry.created_at.to_date, :format => :long) %>
    diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index d0ad6c848..e663cf438 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -344,11 +344,11 @@ class UsersControllerTest < ActionDispatch::IntegrationTest # Should only show the 4 most recent entries assert_select ".profile-diary-card", 4 - assert_select ".card-title", "Fifth Entry" - assert_select ".card-title", "Fourth Entry" - assert_select ".card-title", "Third Entry" - assert_select ".card-title", "Second Entry" - assert_select ".card-title", { :text => "First Entry", :count => 0 } + assert_select ".card-title a", "Fifth Entry" + assert_select ".card-title a", "Fourth Entry" + assert_select ".card-title a", "Third Entry" + assert_select ".card-title a", "Second Entry" + assert_select ".card-title a", { :text => "First Entry", :count => 0 } end def test_show_profile_diaries_with_comments @@ -362,7 +362,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_select ".profile-diary-card" do - assert_select ".card-title", "Entry with Comments" + assert_select ".card-title a", "Entry with Comments" assert_select "small.text-body-secondary", /2 comments/ end end -- 2.39.5