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
career path #512
career path #512
Conversation
3f40c39
to
e23d173
Compare
import editorRun from '../scripts/markdownEditor.js'; | ||
import '../scripts/selectVacancyFilter.js'; | ||
|
||
ujs.start(); | ||
// editorRun(); | ||
editorRun(); |
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.
все супер, написал просто свои вопросики
app/models/career.rb
Outdated
include CareerRepository | ||
|
||
belongs_to :creator, class_name: 'User' | ||
has_many :items, dependent: :nullify, class_name: 'Career::Item' |
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.
перепутаны местами dependent
и class_name
(Прости за придирание к опечаткам)
app/repositories/user_repository.rb
Outdated
@@ -5,5 +5,6 @@ module UserRepository | |||
|
|||
included do | |||
scope :web, -> { order(id: :desc).permitted } | |||
scope :in_career_path, -> { includes(member: :career).joins(member: :career) } |
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.
in_career_path
- звучит, как роут. Может найти какое-то более ясное наименование? has_career
или что-то такое
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.
может и назвать in_career_track
? in или has не знаю, но вместо path использовать track
6cd8bc6
to
703f647
Compare
703f647
to
e8a48e9
Compare
@@ -0,0 +1,5 @@ | |||
# frozen_string_literal: true | |||
|
|||
class Web::Admin::Api::ApplicationController < Web::Admin::ApplicationController |
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.
обычно web это противоположно api и кажется должны быть разные неймспейсы
app/repositories/user_repository.rb
Outdated
@@ -5,5 +5,7 @@ module UserRepository | |||
|
|||
included do | |||
scope :web, -> { order(id: :desc).permitted } | |||
scope :in_career_track, -> { includes(member: :career).joins(member: :career) } | |||
scope :current_career_path, ->(career) { joins(members: :career).where(members: { state: 'active', career: }) } |
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.
чтобы не использовать строки (https://ru.hexlet.io/blog/posts/izbavlyaytes-ot-strok)
можно сделать where.merge(...Member.with_state(:active))
if @member.save | ||
f(:success) | ||
else | ||
f(:error) |
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.
при ошибке же недолжен редиректится а должен new рендерится с отображением ошибок
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.
@career_member = Career::Member.new
внутри не будет же ошибок как же их отобразить
redirect_to admin_careers_path | ||
else | ||
f(:error) | ||
@career = career.becomes(Career) |
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.
кажется можно избавится от becomes если сделать наоборот, поменять местами career и @career
app/models/career.rb
Outdated
|
||
validates :name, :description, :locale, presence: true | ||
validates :slug, presence: true, uniqueness: { case_sensitive: false } | ||
has_many :items, class_name: 'Career::Item', dependent: :nullify |
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.
nullify тут ок?
app/models/user.rb
Outdated
@@ -24,6 +24,7 @@ class User < ApplicationRecord | |||
has_many :resume_answer_likes, through: :resume_answers, source: :likes | |||
has_many :resume_comments, class_name: 'Resume::Comment', dependent: :destroy | |||
has_many :notifications, dependent: :destroy | |||
has_many :members, class_name: 'Career::Member', dependent: :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.
has_many :members
предложил бы уточнять в названии какие именно мемберы career_members. Так как юзер потенциально может быть мембером и для других сущностей в будущем
app/presenters/user_presenter.rb
Outdated
@@ -8,4 +8,18 @@ def full_name | |||
end | |||
|
|||
alias to_s full_name | |||
|
|||
def date_finished_career_path |
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.
похоже path тут не нужно в имени
bcc761c
to
5016942
Compare
5016942
to
1366e3b
Compare
|
||
class Web::Admin::Careers::MembersController < Web::Admin::Careers::ApplicationController | ||
def new | ||
resource_career |
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.
??
@items = career.items.order(order: :asc) | ||
@steps = career.steps |
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.
это для формы же? тогда есть два варика как это сделать лучше
- брать прям в шаблоне carrer.items
- добавить в класс формы методы для получения этих штук ну и вызывать в шаблоне
@@ -99,4 +99,11 @@ def seo_for_paging(number_page, text) | |||
|
|||
"#{t('page', number: number_page)}-#{text}" | |||
end | |||
|
|||
# rubocop:disable Rails/HelperInstanceVariable | |||
def append_javascript_packs(*packs) |
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.
а чет я не нашел - кто потом рендерить эти javascript_packs на страницу?
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.
ну это где ты вызываешь показываешь
а вот потом что с ним происходит, кто его на страницу добавляет?
This reverts commit 0843f78.
No description provided.