mirror of
https://github.com/we-promise/sure.git
synced 2026-04-09 15:24:48 +00:00
* feat: add protection indicator to entries and unlock functionality - Introduced protection indicator component rendering on hover and in detail views. - Added support to unlock entries, clearing protection flags (`user_modified`, `import_locked`, and locked attributes). - Updated routes, controllers, and models to enable unlock functionality for trades and transactions. - Refactored views and localized content to support the new feature. - Added relevant tests for unlocking functionality and attribute handling. * feat: improve sync protection and turbo stream updates for entries - Added tests for turbo stream updates reflecting protection indicators. - Ensured user-modified entries lock specific attributes to prevent overwrites. - Updated controllers to mark entries as user-modified and reload for accurate rendering. - Enhanced protection indicator rendering using turbo frames. - Applied consistent lock state handling across trades and transactions. * Address PR review comments for protection indicator --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
64 lines
2.5 KiB
Plaintext
64 lines
2.5 KiB
Plaintext
<%# locals: (entry:, balance_trend: nil, **) %>
|
|
|
|
<% trade = entry.entryable %>
|
|
|
|
<%= turbo_frame_tag dom_id(entry) do %>
|
|
<%= turbo_frame_tag dom_id(trade) do %>
|
|
<div class="group grid grid-cols-12 items-center <%= entry.excluded ? "text-secondary bg-surface-inset" : "text-primary" %> text-sm font-medium p-4">
|
|
<div class="col-span-8 flex items-center gap-4">
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
|
class: "checkbox checkbox--light hidden lg:block",
|
|
data: {
|
|
id: entry.id,
|
|
"bulk-select-target": "row",
|
|
action: "bulk-select#toggleRowSelection",
|
|
checkbox_toggle_target: "selectionEntry"
|
|
} %>
|
|
|
|
<div class="max-w-full">
|
|
<%= tag.div class: ["flex items-center gap-2 min-w-0"] do %>
|
|
<div class="hidden lg:flex">
|
|
<%= render DS::FilledIcon.new(
|
|
variant: :text,
|
|
text: entry.name,
|
|
size: "sm",
|
|
rounded: true
|
|
) %>
|
|
</div>
|
|
|
|
<div class="flex lg:hidden">
|
|
<%= render "investment_activity/quick_edit_badge", entry: entry, entryable: trade %>
|
|
</div>
|
|
|
|
<div class="truncate flex-shrink">
|
|
<%= link_to entry.name,
|
|
entry_path(entry),
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
class: "hover:underline" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hidden lg:flex col-span-2 items-center">
|
|
<%= render "investment_activity/quick_edit_badge", entry: entry, entryable: trade %>
|
|
</div>
|
|
|
|
<div class="shrink-0 col-span-4 lg:col-span-2 ml-auto flex items-center justify-end gap-2">
|
|
<%# Protection indicator - shows on hover when entry is protected from sync %>
|
|
<% if entry.protected_from_sync? && !entry.excluded? %>
|
|
<%= link_to entry_path(entry),
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
class: "invisible group-hover:visible transition-opacity",
|
|
title: t("entries.protection.tooltip") do %>
|
|
<%= icon "lock", size: "sm", class: "text-secondary" %>
|
|
<% end %>
|
|
<% end %>
|
|
<%= content_tag :p,
|
|
format_money(-entry.amount_money),
|
|
class: ["text-green-600": entry.amount.negative?] %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|