Skip to content
Snippets Groups Projects
Commit 1fdbb6c3 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix

parent 8d9d2867
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,6 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
def create
if @heading.save
sync_with_git_if_necessary
redirect_to about_path,
notice: t('admin.successfully_created_html', model: @heading.to_s)
else
......@@ -35,7 +34,6 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
def update
if @heading.update(heading_params)
sync_with_git_if_necessary
redirect_to about_path,
notice: t('admin.successfully_updated_html', model: @heading.to_s)
else
......@@ -48,18 +46,12 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
def destroy
path = about_path
@heading.destroy
sync_with_git_if_necessary
redirect_to path,
notice: t('admin.successfully_destroyed_html', model: @heading.to_s)
end
protected
def sync_with_git_if_necessary
return unless @heading.about.respond_to?(:sync_with_git)
@heading.about.sync_with_git
end
# TODO factorize
def website_id
params[:website_id] || @heading.about&.website.id
......
......@@ -26,6 +26,7 @@
# fk_rails_ae82723550 (university_id => universities.id)
#
class Communication::Block::Heading < ApplicationRecord
include AsIndirectObject
include Sanitizable
include WithPosition
include WithUniversity
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment