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
Get gifts #75
Get gifts #75
Conversation
@gift = current_organization.gifts.find(params[:id]) | ||
@result = current_user.purchase_gift(@gift) | ||
respond_to do |format| | ||
if @result == "Gift successfully added" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не гуд, має бути true/false в резалті бути а не строка
app/models/user.rb
Outdated
|
||
def purchase_gift(gift) | ||
if (balance - gift.price).negative? | ||
return "There are not enough points on your balance" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а якщо не true/false
то повертати якусь константу а не строку і залежно від неї вже робити що треба
if amount == 0
return :no_more_gifts
@@ -5,6 +5,9 @@ | |||
.col-lg-4.col-md-12.mb-4.text-center.btn | |||
.card.shadow.p-3.mb-5.bg-white.border-0.gifts-card | |||
= render partial: 'account/organization_gifts/gift', locals: { gift: gift } | |||
.d-flex.justify-content-start | |||
= button_to 'Get', receive_account_my_gift_path(id: gift.id), class:"button btn btn-outline-success nav-btn posts__card-button me-1 w-100", remote: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
заміни просто на receive_account_my_gift_path(gift)
p.fs-5.mb-4.lead.p-3 | ||
= @gift.description | ||
.d-flex.flex-row.justify-content-center | ||
= button_to 'Get', receive_account_my_gift_path(id: @gift.id), class:"button btn btn-outline-success nav-btn posts__card-button ms-1", remote: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
і тут
Get button
Changes description
Add posibility to get rewards and rspec
Screnshots of the added pages
Check list: