diff --git a/.eslintignore b/.eslintignore index ca6b7d37902..f4b37dd6d72 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,4 +18,6 @@ app/assets/v2/js/ethereumjs-accounts.js app/assets/onepager/js/tx.js app/assets/onepager/js/bignumber.js -app/assets/v2/js/lib/emoji-button.js \ No newline at end of file +app/assets/v2/js/lib/emoji-button.js +app/assets/v2/js/lib/vue.js +app/assets/v2/js/lib/qrcode.js \ No newline at end of file diff --git a/app/app/context.py b/app/app/context.py index d5ba387a529..b99a21b908d 100644 --- a/app/app/context.py +++ b/app/app/context.py @@ -131,7 +131,7 @@ def preprocess(request): 'github_handle': request.user.username if user_is_authenticated else False, 'email': request.user.email if user_is_authenticated else False, 'name': request.user.get_full_name() if user_is_authenticated else False, - 'last_chat_status': request.user.profile.last_chat_status if user_is_authenticated else False, + 'last_chat_status': request.user.profile.last_chat_status if (hasattr(request.user, 'profile') and user_is_authenticated) else False, 'raven_js_version': settings.RAVEN_JS_VERSION, 'raven_js_dsn': settings.SENTRY_JS_DSN, 'release': settings.RELEASE, diff --git a/app/app/urls.py b/app/app/urls.py index 0edce1fc451..38655c3186d 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -71,6 +71,8 @@ url('^api/v1/bounty/create', dashboard.views.create_bounty_v1, name='create_bounty_v1'), url('^api/v1/bounty/cancel', dashboard.views.cancel_bounty_v1, name='cancel_bounty_v1'), url('^api/v1/bounty/fulfill', dashboard.views.fulfill_bounty_v1, name='fulfill_bounty_v1'), + path('api/v1/bounty//close', dashboard.views.close_bounty_v1, name='close_bounty_v1'), + path('api/v1/bounty/payout/', dashboard.views.payout_bounty_v1, name='payout_bounty_v1'), re_path(r'.*api/v0.1/chat/presence$', chat.views.chat_presence, name='chat_presence'), # inbox @@ -371,7 +373,6 @@ # sync methods url(r'^sync/web3/?', dashboard.views.sync_web3, name='sync_web3'), - url(r'^sync/etc/?', dashboard.views.sync_etc, name='sync_etc'), url(r'^sync/get_amount/?', dashboard.helpers.amount, name='helpers_amount'), re_path(r'^sync/get_issue_details/?', dashboard.helpers.issue_details, name='helpers_issue_details'), diff --git a/app/assets/v2/css/base.css b/app/assets/v2/css/base.css index 2c8c166b0fc..5e52b4de05c 100644 --- a/app/assets/v2/css/base.css +++ b/app/assets/v2/css/base.css @@ -181,10 +181,10 @@ a { margin-left: 0; } -.interior .container-fluid { +/* .interior .container-fluid { padding-left: 0; padding-right: 0; -} +} */ .with-grey-background .body { background-color: #eee !important; diff --git a/app/assets/v2/css/bounty.css b/app/assets/v2/css/bounty.css index b1f9308905b..25fad1b6277 100644 --- a/app/assets/v2/css/bounty.css +++ b/app/assets/v2/css/bounty.css @@ -44,6 +44,14 @@ body { text-transform: capitalize; } +.avatar { + width: 50px; + height: 50px; + margin: 0px auto; + border-radius: 50px; + margin-top: 0px; +} + .invite-user .avatar { width: 5.5rem; height: 5.5rem; @@ -71,19 +79,11 @@ body { font-style: italic; } -.bounty_details .avatar { - width: 50px; - height: 50px; - margin: 0px auto; - border-radius: 50px; - margin-top: 0px; -} - .bounty_details .avatar.Azure-Samples { border-radius: 0px; } -#avatar_url .avatar { +.avatar-big { width: 80px; height: 80px; } @@ -170,8 +170,9 @@ body { color: #3E00FF; } -#issue_description { +.issue_description { color: #000000; + font-size: 14px; } .bounty-subheading { @@ -185,7 +186,7 @@ body { .bounty-info-heading { color: #0D0764; - font-weight: 600; + font-weight: 500; text-transform: capitalize; } @@ -270,11 +271,6 @@ body { font-weight: bold; } -#bounty_reserved_for a { - margin-left: 5px; - font-weight: bold; -} - .bounty-actions { display: inherit; } @@ -380,19 +376,6 @@ a.btn { transform: none; } -#bounty_reserved_for img { - vertical-align: top; - margin-left: 3px; - margin-top: -2px; -} - -#btn-white img { - position: absolute; - width: 1.313rem; - top: 0.4375rem; - right: 0.4375rem; -} - .comment { border-left: 1px solid #979797; padding-right: 20px; @@ -439,6 +422,38 @@ a.btn { margin-bottom: 2em; } +.issue_description img { + max-height: 30rem; + max-width: 100%; + cursor: zoom-in; + display: block; + margin-top: 1rem; + margin-bottom: 1rem; +} + +.issue_description h1, +.issue_description h2, +.issue_description h3, +.issue_description h4, +.issue_description h5, +.issue_description h6 { + letter-spacing: 1px; + font-size: 16px; + margin-top: 15px; + text-transform: none; +} + +#bounty_reserved_for img { + vertical-align: top; + margin-left: 3px; + margin-top: -2px; +} + +#bounty_reserved_for a { + margin-left: 5px; + font-weight: bold; +} + #funder_notif_info:empty { display: none; } @@ -460,27 +475,6 @@ a.btn { top: -2px; } -#bounty_details #issue_description img { - max-height: 30rem; - max-width: 30rem; - cursor: pointer; - display: block; - margin-top: 1rem; - margin-bottom: 1rem; -} - -#bounty_details #issue_description h1, -#bounty_details #issue_description h2, -#bounty_details #issue_description h3, -#bounty_details #issue_description h4, -#bounty_details #issue_description h5, -#bounty_details #issue_description h6 { - letter-spacing: 1px; - font-size: 16px; - margin-top: 15px; - text-transform: none; -} - #started_owners_username, #fulfilled_owners_username, #submitted_owners_username { @@ -752,6 +746,21 @@ a.btn { padding: 0 25px; } +.payout-input-amount-container input { + border-top: none; + border-left: none; + border-right: none; + max-width: 5rem; + outline: none; + color: #03B16B; +} + +.payout-input-amount-container input::-webkit-outer-spin-button, +.payout-input-amount-container input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + @media (max-width: 575.98px) { #timer { @@ -856,3 +865,7 @@ a.btn { 0% { transform: translateY(0); } 100% { transform: translateY(-3rem); } } + +.qrcode { + display: inline-block; +} diff --git a/app/assets/v2/css/gitcoin.css b/app/assets/v2/css/gitcoin.css index 0d171ba0257..b8256e98938 100644 --- a/app/assets/v2/css/gitcoin.css +++ b/app/assets/v2/css/gitcoin.css @@ -97,19 +97,6 @@ h4, background-color: #3f00ff; } -#gitcoin-background { - background-image: url("/static/v2/images/header-bg.png"); - background-size: 2000px; - background-position: 0 0; - position: fixed; - top: 0; - left: 0; - z-index: -1; - will-change: transform; - overflow-y: hidden; - overflow-x: hidden; -} - .gitcoin-background { background: url("/static/v2/images/header-bg.png") #0d023b; background-attachment: fixed; @@ -542,6 +529,8 @@ div.button-pink { color: lightgray; } +[v-cloak] > * { display:none!important;} + .accordion { cursor: pointer; width: 100%; @@ -783,3 +772,140 @@ div.button-pink { -webkit-transform: translateY(0) scale(1, 1); } } + + + +/* loading */ +.rhombus-spinner { + height: 65px; + width: 65px; + position: relative; + transform: rotate(45deg); + margin: auto; + color: #25E899; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.rhombus-spinner .rhombus { + height: calc(65px / 7.5); + width: calc(65px / 7.5); + animation-duration: 2000ms; + top: calc(65px / 2.3077); + left: calc(65px / 2.3077); + border-radius: 30px; + background-color: currentColor; + position: absolute; + animation-iteration-count: infinite; +} + +.rhombus-spinner .rhombus:nth-child(2n+0) { + margin-right: 0; +} + +.rhombus-spinner .rhombus.child-1 { + animation-name: rhombus-spinner-animation-child-1; + animation-delay: calc(100ms * 1); +} + +.rhombus-spinner .rhombus.child-2 { + animation-name: rhombus-spinner-animation-child-2; + animation-delay: calc(100ms * 2); +} + +.rhombus-spinner .rhombus.child-3 { + animation-name: rhombus-spinner-animation-child-3; + animation-delay: calc(100ms * 3); +} + +.rhombus-spinner .rhombus.child-4 { + animation-name: rhombus-spinner-animation-child-4; + animation-delay: calc(100ms * 4); +} + +.rhombus-spinner .rhombus.child-5 { + animation-name: rhombus-spinner-animation-child-5; + animation-delay: calc(100ms * 5); +} + +.rhombus-spinner .rhombus.child-6 { + animation-name: rhombus-spinner-animation-child-6; + animation-delay: calc(100ms * 6); +} + +.rhombus-spinner .rhombus.child-7 { + animation-name: rhombus-spinner-animation-child-7; + animation-delay: calc(100ms * 7); +} + +.rhombus-spinner .rhombus.child-8 { + animation-name: rhombus-spinner-animation-child-8; + animation-delay: calc(100ms * 8); +} + +.rhombus-spinner .rhombus.big { + height: calc(65px / 3); + width: calc(65px / 3); + top: calc(65px / 3); + left: calc(65px / 3); + background-color: #3E00FF; + animation: rhombus-spinner-animation-child-big 2s infinite; + animation-duration: 2000ms; + animation-delay: 0.5s; +} + +@keyframes rhombus-spinner-animation-child-1 { + 50% { + transform: translate(-325%, -325%); + } +} + +@keyframes rhombus-spinner-animation-child-2 { + 50% { + transform: translate(0, -325%); + } +} + +@keyframes rhombus-spinner-animation-child-3 { + 50% { + transform: translate(325%, -325%); + } +} + +@keyframes rhombus-spinner-animation-child-4 { + 50% { + transform: translate(325%, 0); + } +} + +@keyframes rhombus-spinner-animation-child-5 { + 50% { + transform: translate(325%, 325%); + } +} + +@keyframes rhombus-spinner-animation-child-6 { + 50% { + transform: translate(0, 325%); + } +} + +@keyframes rhombus-spinner-animation-child-7 { + 50% { + transform: translate(-325%, 325%); + } +} + +@keyframes rhombus-spinner-animation-child-8 { + 50% { + transform: translate(-325%, 0); + } +} + +@keyframes rhombus-spinner-animation-child-big { + 50% { + transform: scale(0.5); + } +} diff --git a/app/assets/v2/css/landing_page.css b/app/assets/v2/css/landing_page.css index cd2d3f162c7..16cf2ec388d 100644 --- a/app/assets/v2/css/landing_page.css +++ b/app/assets/v2/css/landing_page.css @@ -462,10 +462,6 @@ body.funder-page { height: 100%; } -.index #gitcoin-background { - min-width: 100vw; - min-height: 1000vh; -} /* Landing Page Animations */ #WindmillBlades { diff --git a/app/assets/v2/css/submit_bounty.css b/app/assets/v2/css/submit_bounty.css index c7d6163a2ae..9e230db3c45 100644 --- a/app/assets/v2/css/submit_bounty.css +++ b/app/assets/v2/css/submit_bounty.css @@ -249,4 +249,18 @@ input:read-only { display: inline-block; top: 3px; position: relative; +} + +.wallet-alert { + border-radius: 4px; +} + +.wallet-not-connected { + color: #E49003; + background: rgb(228, 144, 3, 0.2); +} + +.wallet-success { + color: #0FCE7C; + background: rgb(15, 206, 124, 0.2); } \ No newline at end of file diff --git a/app/assets/v2/css/users.css b/app/assets/v2/css/users.css index a23b64f9098..7376a6665c1 100644 --- a/app/assets/v2/css/users.css +++ b/app/assets/v2/css/users.css @@ -117,134 +117,3 @@ border-left: 0; color: #3E00FF; } - -/* loading */ -.rhombus-spinner { - height: 65px; - width: 65px; - position: relative; - transform: rotate(45deg); - margin: auto; - color: #25E899; -} - -.rhombus-spinner .rhombus { - height: calc(65px / 7.5); - width: calc(65px / 7.5); - animation-duration: 2000ms; - top: calc(65px / 2.3077); - left: calc(65px / 2.3077); - border-radius: 30px; - background-color: currentColor; - position: absolute; - animation-iteration-count: infinite; -} - -.rhombus-spinner .rhombus:nth-child(2n+0) { - margin-right: 0; -} - -.rhombus-spinner .rhombus.child-1 { - animation-name: rhombus-spinner-animation-child-1; - animation-delay: calc(100ms * 1); -} - -.rhombus-spinner .rhombus.child-2 { - animation-name: rhombus-spinner-animation-child-2; - animation-delay: calc(100ms * 2); -} - -.rhombus-spinner .rhombus.child-3 { - animation-name: rhombus-spinner-animation-child-3; - animation-delay: calc(100ms * 3); -} - -.rhombus-spinner .rhombus.child-4 { - animation-name: rhombus-spinner-animation-child-4; - animation-delay: calc(100ms * 4); -} - -.rhombus-spinner .rhombus.child-5 { - animation-name: rhombus-spinner-animation-child-5; - animation-delay: calc(100ms * 5); -} - -.rhombus-spinner .rhombus.child-6 { - animation-name: rhombus-spinner-animation-child-6; - animation-delay: calc(100ms * 6); -} - -.rhombus-spinner .rhombus.child-7 { - animation-name: rhombus-spinner-animation-child-7; - animation-delay: calc(100ms * 7); -} - -.rhombus-spinner .rhombus.child-8 { - animation-name: rhombus-spinner-animation-child-8; - animation-delay: calc(100ms * 8); -} - -.rhombus-spinner .rhombus.big { - height: calc(65px / 3); - width: calc(65px / 3); - top: calc(65px / 3); - left: calc(65px / 3); - background-color: #3E00FF; - animation: rhombus-spinner-animation-child-big 2s infinite; - animation-duration: 2000ms; - animation-delay: 0.5s; -} - -@keyframes rhombus-spinner-animation-child-1 { - 50% { - transform: translate(-325%, -325%); - } -} - -@keyframes rhombus-spinner-animation-child-2 { - 50% { - transform: translate(0, -325%); - } -} - -@keyframes rhombus-spinner-animation-child-3 { - 50% { - transform: translate(325%, -325%); - } -} - -@keyframes rhombus-spinner-animation-child-4 { - 50% { - transform: translate(325%, 0); - } -} - -@keyframes rhombus-spinner-animation-child-5 { - 50% { - transform: translate(325%, 325%); - } -} - -@keyframes rhombus-spinner-animation-child-6 { - 50% { - transform: translate(0, 325%); - } -} - -@keyframes rhombus-spinner-animation-child-7 { - 50% { - transform: translate(-325%, 325%); - } -} - -@keyframes rhombus-spinner-animation-child-8 { - 50% { - transform: translate(-325%, 0); - } -} - -@keyframes rhombus-spinner-animation-child-big { - 50% { - transform: scale(0.5); - } -} diff --git a/app/assets/v2/js/lib/qrcode.js b/app/assets/v2/js/lib/qrcode.js new file mode 100644 index 00000000000..74563760849 --- /dev/null +++ b/app/assets/v2/js/lib/qrcode.js @@ -0,0 +1,614 @@ +/** + * @fileoverview + * - Using the 'QRCode for Javascript library' + * - Fixed dataset of 'QRCode for Javascript library' for support full-spec. + * - this library has no dependencies. + * + * @author davidshimjs + * @see http://www.d-project.com/ + * @see http://jeromeetienne.github.com/jquery-qrcode/ + */ +var QRCode; + +(function () { + //--------------------------------------------------------------------- + // QRCode for JavaScript + // + // Copyright (c) 2009 Kazuhiko Arase + // + // URL: http://www.d-project.com/ + // + // Licensed under the MIT license: + // http://www.opensource.org/licenses/mit-license.php + // + // The word "QR Code" is registered trademark of + // DENSO WAVE INCORPORATED + // http://www.denso-wave.com/qrcode/faqpatent-e.html + // + //--------------------------------------------------------------------- + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + } + }; + + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + + QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);} + return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);} + if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);} + this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}} + return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;} + for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}} + for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}} + this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);} + var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;} + this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}} + row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. (" + +buffer.getLengthInBits() + +">" + +totalDataCount*8 + +")");} + if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);} + while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);} + while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;} + buffer.put(QRCodeModel.PAD1,8);} + return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}} + var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));} + return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));} + return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;} + return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}} + for(var row=0;row=256){n-=255;} + return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);} + if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));} + this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]; + + function _isSupportCanvas() { + return typeof CanvasRenderingContext2D != "undefined"; + } + + // android 2.x doesn't support Data-URI spec + function _getAndroid() { + var android = false; + var sAgent = navigator.userAgent; + + if (/android/i.test(sAgent)) { // android + android = true; + var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); + + if (aMat && aMat[1]) { + android = parseFloat(aMat[1]); + } + } + + return android; + } + + var svgDrawer = (function() { + + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + + this.clear(); + + function makeSVG(tag, attrs) { + var el = document.createElementNS('http://www.w3.org/2000/svg', tag); + for (var k in attrs) + if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); + return el; + } + + var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight}); + svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); + _el.appendChild(svg); + + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"})); + svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"})); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + if (oQRCode.isDark(row, col)) { + var child = makeSVG("use", {"x": String(col), "y": String(row)}); + child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") + svg.appendChild(child); + } + } + } + }; + Drawing.prototype.clear = function () { + while (this._el.hasChildNodes()) + this._el.removeChild(this._el.lastChild); + }; + return Drawing; + })(); + + var useSVG = document.documentElement.tagName.toLowerCase() === "svg"; + + // Drawing in DOM by using Table tag + var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + var aHTML = ['']; + + for (var row = 0; row < nCount; row++) { + aHTML.push(''); + + for (var col = 0; col < nCount; col++) { + aHTML.push(''); + } + + aHTML.push(''); + } + + aHTML.push('
'); + _el.innerHTML = aHTML.join(''); + + // Fix the margin values as real size. + var elTable = _el.childNodes[0]; + var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; + var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; + + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { + elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; + } + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._el.innerHTML = ''; + }; + + return Drawing; + })() : (function () { // Drawing in Canvas + function _onMakeImage() { + this._elImage.src = this._elCanvas.toDataURL("image/png"); + this._elImage.style.display = "block"; + this._elCanvas.style.display = "none"; + } + + // Android 2.1 bug workaround + // http://code.google.com/p/android/issues/detail?id=5141 + if (this._android && this._android <= 2.1) { + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (("nodeName" in image) && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == "undefined") { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; + } + + /** + * Check whether the user's browser supports Data URI or not + * + * @private + * @param {Function} fSuccess Occurs if it supports Data URI + * @param {Function} fFail Occurs if it doesn't support Data URI + */ + function _safeSetDataURI(fSuccess, fFail) { + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; + + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement("img"); + var fOnError = function() { + self._bSupportDataURI = false; + + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function() { + self._bSupportDataURI = true; + + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; + + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { + self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); + } + }; + + /** + * Drawing QRCode by using canvas + * + * @constructor + * @param {HTMLElement} el + * @param {Object} htOption QRCode Options + */ + var Drawing = function (el, htOption) { + this._bIsPainted = false; + this._android = _getAndroid(); + + this._htOption = htOption; + this._elCanvas = document.createElement("canvas"); + this._elCanvas.width = htOption.width; + this._elCanvas.height = htOption.height; + el.appendChild(this._elCanvas); + this._el = el; + this._oContext = this._elCanvas.getContext("2d"); + this._bIsPainted = false; + this._elImage = document.createElement("img"); + this._elImage.alt = "Scan me!"; + this._elImage.style.display = "none"; + this._el.appendChild(this._elImage); + this._bSupportDataURI = null; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.width / nCount; + var nHeight = _htOption.height / nCount; + var nRoundedWidth = Math.round(nWidth); + var nRoundedHeight = Math.round(nHeight); + + _elImage.style.display = "none"; + this.clear(); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = col * nWidth; + var nTop = row * nHeight; + _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.lineWidth = 1; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + + // 안티 앨리어싱 방지 처리 + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedWidth, + nRoundedHeight + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight + ); + } + } + + this._bIsPainted = true; + }; + + /** + * Make the image from Canvas if the browser supports Data URI. + */ + Drawing.prototype.makeImage = function () { + if (this._bIsPainted) { + _safeSetDataURI.call(this, _onMakeImage); + } + }; + + /** + * Return whether the QRCode is painted or not + * + * @return {Boolean} + */ + Drawing.prototype.isPainted = function () { + return this._bIsPainted; + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); + this._bIsPainted = false; + }; + + /** + * @private + * @param {Number} nNumber + */ + Drawing.prototype.round = function (nNumber) { + if (!nNumber) { + return nNumber; + } + + return Math.floor(nNumber * 1000) / 1000; + }; + + return Drawing; + })(); + + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L : + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M : + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q : + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H : + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error("Too long data"); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + /** + * @class QRCode + * @constructor + * @example + * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); + * + * @example + * var oQRCode = new QRCode("test", { + * text : "http://naver.com", + * width : 128, + * height : 128 + * }); + * + * oQRCode.clear(); // Clear the QRCode. + * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. + * + * @param {HTMLElement|String} el target element or 'id' attribute of element. + * @param {Object|String} vOption + * @param {String} vOption.text QRCode link data + * @param {Number} [vOption.width=256] + * @param {Number} [vOption.height=256] + * @param {String} [vOption.colorDark="#000000"] + * @param {String} [vOption.colorLight="#ffffff"] + * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] + */ + QRCode = function (el, vOption) { + this._htOption = { + width : 256, + height : 256, + typeNumber : 4, + colorDark : "#000000", + colorLight : "#ffffff", + correctLevel : QRErrorCorrectLevel.H + }; + + if (typeof vOption === 'string') { + vOption = { + text : vOption + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + if (typeof el == "string") { + el = document.getElementById(el); + } + + if (this._htOption.useSVG) { + Drawing = svgDrawer; + } + + this._android = _getAndroid(); + this._el = el; + this._oQRCode = null; + this._oDrawing = new Drawing(this._el, this._htOption); + + if (this._htOption.text) { + this.makeCode(this._htOption.text); + } + }; + + /** + * Make the QRCode + * + * @param {String} sText link data + */ + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this._el.title = sText; + this._oDrawing.draw(this._oQRCode); + this.makeImage(); + }; + + /** + * Make the Image from Canvas element + * - It occurs automatically + * - Android below 3 doesn't support Data-URI spec. + * + * @private + */ + QRCode.prototype.makeImage = function () { + if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) { + this._oDrawing.makeImage(); + } + }; + + /** + * Clear the QRCode + */ + QRCode.prototype.clear = function () { + this._oDrawing.clear(); + }; + + /** + * @name QRCode.CorrectLevel + */ + QRCode.CorrectLevel = QRErrorCorrectLevel; +})(); diff --git a/app/assets/v2/js/lib/vue.js b/app/assets/v2/js/lib/vue.js new file mode 100644 index 00000000000..b72127b0e80 --- /dev/null +++ b/app/assets/v2/js/lib/vue.js @@ -0,0 +1,6 @@ +/*! + * Vue.js v2.6.11 + * (c) 2014-2019 Evan You + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!z&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s0&&(st((u=e(u,(a||"")+"_"+c))[0])&&st(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?st(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):st(u)&&st(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function st(e){return n(e)&&n(e.text)&&!1===e.isComment}function ct(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=pt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=dt(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function pt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:at(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function dt(e,t){return function(){return e[t]}}function vt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;idocument.createEvent("Event").timeStamp&&(sn=function(){return cn.now()})}function un(){var e,t;for(an=sn(),rn=!0,Qt.sort(function(e,t){return e.id-t.id}),on=0;onon&&Qt[n].id>e.id;)n--;Qt.splice(n+1,0,e)}else Qt.push(e);nn||(nn=!0,Ye(un))}}(this)},fn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},fn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},fn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},fn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var pn={enumerable:!0,configurable:!0,get:S,set:S};function dn(e,t,n){pn.get=function(){return this[t][n]},pn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,pn)}function vn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);xe(r,o,a),o in e||dn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&dn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new fn(e,a||S,S,hn)),i in e||mn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&qt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ut(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Yt(n,"beforeCreate"),function(e){var t=ct(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),vn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Yt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(wn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return _n(this,e,t,n);(n=n||{}).user=!0;var r=new fn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(wn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;iparseInt(this.max)&&On(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Ye,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),M.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Tn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Cn(e),function(e){M.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(wn),Object.defineProperty(wn.prototype,"$isServer",{get:te}),Object.defineProperty(wn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(wn,"FunctionalRenderContext",{value:Tt}),wn.version="2.6.11";var En=p("style,class"),Nn=p("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Nn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Dn=p("contenteditable,draggable,spellcheck"),Ln=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Hn(t)||"false"===t?"false":"contenteditable"===e&&Ln(t)?t:"true"},In=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Fn="http://www.w3.org/1999/xlink",Pn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Rn=function(e){return Pn(e)?e.slice(6,e.length):""},Hn=function(e){return null==e||!1===e};function Bn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Un(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Un(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Vn(t));return""}(t.staticClass,t.class)}function Un(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Vn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i-1?hr(e,t,n):In(t)?Hn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Dn(t)?e.setAttribute(t,Mn(t,n)):Pn(t)?Hn(n)?e.removeAttributeNS(Fn,Rn(t)):e.setAttributeNS(Fn,t,n):hr(e,t,n)}function hr(e,t,n){if(Hn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var mr={create:dr,update:dr};function yr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Bn(r),c=i._transitionClasses;n(c)&&(s=zn(s,Vn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var gr,_r,br,$r,wr,Cr,xr={create:yr,update:yr},kr=/[\w).+\-_$\]]/;function Ar(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&kr.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r-1?{exp:e.slice(0,$r),key:'"'+e.slice($r+1)+'"'}:{exp:e,key:null};_r=e,$r=wr=Cr=0;for(;!zr();)Vr(br=Ur())?Jr(br):91===br&&Kr(br);return{exp:e.slice(0,wr),key:e.slice(wr+1,Cr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Ur(){return _r.charCodeAt(++$r)}function zr(){return $r>=gr}function Vr(e){return 34===e||39===e}function Kr(e){var t=1;for(wr=$r;!zr();)if(Vr(e=Ur()))Jr(e);else if(91===e&&t++,93===e&&t--,0===t){Cr=$r;break}}function Jr(e){for(var t=e;!zr()&&(e=Ur())!==t;);}var qr,Wr="__r",Zr="__c";function Gr(e,t,n){var r=qr;return function i(){null!==t.apply(null,arguments)&&Qr(e,i,n,r)}}var Xr=Ve&&!(X&&Number(X[1])<=53);function Yr(e,t,n,r){if(Xr){var i=an,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}qr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function Qr(e,t,n,r){(r||qr).removeEventListener(e,t._wrapper||t,n)}function ei(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};qr=r.elm,function(e){if(n(e[Wr])){var t=q?"change":"input";e[t]=[].concat(e[Wr],e[t]||[]),delete e[Wr]}n(e[Zr])&&(e.change=[].concat(e[Zr],e.change||[]),delete e[Zr])}(i),rt(i,o,Yr,Qr,Gr,r.context),qr=void 0}}var ti,ni={create:ei,update:ei};function ri(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);ii(a,u)&&(a.value=u)}else if("innerHTML"===i&&qn(a.tagName)&&t(a.innerHTML)){(ti=ti||document.createElement("div")).innerHTML=""+o+"";for(var l=ti.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function ii(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var oi={create:ri,update:ri},ai=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function si(e){var t=ci(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ci(e){return Array.isArray(e)?O(e):"string"==typeof e?ai(e):e}var ui,li=/^--/,fi=/\s*!important$/,pi=function(e,t,n){if(li.test(t))e.style.setProperty(t,n);else if(fi.test(n))e.style.setProperty(C(t),n.replace(fi,""),"important");else{var r=vi(t);if(Array.isArray(n))for(var i=0,o=n.length;i-1?t.split(yi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function _i(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(yi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function bi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,$i(e.name||"v")),A(t,e),t}return"string"==typeof e?$i(e):void 0}}var $i=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),wi=z&&!W,Ci="transition",xi="animation",ki="transition",Ai="transitionend",Oi="animation",Si="animationend";wi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ki="WebkitTransition",Ai="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Oi="WebkitAnimation",Si="webkitAnimationEnd"));var Ti=z?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ti(function(){Ti(e)})}function Ni(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),gi(e,t))}function ji(e,t){e._transitionClasses&&h(e._transitionClasses,t),_i(e,t)}function Di(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Ci?Ai:Si,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=Ci,l=a,f=o.length):t===xi?u>0&&(n=xi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Ci:xi:null)?n===Ci?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Ci&&Li.test(r[ki+"Property"])}}function Ii(e,t){for(;e.length1}function Ui(e,t){!0!==t.data.show&&Pi(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;ov?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o-1,a.selected!==o&&(a.selected=o);else if(N(Wi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function qi(e,t){return t.every(function(t){return!N(t,e)})}function Wi(e){return"_value"in e?e._value:e.value}function Zi(e){e.target.composing=!0}function Gi(e){e.target.composing&&(e.target.composing=!1,Xi(e.target,"input"))}function Xi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Yi(e){return!e.componentInstance||e.data&&e.data.transition?e:Yi(e.componentInstance._vnode)}var Qi={model:Vi,show:{bind:function(e,t,n){var r=t.value,i=(n=Yi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Pi(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Yi(n)).data&&n.data.transition?(n.data.show=!0,r?Pi(n,function(){e.style.display=e.__vOriginalDisplay}):Ri(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},eo={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function to(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?to(zt(t.children)):e}function no(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function ro(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var io=function(e){return e.tag||Ut(e)},oo=function(e){return"show"===e.name},ao={name:"transition",props:eo,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(io)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=to(o);if(!a)return o;if(this._leaving)return ro(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=no(this),u=this._vnode,l=to(u);if(a.data.directives&&a.data.directives.some(oo)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!Ut(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,it(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),ro(e,o);if("in-out"===r){if(Ut(a))return u;var p,d=function(){p()};it(c,"afterEnter",d),it(c,"enterCancelled",d),it(f,"delayLeave",function(e){p=e})}}return o}}},so=A({tag:String,moveClass:String},eo);function co(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function uo(e){e.data.newPos=e.elm.getBoundingClientRect()}function lo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete so.mode;var fo={Transition:ao,TransitionGroup:{props:so,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Zt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=no(this),s=0;s-1?Gn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Gn[e]=/HTMLUnknownElement/.test(t.toString())},A(wn.options.directives,Qi),A(wn.options.components,fo),wn.prototype.__patch__=z?zi:S,wn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Yt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new fn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Yt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Yt(e,"mounted")),e}(this,e=e&&z?Yn(e):void 0,t)},z&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",wn)},0);var po=/\{\{((?:.|\r?\n)+?)\}\}/g,vo=/[-.*+?^${}()|[\]\/\\]/g,ho=g(function(e){var t=e[0].replace(vo,"\\$&"),n=e[1].replace(vo,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var mo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Fr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Ir(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var yo,go={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Fr(e,"style");n&&(e.staticStyle=JSON.stringify(ai(n)));var r=Ir(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},_o=function(e){return(yo=yo||document.createElement("div")).innerHTML=e,yo.textContent},bo=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),$o=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),wo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),Co=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Ao="((?:"+ko+"\\:)?"+ko+")",Oo=new RegExp("^<"+Ao),So=/^\s*(\/?)>/,To=new RegExp("^<\\/"+Ao+"[^>]*>"),Eo=/^]+>/i,No=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Io=/&(?:lt|gt|quot|amp|#39);/g,Fo=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Po=p("pre,textarea",!0),Ro=function(e,t){return e&&Po(e)&&"\n"===t[0]};function Ho(e,t){var n=t?Fo:Io;return e.replace(n,function(e){return Mo[e]})}var Bo,Uo,zo,Vo,Ko,Jo,qo,Wo,Zo=/^@|^v-on:/,Go=/^v-|^@|^:|^#/,Xo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Yo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Qo=/^\(|\)$/g,ea=/^\[.*\]$/,ta=/:(.*)$/,na=/^:|^\.|^v-bind:/,ra=/\.[^.\]]+(?=[^\]]*$)/g,ia=/^v-slot(:|$)|^#/,oa=/[\r\n]/,aa=/\s+/g,sa=g(_o),ca="_empty_";function ua(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ma(t),rawAttrsMap:{},parent:n,children:[]}}function la(e,t){Bo=t.warn||Sr,Jo=t.isPreTag||T,qo=t.mustUseProp||T,Wo=t.getTagNamespace||T;t.isReservedTag;zo=Tr(t.modules,"transformNode"),Vo=Tr(t.modules,"preTransformNode"),Ko=Tr(t.modules,"postTransformNode"),Uo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=fa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&da(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&da(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Jo(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Do(l)||"noscript"===l||(n=n.replace(//g,"$1").replace(//g,"$1")),Ro(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(No.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(jo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(To);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ro(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(To.test($)||Oo.test($)||No.test($)||jo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(Oo);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(So))&&(r=e.match(xo)||e.match(Co));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&wo(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Bo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Wo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;nc&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Ar(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Br(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Br(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Br(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Ir(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Br(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Wr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Br(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Hr(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:bo,mustUseProp:jn,canBeLeftOpenTag:$o,isReservedTag:Wn,getTagNamespace:Zn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(ba)},xa=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function ka(e,t){e&&($a=xa(t.staticKeys||""),wa=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!wa(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every($a)))}(t);if(1===t.type){if(!wa(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function(?:\s+[\w$]+)?\s*\(/,Oa=/\([^)]*?\);*$/,Sa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ta={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Na=function(e){return"if("+e+")return null;"},ja={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Na("$event.target !== $event.currentTarget"),ctrl:Na("!$event.ctrlKey"),shift:Na("!$event.shiftKey"),alt:Na("!$event.altKey"),meta:Na("!$event.metaKey"),left:Na("'button' in $event && $event.button !== 0"),middle:Na("'button' in $event && $event.button !== 1"),right:Na("'button' in $event && $event.button !== 2")};function Da(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=La(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function La(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return La(e)}).join(",")+"]";var t=Sa.test(e.value),n=Aa.test(e.value),r=Sa.test(e.value.replace(Oa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(ja[s])o+=ja[s],Ta[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Na(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ta[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ia={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Fa=function(e){this.options=e,this.warn=e.warn||Sr,this.transforms=Tr(e.modules,"transformCode"),this.dataGenFns=Tr(e.modules,"genData"),this.directives=A(A({},Ia),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Pa(e,t){var n=new Fa(t);return{render:"with(this){return "+(e?Ra(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ra(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ha(e,t);if(e.once&&!e.onceProcessed)return Ba(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Ua(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=qa(e,t),i="_t("+n+(r?","+r:""),o=e.attrs||e.dynamicAttrs?Ga((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:qa(t,n,!0);return"_c("+e+","+Va(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Va(e,t));var i=e.inlineTemplate?null:qa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Pa(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ga(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ka(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ka))}function Ja(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ua(e,t,Ja,"null");if(e.for&&!e.forProcessed)return za(e,t,Ja);var r=e.slotScope===ca?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(qa(e,t)||"undefined")+":undefined":qa(e,t)||"undefined":Ra(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function qa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ra)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'
',ts.innerHTML.indexOf(" ")>0}var os=!!z&&is(!1),as=!!z&&is(!0),ss=g(function(e){var t=Yn(e);return t&&t.innerHTML}),cs=wn.prototype.$mount;return wn.prototype.$mount=function(e,t){if((e=e&&Yn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ss(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=rs(r,{outputSourceRange:!1,shouldDecodeNewlines:os,shouldDecodeNewlinesForHref:as,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return cs.call(this,e,t)},wn.compile=rs,wn}); diff --git a/app/assets/v2/js/note.js b/app/assets/v2/js/note.js index 5d171fcb778..07ebf21984b 100644 --- a/app/assets/v2/js/note.js +++ b/app/assets/v2/js/note.js @@ -1,48 +1,3 @@ -const movementStrength = 25; -let startX = null; -let startY = null; -let mouseX = 0; -let mouseY = 0; -let scrollContainer; -const moveBackground = RAFThrottle(e => { - mouseY = e.pageY || mouseY; - const pageY = mouseY - ($(window).height() / 2) - - ((scrollContainer === window) ? window.scrollY : scrollContainer.scrollTop()) * 2; - let newvalueY = movementStrength / $(window).height() * pageY; - - $('.gitcoin-background').css('background-position', ` center ${newvalueY}px`); -}); - -$(document).ready(function() { - scrollContainer = scrollContainer || $(window); // Allows overriding page scroll container - - $('.header, .white-light-bg,.gitcoin-background').each(function(index, element) { - $(element).mousemove(e => { - const pageX = e.pageX - ($(window).width() / 2); - const pageY = e.pageY - ($(window).height() / 2); - const newvalueX = movementStrength / $(window).width() * (pageX - startX) * -1 - 25; - const newvalueY = movementStrength / $(window).height() * (pageY - startY) * -1 - 50; - - if (!startX) { - startX = newvalueX; - } - - if (!startY) { - startY = newvalueY; - } - - $(element).css('background-position', `${newvalueX - startX}px ${newvalueY - startY}px`); - }); - }); - - const $navbar = $('.navbar'); - const $header = $('.header'); - - $navbar.mousemove(moveBackground); - $header.mousemove(moveBackground); - scrollContainer.scroll(moveBackground); -}); - function RAFThrottle(f) { let throttledHandler; diff --git a/app/assets/v2/js/notifications.js b/app/assets/v2/js/notifications.js index 500ea0c52fa..bd140572e84 100644 --- a/app/assets/v2/js/notifications.js +++ b/app/assets/v2/js/notifications.js @@ -248,30 +248,3 @@ const newData = (newObj, oldObj) => { }); }; -Vue.filter('moment-fromnow', function(date) { - moment.defineLocale('en-custom', { - parentLocale: 'en', - relativeTime: { - future: 'in %s', - past: '%s ', - s: 'now', - ss: '%ds', - m: '1m', - mm: '%d m', - h: '1h', - hh: '%dh', - d: '1 day', - dd: '%d days', - M: '1 month', - MM: '%d months', - y: '1 year', - yy: '%d years' - } - }); - return moment.utc(date).fromNow(); -}); - -Vue.filter('moment', function(date) { - moment.locale('en'); - return moment.utc(date).fromNow(); -}); diff --git a/app/assets/v2/js/pages/bounty_details.js b/app/assets/v2/js/pages/bounty_details.js index d8c86e7bcd0..1f78b3dacc0 100644 --- a/app/assets/v2/js/pages/bounty_details.js +++ b/app/assets/v2/js/pages/bounty_details.js @@ -2,6 +2,10 @@ /* eslint no-redeclare: "warn" */ /* eslint no-loop-func: "warn" */ +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + const _truthy = function(val) { if (!val || val == '0x0000000000000000000000000000000000000000') { return false; @@ -1811,4 +1815,4 @@ var main = function() { window.addEventListener('load', function() { main(); -}); +}); \ No newline at end of file diff --git a/app/assets/v2/js/pages/bounty_details2.js b/app/assets/v2/js/pages/bounty_details2.js new file mode 100644 index 00000000000..d6d8094db31 --- /dev/null +++ b/app/assets/v2/js/pages/bounty_details2.js @@ -0,0 +1,640 @@ +var appBounty; +let bounty = []; +let url = location.href; +const loadingState = { + loading: 'loading', + error: 'error', + empty: 'empty', + resolved: 'resolved' +}; + +document.result = bounty; +// listen_for_web3_changes(); + +Vue.mixin({ + methods: { + fetchBounty: function(newData) { + let vm = this; + let apiUrlBounty = `/actions/api/v0.1/bounty?github_url=${document.issueURL}`; + const getBounty = fetchData(apiUrlBounty, 'GET'); + + $.when(getBounty).then(function(response) { + if (!response.length) { + vm.loadingState = 'empty'; + return vm.syncBounty(); + } + vm.bounty = response[0]; + vm.loadingState = 'resolved'; + vm.isOwner = vm.checkOwner(response[0].bounty_owner_github_username); + vm.isOwnerAddress = vm.checkOwnerAddress(response[0].bounty_owner_address); + document.result = response[0]; + if (newData) { + delete sessionStorage['fulfillers']; + delete sessionStorage['bountyId']; + localStorage[document.issueURL] = ''; + document.title = `${response[0].title} | Gitcoin`; + window.history.replaceState({}, `${response[0].title} | Gitcoin`, response[0].url); + } + if (vm.bounty.event && localStorage['pendingProject'] && (vm.bounty.standard_bounties_id == localStorage['pendingProject'])) { + projectModal(vm.bounty.pk); + } + vm.staffOptions(); + }).catch(function(error) { + vm.loadingState = 'error'; + _alert('Error fetching bounties. Please contact founders@gitcoin.co', 'error'); + }); + }, + syncBounty: function() { + let vm = this; + + if (!localStorage[document.issueURL]) { + vm.loadingState = 'notfound'; + return; + } + + let bountyMetadata = JSON.parse(localStorage[document.issueURL]); + + async function waitBlock(txid) { + let receipt = promisify(cb => web3.eth.getTransactionReceipt(txid, cb)); + + try { + let result = await receipt; + + console.log(result); + const data = { + url: document.issueURL, + txid: txid, + network: document.web3network + }; + let syncDb = fetchData ('/sync/web3/', 'POST', data); + + $.when(syncDb).then(function(response) { + console.log(response); + + vm.fetchBounty(true); + }).catch(function(error) { + setTimeout(vm.syncBounty(), 10000); + }); + } catch (error) { + return error; + } + } + waitBlock(bountyMetadata.txid); + + }, + checkOwner: function(handle) { + let vm = this; + + if (vm.contxt.github_handle) { + return caseInsensitiveCompare(document.contxt['github_handle'], handle); + } + return false; + + }, + checkOwnerAddress: function(bountyOwnerAddress) { + let vm = this; + + if (cb_address) { + return caseInsensitiveCompare(cb_address, bountyOwnerAddress); + } + return false; + + }, + checkInterest: function() { + let vm = this; + + if (!vm.contxt.github_handle) { + return false; + } + let isInterested = !!(vm.bounty.interested || []).find(interest => caseInsensitiveCompare(interest.profile.handle, vm.contxt.github_handle)); + // console.log(isInterested) + + return isInterested; + + }, + checkApproved: function() { + let vm = this; + + if (!vm.contxt.github_handle) { + return false; + } + // pending=false + let result = vm.bounty.interested.find(interest => caseInsensitiveCompare(interest.profile.handle, vm.contxt.github_handle)); + + return result ? !result.pending : false; + + }, + checkFulfilled: function() { + let vm = this; + + if (!vm.contxt.github_handle) { + return false; + } + return !!(vm.bounty.fulfillments || []).find(fulfiller => caseInsensitiveCompare(fulfiller.fulfiller_github_username, vm.contxt.github_handle)); + }, + syncGhIssue: function() { + let vm = this; + let apiUrlIssueSync = `/sync/get_issue_details?url=${encodeURIComponent(vm.bounty.github_url)}&token=${currentProfile.githubToken}`; + const getIssueSync = fetchData(apiUrlIssueSync, 'GET'); + + $.when(getIssueSync).then(function(response) { + vm.updateGhIssue(response); + }); + }, + updateGhIssue: function(response) { + let vm = this; + const payload = JSON.stringify({ + issue_description: response.description, + title: response.title + }); + let apiUrlUpdateIssue = `/bounty/change/${vm.bounty.pk}`; + const postUpdateIssue = fetchData(apiUrlUpdateIssue, 'POST', payload); + + $.when(postUpdateIssue).then(function(response) { + vm.bounty.issue_description = response.description; + vm.bounty.title = response.title; + _alert({ message: response.msg }, 'success'); + }).catch(function(response) { + _alert({ message: response.responseJSON.error }, 'error'); + }); + }, + copyTextToClipboard: function(text) { + if (!navigator.clipboard) { + _alert('Could not copy text to clipboard', 'error', 5000); + } else { + navigator.clipboard.writeText(text).then(function() { + _alert('Text copied to clipboard', 'success', 5000); + }, function(err) { + _alert('Could not copy text to clipboard', 'error', 5000); + }); + } + }, + fulfillmentComplete: function(fulfillment_id, amount) { + + let vm = this; + + const token_name = vm.bounty.token_name; + const decimals = tokenNameToDetails('mainnet', token_name).decimals; + + const payload = { + amount: amount * 10 ** decimals, + token_name: token_name, + bounty_owner_address: vm.bounty.bounty_owner_address + }; + + const apiUrlBounty = `/api/v1/bounty/payout/${fulfillment_id}`; + + fetchData(apiUrlBounty, 'POST', payload).then(response => { + if (200 <= response.status && response.status <= 204) { + console.log('success', response); + } else { + _alert('Unable to make payout bounty. Please try again later', 'error'); + console.error(`error: bounty payment failed with status: ${response.status} and message: ${response.message}`); + } + }); + }, + closeBounty: function() { + + let vm = this; + const bounty_id = vm.bounty.pk; + + const apiUrlBounty = `/api/v1/bounty/${bounty_id}/close`; + + fetchData(apiUrlBounty, 'POST').then(response => { + if (200 <= response.status && response.status <= 204) { + vm.bounty.status = 'done'; + } else { + _alert('Unable to close. bounty. Please try again later', 'error'); + console.error(`error: bounty closure failed with status: ${response.status} and message: ${response.message}`); + } + }); + }, + show_extend_deadline_modal: function() { + show_extend_deadline_modal(); + }, + show_interest_modal: function() { + show_interest_modal(); + }, + staffOptions: function() { + let vm = this; + + if (!vm.bounty.pk) { + return; + } + + if (vm.contxt.is_staff) { + vm.quickLinks.push({ + label: 'View in Admin', + href: `/_administrationdashboard/bounty/${vm.bounty.pk}/change/`, + title: 'View in Admin Tool' + }, { + label: 'Hide Bounty', + href: `${vm.bounty.url}?admin_override_and_hide=1`, + title: 'Hides Bounty from Active Bounties' + }, { + label: 'Toggle Remarket Ready', + href: `${vm.bounty.url}?admin_toggle_as_remarket_ready=1`, + title: 'Sets Remarket Ready if not already remarket ready. Unsets it if already remarket ready.' + }, { + label: 'Suspend Auto Approval', + href: `${vm.bounty.url}?suspend_auto_approval=1`, + title: 'Suspend *Auto Approval* of Bounty Hunters Who Have Applied for This Bounty' + }); + + if (vm.bounty.needs_review) { + vm.quickLinks.push({ + label: 'Mark as Reviewed', + href: `${vm.bounty.url}?mark_reviewed=1`, + title: 'Suspend *Auto Approval* of Bounty Hunters Who Have Applied for This Bounty' + }); + } + } + }, + contactFunder: function() { + let vm = this; + let text = window.prompt('What would you like to say to the funder?', ''); + + if (text === null) { + return; + } + document.location.href = `${vm.bounty.url}?admin_contact_funder=${text}`; + }, + snoozeeGitbot: function() { + let vm = this; + let text = window.prompt('How many days do you want to snooze?', ''); + + if (text === null) { + return; + } + document.location.href = `${vm.bounty.url}?snooze=${text}`; + }, + overrideStatus: function() { + let vm = this; + let text = window.prompt('What new status (valid choices: "open", "started", "submitted", "done", "expired", "cancelled", "" to remove override )?', ''); + + if (text === null) { + return; + } + document.location.href = `${vm.bounty.url}?admin_override_satatus=${text}`; + }, + hasAcceptedFulfillments: function() { + let vm = this; + + if (!vm.bounty) { + return []; + } + + if (vm.is_bounties_network) { + return vm.bounty.fulfillments.filter(fulfillment => fulfillment.accepted); + } + + return vm.bounty.fulfillments.filter(fulfillment => + fulfillment.accepted && + fulfillment.payout_status == 'done' + ); + + }, + stopWork: function(isOwner) { + let text = isOwner ? + 'Are you sure you would like to stop this user from working on this bounty ?' : + 'Are you sure you would like to stop working on this bounty ?'; + + if (!confirm(text)) { + return; + } + + let vm = this; + + const headers = { + 'X-CSRFToken': csrftoken + }; + + const apiUrlBounty = `/actions/bounty/${vm.bounty.pk}/interest/remove/`; + + fetchData(apiUrlBounty, 'POST', {}, headers).then(response => { + if (200 <= response.status && response.status <= 204) { + this.fetchBounty(); + let text = isOwner ? + "'You\'ve stopped the user from working on this bounty ?" : + "'You\'ve stopped work on this bounty"; + + _alert(text, 'success'); + } else { + _alert('Unable to stop work on bounty. Please try again later', 'error'); + console.error(`error: stopping work on bounty failed due to : ${response}`); + } + }); + }, + canStopWork: function(handle) { + let vm = this; + + if (!handle) { + return false; + } + + if (vm.bounty.fulfillments.filter(fulfillment => + fulfillment.fulfiller_github_username != handle).length + ) { + return true; + } + + return false; + }, + totalAmountPaid: function(inputAmount) { + let vm = this; + let amount_paid = 0; + + vm.bounty.fulfillments.forEach(fulfillment => { + amount_paid += (fulfillment.payout_amount / 10 ** vm.decimals); + }); + + vm.bounty.amount_paid = parseFloat(amount_paid) + parseFloat(inputAmount); + } + }, + computed: { + sortedActivity: function() { + const token_details = tokenAddressToDetailsByNetwork( + this.bounty.token_address, this.bounty.network + ); + const decimals = token_details && token_details.decimals; + + this.decimals = decimals; + + let activities = this.bounty.activities.sort((a, b) => new Date(b.created) - new Date(a.created)); + + if (decimals) { + activities.forEach(activity => { + if (activity.metadata) { + if (activity.metadata.new_bounty) { + // ETH + activity.metadata.new_bounty['token_value'] = activity.metadata.new_bounty.value_in_token / 10 ** decimals; + if (activity.metadata.old_bounty) { + activity.metadata.old_bounty['token_value'] = activity.metadata.old_bounty.value_in_token / 10 ** decimals; + } + } else { + // cross-chain + activity.metadata['token_value'] = activity.metadata.value_in_token / 10 ** decimals; + } + } + }); + } + return activities; + } + } +}); + + +if (document.getElementById('gc-bounty-detail')) { + appBounty = new Vue({ + delimiters: [ '[[', ']]' ], + el: '#gc-bounty-detail', + data() { + return { + loadingState: loadingState['loading'], + bounty: bounty, + url: url, + cb_address: cb_address, + isOwner: false, + isOwnerAddress: false, + is_bounties_network: is_bounties_network, + inputAmount: 0, + decimals: 18, + inputBountyOwnerAddress: bounty.bounty_owner_address, + contxt: document.contxt, + quickLinks: [] + }; + }, + mounted() { + this.fetchBounty(); + } + }); +} + + +var show_extend_deadline_modal = function() { + let modals = $('#modalExtend'); + let modalBody = $('#modalExtend .modal-content'); + const url = '/modal/extend_issue_deadline?pk=' + document.result['pk']; + + moment.locale('en'); + modals.on('show.bs.modal', function() { + modalBody.load(url, ()=> { + const currentExpires = moment.utc(document.result['expires_date']); + + $('#modalExtend input[name="expirationTimeDelta"]').daterangepicker({ + parentEl: '#extend_deadline', + singleDatePicker: true, + startDate: moment(currentExpires).add(1, 'month'), + minDate: moment().add(1, 'day'), + ranges: { + '1 week': [ moment(currentExpires).add(7, 'days'), moment(currentExpires).add(7, 'days') ], + '2 weeks': [ moment(currentExpires).add(14, 'days'), moment(currentExpires).add(14, 'days') ], + '1 month': [ moment(currentExpires).add(1, 'month'), moment(currentExpires).add(1, 'month') ], + '3 months': [ moment(currentExpires).add(3, 'month'), moment(currentExpires).add(3, 'month') ], + '1 year': [ moment(currentExpires).add(1, 'year'), moment(currentExpires).add(1, 'year') ] + }, + 'locale': { + 'customRangeLabel': 'Custom' + } + }, function(start, end, label) { + set_extended_time_html(end); + }); + + set_extended_time_html($('#modalExtend input[name="expirationTimeDelta"]').data('daterangepicker').endDate); + + $('#neverExpires').on('click', () => { + if ($('#neverExpires').is(':checked')) { + $('#expirationTimeDelta').attr('disabled', true); + $('#extended-expiration-date #extended-days').html('Never'); + $('#extended-expiration-date #extended-date').html('-'); + } else { + $('#expirationTimeDelta').attr('disabled', false); + set_extended_time_html($('#modalExtend input[name="expirationTimeDelta"]').data('daterangepicker').endDate); + } + }); + + modals.on('submit', function(event) { + event.preventDefault(); + + var extended_time = $('input[name=updatedExpires]').val(); + + extend_expiration(document.result['pk'], { + deadline: extended_time + }); + // setTimeout(function() { + // window.location.reload(); + // }, 2000); + }); + }); + }); + modals.bootstrapModal('show'); + $(document, modals).on('hidden.bs.modal', function(e) { + $('#extend_deadline').remove(); + $('.daterangepicker').remove(); + }); +}; + +var set_extended_time_html = function(extendedDuration) { + extendedDuration = extendedDuration.set({hour: 0, minute: 0, second: 0, millisecond: 0}); + $('input[name=updatedExpires]').val(extendedDuration.utc().unix()); + $('#extended-expiration-date #extended-date').html(extendedDuration.format('MM-DD-YYYY hh:mm A')); + $('#extended-expiration-date #extended-days').html(moment.utc(extendedDuration).fromNow()); +}; + +var extend_expiration = function(bounty_pk, data) { + var request_url = '/actions/bounty/' + bounty_pk + '/extend_expiration/'; + + $.post(request_url, data, function(result) { + + if (result.success) { + _alert({ message: result.msg }, 'success'); + appBounty.bounty.expires_date = moment.unix(data.deadline).utc().format(); + return appBounty.bounty.expires_date; + } + return false; + }).fail(function(result) { + _alert({ message: gettext('got an error. please try again, or contact support@gitcoin.co') }, 'error'); + }); +}; + +var show_interest_modal = function() { + var self = this; + var modals = $('#modalInterest'); + let modalBody = $('#modalInterest .modal-content'); + let modalUrl = `/interest/modal?redirect=${window.location.pathname}&pk=${document.result['pk']}`; + + modals.on('show.bs.modal', function() { + modalBody.load(modalUrl, ()=> { + if (document.result['repo_type'] === 'private') { + document.result.unsigned_nda ? $('.nda-download-link').attr('href', document.result.unsigned_nda.doc) : $('#nda-upload').hide(); + } + + let actionPlanForm = $('#action_plan'); + let issueMessage = $('#issue_message'); + + issueMessage.attr('placeholder', gettext('What steps will you take to complete this task? (min 30 chars)')); + + actionPlanForm.on('submit', function(event) { + event.preventDefault(); + + let msg = issueMessage.val().trim(); + + if (!msg || msg.length < 30) { + _alert({message: gettext('Please provide an action plan for this ticket. (min 30 chars)')}, 'error'); + return false; + } + + const issueNDA = document.result['repo_type'] === 'private' ? $('#issueNDA')[0].files : undefined; + + if (issueNDA && typeof issueNDA[0] !== 'undefined') { + + const formData = new FormData(); + + formData.append('docs', issueNDA[0]); + formData.append('doc_type', 'signed_nda'); + + const ndaSend = { + url: '/api/v0.1/bountydocument', + method: 'POST', + data: formData, + processData: false, + dataType: 'json', + contentType: false + }; + + $.ajax(ndaSend).done(function(response) { + if (response.status == 200) { + _alert(response.message, 'info'); + add_interest(document.result['pk'], { + issue_message: msg, + signed_nda: response.bounty_doc_id, + discord_username: $('#discord_username').length ? $('#discord_username').val() : null + }).then(success => { + if (success) { + $(self).attr('href', '/uninterested'); + $(self).find('span').text(gettext('Stop Work')); + $(self).parent().attr('title', '
' + gettext('Notify the funder that you will not be working on this project') + '
'); + modals.bootstrapModal('hide'); + } + }).catch((error) => { + if (error.responseJSON.error === 'You may only work on max of 3 issues at once.') + return; + throw error; + }); + } else { + _alert(response.message, 'error'); + } + }).fail(function(error) { + _alert(error, 'error'); + }); + } else { + add_interest(document.result['pk'], { + issue_message: msg, + discord_username: $('#discord_username').length ? $('#discord_username').val() : null + }).then(success => { + if (success) { + // $(self).attr('href', '/uninterested'); + // $(self).find('span').text(gettext('Stop Work')); + // $(self).parent().attr('title', '
' + gettext('Notify the funder that you will not be working on this project') + '
'); + appBounty.fetchBounty(); + modals.bootstrapModal('hide'); + + if (document.result.event) { + projectModal(document.result.pk); + } + } + }).catch((error) => { + if (error.responseJSON.error === 'You may only work on max of 3 issues at once.') + return; + throw error; + }); + } + + }); + + }); + }); + modals.bootstrapModal('show'); +}; + +$('body').on('click', '.issue_description img', function() { + var content = $.parseHTML( + '
' + + '' + + '' + + '' + + '
' + + '
'); + + $(content).appendTo('body').modal({ + modalClass: 'modal magnify' + }); +}); + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +const promisify = (inner) => + new Promise((resolve, reject) => + inner((err, res) => { + if (err) { + reject(err); + } else { + resolve(res); + } + }) + ); + +// async function waitBlock(txid) { +// while (true) { +// let receipt = web3.eth.getTransactionReceipt(txid); +// if (receipt && receipt.contractAddress) { +// console.log("Your contract has been deployed at http://testnet.etherscan.io/address/" + receipt.contractAddress); +// console.log("Note that it might take 30 - 90 sceonds for the block to propagate befor it's visible in etherscan.io"); +// break; +// } +// console.log("Waiting a mined block to include your contract... currently in block " + web3.eth.blockNumber); +// await sleep(4000); +// } +// } diff --git a/app/assets/v2/js/pages/bounty_share.js b/app/assets/v2/js/pages/bounty_share.js index 37151e1bf5d..a3d5d062063 100644 --- a/app/assets/v2/js/pages/bounty_share.js +++ b/app/assets/v2/js/pages/bounty_share.js @@ -1,5 +1,6 @@ -$('.modal-link').click(function(e) { +$('body').on('click', '.modal-link', function(e) { + console.log(e); let modals = $('#modal'); let modalBody = $('#modal .modal-content'); let modalUrl = `/modal/social_contribution?pk=${document.result.pk}`; diff --git a/app/assets/v2/js/pages/bulk_payout.js b/app/assets/v2/js/pages/bulk_payout.js index e9545967b9e..c94f19312ed 100644 --- a/app/assets/v2/js/pages/bulk_payout.js +++ b/app/assets/v2/js/pages/bulk_payout.js @@ -1,3 +1,7 @@ +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + const rateUser = (elem) => { let userSelected = $(elem).select2('data')[0].text; diff --git a/app/assets/v2/js/pages/cancel_bounty/ETH.js b/app/assets/v2/js/pages/cancel_bounty/ETH.js index 7165b646072..7bb3ae31152 100644 --- a/app/assets/v2/js/pages/cancel_bounty/ETH.js +++ b/app/assets/v2/js/pages/cancel_bounty/ETH.js @@ -3,6 +3,11 @@ * Data is stored on IPFS + the data is stored in * standard bounties contract on the ethereum blockchain */ + +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + const ethCancelBounty = data => { if (is_bounties_network) { diff --git a/app/assets/v2/js/pages/create_bounty/ETH.js b/app/assets/v2/js/pages/create_bounty/ETH.js index 0875c640535..084c1e3b04b 100644 --- a/app/assets/v2/js/pages/create_bounty/ETH.js +++ b/app/assets/v2/js/pages/create_bounty/ETH.js @@ -134,7 +134,7 @@ const ethCreateBounty = data => { _alert({ message: gettext('Submission sent to web3.') }, 'info'); setTimeout(() => { delete localStorage['issueURL']; - document.location.href = '/funding/details/?url=' + issueURL; + document.location.href = '/funding/details/?url=' + issueURL + '&sb=1'; }, 1000); } diff --git a/app/assets/v2/js/pages/create_bounty/token.js b/app/assets/v2/js/pages/create_bounty/token.js index cde244a8f42..9e73e23a6e8 100644 --- a/app/assets/v2/js/pages/create_bounty/token.js +++ b/app/assets/v2/js/pages/create_bounty/token.js @@ -75,7 +75,8 @@ createBounty = data => { 'attached_job_description': hiring.jobDescription, 'eventTag': metadata.eventTag, 'auto_approve_workers': data.auto_approve_workers ? 'True' : 'False', - 'web3_type': 'qr' + 'web3_type': 'qr', + 'bounty_owner_address': data.funderAddress }; const url = '/api/v1/bounty/create'; diff --git a/app/assets/v2/js/pages/faucet_form.js b/app/assets/v2/js/pages/faucet_form.js index ba6f539d87f..acbcb58f980 100644 --- a/app/assets/v2/js/pages/faucet_form.js +++ b/app/assets/v2/js/pages/faucet_form.js @@ -1,3 +1,7 @@ +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + $('document').ready(function() { $('#comment').bind('input propertychange', function() { diff --git a/app/assets/v2/js/pages/fulfill_bounty/ETH.js b/app/assets/v2/js/pages/fulfill_bounty/ETH.js index 6fbd9e355b3..4247af264ea 100644 --- a/app/assets/v2/js/pages/fulfill_bounty/ETH.js +++ b/app/assets/v2/js/pages/fulfill_bounty/ETH.js @@ -3,6 +3,11 @@ * Data is stored on IPFS + the data is stored in * standard bounties contract on the ethereum blockchain */ + +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + const ethFulfillBounty = data => { if (is_bounties_network) { waitforWeb3(actions_page_warn_if_not_on_same_network); diff --git a/app/assets/v2/js/pages/fulfill_bounty/token.js b/app/assets/v2/js/pages/fulfill_bounty/token.js index c12a2d734f9..3c62cbd3120 100644 --- a/app/assets/v2/js/pages/fulfill_bounty/token.js +++ b/app/assets/v2/js/pages/fulfill_bounty/token.js @@ -4,6 +4,16 @@ */ fulfillBounty = data => { + if (!data.githubPRLink) { + _alert({ message: gettext('Add Github Link to let the funder know where they can check out your work') }, 'error'); + return; + } + + if (!data.payoutAddress) { + _alert({ message: gettext('Add address you would want to be paid out upon payout') }, 'error'); + return; + } + const url = '/api/v1/bounty/fulfill'; const metadata = { diff --git a/app/assets/v2/js/pages/increase_bounty.js b/app/assets/v2/js/pages/increase_bounty.js index 80352f551ec..e34ca8d18cd 100644 --- a/app/assets/v2/js/pages/increase_bounty.js +++ b/app/assets/v2/js/pages/increase_bounty.js @@ -1,4 +1,8 @@ /* eslint-disable no-lonely-if */ +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + load_tokens(); const FEE_PERCENTAGE = document.FEE_PERCENTAGE / 100.0; diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index 1b3fc01f9df..dd3e40370f4 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -1,7 +1,62 @@ /* eslint-disable no-console */ /* eslint-disable nonblock-statement-body-position */ /* eslint-disable no-lonely-if */ +document.web3network = 'mainnet'; load_tokens(); +// listen_for_web3_changes(); + +const qr_tokens = ['ETC']; + + +const updateOnNetworkOrTokenChange = () => { + const tokenName = $('select[name=denomination]').select2('data')[0] && + $('select[name=denomination]').select2('data')[0].text; + + if (!tokenName) { + // tokens haven't loaded yet + } else if (qr_tokens.includes(tokenName)) { + document.web3network = 'mainnet'; + + $('#navbar-network-banner').hide(); + $('.navbar-network').hide(); + + $('.funder-address-container').show(); + $('#funderAddress').attr('required', true); + + $('.web3-alert').hide(); + + } else { + listen_for_web3_changes(); + + $('#navbar-network-banner').show(); + $('.navbar-network').show(); + + $('.funder-address-container').hide(); + $('#funderAddress').removeAttr('required'); + $('#funderAddress').val(''); + + $('.web3-alert').show(); + if (!document.web3network) { + $('.web3-alert').html('To continue, please setup a web3 wallet.'); + $('.web3-alert').addClass('wallet-not-connected'); + } else if (document.web3network == 'locked') { + $('.web3-alert').html('To continue, please unlock your web3 wallet'); + $('.web3-alert').addClass('wallet-not-connected'); + } else if (document.web3network == 'rinkeby') { + $('.web3-alert').html(`connected to address ${web3.eth.coinbase} on rinkeby`); + $('.web3-alert').addClass('wallet-success'); + } else { + $('.web3-alert').html(`connected to address ${web3.eth.coinbase} on mainnet`); + $('.web3-alert').addClass('wallet-success'); + } + } +}; + +window.addEventListener('load', function() { + setTimeout(() => { + setInterval(updateOnNetworkOrTokenChange, 1000); + }, 5000); +}); var localStorage = window.localStorage ? window.localStorage : {}; const quickstartURL = document.location.origin + '/bounty/quickstart'; @@ -364,9 +419,17 @@ $(function() { var triggerDenominationUpdate = function(e) { setUsdAmount(); handleTokenAuth(); - const token_val = $('select[name=denomination]').val(); - const tokendetails = tokenAddressToDetails(token_val); - var token = tokendetails['name']; + + updateOnNetworkOrTokenChange(); + + const token_address = $('select[name=denomination]').val(); + const tokenName = $('select[name=denomination]').select2('data')[0].text; + + const tokendetails = qr_tokens.includes(tokenName) ? + tokenAddressToDetailsByNetwork(token_address, 'mainnet') : + tokenAddressToDetails(token_address); + + const token = tokendetails['name']; updateViewForToken(token); @@ -376,9 +439,13 @@ $(function() { }; $('select[name=denomination]').change(triggerDenominationUpdate); + waitforWeb3(function() { - setTimeout(function() { - triggerDenominationUpdate(); + let denominationId = setInterval(function() { + if ($('select[name=denomination]').val()) { + triggerDenominationUpdate(); + clearInterval(denominationId); + } }, 1000); }); @@ -754,4 +821,4 @@ const transformBountyData = form => { data.metadata = metadata; return data; -}; \ No newline at end of file +}; diff --git a/app/assets/v2/js/pages/process_bounty.js b/app/assets/v2/js/pages/process_bounty.js index 62854debd41..3f97cd5e730 100644 --- a/app/assets/v2/js/pages/process_bounty.js +++ b/app/assets/v2/js/pages/process_bounty.js @@ -1,4 +1,9 @@ /* eslint-disable no-console */ + +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + window.onload = function() { const rateUser = () => { diff --git a/app/assets/v2/js/pages/refund_request.js b/app/assets/v2/js/pages/refund_request.js index 3de6f1830da..2761502367a 100644 --- a/app/assets/v2/js/pages/refund_request.js +++ b/app/assets/v2/js/pages/refund_request.js @@ -1,3 +1,7 @@ +window.addEventListener('load', function() { + setInterval(listen_for_web3_changes, 1000); +}); + $(document).ready(function() { if (!caseInsensitiveCompare($('#bounty_owner').html(), document.contxt.github_handle)) { $('.metamask-banner').hide(); diff --git a/app/assets/v2/js/shared.js b/app/assets/v2/js/shared.js index 5670d06122a..052fadcec19 100644 --- a/app/assets/v2/js/shared.js +++ b/app/assets/v2/js/shared.js @@ -433,6 +433,7 @@ var update_fulfiller_list = function(bounty_pk) { }); return fulfillers; }; +// ETC TODO END function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; @@ -1023,11 +1024,6 @@ var actions_page_warn_if_not_on_same_network = function() { attach_change_element_type(); -if (typeof is_bounties_network == 'undefined' || is_bounties_network) { - window.addEventListener('load', function() { - setInterval(listen_for_web3_changes, 1000); - }); -} var setUsdAmount = function() { const amount = $('input[name=amount]').val(); diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 17ad45fdcca..af81c623fcc 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -101,7 +101,9 @@ function openContributorPopOver(contributor, element) { controller = null; element.popover({ placement: 'auto', - trigger: 'hover', + // container: element, + trigger: 'manual', + delay: { 'show': 200, 'hide': 500 }, template: ` `, content: renderPopOverData(response), html: true + }).on('mouseenter', function() { + var _this = this; + + $(this).popover('show'); + $('.popover').on('mouseleave', function() { + $(_this).popover('hide'); + }); + }).on('mouseleave', function() { + var _this = this; + + setTimeout(function() { + if (!$('.popover:hover').length) { + $(_this).popover('hide'); + } + }, 100); }); $(element).popover('show'); }) @@ -119,7 +136,9 @@ function openContributorPopOver(contributor, element) { } else { element.popover({ placement: 'auto', - trigger: 'hover', + // container: element, + trigger: 'manual', + delay: { 'show': 200, 'hide': 500 }, template: ` ` }); + + +Vue.component('qrcode', { + props: ['string'], + template: '
', + data() { + return { + jqEl: null, + qrcode: null + }; + }, + mounted() { + let vm = this; + + vm.jqEl = $(this.$el); + vm.qrcode = new QRCode(vm.jqEl[0], vm.string); + return vm.qrcode; + + // document.getElementsByClassName("qrcode")[0].innerHTML = qr.createImgTag(); + // var qrcode = new QRCode(document.getElementById("qrcode"), { + // text: "http://jindo.dev.naver.com/collie", + // width: 128, + // height: 128, + // colorDark : "#000000", + // colorLight : "#ffffff", + // correctLevel : QRCode.CorrectLevel.H + // }); + // qrcode.makeCode("http://naver.com") + }, + watch: { + string: function(string) { + let vm = this; + + return vm.qrcode.makeCode(string); + } + }, + computed: { + // normalizedSize: function () { + // console.log(vm.jqEl) + // return new QRCode(vm.jqEl, "http://jindo.dev.naver.com/collie"); + // // return this.size.trim().toLowerCase() + // } + } +}); diff --git a/app/assets/v2/js/vue-filters.js b/app/assets/v2/js/vue-filters.js new file mode 100644 index 00000000000..7d253a9ddf4 --- /dev/null +++ b/app/assets/v2/js/vue-filters.js @@ -0,0 +1,92 @@ +Vue.filter('moment-fromnow', function(date) { + moment.defineLocale('en-custom', { + parentLocale: 'en', + relativeTime: { + future: 'in %s', + past: '%s ', + s: 'now', + ss: '%ds', + m: '1m', + mm: '%d m', + h: '1h', + hh: '%dh', + d: '1 day', + dd: '%d days', + M: '1 month', + MM: '%d months', + y: '1 year', + yy: '%d years' + } + }); + return moment.utc(date).fromNow(); +}); + +Vue.filter('moment', function(date) { + moment.locale('en'); + return moment.utc(date).fromNow(); +}); + +Vue.filter('momentFormat', function(date, format) { + const _format = !format ? 'LLLL' : format; + + return moment(date).format(_format); +}); + + +Vue.filter('markdownit', function(val) { + if (!val) + return ''; + const _markdown = new markdownit({ + linkify: true, + highlight: function(str, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + return `
${hljs.highlight(lang, str, true).value}
`; + } catch (__) {} + } + return `
${sanitize(_markdown.utils.escapeHtml(str))}
`; + } + }); + + _markdown.renderer.rules.table_open = function() { + return ''; + }; + ui_body = sanitize(_markdown.render(val)); + return ui_body; +}); + +Vue.filter('truncateHash', function(elem, _number) { + const number = !_number ? _number = 4 : _number; + let content = elem.trim(); + + return content.substr(0, number + 2) + '\u2026' + content.substr(-number); +}); + +Vue.filter('stringReplace', function(activity_type) { + const activity_names = { + new_bounty: gettext('Bounty Created'), + start_work: gettext('Work Started'), + stop_work: gettext('Work Stopped'), + work_submitted: gettext('Work Submitted'), + work_done: gettext('Work Done'), + worker_approved: gettext('Approved'), + worker_rejected: gettext('Rejected Contributor'), + worker_applied: gettext('Contributor Applied'), + increased_bounty: gettext('Increased Funding'), + killed_bounty: gettext('Canceled Bounty'), // All other sections become empty ? + new_crowdfund: gettext('Added new Crowdfund Contribution'), + new_tip: gettext('Tip Sent'), + receive_tip: gettext('Tip Received'), + bounty_changed: gettext('Bounty Details Updated'), + extend_expiration: gettext('Extended Bounty Expiration'), + bounty_abandonment_escalation_to_mods: gettext('Escalated for Abandonment of Bounty'), + bounty_abandonment_warning: gettext('Warned for Abandonment of Bounty'), + bounty_removed_slashed_by_staff: gettext('Dinged and Removed from Bounty by Staff'), + bounty_removed_by_staff: gettext('Removed from Bounty by Staff'), + bounty_removed_by_funder: gettext('Removed from Bounty by Funder'), + new_kudos: gettext('New Kudos') + }; + + return activity_names[activity_type]; +}); + diff --git a/app/dashboard/helpers.py b/app/dashboard/helpers.py index 1bdc252132d..433ebf5d424 100644 --- a/app/dashboard/helpers.py +++ b/app/dashboard/helpers.py @@ -566,6 +566,7 @@ def create_new_bounty(old_bounties, bounty_payload, bounty_details, bounty_id): bounty_kwargs.update(latest_old_bounty_dict) try: print('new bounty with kwargs:{}'.format(bounty_kwargs)) + _ = bounty_kwargs.pop('payout_tx_id', None) new_bounty = Bounty.objects.create(**bounty_kwargs) merge_bounty(latest_old_bounty, new_bounty, metadata, bounty_details) except Exception as e: diff --git a/app/dashboard/management/commands/sync_etc_payouts.py b/app/dashboard/management/commands/sync_etc_payouts.py index 7cf0d5feeb4..d0096a2c529 100644 --- a/app/dashboard/management/commands/sync_etc_payouts.py +++ b/app/dashboard/management/commands/sync_etc_payouts.py @@ -19,7 +19,7 @@ from django.core.management.base import BaseCommand -from dashboard.models import Bounty +from dashboard.models import BountyFulfillment from dashboard.utils import sync_etc_payout @@ -28,8 +28,8 @@ class Command(BaseCommand): help = 'checks if payments are confirmed for ETC bounties that have been paid out' def handle(self, *args, **options): - bounties_to_check = Bounties.objects.filter( - payout_tx_id=None, bounty_state='done', token_name='ETC', - network='ETC') - for bounty in bounties_to_check.all(): - sync_etc_payout(bounty) + fulfillments_to_check = BountyFulfillment.objects.filter( + payout_status='pending', token_name='ETC' + ) + for fulfillment in fulfillments_to_check.all(): + sync_etc_payout(fulfillment) diff --git a/app/dashboard/migrations/0090_auto_20200312_0008.py b/app/dashboard/migrations/0090_auto_20200312_0008.py new file mode 100644 index 00000000000..5590bd5bc10 --- /dev/null +++ b/app/dashboard/migrations/0090_auto_20200312_0008.py @@ -0,0 +1,42 @@ +# Generated by Django 2.2.4 on 2020-03-12 00:08 + +from django.db import migrations, models +import economy.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0089_merge_20200310_1649'), + ] + + operations = [ + migrations.RemoveField( + model_name='bounty', + name='payout_confirmed', + ), + migrations.RemoveField( + model_name='bounty', + name='payout_tx_id', + ), + migrations.AddField( + model_name='bountyfulfillment', + name='payout_amount', + field=models.DecimalField(blank=True, decimal_places=4, max_digits=50, null=True), + ), + migrations.AddField( + model_name='bountyfulfillment', + name='payout_status', + field=models.CharField(blank=True, choices=[('pending', 'pending'), ('done', 'done')], max_length=10), + ), + migrations.AddField( + model_name='bountyfulfillment', + name='payout_tx_id', + field=models.CharField(blank=True, default='0x0', max_length=255), + ), + migrations.AddField( + model_name='bountyfulfillment', + name='token_name', + field=models.CharField(blank=True, max_length=10), + ), + ] diff --git a/app/dashboard/migrations/0091_merge_20200316_1102.py b/app/dashboard/migrations/0091_merge_20200316_1102.py new file mode 100644 index 00000000000..19cecb8c3c6 --- /dev/null +++ b/app/dashboard/migrations/0091_merge_20200316_1102.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.4 on 2020-03-16 11:02 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0090_auto_20200313_1425'), + ('dashboard', '0090_auto_20200312_0008'), + ] + + operations = [ + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 619159db7d1..6e969a4994e 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -276,8 +276,6 @@ class Bounty(SuperModel): WORK_IN_PROGRESS_STATUSES = ['reserved', 'open', 'started', 'submitted'] TERMINAL_STATUSES = ['done', 'expired', 'cancelled'] - payout_confirmed = models.BooleanField(default=False, blank=True, null=True) - payout_tx_id = models.CharField(default="0x0", max_length=255, blank=True) bounty_state = models.CharField(max_length=50, choices=BOUNTY_STATES, default='open', db_index=True) web3_type = models.CharField(max_length=50, default='bounties_network') title = models.CharField(max_length=1000) @@ -1327,6 +1325,11 @@ def submitted(self): class BountyFulfillment(SuperModel): """The structure of a fulfillment on a Bounty.""" + PAYOUT_STATUS = [ + ('pending', 'pending'), + ('done', 'done'), + ] + fulfiller_address = models.CharField(max_length=50) fulfiller_email = models.CharField(max_length=255, blank=True) fulfiller_github_username = models.CharField(max_length=255, blank=True) @@ -1342,6 +1345,11 @@ class BountyFulfillment(SuperModel): bounty = models.ForeignKey(Bounty, related_name='fulfillments', on_delete=models.CASCADE) profile = models.ForeignKey('dashboard.Profile', related_name='fulfilled', on_delete=models.CASCADE, null=True) + token_name = models.CharField(max_length=10, blank=True) + payout_tx_id = models.CharField(default="0x0", max_length=255, blank=True) + payout_status = models.CharField(max_length=10, choices=PAYOUT_STATUS, blank=True) + payout_amount = models.DecimalField(null=True, blank=True, decimal_places=4, max_digits=50) + def __str__(self): """Define the string representation of BountyFulfillment. @@ -1376,6 +1384,10 @@ def to_json(self): 'email': self.fulfiller_email, 'githubUsername': self.fulfiller_github_username, 'name': self.fulfiller_name, + 'payout_status': self.payout_status, + 'payout_amount': self.payout_amount, + 'token_name': self.token_name, + 'payout_tx_id': self.payout_tx_id } diff --git a/app/dashboard/router.py b/app/dashboard/router.py index 24501922644..6894a98c1c2 100644 --- a/app/dashboard/router.py +++ b/app/dashboard/router.py @@ -38,14 +38,15 @@ class BountyFulfillmentSerializer(serializers.ModelSerializer): """Handle serializing the BountyFulfillment object.""" - + profile = ProfileSerializer() class Meta: """Define the bounty fulfillment serializer metadata.""" model = BountyFulfillment - fields = ('fulfiller_address', - 'fulfiller_github_username', 'fulfiller_name', - 'fulfillment_id', 'accepted', 'profile', 'created_on', 'accepted_on', 'fulfiller_github_url') + fields = ('pk', 'fulfiller_address', + 'fulfiller_github_username', 'fulfiller_name', 'fulfiller_metadata', + 'fulfillment_id', 'accepted', 'profile', 'created_on', 'accepted_on', 'fulfiller_github_url', + 'payout_tx_id', 'payout_amount', 'token_name', 'payout_status') class BountyDocumentsSerializer(serializers.ModelSerializer): @@ -110,7 +111,7 @@ class Meta: """Define the activity serializer metadata.""" model = Activity - fields = ('activity_type', 'created', 'profile', 'metadata', 'bounty', 'tip', 'kudos') + fields = ('activity_type', 'pk', 'created', 'profile', 'metadata', 'bounty', 'tip', 'kudos') class InterestSerializer(serializers.ModelSerializer): @@ -122,7 +123,7 @@ class InterestSerializer(serializers.ModelSerializer): class Meta: """Define the Interest serializer metadata.""" model = Interest - fields = ('profile', 'created', 'pending', 'signed_nda', 'issue_message') + fields = ('pk', 'profile', 'created', 'pending', 'signed_nda', 'issue_message') # Serializers define the API representation. @@ -224,8 +225,8 @@ class Meta: ) -class BountyViewSet(viewsets.ModelViewSet): - """Handle the Bounty view behavior.""" +class BountiesViewSet(viewsets.ModelViewSet): + """Handle Bounties view behavior.""" queryset = Bounty.objects.prefetch_related('fulfillments', 'interested', 'interested__profile', 'activities', 'unsigned_nda', 'event') \ .all().order_by('-web3_created') serializer_class = BountySerializer @@ -450,16 +451,56 @@ def get_queryset(self): return queryset -class BountyViewSetSlim(BountyViewSet): +class BountiesViewSetSlim(BountiesViewSet): queryset = Bounty.objects.all().order_by('-web3_created') serializer_class = BountySerializerSlim -class BountyViewSetCheckIn(BountyViewSet): +class BountiesViewSetCheckIn(BountiesViewSet): queryset = Bounty.objects.all().order_by('standard_bounties_id') serializer_class = BountySerializerCheckIn + +class BountyViewSet(viewsets.ModelViewSet): + """API response for an individual bounty by url""" + + queryset = Bounty.objects.prefetch_related( + 'fulfillments', 'fulfillments__profile', 'interested', 'interested__profile', 'activities', + 'unsigned_nda', 'event' + ) + serializer_class = BountySerializer + filter_backends = (django_filters.rest_framework.DjangoFilterBackend,) + + def get_queryset(self): + """Constructs queryset for an individual bounty + + Returns: + QuerySet: The Bounty queryset. + + """ + + param_keys = self.request.query_params.keys() + + queryset = Bounty.objects.prefetch_related( + 'fulfillments', 'interested', 'interested__profile', 'activities', + 'unsigned_nda', 'event' + ) + + queryset = queryset.current() + + if 'github_url' in param_keys: + url = self.request.query_params.get('github_url') + queryset = queryset.filter(github_url=url) + + queryset = queryset.order_by('-web3_created') + queryset = queryset.distinct() + + return queryset + + # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter() -router.register(r'bounties/slim', BountyViewSetSlim) -router.register(r'bounties', BountyViewSet) -router.register(r'checkin', BountyViewSetCheckIn) +router.register(r'bounties/slim', BountiesViewSetSlim) +router.register(r'bounties', BountiesViewSet) +router.register(r'checkin', BountiesViewSetCheckIn) + +router.register(r'bounty', BountyViewSet) diff --git a/app/dashboard/templates/bounty/change.html b/app/dashboard/templates/bounty/change.html index cdb492a4035..9e20fd970da 100644 --- a/app/dashboard/templates/bounty/change.html +++ b/app/dashboard/templates/bounty/change.html @@ -112,6 +112,9 @@

{% trans "Change Bounty Details" %}

document.pk = {{ pk }}; document.result = {{ result|safe }}; const token_address = '{{ token_address }}'; + {% if not is_bounties_network %} + document.web3network = 'mainnet'; + {% endif %} diff --git a/app/dashboard/templates/bounty/details.html b/app/dashboard/templates/bounty/details.html index e514325073a..0f7fd80b7c6 100644 --- a/app/dashboard/templates/bounty/details.html +++ b/app/dashboard/templates/bounty/details.html @@ -166,7 +166,7 @@

{% trans "Description" %}
-
+
@@ -505,8 +505,8 @@

{{ noscript.keywords }}

+ + {% include 'shared/bottom_notification.html' %} + {% include 'shared/analytics.html' %} + {% include 'shared/footer_scripts.html' with slim=1 %} + {% include 'shared/footer.html' %} + {% include 'shared/current_profile.html' %} + + + + + + + + + + + + + + + + + + + + + + + + {% for message in messages %} + {% if message.tags == 'success'%} + + {% endif %} + + {% endfor %} + + + diff --git a/app/dashboard/templates/bounty/fulfill.html b/app/dashboard/templates/bounty/fulfill.html index 2c91734fb2d..6f9bdefe1fe 100644 --- a/app/dashboard/templates/bounty/fulfill.html +++ b/app/dashboard/templates/bounty/fulfill.html @@ -30,7 +30,7 @@ {% include 'shared/top_nav.html' with class='d-md-flex' %} {% include 'shared/nav.html' %}
-
+
{% include 'shared/no_issue_error.html' with page='fulfill_bounty' %} diff --git a/app/dashboard/templates/bounty/fund.html b/app/dashboard/templates/bounty/fund.html index 60039080f6a..03d159ca7b6 100644 --- a/app/dashboard/templates/bounty/fund.html +++ b/app/dashboard/templates/bounty/fund.html @@ -29,308 +29,302 @@ {% include 'shared/tag_manager_2.html' %} -
+
{% include 'shared/top_nav.html' with class='d-md-flex' %} {% include 'shared/nav.html' %}
-
-
-
- {% include 'shared/no_issue_error.html' with page='submit_bounty' %} - {% include 'shared/no_metamask_error.html' %} - {% include 'shared/zero_balance_error.html' %} - {% include 'shared/unlock_metamask.html' %} - {% include 'shared/connect_metamask.html' %} -
-
-
- - -
-
- -
-

{% trans "Fund Issue" %}

-

Fund your GitHub issue and work with talented developers!

-
-

Github Repo Type

-
- - -
-
-
-
Important Notes on Private Repo Bounties
-
    -
  • Please make sure you are the repo admin to fund the issue
  • -
  • Gitcoin will NOT have any access to your private repo
  • -
  • You have to approve and give repository access to each contributor before they can start work
  • -
  • You can upload an NDA that each contributor has to sign before they can start work
  • -
-
-
+
+ +
+ + +
+

{% trans "Fund Issue" %}

+

Fund your GitHub issue and work with talented developers!

+
+

Github Repo Type

+
+ +
- - -
-

{% trans "Last Synced " %}

- +
+
+
Important Notes on Private Repo Bounties
+
    +
  • Please make sure you are the repo admin to fund the issue
  • +
  • Gitcoin will NOT have any access to your private repo
  • +
  • You have to approve and give repository access to each contributor before they can start work
  • +
  • You can upload an NDA that each contributor has to sign before they can start work
  • +
+
-
- +
+ + +
+

{% trans "Last Synced " %}

+ +
+
+ +
+
+
+ +
-
-
- - -
-
- - -
+
+ +
- +
+ - + - {% include 'shared/pricing.html' %} + {% include 'shared/pricing.html' %} -
- {% include 'shared/bounty_details.html' %} -
+
+
-
- {% include 'shared/bounty_categories.html' %} -
+ -
- {% include 'shared/bounty_keywords.html' %} -
+
+ {% include 'shared/bounty_details.html' %} +
+
+ {% include 'shared/bounty_categories.html' %}
-
- -
- {% include 'shared/issue_details.html' %} - {% include 'shared/issue_deadline.html' %} -
- - -
-
+
+ {% include 'shared/bounty_keywords.html' %}
-
- - -
- {% include 'shared/reserved.html' %} +
+ +
+ +
+ {% include 'shared/issue_details.html' %} + {% include 'shared/issue_deadline.html' %} +
+ +
+
-
- -
-
- + + +
+ +
+
+ +
+ + +
+ +
+ {% if events %} +
+
- -
- -
- {% if events %} -
- -
- - -
-
- -
- -
+
+ +
+
- {% endif %} -
+
+ {% endif %}
+
-
- -
-
- {% include 'shared/notification_email.html' with show_information_publicly_checkbox=1 %} - {% include 'shared/github_username.html' %} -
+
+ +
+
+ {% include 'shared/notification_email.html' with show_information_publicly_checkbox=1 %} + {% include 'shared/github_username.html' %}
+
-
- - + -
- - {% if FEE_PERCENTAGE != 0 %} -
-
- {% trans "No Surprises" %} -
-
-
-

- Simply pay the bounty amount ( plus a {% if FEE_PERCENTAGE == 10 %} standard {% else %} discounted {% endif %} - 10% Gitcoin platform fee ). - This covers our costs for finding quality contributors to join our platform so that you get the best work. - If your business requires additional assistance, please contact us founders@gitcoin.co +

+ + {% if FEE_PERCENTAGE != 0 %} +
+
+ {% trans "No Surprises" %} +
+
+
+

+ Simply pay the bounty amount ( plus a {% if FEE_PERCENTAGE == 10 %} standard {% else %} discounted {% endif %} + 10% Gitcoin platform fee ). + This covers our costs for finding quality contributors to join our platform so that you get the best work. + If your business requires additional assistance, please contact us founders@gitcoin.co +

+
+
+
+

+

+ (10%)

-
-
-

-

- (10%) -

-
-
- {% endif %} - -
-
- - -
-
- - -
-
-
{% trans "Gas Settings" %}
-
- {% include 'shared/bounty_actions_hidden_vars.html' %} - {% include 'shared/wallet_estimate.html' %} -
+ {% endif %} + +
+
+ + +
+
+ +
- -
-
-
-
{% trans "Total"%}
-
-
-

{% trans "Payment Due" %}

- - -

- Bounty 0 - ETH - - - - {% if FEE_PERCENTAGE != 0 %} - + - 0 - ETH Gitcoin Platform Fee - {% else %} - + No Fees - {% endif %} - -

-

- You will have to approve - - {% if FEE_PERCENTAGE == 0 %} 1 {% else %} 2 {% endif %} - Metamask confirmations. - -

-
+
+
{% trans "Gas Settings" %}
+
+ {% include 'shared/bounty_actions_hidden_vars.html' %} + {% include 'shared/wallet_estimate.html' %}
+
-
- -

- Your transaction is secured by the audited StandardBounties contract on the Ethereum blockchain. - Learn more here. -

+
+
+
+
{% trans "Total"%}
+
+
+

{% trans "Payment Due" %}

+ + +

+ Bounty 0 + ETH + + + + {% if FEE_PERCENTAGE != 0 %} + + + 0 + ETH Gitcoin Platform Fee + {% else %} + + No Fees + {% endif %} + +

+

+ You will have to approve + + {% if FEE_PERCENTAGE == 0 %} 1 {% else %} 2 {% endif %} + Metamask confirmations. + +

+
- -
+
+
+ +

+ Your transaction is secured by the audited StandardBounties contract on the Ethereum blockchain. + Learn more here. +

+
+
+
diff --git a/app/dashboard/templates/labs.html b/app/dashboard/templates/labs.html index fcbde59089e..3eebdbcebac 100644 --- a/app/dashboard/templates/labs.html +++ b/app/dashboard/templates/labs.html @@ -20,7 +20,7 @@ {% include 'shared/head.html' %} {% include 'shared/cards_pic.html' %} -
+

Gitcoin Labs is on hiatus.

2019/07/01 - After our friend & colleague, Austin Griffith, left Gitcoin, we are working on a community-driven research roadmap for Gitcoin Labs. Want to be involved? Checkout the Roadmap. or Get in Touch

diff --git a/app/dashboard/templates/shared/labs_nav.html b/app/dashboard/templates/shared/labs_nav.html index 060e144192d..6cc8567e30d 100644 --- a/app/dashboard/templates/shared/labs_nav.html +++ b/app/dashboard/templates/shared/labs_nav.html @@ -17,7 +17,6 @@ {% endcomment %} {% load i18n static matches cookielaw_tags %}