Implement a way for users to confirm submissions
This commit is contained in:
parent
97fcc32990
commit
cf815695b7
|
@ -1,6 +1,6 @@
|
|||
class LecturesController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :assign_lecture, only: [:show, :edit, :update]
|
||||
before_action :assign_lecture, only: [:show, :edit, :update, :confirm]
|
||||
|
||||
def index
|
||||
@lectures = Lecture.where user: current_user
|
||||
|
@ -34,6 +34,11 @@ class LecturesController < ApplicationController
|
|||
def show
|
||||
end
|
||||
|
||||
def confirm
|
||||
@lecture.touch :confirmed_at
|
||||
redirect_to @lecture, notice: I18n.t(:lecture_was_successfully_confirmed)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assign_lecture
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class WorkshopsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :assign_workshop, only: [:show, :edit, :update]
|
||||
before_action :assign_workshop, only: [:show, :edit, :update, :confirm]
|
||||
|
||||
def index
|
||||
@workshops = Workshop.where user: current_user
|
||||
|
@ -34,6 +34,11 @@ class WorkshopsController < ApplicationController
|
|||
def show
|
||||
end
|
||||
|
||||
def confirm
|
||||
@workshop.touch :confirmed_at
|
||||
redirect_to @workshop, notice: I18n.t(:workshop_was_successfully_confirmed)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assign_workshop
|
||||
|
|
|
@ -68,4 +68,7 @@ bg:
|
|||
of_motto: да споделим свободата
|
||||
|
||||
meta_data: "Език: %{language}, поток: „%{track}“, продължителност: %{length} мин."
|
||||
suggestion_and_speaker_count: "%{suggestions} предложения от %{speakers} лектори"
|
||||
suggestion_and_speaker_count: "%{suggestions} предложения от %{speakers} лектори"
|
||||
|
||||
lecture_was_successfully_confirmed: "Лекцията беше потвърдена успешно"
|
||||
workshop_was_successfully_confirmed: "Уъркшопът беше потвърден успешно"
|
|
@ -66,4 +66,7 @@ en:
|
|||
|
||||
of_motto: share the freedom
|
||||
meta_data: "Language: %{language}, track: \"%{track}\", length: %{length} min."
|
||||
suggestion_and_speaker_count: "%{suggestions} suggestions by %{speakers} speakers"
|
||||
suggestion_and_speaker_count: "%{suggestions} suggestions by %{speakers} speakers"
|
||||
|
||||
lecture_was_successfully_confirmed: "The lecture was successfully confirmed"
|
||||
workshop_was_successfully_confirmed: "The workshop was successfully confirmed"
|
|
@ -1,6 +1,15 @@
|
|||
Rails.application.routes.draw do
|
||||
resources :lectures, only: [:index, :new, :create, :edit, :update, :show]
|
||||
resources :workshops, only: [:index, :new, :create, :edit, :update, :show]
|
||||
resources :lectures, only: [:index, :new, :create, :edit, :update, :show] do
|
||||
member do
|
||||
get 'confirm'
|
||||
end
|
||||
end
|
||||
|
||||
resources :workshops, only: [:index, :new, :create, :edit, :update, :show] do
|
||||
member do
|
||||
get 'confirm'
|
||||
end
|
||||
end
|
||||
|
||||
devise_for :users, controllers: {registrations: 'registrations', sessions: 'sessions'}
|
||||
|
||||
|
|
Loading…
Reference in New Issue