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
|
||||
|
|
|
@ -69,3 +69,6 @@ bg:
|
|||
|
||||
meta_data: "Език: %{language}, поток: „%{track}“, продължителност: %{length} мин."
|
||||
suggestion_and_speaker_count: "%{suggestions} предложения от %{speakers} лектори"
|
||||
|
||||
lecture_was_successfully_confirmed: "Лекцията беше потвърдена успешно"
|
||||
workshop_was_successfully_confirmed: "Уъркшопът беше потвърден успешно"
|
|
@ -67,3 +67,6 @@ en:
|
|||
of_motto: share the freedom
|
||||
meta_data: "Language: %{language}, track: \"%{track}\", length: %{length} min."
|
||||
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