Skip to content
Snippets Groups Projects
Commit 2886ebfb authored by winniehell's avatar winniehell
Browse files

Remove `pinTo` from `Flash` and make inline flash messages look nicer (!4854)

parent 3041c433
No related branches found
No related tags found
1 merge request!4854Remove pinTo from Flash
Loading
@@ -5,6 +5,7 @@ v 8.10.0 (unreleased)
Loading
@@ -5,6 +5,7 @@ v 8.10.0 (unreleased)
- Replace Haml with Hamlit to make view rendering faster. !3666 - Replace Haml with Hamlit to make view rendering faster. !3666
- Refactor repository paths handling to allow multiple git mount points - Refactor repository paths handling to allow multiple git mount points
- Add Application Setting to configure default Repository Path for new projects - Add Application Setting to configure default Repository Path for new projects
- Remove pinTo from Flash and make inline flash messages look nicer !4854 (winniehell)
- Wrap code blocks on Activies and Todos page. !4783 (winniehell) - Wrap code blocks on Activies and Todos page. !4783 (winniehell)
- Align flash messages with left side of page content !4959 (winniehell) - Align flash messages with left side of page content !4959 (winniehell)
- Display last commit of deleted branch in push events !4699 (winniehell) - Display last commit of deleted branch in push events !4699 (winniehell)
Loading
Loading
class @Flash class @Flash
constructor: (message, type = 'alert')-> hideFlash = -> $(@).fadeOut()
@flash = $(".flash-container")
@flash.html("")
   
innerDiv = $('<div/>', constructor: (message, type = 'alert', parent = null)->
if parent
@flashContainer = parent.find('.flash-container')
else
@flashContainer = $('.flash-container-page')
@flashContainer.html('')
flash = $('<div/>',
class: "flash-#{type}" class: "flash-#{type}"
) )
innerDiv.appendTo(".flash-container") flash.on 'click', hideFlash
   
textDiv = $("<div/>", textDiv = $('<div/>',
class: "flash-text", class: 'flash-text',
text: message text: message
) )
textDiv.appendTo(innerDiv) textDiv.appendTo(flash)
   
if @flash.parent().hasClass('content-wrapper') if @flashContainer.parent().hasClass('content-wrapper')
textDiv.addClass('container-fluid container-limited') textDiv.addClass('container-fluid container-limited')
   
@flash.click -> $(@).fadeOut() flash.appendTo(@flashContainer)
@flash.show() @flashContainer.show()
   
pinTo: (selector) ->
@flash.detach().appendTo(selector)
Loading
@@ -167,8 +167,7 @@ class @Notes
Loading
@@ -167,8 +167,7 @@ class @Notes
renderNote: (note) -> renderNote: (note) ->
unless note.valid unless note.valid
if note.award if note.award
flash = new Flash('You have already awarded this emoji!', 'alert') new Flash('You have already awarded this emoji!', 'alert')
flash.pinTo('.header-content')
return return
   
if note.award if note.award
Loading
@@ -293,6 +292,8 @@ class @Notes
Loading
@@ -293,6 +292,8 @@ class @Notes
form.find("#note_line_code").remove() form.find("#note_line_code").remove()
form.find("#note_type").remove() form.find("#note_type").remove()
   
@parentTimeline = form.parents('.timeline')
### ###
General note form setup. General note form setup.
   
Loading
@@ -323,8 +324,7 @@ class @Notes
Loading
@@ -323,8 +324,7 @@ class @Notes
@renderNote(note) @renderNote(note)
   
addNoteError: (xhr, note, status) => addNoteError: (xhr, note, status) =>
flash = new Flash('Your comment could not be submitted! Please check your network connection and try again.', 'alert') new Flash('Your comment could not be submitted! Please check your network connection and try again.', 'alert', @parentTimeline)
flash.pinTo('.md-area')
   
### ###
Called in response to the new note form being submitted Called in response to the new note form being submitted
Loading
Loading
.flash-container { .flash-container {
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
margin-bottom: $gl-padding;
font-size: 14px; font-size: 14px;
width: 100%;
z-index: 100; z-index: 100;
   
.flash-notice { .flash-notice {
Loading
@@ -18,9 +18,27 @@
Loading
@@ -18,9 +18,27 @@
} }
   
.flash-notice, .flash-alert { .flash-notice, .flash-alert {
.container-fluid.flash-text { border-radius: $border-radius-default;
.container-fluid.container-limited.flash-text {
background: transparent; background: transparent;
} }
} }
&.flash-container-page {
margin-bottom: 0;
.flash-notice, .flash-alert {
border-radius: 0;
}
}
}
@media (max-width: $screen-md-min) {
ul.notes {
.flash-container.timeline-content {
margin-left: 0;
}
}
} }
   
.flash-container .flash-container.flash-container-page
- if alert - if alert
.flash-alert .flash-alert
= alert = alert
Loading
Loading
Loading
@@ -2,6 +2,8 @@
Loading
@@ -2,6 +2,8 @@
= render "projects/notes/notes" = render "projects/notes/notes"
%ul.notes.notes-form.timeline %ul.notes.notes-form.timeline
%li.timeline-entry %li.timeline-entry
.flash-container.timeline-content
- if can? current_user, :create_note, @project - if can? current_user, :create_note, @project
.timeline-icon.hidden-xs.hidden-sm .timeline-icon.hidden-xs.hidden-sm
%a.author_link{ href: user_path(current_user) } %a.author_link{ href: user_path(current_user) }
Loading
Loading
:css :css
.hidden { display: none !important; } .hidden { display: none !important; }
   
.flash-container .flash-container.flash-container-page
.flash-alert .flash-alert
.flash-notice .flash-notice
   
Loading
Loading
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