Skip to content

Commit 62f9741

Browse files
author
Dany Marcoux
authored
Merge pull request #13645 from dmarcoux/issue-13574
Consistently name news accross the UI
2 parents 4a7f407 + 09be70b commit 62f9741

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

src/api/app/components/status_message_component.html.haml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#{time_ago_in_words(@status_message.created_at)} ago
1010
- if policy(@status_message).update? && policy(@status_message).destroy?
1111
.float-end
12-
= link_to(edit_status_message_path(@status_message), title: 'Edit status message', class: 'mr-2') do
12+
= link_to(edit_status_message_path(@status_message), title: 'Edit news item', class: 'mr-2') do
1313
%i.fas.fa-edit.text-secondary
14-
= link_to('#', title: 'Delete status message', data: { toggle: 'modal',
15-
target: '#delete-status-message-modal',
16-
action: status_message_path(@status_message) }) do
14+
= link_to('#', title: 'Delete news item', data: { toggle: 'modal',
15+
target: '#delete-news-item-modal',
16+
action: status_message_path(@status_message) }) do
1717

1818
%i.fas.fa-times-circle.text-danger
1919
.mt-2.mb-0

src/api/app/controllers/webui/status_messages_controller.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def create
2727
status_message = authorize StatusMessage.new(status_message_params)
2828

2929
if status_message.save
30-
flash[:success] = 'Status message was successfully created.'
30+
flash[:success] = 'News item was successfully created.'
3131
else
32-
flash[:error] = "Could not create status message: #{status_message.errors.full_messages.to_sentence}"
32+
flash[:error] = "Could not create news item: #{status_message.errors.full_messages.to_sentence}"
3333
end
3434

3535
redirect_to(action: 'index')
@@ -39,9 +39,9 @@ def update
3939
status_message = authorize StatusMessage.find(params[:id])
4040

4141
if status_message.update(status_message_params)
42-
flash[:success] = 'Status message was successfully updated.'
42+
flash[:success] = 'News item was successfully updated.'
4343
else
44-
flash[:error] = "Could not update status message: #{status_message.errors.full_messages.to_sentence}"
44+
flash[:error] = "Could not update news item: #{status_message.errors.full_messages.to_sentence}"
4545
end
4646

4747
redirect_to(action: 'index')
@@ -51,9 +51,9 @@ def destroy
5151
status_message = authorize StatusMessage.find(params[:id])
5252

5353
if status_message.destroy
54-
flash[:success] = 'Status message was successfully deleted.'
54+
flash[:success] = 'News item was successfully deleted.'
5555
else
56-
flash[:error] = "Could not delete status message: #{status_message.errors.full_messages.to_sentence}"
56+
flash[:error] = "Could not delete news item: #{status_message.errors.full_messages.to_sentence}"
5757
end
5858

5959
redirect_back_or_to({ action: 'index' })

src/api/app/views/webui/main/_status_messages.html.haml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
.card-footer
1616
= link_to(new_status_message_path, class: 'nav-link') do
1717
%i.fas.fa-plus-circle.text-primary
18-
Create Status Message
18+
Create News Item
1919

2020
- if status_message_policy.destroy?
21-
= render DeleteConfirmationDialogComponent.new(modal_id: 'delete-status-message-modal',
21+
= render DeleteConfirmationDialogComponent.new(modal_id: 'delete-news-item-modal',
2222
method: :delete,
23-
options: { modal_title: 'Do you want to remove this status message?',
24-
confirmation_text: 'Please confirm the deletion of this status message' })
23+
options: { modal_title: 'Do you want to remove this news item?',
24+
confirmation_text: 'Please confirm the deletion of this news item' })

src/api/app/views/webui/status_messages/edit.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- @pagetitle = 'Edit Status Message'
1+
- @pagetitle = 'Edit News Item'
22

33
.row
44
.col

src/api/app/views/webui/status_messages/index.html.haml

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
= page_entries_info @status_messages, entry_name: 'news'
3333

3434
.pt-4
35-
= link_to(new_status_message_path, title: 'Create News') do
35+
= link_to(new_status_message_path, title: 'Create News Item') do
3636
%i.fas.fa-plus-circle.text-primary
37-
Create News
37+
Create News Item
3838

39-
= render DeleteConfirmationDialogComponent.new(modal_id: 'delete-status-message-modal',
39+
= render DeleteConfirmationDialogComponent.new(modal_id: 'delete-news-item-modal',
4040
method: :delete,
41-
options: { modal_title: 'Do you want to remove this status message?',
42-
confirmation_text: 'Please confirm the deletion of this status message' })
41+
options: { modal_title: 'Do you want to remove this news item?',
42+
confirmation_text: 'Please confirm the deletion of this news item' })

src/api/app/views/webui/status_messages/new.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- @pagetitle = 'Create Status Message'
1+
- @pagetitle = 'Create News Item'
22
.row
33
.col
44
.card

src/api/spec/controllers/webui/status_messages_controller_spec.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
describe 'POST create' do
1212
it { is_expected.to use_after_action(:verify_authorized) }
1313

14-
it 'create a status message' do
14+
it 'create a news item' do
1515
login(admin_user)
1616

1717
post :create, params: { status_message: { message: 'Some message', severity: 'green' } }
@@ -27,13 +27,13 @@
2727
post :create, params: { status_message: { message: 'Some message' } }
2828
end.not_to change(StatusMessage, :count)
2929
expect(response).to redirect_to(status_messages_path)
30-
expect(flash[:error]).to eq("Could not create status message: Severity can't be blank")
30+
expect(flash[:error]).to eq("Could not create news item: Severity can't be blank")
3131

3232
expect do
3333
post :create, params: { status_message: { severity: 'green' } }
3434
end.not_to change(StatusMessage, :count)
3535
expect(response).to redirect_to(status_messages_path)
36-
expect(flash[:error]).to eq("Could not create status message: Message can't be blank")
36+
expect(flash[:error]).to eq("Could not create news item: Message can't be blank")
3737
end
3838

3939
context 'non-admin users' do
@@ -57,7 +57,7 @@
5757
post :create, params: { status_message: { severity: 'green' } }
5858
end
5959

60-
it { expect(flash[:error]).to eq("Could not create status message: Message can't be blank") }
60+
it { expect(flash[:error]).to eq("Could not create news item: Message can't be blank") }
6161
end
6262

6363
context 'empty severity' do
@@ -66,7 +66,7 @@
6666
post :create, params: { status_message: { message: 'Some message' } }
6767
end
6868

69-
it { expect(flash[:error]).to eq("Could not create status message: Severity can't be blank") }
69+
it { expect(flash[:error]).to eq("Could not create news item: Severity can't be blank") }
7070
end
7171

7272
context 'that fails at saving the message' do
@@ -117,7 +117,7 @@
117117

118118
it { is_expected.to use_after_action(:verify_authorized) }
119119

120-
context 'when the status message is not yet acknowledged' do
120+
context 'when the news item is not yet acknowledged' do
121121
before do
122122
allow(RabbitmqBus).to receive(:send_to_bus)
123123
login(admin_user)
@@ -141,7 +141,7 @@
141141
end
142142
end
143143

144-
context 'when the status message is already acknowledged' do
144+
context 'when the news item is already acknowledged' do
145145
before do
146146
allow(RabbitmqBus).to receive(:send_to_bus)
147147
login(admin_user)

0 commit comments

Comments
 (0)