feat(announce): can destroy a note and add at the same date
This commit is contained in:
parent
5df6997fa3
commit
e49436aa5d
8 changed files with 47 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue