Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(public account share): fix public account share buttons and labels #77

Merged
merged 4 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AccountsController < ApplicationController
def show
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/my_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ def show; end
Account.shared_for(current_user)
end

helper_method memoize def public_shared_accounts
Account.shared_for_public
end

helper_method memoize def unaccepted_shares
AccountShare.unaccepted.for(current_user)
end
Expand Down
12 changes: 8 additions & 4 deletions app/views/account_shares/_account_share.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
tr
td= account_share.name
td= account_share.email
- if account_share.public?
td= 'public'
td= 'public'
- else
td= account_share.name
td= account_share.email
td= account_share.created_at.to_formatted_s(:short)
td= account_share.accepted_at&.to_formatted_s(:short)
- if account_share.public?
td= ''
td= link_to 'link', account_path(account)
- else
td= link_to 'link', accept_account_share_url(token: account_share.token)
td= link_to 'Cancel', account_share_path(account, account_share), method: :delete, data: {confirm: 'Cancel this share?'}, class: 'button is-small is-light'
td= link_to 'Cancel', account_share_path(account, account_share), method: :delete, data: {confirm: 'Cancel this share?'}, class: 'button is-small is-light'
11 changes: 0 additions & 11 deletions app/views/my_accounts/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@
= link_to '+ Add', new_account_topup_path(shared_account), class: 'card-footer-item'
= link_to '- Spend', new_account_spend_path(shared_account), class: 'card-footer-item'
br
- if public_shared_accounts.present?
| Public shared accounts
- public_shared_accounts.each do |shared_account|
.card.box
.card-content
.media
.media-content
p.title.is-6 Owner: #{shared_account.parent.email}
p.title.is-4= link_to shared_account.name, account_path(shared_account)
p.subtitle.is-6= shared_account.balance

- if unaccepted_shares.present?
h2.title
| Unaccepted shares
Expand Down