Skip to content

Commit

Permalink
Add notifications area
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Sep 2, 2019
1 parent 03a4825 commit 0583f86
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pyforms_web/basewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ def generate_panel(self, formset):
"""
if formset is None:
return ''
elif 'notifications-area' == formset:
return "<div class='notifications-area field'></div>"

elif '=' in formset:
index = list( formset ).index('=')
return "<div id='{splitter_id}' class='horizontalSplitter' ><div>{top}</div><div>{bottom}</div></div>".format(
Expand Down
10 changes: 6 additions & 4 deletions pyforms_web/web/static/pyforms.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyforms_web/web/static/pyformsjs/BaseWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ class BaseWidget{
for(var i=0; i<msg.messages.length; i++) html += '<li>'+msg.messages[i]+'</li>';
html += '</ul>';
};
$(html).prependTo(this.jquery()).find('.close').on('click', function(){

var destination = this.jquery().find('.notifications-area');
if( destination.length==0 )
destination = this.jquery()

$(html).prependTo(destination).find('.close').on('click', function(){
$(this).closest('.message').transition({animation:'fade',onComplete:function(){$(this).remove();} });
});
};
Expand Down
1 change: 1 addition & 0 deletions utilities/merge-js.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
os.path.join("static","pyformsjs","ControlSimpleLabel.js"),
os.path.join("static","pyformsjs","ControlTimeout.js"),
os.path.join("static","pyformsjs","ControlEmptyWidget.js"),
os.path.join("static","pyformsjs","ControlSearch.js"),
os.path.join("static","pyformsjs","ControlMenu.js"),
os.path.join("static","pyformsjs","ControlTree.js"),
os.path.join("static","pyformsjs","ControlOrganogram.js"),
Expand Down

0 comments on commit 0583f86

Please sign in to comment.