Skip to content

Commit

Permalink
w2prompt to allow text areas
Browse files Browse the repository at this point in the history
  • Loading branch information
mrg2001 committed Dec 4, 2016
1 parent a70220a commit becedb7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/less/src/popup.less
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,12 @@
font-size: 13px;
line-height: 1.5;
}

.w2ui-prompt {
textarea {
width: 100%;
height: 50px;
resize: none
}
}
}
29 changes: 23 additions & 6 deletions src/w2popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ var w2prompt = function (label, title, callBack) {
label : '',
value : '',
attrs : '',
textarea : false,
title : w2utils.lang('Notification'),
ok_text : w2utils.lang('Ok'),
cancel_text : w2utils.lang('Cancel'),
Expand Down Expand Up @@ -1039,10 +1040,16 @@ var w2prompt = function (label, title, callBack) {
w2popup.message({
width : options.width,
height : options.height,
body : '<div class="w2ui-centered" style="font-size: 13px;">'+
' <label style="margin-right: 10px;">' + options.label + ':</label>'+
' <input id="w2prompt" '+ options.attrs +'>'+
'</div>',
body : (options.textarea
? '<div class="w2ui-prompt" style="font-size: 13px; padding: 15px 10px 0 10px;">'+
' <div style="padding-bottom: 5px">' + options.label + '</div>'+
' <textarea id="w2prompt" '+ options.attrs +'></textarea>'+
'</div>'
: '<div class="w2ui-prompt w2ui-centered" style="font-size: 13px;">'+
' <label style="margin-right: 10px;">' + options.label + '</label>'+
' <input id="w2prompt" '+ options.attrs +'>'+
'</div>'
),
buttons : '<button id="Ok" class="w2ui-popup-btn w2ui-btn">' + options.ok_text + '</button><button id="Cancel" class="w2ui-popup-btn w2ui-btn">' + options.cancel_text + '</button>',
onOpen: function () {
$('#w2prompt').val(options.value);
Expand Down Expand Up @@ -1079,8 +1086,18 @@ var w2prompt = function (label, title, callBack) {
title : options.title,
modal : true,
showClose : false,
body : '<div class="w2ui-centered" style="font-size: 13px;"><label style="margin-right: 10px;">' + options.label + ':</label><input id="w2prompt"></div>',
buttons : '<button id="Ok" class="w2ui-popup-btn w2ui-btn">' + options.ok_text + '</button><button id="Cancel" class="w2ui-popup-btn w2ui-btn">' + options.cancel_text + '</button>',
body : (options.textarea
? '<div class="w2ui-prompt" style="font-size: 13px; padding: 15px 10px 0 10px;">'+
' <div style="padding-bottom: 5px">' + options.label + '</div>'+
' <textarea id="w2prompt" '+ options.attrs +'></textarea>'+
'</div>'
: '<div class="w2ui-prompt w2ui-centered" style="font-size: 13px;">'+
' <label style="margin-right: 10px;">' + options.label + '</label>'+
' <input id="w2prompt" '+ options.attrs +'>'+
'</div>'
),
buttons : '<button id="Ok" class="w2ui-popup-btn w2ui-btn">' + options.ok_text + '</button>'+
'<button id="Cancel" class="w2ui-popup-btn w2ui-btn">' + options.cancel_text + '</button>',
onOpen: function (event) {
// do not use onComplete as it is slower
setTimeout(function () {
Expand Down

0 comments on commit becedb7

Please sign in to comment.