BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5e74a363
Commit
5e74a363
authored
Feb 05, 2018
by
Fatih Acet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'axios-admin-message' into 'master'
Replace $.ajax in admin broadcast messages with axios See merge request gitlab-org/gitlab-ce!16840
parents
3cb7b472
95994503
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
broadcast_message.js
...ripts/pages/admin/broadcast_messages/broadcast_message.js
+11
-6
broadcast_messages_controller.rb
app/controllers/admin/broadcast_messages_controller.rb
+4
-1
preview.js.haml
app/views/admin/broadcast_messages/preview.js.haml
+0
-1
No files found.
app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
View file @
5e74a363
import
_
from
'underscore'
;
import
axios
from
'~/lib/utils/axios_utils'
;
import
flash
from
'~/flash'
;
import
{
__
}
from
'~/locale'
;
export
default
function
initBroadcastMessagesForm
()
{
$
(
'input#broadcast_message_color'
).
on
(
'input'
,
function
onMessageColorInput
()
{
...
...
@@ -18,13 +21,15 @@ export default function initBroadcastMessagesForm() {
if
(
message
===
''
)
{
$
(
'.js-broadcast-message-preview'
).
text
(
'Your message here'
);
}
else
{
$
.
ajax
({
url
:
previewPath
,
type
:
'POST'
,
data
:
{
broadcast_message
:
{
message
},
axios
.
post
(
previewPath
,
{
broadcast_message
:
{
message
,
},
});
})
.
then
(({
data
})
=>
{
$
(
'.js-broadcast-message-preview'
).
html
(
data
.
message
);
})
.
catch
(()
=>
flash
(
__
(
'An error occurred while rendering preview broadcast message'
)));
}
},
250
));
}
app/controllers/admin/broadcast_messages_controller.rb
View file @
5e74a363
class
Admin
::
BroadcastMessagesController
<
Admin
::
ApplicationController
include
BroadcastMessagesHelper
before_action
:finder
,
only:
[
:edit
,
:update
,
:destroy
]
def
index
...
...
@@ -37,7 +39,8 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
end
def
preview
@broadcast_message
=
BroadcastMessage
.
new
(
broadcast_message_params
)
broadcast_message
=
BroadcastMessage
.
new
(
broadcast_message_params
)
render
json:
{
message:
render_broadcast_message
(
broadcast_message
)
}
end
protected
...
...
app/views/admin/broadcast_messages/preview.js.haml
deleted
100644 → 0
View file @
3cb7b472
$('.js-broadcast-message-preview').html("
#{
j
(
render_broadcast_message
(
@broadcast_message
))
}
");
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment