백로그
0할 일
0진행 중
0리뷰
0완료 (15일)
2QT 테마 라우트 + 컨트롤러 + 테스트
## 목표 Qt::ThemesController 생성 (index, show, subscribe) + 라우트 + 컨트롤러 테스트 ## 1. 라우트 (config/routes.rb) qt namespace 안에 추가: ```ruby resources :themes, only: [:index, :show] do member do post :subscribe end end ``` ## 2. 컨트롤러 (app/controllers/qt/themes_controller.rb) - `index`: QtTheme.active 목록 (is_default 먼저, 나머지 최신순) - `show`: @theme = QtTheme.active.find(params[:id]), @contents = @theme.qt_contents.order(:day_number), @existing_session 중복 체크 - `subscribe`: - QtSession 생성 (title: theme.title, qt_theme: theme, creator: current_user, start_date: Date.current, end_date: Date.current + theme.total_day - 1, total_days: theme.total_day) - QtParticipant 생성 (role: :creator, user: current_user) - 이미 같은 테마로 active 세션 있으면 redirect with alert - 성공 시 redirect_to qt_session_path(session), notice: "플랜이 시작되었습니다!" ## 3. 테스트 (test/controllers/qt/themes_controller_test.rb) - GET /qt/themes - 로그인 필수, active 테마만 표시, inactive 미표시 - GET /qt/themes/:id - 테마 상세 표시, inactive 테마 404 - POST /qt/themes/:id/subscribe - 세션+참여자 생성, 중복 구독 방지 - 비로그인 시 redirect ## 참고 파일 - app/controllers/qt/sessions_controller.rb (패턴 참고) - app/models/qt_theme.rb (scope :active) - app/models/qt_session.rb (generate_invite_code) - test/fixtures/qt_themes.yml (default_theme, ai_theme, inactive_theme) ## 완료 기준 - 라우트 동작, 컨트롤러 3개 액션, 테스트 전체 통과
QT 테마 뷰 (index + show + 카드 파셜)
## 목표 QT 테마 브라우즈 + 상세 페이지 뷰 구현 ## 1. _theme_card 파셜 (app/views/qt/themes/_theme_card.html.erb) - 디자인 시스템 shared/card 파셜 활용 - 표시: 제목, 설명(truncate), 총 일수, 성경 범위(bible_books), AI생성 뱃지 - 링크: qt_theme_path(theme)로 상세 이동 ## 2. index 뷰 (app/views/qt/themes/index.html.erb) - 페이지 제목: "QT 테마" - 기본 테마 섹션 (is_default: true) + 일반 테마 섹션 - 반응형 그리드: grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 - 테마 없을 때 shared/empty_state 파셜 사용 ## 3. show 뷰 (app/views/qt/themes/show.html.erb) - 테마 정보: 제목, 설명, 총 일수, 성경 범위 - 콘텐츠 미리보기: @contents에서 처음 3일분만 표시 (day_number, theme_title, bible_passage) - "이 테마로 플랜 시작" 버튼 → POST subscribe_qt_theme_path(@theme), method: :post - @existing_session이 있으면 "이미 진행 중인 플랜이 있습니다" 안내 + 해당 세션 링크 - 뒤로가기: qt_themes_path ## 디자인 패턴 참고 - app/views/qt/sessions/index.html.erb (카드 레이아웃 패턴) - app/views/shared/_card.html.erb, _button.html.erb, _badge.html.erb, _empty_state.html.erb - 색상/텍스트: text-heading, text-body, text-small, text-caption - 다크모드: bg-surface-default, text-text-primary 등 디자인 토큰 사용 ## 완료 기준 - 3개 뷰 파일 생성, 디자인 시스템 일관성, 반응형 동작