updated forms to display a bit better
This commit is contained in:
parent
68e821fa24
commit
f967a4af6d
@ -203,37 +203,47 @@
|
||||
<button ng-click="order.toogleDelivery( 'takeout' )" ng-class="{'toggle-active': order.form.delivery_type=='takeout' }" class="payment-form-toggle">takeout</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="payment-form-group form-group">
|
||||
<i class="form-icon form-field"> </i>
|
||||
<div class="form-field">
|
||||
<div ng-show="(restaurant.delivery == '1' && restaurant.takeout != '1')">
|
||||
<label class="pay-title-label">Delivery Info</label>
|
||||
</div>
|
||||
|
||||
<div ng-show="(restaurant.delivery != '1' && restaurant.takeout == '1')">
|
||||
<label class="pay-title-label">Takeout Info </label>
|
||||
<span class="take-out-only">Take out only!</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-show="(restaurant.delivery == '1' && restaurant.takeout != '1')">
|
||||
<label class="pay-title-label">Delivery Info</label>
|
||||
</div>
|
||||
|
||||
<div ng-show="(restaurant.delivery != '1' && restaurant.takeout == '1')">
|
||||
<label class="pay-title-label">Takeout Info </label>
|
||||
<span class="take-out-only">Take out only!</span>
|
||||
</div>
|
||||
|
||||
<div class="personal-info field-container">
|
||||
<div class="payment-form-group form-group">
|
||||
<i class="fa fa-user payment-form-icon form-icon"></i>
|
||||
<input type="text" name="pay-name" tabindex="2" ng-model="order.form.name" class="payment-form-input form-input" placeholder="name">
|
||||
<i class="fa fa-user payment-form-icon form-icon form-field"></i>
|
||||
<input type="text" name="pay-name" tabindex="2" ng-model="order.form.name" class="payment-form-input form-input form-field" placeholder="name">
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group">
|
||||
<i class="fa fa-phone payment-form-icon form-icon"></i>
|
||||
<input type="tel" name="pay-phone" tabindex="3" ng-format-phone ng-model="order.form.phone" class="payment-form-input form-input" placeholder="phone number">
|
||||
<i class="fa fa-phone payment-form-icon form-icon form-field"></i>
|
||||
<input type="tel" name="pay-phone" tabindex="3" ng-format-phone ng-model="order.form.phone" class="payment-form-input form-input form-field" placeholder="phone number">
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group">
|
||||
<i class="fa fa-map-marker payment-form-icon form-icon animate-show"></i>
|
||||
<p>Pickup from: {{restaurant.address | nl2br}}</p>
|
||||
<textarea ng-autosize ng-show="order.form.delivery_type=='delivery'" class="payment-form-input form-input" ng-model="order.form.address" name="pay-address" id="pay-address" tabindex="5" placeholder="address"></textarea>
|
||||
<i class="fa fa-map-marker payment-form-icon form-icon form-field"></i>
|
||||
<p ng-show="order.form.delivery_type!='delivery'">Pickup from: <span ng-bind-html-unsafe="restaurant.address | nl2br"></span></p>
|
||||
<textarea ng-autosize ng-show="order.form.delivery_type=='delivery'" class="payment-form-input form-input form-field" ng-model="order.form.address" name="pay-address" id="pay-address" tabindex="5" placeholder="address"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group">
|
||||
|
||||
<i class="fa fa-bullhorn payment-form-icon form-icon"></i>
|
||||
<textarea ng-autosize name="notes" ng-blur="checkGiftCard()" ng-model="order.form.notes" tabindex="6" class="payment-form-input form-input" placeholder="notes"></textarea>
|
||||
<i class="fa fa-bullhorn payment-form-icon form-icon form-field"></i>
|
||||
<textarea ng-autosize name="notes" ng-blur="checkGiftCard()" ng-model="order.form.notes" tabindex="6" class="payment-form-input form-input form-field" placeholder="notes"></textarea>
|
||||
|
||||
<!-- Gift card messages -->
|
||||
<div class="giftcard-info">
|
||||
@ -289,20 +299,20 @@
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group" ng-show="order.form.pay_type=='card'">
|
||||
<i class="fa fa-credit-card payment-form-icon form-icon"></i>
|
||||
<input type="tel" name="pay-card-number" tabindex="6" ng-change="order.creditCardChanged();" ng-model="order.form.cardNumber" class="payment-form-input form-input">
|
||||
<i class="fa fa-credit-card payment-form-icon form-icon form-field"></i>
|
||||
<input type="tel" name="pay-card-number" tabindex="6" ng-change="order.creditCardChanged();" ng-model="order.form.cardNumber" class="payment-form-input form-input form-field">
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group" ng-show="order.form.pay_type=='card'">
|
||||
<i class="fa payment-form-icon form-icon"></i>
|
||||
<select ng-change="order.cardInfoChanged()" ng-model="order.form.cardMonth" ng-options="month.value as month.label for month in order._months()" tabindex="7" class="payment-form-select payment-form-input form-input">{{order.form.card.month}}</select>
|
||||
<select ng-change="order.cardInfoChanged()" ng-model="order.form.cardYear" ng-options="year.value as year.label for year in order._years()" tabindex="8" class="payment-form-select payment-form-input form-input"></select>
|
||||
<i class="fa payment-form-icon form-icon form-field"></i>
|
||||
<select ng-change="order.cardInfoChanged()" ng-model="order.form.cardMonth" ng-options="month.value as month.label for month in order._months()" tabindex="7" class="payment-form-select payment-form-input form-input form-field">{{order.form.card.month}}</select>
|
||||
<select ng-change="order.cardInfoChanged()" ng-model="order.form.cardYear" ng-options="year.value as year.label for year in order._years()" tabindex="8" class="payment-form-select payment-form-input form-input form-field"></select>
|
||||
</div>
|
||||
|
||||
<div class="payment-form-group form-group" ng-show="order.form.pay_type=='card'">
|
||||
<i class="fa fa-thumbs-up payment-form-icon form-icon"></i>
|
||||
<i class="fa fa-thumbs-up payment-form-icon form-icon form-field"></i>
|
||||
<input type="hidden" name="pay-autotip-value" ng-model="order.form.autotip" value="0">
|
||||
<select ng-model="order.form.tip" ng-options="tip.value as tip.label for tip in order._tips()" ng-change="order.tipChanged();" class="tip payment-form-select payment-form-input form-input" tabindex="9"></select>
|
||||
<select ng-model="order.form.tip" ng-options="tip.value as tip.label for tip in order._tips()" ng-change="order.tipChanged();" class="tip payment-form-select payment-form-input form-input form-field" tabindex="9"></select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -12,18 +12,18 @@
|
||||
<div ng-show="!support.thanks">
|
||||
<form>
|
||||
<div class="support-form-group form-group">
|
||||
<i class="fa fa-user support-form-icon form-icon"></i>
|
||||
<input type="text" maxlength="50" ng-model="support.form.name" name="support-name" tabindex="1" class="form-input support-form-input" placeholder="name">
|
||||
<i class="fa fa-user support-form-icon form-icon form-field"></i>
|
||||
<input type="text" maxlength="50" ng-model="support.form.name" name="support-name" tabindex="1" class="form-input support-form-input form-field" placeholder="name">
|
||||
</div>
|
||||
|
||||
<div class="support-form-group form-group">
|
||||
<i class="fa fa-phone support-form-icon form-icon"></i>
|
||||
<input type="tel" maxlength="30" ng-model="support.form.phone" name="support-phone" tabindex="2" ng-format-phone class="form-input support-form-input" placeholder="phone number">
|
||||
<i class="fa fa-phone support-form-icon form-icon form-field"></i>
|
||||
<input type="tel" maxlength="30" ng-model="support.form.phone" name="support-phone" tabindex="2" ng-format-phone class="form-input support-form-input form-field" placeholder="phone number">
|
||||
</div>
|
||||
|
||||
<div class="support-form-group form-group">
|
||||
<i class="fa fa-bullhorn support-form-icon form-icon"></i>
|
||||
<textarea ng-model="support.form.message" class="form-input support-form-input" name="support-message" tabindex="3" placeholder="message"></textarea>
|
||||
<i class="fa fa-bullhorn support-form-icon form-icon form-field"></i>
|
||||
<textarea ng-autosize ng-model="support.form.message" class="form-input support-form-input form-field" name="support-message" tabindex="3" placeholder="message"></textarea>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@ -1678,7 +1678,7 @@ p {
|
||||
.form-icon {
|
||||
color: #00957f;
|
||||
font-size: 1.8em;
|
||||
width: 1em;
|
||||
width: 1.1em;
|
||||
text-align: center;
|
||||
padding-right: .5em;
|
||||
}
|
||||
@ -1688,10 +1688,10 @@ p {
|
||||
box-sizing: border-box;
|
||||
white-space:nowrap;
|
||||
}
|
||||
.form-icon, .form-input, .form-select {
|
||||
.form-field, .form-field.fa {
|
||||
vertical-align: top;
|
||||
padding-top: .4em;
|
||||
display: table-cell !important;
|
||||
display: table-cell;
|
||||
}
|
||||
.form-select {
|
||||
background: #fff;
|
||||
@ -1768,7 +1768,7 @@ p {
|
||||
|
||||
/* appended by autosize directive */
|
||||
.autosize {
|
||||
margin: .1em 0 .2em 2px;
|
||||
margin-bottom: .5em;
|
||||
-webkit-transition: height 0.2s;
|
||||
-moz-transition: height 0.2s;
|
||||
-ms-transition: height 0.2s;
|
||||
|
||||
@ -272,7 +272,7 @@ NGApp.directive('ngAutosize', function () {
|
||||
link: function (scope, elem, attr) {
|
||||
setTimeout( function(){
|
||||
elem.addClass('autosize');
|
||||
elem.data( 'autosize', elem.autosize({append: "\n"}) );
|
||||
elem.data( 'autosize', elem.autosize() );
|
||||
}, 1 );
|
||||
}
|
||||
};
|
||||
|
||||
248
www/assets/js/jquery.autosize-min.js
vendored
248
www/assets/js/jquery.autosize-min.js
vendored
@ -1,7 +1,251 @@
|
||||
/*!
|
||||
Autosize v1.17.1 - 2013-06-23
|
||||
Autosize v1.18.1 - 2013-11-05
|
||||
Automatically adjust textarea height based on user input.
|
||||
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
|
||||
license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var o,a={};if(t=u,s.className=i.className,l=parseInt(h.css("maxHeight"),10),e.each(n,function(e,t){a[t]=h.css(t)}),e(s).css(a),"oninput"in u){var r=u.style.width;u.style.width="0px",o=u.offsetWidth,u.style.width=r}}function a(){var n,a,r,c;t!==u&&o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,a=parseInt(u.style.height,10),"getComputedStyle"in window?(c=window.getComputedStyle(u),r=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,t){r-=parseInt(c[t],10)}),s.style.width=r+"px"):s.style.width=Math.max(h.width(),0)+"px",s.scrollTop=0,s.scrollTop=9e4,n=s.scrollTop,l&&n>l?(u.style.overflowY="scroll",n=l):(u.style.overflowY="hidden",d>n&&(n=d)),n+=p,a!==n&&(u.style.height=n+"px",w&&i.callback.call(u,u))}function r(){clearTimeout(c),c=setTimeout(function(){h.width()!==z&&a()},parseInt(i.resizeDelay,10))}var l,d,c,u=this,h=e(u),p=0,w=e.isFunction(i.callback),f={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},z=h.width();h.data("autosize")||(h.data("autosize",!0),("border-box"===h.css("box-sizing")||"border-box"===h.css("-moz-box-sizing")||"border-box"===h.css("-webkit-box-sizing"))&&(p=h.outerHeight()-h.height()),d=Math.max(parseInt(h.css("minHeight"),10)-p||0,h.height()),h.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===h.css("resize")||"vertical"===h.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?h.on("input.autosize keyup.autosize",a):h.on("propertychange.autosize",function(){"value"===event.propertyName&&a()}):h.on("input.autosize",a),i.resizeDelay!==!1&&e(window).on("resize.autosize",r),h.on("autosize.resize",a),h.on("autosize.resizeIncludeStyle",function(){t=null,a()}),h.on("autosize.destroy",function(){t=null,clearTimeout(c),e(window).off("resize",r),h.off("autosize").off(".autosize").css(f).removeData("autosize")}),a())})}})(window.jQuery||window.Zepto);
|
||||
(function ($) {
|
||||
var
|
||||
defaults = {
|
||||
className: 'autosizejs',
|
||||
append: '',
|
||||
callback: false,
|
||||
resizeDelay: 10
|
||||
},
|
||||
|
||||
// border:0 is unnecessary, but avoids a bug in Firefox on OSX
|
||||
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
|
||||
|
||||
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
||||
typographyStyles = [
|
||||
'fontFamily',
|
||||
'fontSize',
|
||||
'fontWeight',
|
||||
'fontStyle',
|
||||
'letterSpacing',
|
||||
'textTransform',
|
||||
'wordSpacing',
|
||||
'textIndent'
|
||||
],
|
||||
|
||||
// to keep track which textarea is being mirrored when adjust() is called.
|
||||
mirrored,
|
||||
|
||||
// the mirror element, which is used to calculate what size the mirrored element should be.
|
||||
mirror = $(copy).data('autosize', true)[0];
|
||||
|
||||
// test that line-height can be accurately copied.
|
||||
mirror.style.lineHeight = '99px';
|
||||
if ($(mirror).css('lineHeight') === '99px') {
|
||||
typographyStyles.push('lineHeight');
|
||||
}
|
||||
mirror.style.lineHeight = '';
|
||||
|
||||
$.fn.autosize = function (options) {
|
||||
if (!this.length) {
|
||||
return this;
|
||||
}
|
||||
|
||||
options = $.extend({}, defaults, options || {});
|
||||
|
||||
if (mirror.parentNode !== document.body) {
|
||||
$(document.body).append(mirror);
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
var
|
||||
ta = this,
|
||||
$ta = $(ta),
|
||||
maxHeight,
|
||||
minHeight,
|
||||
boxOffset = 0,
|
||||
callback = $.isFunction(options.callback),
|
||||
originalStyles = {
|
||||
height: ta.style.height,
|
||||
overflow: ta.style.overflow,
|
||||
overflowY: ta.style.overflowY,
|
||||
wordWrap: ta.style.wordWrap,
|
||||
resize: ta.style.resize
|
||||
},
|
||||
timeout,
|
||||
width = $ta.width();
|
||||
|
||||
if ($ta.data('autosize')) {
|
||||
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
||||
return;
|
||||
}
|
||||
$ta.data('autosize', true);
|
||||
|
||||
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
|
||||
boxOffset = $ta.outerHeight() - $ta.height();
|
||||
}
|
||||
|
||||
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
||||
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
||||
|
||||
$ta.css({
|
||||
overflow: 'hidden',
|
||||
overflowY: 'hidden',
|
||||
wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
|
||||
resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
|
||||
});
|
||||
|
||||
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
|
||||
function setWidth() {
|
||||
var style, width;
|
||||
|
||||
if ('getComputedStyle' in window) {
|
||||
style = window.getComputedStyle(ta, null);
|
||||
width = ta.getBoundingClientRect().width;
|
||||
|
||||
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
|
||||
width -= parseInt(style[val],10);
|
||||
});
|
||||
|
||||
mirror.style.width = width + 'px';
|
||||
}
|
||||
else {
|
||||
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported and unneeded in IE8 and lower.
|
||||
mirror.style.width = Math.max($ta.width(), 0) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
function initMirror() {
|
||||
var styles = {};
|
||||
|
||||
mirrored = ta;
|
||||
mirror.className = options.className;
|
||||
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
||||
|
||||
// mirror is a duplicate textarea located off-screen that
|
||||
// is automatically updated to contain the same text as the
|
||||
// original textarea. mirror always has a height of 0.
|
||||
// This gives a cross-browser supported way getting the actual
|
||||
// height of the text, through the scrollTop property.
|
||||
$.each(typographyStyles, function(i,val){
|
||||
styles[val] = $ta.css(val);
|
||||
});
|
||||
$(mirror).css(styles);
|
||||
|
||||
setWidth();
|
||||
|
||||
// Chrome-specific fix:
|
||||
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
|
||||
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
|
||||
if (window.chrome) {
|
||||
var width = ta.style.width;
|
||||
ta.style.width = '0px';
|
||||
var ignore = ta.offsetWidth;
|
||||
ta.style.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
// Using mainly bare JS in this function because it is going
|
||||
// to fire very often while typing, and needs to very efficient.
|
||||
function adjust() {
|
||||
var height, original;
|
||||
|
||||
if (mirrored !== ta) {
|
||||
initMirror();
|
||||
} else {
|
||||
setWidth();
|
||||
}
|
||||
|
||||
mirror.value = ta.value + options.append;
|
||||
mirror.style.overflowY = ta.style.overflowY;
|
||||
original = parseInt(ta.style.height,10);
|
||||
|
||||
|
||||
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
|
||||
mirror.scrollTop = 0;
|
||||
|
||||
mirror.scrollTop = 9e4;
|
||||
|
||||
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
||||
height = mirror.scrollTop;
|
||||
|
||||
if (maxHeight && height > maxHeight) {
|
||||
ta.style.overflowY = 'scroll';
|
||||
height = maxHeight;
|
||||
} else {
|
||||
ta.style.overflowY = 'hidden';
|
||||
if (height < minHeight) {
|
||||
height = minHeight;
|
||||
}
|
||||
}
|
||||
|
||||
height += boxOffset;
|
||||
|
||||
if (original !== height) {
|
||||
ta.style.height = height + 'px';
|
||||
if (callback) {
|
||||
options.callback.call(ta,ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resize () {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function(){
|
||||
var newWidth = $ta.width();
|
||||
|
||||
if (newWidth !== width) {
|
||||
width = newWidth;
|
||||
adjust();
|
||||
}
|
||||
}, parseInt(options.resizeDelay,10));
|
||||
}
|
||||
|
||||
if ('onpropertychange' in ta) {
|
||||
if ('oninput' in ta) {
|
||||
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
||||
// so binding to onkeyup to catch most of those occasions. There is no way that I
|
||||
// know of to detect something like 'cut' in IE9.
|
||||
$ta.on('input.autosize keyup.autosize', adjust);
|
||||
} else {
|
||||
// IE7 / IE8
|
||||
$ta.on('propertychange.autosize', function(){
|
||||
if(event.propertyName === 'value'){
|
||||
adjust();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Modern Browsers
|
||||
$ta.on('input.autosize', adjust);
|
||||
}
|
||||
|
||||
// Set options.resizeDelay to false if using fixed-width textarea elements.
|
||||
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
|
||||
|
||||
if (options.resizeDelay !== false) {
|
||||
$(window).on('resize.autosize', resize);
|
||||
}
|
||||
|
||||
// Event for manual triggering if needed.
|
||||
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
|
||||
$ta.on('autosize.resize', adjust);
|
||||
|
||||
// Event for manual triggering that also forces the styles to update as well.
|
||||
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
|
||||
$ta.on('autosize.resizeIncludeStyle', function() {
|
||||
mirrored = null;
|
||||
adjust();
|
||||
});
|
||||
|
||||
$ta.on('autosize.destroy', function(){
|
||||
mirrored = null;
|
||||
clearTimeout(timeout);
|
||||
$(window).off('resize', resize);
|
||||
$ta
|
||||
.off('autosize')
|
||||
.off('.autosize')
|
||||
.css(originalStyles)
|
||||
.removeData('autosize');
|
||||
});
|
||||
|
||||
// Call adjust in case the textarea already contains text.
|
||||
adjust();
|
||||
});
|
||||
};
|
||||
}(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
|
||||
Loading…
x
Reference in New Issue
Block a user