Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bloc titre - nettoyage #2301

Merged
merged 40 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
009477d
Block title
arnaudlevy Oct 9, 2024
b56a4e1
wip
arnaudlevy Oct 9, 2024
5ef59a6
wip migration
arnaudlevy Oct 9, 2024
24bb7fb
Merge branch 'main' into block-title
arnaudlevy Oct 9, 2024
ddc855d
migration
arnaudlevy Oct 9, 2024
da22672
Merge branch 'block-title' of github.com:osunyorg/admin into block-title
arnaudlevy Oct 9, 2024
f851d31
working!
arnaudlevy Oct 9, 2024
3c5ccd2
cleanup
arnaudlevy Oct 9, 2024
a2529c5
Fix
arnaudlevy Oct 9, 2024
3db41c5
Merge branch 'main' into block-title
arnaudlevy Oct 9, 2024
1475406
migration
arnaudlevy Oct 9, 2024
7758219
fix
arnaudlevy Oct 9, 2024
1a0846b
clean
arnaudlevy Oct 9, 2024
650aeb3
Merge branch 'block-title' into block-title-clean
arnaudlevy Oct 9, 2024
44cf570
fix
arnaudlevy Oct 9, 2024
b60c4c3
fix
arnaudlevy Oct 9, 2024
0eee364
fix
arnaudlevy Oct 9, 2024
a1fc0b4
lib
arnaudlevy Oct 11, 2024
049cecf
Merge branch 'main' into block-title
SebouChu Oct 11, 2024
131f9fd
Merge branch 'block-title' into block-title-clean
arnaudlevy Oct 11, 2024
1b2c46a
Merge branch 'main' into block-title
SebouChu Oct 14, 2024
1aa3721
fixes from feedback
SebouChu Oct 14, 2024
0f57675
wip (loca missing)
arnaudlevy Oct 15, 2024
bb37e83
done
arnaudlevy Oct 15, 2024
e14670d
biography:text
SebouChu Oct 15, 2024
a1c22c5
set migration as job
SebouChu Oct 15, 2024
71e753a
Merge branch 'block-title' of github.com:noesya/osuny into block-title
SebouChu Oct 15, 2024
4f1a320
prevent job enqueuing during migration
SebouChu Oct 15, 2024
3cb0fb3
reordering in block model
SebouChu Oct 15, 2024
845b8a8
2 minute job, no need for special queue
SebouChu Oct 15, 2024
929a41c
Merge branch 'main' into block-title
arnaudlevy Oct 15, 2024
7df8131
Merge branch 'main' into block-title
SebouChu Oct 15, 2024
7a11dbb
fix blocks enum scope
SebouChu Oct 15, 2024
5f8d0b4
Merge branch 'block-title' into block-title-clean
SebouChu Oct 15, 2024
164d467
Merge branch 'main' into block-title-clean
SebouChu Oct 28, 2024
357124b
annotate
SebouChu Oct 28, 2024
a0a5172
schema
SebouChu Oct 28, 2024
e8ff910
remove job
SebouChu Oct 28, 2024
49e2485
remove old migration
SebouChu Oct 28, 2024
d9149e3
Merge branch 'main' into block-title-clean
arnaudlevy Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions app/controllers/admin/communication/blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,8 @@ def redirect_if_block_language_is_incorrect

def reorder_object
@id = @object[:id]
@object[:kind] == 'heading' ? reorder_heading
: reorder_block
end

def reorder_heading
@heading = current_university.communication_block_headings.find(@id)
@heading.update_columns position: @index_heading
@index_block = 0
@index_heading += 1
end

def reorder_block
@block = current_university.communication_blocks.find(@id)
@block.update_columns position: @index_block,
heading_id: @heading&.id
@block.update_columns position: @index_block
@index_block += 1
end

Expand Down
5 changes: 1 addition & 4 deletions app/models/communication/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
# updated_at :datetime not null
# about_id :uuid indexed => [about_type]
# communication_website_id :uuid indexed
# heading_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_blocks_on_communication_website_id (communication_website_id)
# index_communication_blocks_on_heading_id (heading_id)
# index_communication_blocks_on_university_id (university_id)
# index_communication_website_blocks_on_about (about_type,about_id)
#
# Foreign Keys
#
# fk_rails_18291ef65f (university_id => universities.id)
# fk_rails_80e5625874 (communication_website_id => communication_websites.id)
# fk_rails_90ac986fab (heading_id => communication_block_headings.id)
#
class Communication::Block < ApplicationRecord
BLOCK_COPY_COOKIE = 'osuny-content-editor-block-copy'
Expand Down Expand Up @@ -166,7 +163,7 @@ def to_s
protected

def last_ordered_element
about.blocks.where(heading_id: heading_id).ordered.last
about.blocks.ordered.last
end

def set_university_and_website_from_about
Expand Down
118 changes: 0 additions & 118 deletions app/models/communication/block/heading.rb

This file was deleted.

7 changes: 1 addition & 6 deletions app/models/communication/block/with_heading_ranks.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
module Communication::Block::WithHeadingRanks
extend ActiveSupport::Concern

DEFAULT_HEADING_LEVEL = 2 # h1 is the page title

included do
# TODO TITLE remove
belongs_to :heading, optional: true
end
DEFAULT_HEADING_LEVEL = 2 # h1 is the page title

def heading_rank_self
title.present? ? heading_rank_base : false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# published :boolean default(FALSE)
# published_at :datetime
# slug :string
# subtitle :string
# summary :text
# title :string
# created_at :datetime not null
Expand Down
6 changes: 4 additions & 2 deletions app/models/concerns/contentful.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ module Contentful
LARGE_NUMBER_OF_BLOCKS = 5

included do
has_many :blocks, as: :about, class_name: 'Communication::Block', dependent: :destroy
has_many :headings, as: :about, class_name: 'Communication::Block::Heading', dependent: :destroy
has_many :blocks,
as: :about,
class_name: 'Communication::Block',
dependent: :destroy
end

def contents
Expand Down
5 changes: 0 additions & 5 deletions app/models/university/with_communication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,5 @@ module University::WithCommunication
class_name: 'Communication::Block',
dependent: :destroy
alias_method :blocks, :communication_blocks

has_many :communication_block_headings,
class_name: 'Communication::Block::Heading',
dependent: :destroy
alias_method :headings, :communication_block_headings
end
end
40 changes: 0 additions & 40 deletions app/services/migrations/fix_key_figures.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class RemoveCommunicationBlockHeadings < ActiveRecord::Migration[7.1]
def change
remove_column :communication_blocks, :heading_id
drop_table :communication_block_headings
end
end
Loading
Loading