feat(announce): can destroy a note and add at the same date

This commit is contained in:
Colin Darie 2023-10-26 14:36:03 +02:00
parent 5df6997fa3
commit e49436aa5d
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
8 changed files with 47 additions and 5 deletions

View file

@ -1,6 +1,6 @@
class SuperAdmins::ReleaseNotesController < ApplicationController
before_action :authenticate_super_admin!
before_action :set_note, only: [:edit, :update]
before_action :set_note, only: [:edit, :update, :destroy]
def index
@release_notes = ReleaseNote
@ -14,7 +14,7 @@ class SuperAdmins::ReleaseNotesController < ApplicationController
end
def new
@release_note = ReleaseNote.new(released_on: Date.current)
@release_note = ReleaseNote.new(released_on: params[:date].presence || Date.current, published: true)
end
def create
@ -40,6 +40,12 @@ class SuperAdmins::ReleaseNotesController < ApplicationController
end
end
def destroy
@release_note.destroy!
redirect_to super_admins_release_notes_path, notice: t('.success')
end
private
def release_note_params