-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(public account share): fix public account share buttons and labels (
#77) * fix(public account share): fix public account share buttons and labels * fix(public account share): fixup! fix public account share buttons and labels * fix(public account share): fixup! fixup! fix public account share buttons and labels * fix(public account share): fixup! fixup! fixup! fix public account share buttons and labels --------- Co-authored-by: VladislavSokov <[email protected]>
- Loading branch information
1 parent
8a1c097
commit 25da517
Showing
16 changed files
with
155 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
class PublicAccountSharesController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :authenticate_user!, only: [:create, :new] | ||
|
||
def show; end | ||
|
||
def new; end | ||
|
||
def create | ||
AccountShare.create!(user_id: current_user.id, account_id: account.id, accepted_at: Time.current) | ||
redirect_to account_shares_path account | ||
AccountShare.create!(user_id: current_user.id, | ||
account_id: account.id, | ||
token: SecureRandom.urlsafe_base64(32), | ||
accepted_at: Time.current) | ||
redirect_to account_shares_path(account) | ||
end | ||
|
||
private | ||
|
||
helper_method memoize def public_account | ||
AccountShare.find_by(token: params[:token]).account | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', public_account_path(token: account_share.token) | ||
- 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tr | ||
td= objective.name | ||
td= objective.amount | ||
td= number_to_percentage(public_account.balance / objective.amount * 100, precision: 0) | ||
td= ([objective.amount - public_account.balance, 0].max / public_account.automatic_topup_configs.sum(:amount).+(0.1)).round(2) | ||
td= image_tag objective.image_url | ||
td= '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tr | ||
td= transaction.date | ||
td= transaction.from_account.name | ||
td= transaction.to_account.name | ||
td= transaction.signed_amount(public_account) | ||
td= transaction.description | ||
td= '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
h2.title.is-4 | ||
| Account details | ||
.buttons | ||
= link_to 'Back', my_account_path, class: 'button is-light' | ||
.columns | ||
.column | ||
.card | ||
.card-header | ||
.card-header-title.is-centered | ||
h3.title.is-4= public_account.name | ||
.card-content | ||
nav.level | ||
div.level-item.has-text-centered | ||
div | ||
p.heading Balance | ||
p.title #{public_account.balance} | ||
.columns | ||
.column | ||
.card | ||
.card-header | ||
.card-header-title.is-centered | ||
h3.title.is-4 History | ||
.card-content.px-1 | ||
.table-container | ||
table.table.is-fullwidth.is-striped | ||
thead | ||
tr | ||
th Date | ||
th From | ||
th To | ||
th Amount | ||
th Description | ||
th Actions | ||
tbody | ||
= render partial: 'transaction', collection: public_account.transactions, public_account: public_account | ||
.columns | ||
.column | ||
.card | ||
.card-header | ||
.card-header-title.is-centered | ||
h3.title.is-4 Objectives | ||
.card-content.px-1 | ||
.table-container | ||
table.table.is-fullwidth.is-striped | ||
thead | ||
tr | ||
th Name | ||
th Amount | ||
th Progress | ||
th Weeks # to goal | ||
th Image | ||
th Actions | ||
tbody | ||
= render partial: 'objective', collection: public_account.objectives, public_account: public_account | ||
.columns | ||
.column | ||
.card | ||
.card-header | ||
.card-header-title.is-centered | ||
.title.is-4 Weekly Automatic Topups | ||
.card-content.px-1 | ||
.table-container | ||
table.table.is-fullwidth.is-striped | ||
thead | ||
tr | ||
th From | ||
th Amount | ||
th Actions | ||
- public_account.automatic_topup_configs.each do |config| | ||
tr | ||
td= config.from_account.name | ||
td= config.amount | ||
td '' | ||
- if public_account.accumulative_balance_data.present? | ||
= line_chart public_account.accumulative_balance_data, xtitle: 'Date', ytitle: 'Accumulative Balance' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.