-
Notifications
You must be signed in to change notification settings - Fork 11
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
Show calculator #946
base: base-setup
Are you sure you want to change the base?
Show calculator #946
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## base-setup #946 +/- ##
=============================================
Coverage ? 64.66%
=============================================
Files ? 71
Lines ? 982
Branches ? 0
=============================================
Hits ? 635
Misses ? 347
Partials ? 0 ☔ View full report in Codecov by Sentry. |
@@ -59,7 +59,7 @@ def collection | |||
end | |||
|
|||
def calculator | |||
@calculator = Calculator.friendly.find(params[:slug]) | |||
@calculator = Calculator.find(params[:slug]) |
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.
тестів нема + юзай ресурс
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.
не дуже розумію, що це за результат з парамсів?
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.
SEO-friendly урла залишена з попердньої реалізації.
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.
що це ще таке?? ну Наталя, як ми юзаємо ресурс?
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.
я і не казав забирати слаг
<td><%= calculator.id %></td> | ||
<td><%= calculator.name %></td> | ||
<td><%= calculator.en_name %></td> |
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.
<td><%= calculator.en_name %></td> | |
<td><%= calculator.name %></td> |
app/views/calculators/show.html.erb
Outdated
<div class="container place-items-center"> | ||
<h1 class="text-4xl font-bold">Calculator <%= @calculator.en_name %></h1><br> | ||
|
||
<%= form_with url: calculate_account_calculator_path(slug: @calculator.slug || @calculator.id) do |form| %> |
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.
<%= form_with url: calculate_account_calculator_path(slug: @calculator.slug || @calculator.id) do |form| %> | |
<%= form_with url: calculate_account_calculator_path(@calculator) do |form| %> | |
@@ -59,7 +59,7 @@ def collection | |||
end | |||
|
|||
def calculator | |||
@calculator = Calculator.friendly.find(params[:slug]) | |||
@calculator = Calculator.find(params[:slug]) |
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.
що це ще таке?? ну Наталя, як ми юзаємо ресурс?
app/models/calculator.rb
Outdated
def name | ||
(I18n.locale == :uk) ? uk_name : en_name | ||
end |
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.
@@ -59,7 +59,7 @@ def collection | |||
end | |||
|
|||
def calculator | |||
@calculator = Calculator.friendly.find(params[:slug]) | |||
@calculator = Calculator.find(params[:slug]) |
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.
я і не казав забирати слаг
@@ -45,6 +46,6 @@ def collection | |||
end | |||
|
|||
def resource | |||
collection.friendly.find(params[:slug]) | |||
collection.find(params[:slug]) |
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.
а чому шукає слаг, але скоуп френдлі видаляється?
@@ -1,7 +1,7 @@ | |||
# frozen_string_literal: true | |||
|
|||
class Account::CalculatorsController < Account::BaseController | |||
before_action :calculator, only: [:edit, :update, :destroy] | |||
before_action :resource, only: [:edit, :update, :destroy] |
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.
видали цей біфор екшин
end | ||
|
||
it "assigns the correct calculator to @calculator" do | ||
get :show, params: { slug: calculator.slug, locale: :en } |
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 :show, params: { slug: calculator.slug, locale: :en } | |
get :show, params: { slug: calculator.slug, locale: :en } | |
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.
і так скрізь. розділяй дії та експектейшини
порізолвай конфлікти |
dev
Project
Code reviewers
Summary of issue
If Admin created calculator via constructor, User could see it.
Summary of change
CHECK LIST