diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index ed768d08e97d259fdadde03b4b40e8670dc727b0..59d645d193544a65156663d05a4bdd020b78f697 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -186,7 +186,7 @@ "BTN_PENDING": "Pending registrations", "SHOW_MORE": "Show more", "SHOW_MORE_COUNT": "(current limit to {{limit}})", - "NO_PENDING": "No pending registration has been found" + "NO_PENDING": "No pending registration has in found" }, "MODAL": { "TITLE": "Search" @@ -197,7 +197,8 @@ "LIST": "Details of received certifications", "PENDING_LIST": "Pending certifications", "RECEIVED": "Received certifications", - "RECEIVED_BY": "Certifications received by {{uid}}" + "RECEIVED_BY": "Certifications received by {{uid}}", + "ERROR": "Received certifications in error" }, "GIVEN_CERTIFICATIONS": { "TITLE": "{{uid}} - Certifications sent", @@ -205,7 +206,8 @@ "LIST": "Détails of sent certifications", "PENDING_LIST": "Pending certifications", "SENT": "Sent certifications", - "SENT_BY": "Certifications sent by {{uid}}" + "SENT_BY": "Certifications sent by {{uid}}", + "ERROR": "Sent certifications with error" } }, "LOGIN": { diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 33889f5f32c27ca650c2aa5740ee51bd1c89b2db..707dcc93728f18703531f9f0021f1fa97c56c575 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -197,7 +197,8 @@ "LIST": "Détail des certifications reçues", "PENDING_LIST": "Certifications en attente de traitement", "RECEIVED": "Certifications reçues", - "RECEIVED_BY": "Certifications reçues par {{uid}}" + "RECEIVED_BY": "Certifications reçues par {{uid}}", + "ERROR": "Certifications reçues en erreur" }, "GIVEN_CERTIFICATIONS": { "TITLE": "{{uid}} - Certifications émises", @@ -205,7 +206,8 @@ "LIST": "Détail des certifications émises", "PENDING_LIST": "Certifications en attente de traitement", "SENT": "Certifications émises", - "SENT_BY": "Certifications émises par {{uid}}" + "SENT_BY": "Certifications émises par {{uid}}", + "ERROR": "Certifications émises en erreur" } }, "LOGIN": { diff --git a/www/js/config.js b/www/js/config.js index a4abe2121993d8fdbd80c511bf8ce9c2013a07b8..f9ebe07493171e815ff94ef620a5dfe997910972 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -10,35 +10,39 @@ angular.module("cesium.config", []) .constant("csConfig", { "cacheTimeMs": 60000, - "fallbackLanguage": "en", - "rememberMe": false, + "fallbackLanguage": "fr-FR", + "defaultLanguage": "fr-FR", + "rememberMe": true, "showUDHistory": false, - "timeout": 10000, + "timeout": 6000, "timeWarningExpireMembership": 5184000, "timeWarningExpire": 7776000, "useLocalStorage": true, "useRelative": true, "initPhase": false, "expertMode": false, - "decimalCount": 4, + "decimalCount": 2, "helptip": { "enable": true, - "installDocUrl": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + "installDocUrl": { + "fr-FR": "http://www.le-sou.org/devenir-noeud/", + "en": "https://github.com/duniter/duniter/blob/master/doc/install-a-node.md" + } }, "node": { - "host": "cgeek.fr", - "port": "9330" + "host": "duniter.le-sou.org", + "port": "9600" }, "plugins": { "es": { "enable": true, - "askEnable": false, - "host": "data.duniter.fr", + "askEnable": true, + "host": "data.le-sou.org", "port": "80" } }, "version": "0.5.0", - "build": "2016-11-09T20:03:22.217Z", + "build": "2016-11-09T20:11:53.167Z", "newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug" }) diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 74089bd8ca8e4492829f43b4554263b8e4f91588..c0dbc9ccd7b2c6948bf2578727cb2c9b45df6c1f 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -455,7 +455,7 @@ function WotCertificationsViewController($scope, $rootScope, $state, $timeout, $ $scope.formData = identity; $scope.canCertify = $scope.formData.hasSelf && (!csWallet.isLogin() || (!csWallet.isUserPubkey(pubkey))); $scope.canSelectAndCertify = $scope.formData.hasSelf && csWallet.isUserPubkey(pubkey); - $scope.alreadyCertified = $scope.canCertify ? !!_.findWhere(identity.certifications, { uid: csWallet.data.uid, valid: true }) : false; + $scope.alreadyCertified = $scope.canCertify ? !!_.findWhere(identity.received_cert, { uid: csWallet.data.uid, valid: true }) : false; $scope.loading = false; diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index 573d9b49364ccf43911293426aa52bfa612266d4..79fc224573df6473c6553b6a1f076219812dc902 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -24,6 +24,17 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic return idties; }, + _sortCertifications = function(certifications) { + certifications = _.sortBy(certifications, function(cert){ + var score = 1; + score += (1000000000000 * (cert.expiresIn ? cert.expiresIn : 0)); + score += (10000000 * (cert.isMember ? 1 : 0)); + score += (10 * (cert.block ? cert.block : 0)); + return -score; + }); + return certifications; + }, + loadRequirements = function(pubkey, uid) { return $q(function(resolve, reject) { // Get requirements @@ -120,7 +131,8 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic pubkey: cert.pubkey, uid: cert.uids[0], cert_time: { - block: (cert.meta && cert.meta.block_number) ? cert.meta.block_number : 0 + block: (cert.meta && cert.meta.block_number) ? cert.meta.block_number : 0, + block_hash: (cert.meta && cert.meta.block_hash) ? cert.meta.block_hash : null }, isMember: cert.isMember, wasMember: cert.wasMember @@ -149,6 +161,10 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic var result = { pubkey: cert.pubkey, uid: cert.uid, + cert_time: { + block: (cert.cert_time && cert.cert_time.block) ? cert.cert_time.block : 0, + block_hash: (cert.cert_time && cert.cert_time.block_hash) ? cert.cert_time.block_hash : null + }, sigDate: cert.meta ? cert.meta.timestamp : null, isMember: cert.isMember, wasMember: cert.wasMember @@ -177,7 +193,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic // Check if self has been done on a valid block if (!identity.isMember && identity.number !== 0 && identity.hash !== block.hash) { addEvent(identity, {type: 'error', message: 'ERROR.IDENTITY_INVALID_BLOCK_HASH'}); - console.debug("Invalid membership for uid={0}: block hash not match a real block (block cancelled)".format(identity.uid)); + console.debug("[wot] Invalid membership for {0}: block hash changed".format(identity.uid)); } return identity; @@ -208,7 +224,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic }); }, - loadCertifications = function(getFunction, pubkey, lookupCertifications, parameters, medianTime) { + loadCertifications = function(getFunction, pubkey, lookupCertifications, parameters, medianTime, certifiersOf) { function _certId(pubkey, block) { return pubkey + '-' + block; @@ -223,8 +239,6 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic return res; }, {}) : {}; - var certificationCount = 0; - var pendingCertificationCount = 0; var isMember = true; return getFunction({ pubkey: pubkey }) @@ -241,9 +255,6 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic (certTime + parameters.sigWindow - medianTime) : (certTime + parameters.sigValidity - medianTime)); expiresIn = (expiresIn < 0) ? 0 : expiresIn; - // Increment counter - if (!pending && expiresIn > 0) certificationCount++; - else if (pending) pendingCertificationCount++; // Remove from lookup certs var certId = _certId(cert.pubkey, lookupHasCertTime && cert.cert_time ? cert.cert_time.block : cert.sigDate); delete lookupCerticationsByCertId[certId]; @@ -299,9 +310,11 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic return res.concat(pendingCertByBlocks[block.number].reduce(function(res, cert) { var certTime = block.medianTime; var expiresIn = Math.max(0, certTime + parameters.sigWindow - medianTime); - var valid = (expiresIn > 0); - if (!valid) return res; // Keep only valid cert - pendingCertificationCount++; + var validBuid = (!cert.cert_time || !cert.cert_time.block_hash || cert.cert_time.block_hash == block.hash); + if (!validBuid) { + console.debug("[wot] Invalid cert {0}: block hash changed".format(cert.pubkey.substring(0,8))); + } + var valid = (expiresIn > 0) && (!certifiersOf || cert.isMember) && validBuid; return res.concat({ pubkey: cert.pubkey, uid: cert.uid, @@ -312,7 +325,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic willExpire: (expiresIn && expiresIn <= csSettings.data.timeWarningExpire), pending: true, block: lookupHasCertTime && cert.cert_time ? cert.cert_time.block : - (cert.sigDate ? cert.sigDate.split('-')[0] : null), + (cert.sigDate ? cert.sigDate.split('-')[0] : null), valid: valid }); }, [])); @@ -331,27 +344,30 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic } return res; }, {}); - certifications = certifications.reduce(function(res, cert) { - if (!cert.pending || (cert.valid && !writtenCertByPubkey[cert.pubkey])) { - return res.concat(cert); - } - pendingCertificationCount--; - return res; - }, []); // Final sort - certifications = _.sortBy(certifications, function(cert){ - var score = 1; - score += (1000000000000 * (cert.expiresIn ? cert.expiresIn : 0)); - score += (10000000 * (cert.isMember ? 1 : 0)); - score += (10 * (cert.block ? cert.block : 0)); - return -score; - }); + certifications = _sortCertifications(certifications); + + // Split into valid/pending/error + var pendingCertifications = []; + var errorCertifications = []; + var validCertifications = certifications.reduce(function(res, cert) { + if (cert.pending) { + if (cert.valid && !writtenCertByPubkey[cert.pubkey]) { + pendingCertifications.push(cert); + } + else if (!cert.valid && !writtenCertByPubkey[cert.pubkey]){ + errorCertifications.push(cert); + } + return res; + } + return res.concat(cert); + }, []); return { - pendingCertificationCount: pendingCertificationCount, - certificationCount: certificationCount, - certifications: certifications + valid: validCertifications, + pending: pendingCertifications, + error: errorCertifications }; }) ; @@ -438,21 +454,22 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic }) ]) .then(function() { + return $q.all([ // Get received certifications - loadCertifications(BMA.wot.certifiersOf, pubkey, data.lookup ? data.lookup.certifications : null, parameters, medianTime) + loadCertifications(BMA.wot.certifiersOf, pubkey, data.lookup ? data.lookup.certifications : null, parameters, medianTime, true/*certifiersOf*/) .then(function (res) { - data.certifications = res.certifications; - data.certificationCount = res.certificationCount; - data.pendingCertificationCount = res.pendingCertificationCount; + data.received_cert = res.valid; + data.received_cert_pending = res.pending; + data.received_cert_error = res.error; }), // Get given certifications - loadCertifications(BMA.wot.certifiedBy, pubkey, data.lookup ? data.lookup.givenCertifications : null, parameters, medianTime) + loadCertifications(BMA.wot.certifiedBy, pubkey, data.lookup ? data.lookup.givenCertifications : null, parameters, medianTime, false/*certifiersOf*/) .then(function (res) { - data.givenCertifications = res.certifications; - data.givenCertificationCount = res.certificationCount; - data.pendingGivenCertificationCount = res.pendingCertificationCount; + data.given_cert = res.valid; + data.given_cert_pending = res.pending; + data.given_cert_error = res.error; }), // Get sources diff --git a/www/templates/wot/tabs/item_certification.html b/www/templates/wot/tabs/item_certification.html new file mode 100644 index 0000000000000000000000000000000000000000..c9c6fb0cb1c549e6cf8e8bb1f35e12cec0841403 --- /dev/null +++ b/www/templates/wot/tabs/item_certification.html @@ -0,0 +1,46 @@ + + <span ng-if="cert.isMember"> + <h3> + <i class="icon ion-clock" ng-if="cert.pending"> </i> + <span class="positive"> + <i class="ion-person"> </i> + {{::cert.uid}} + </span> + </h3> + <h4 class="gray"> + <i class="ion-key"></i> + {{::cert.pubkey | formatPubkey}} + <span class="gray"> | {{::cert.time|formatDate}}</span> + <span class="gray" ng-if="$root.settings.expertMode"> | {{::cert.pending ? 'WOT.SIGNED_ON_BLOCK' : 'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> + </h4> + </span> + <span ng-if="!cert.isMember"> + <h3> + <i class="icon ion-clock" ng-if="cert.pending"> </i> + <span ng-if="cert.uid" class="dark"> + <i class="ion-person"> </i> + {{::cert.uid}} + </span> + <span ng-if="!cert.uid" class="gray"> + <i class="ion-key"> </i> + {{::cert.pubkey | formatPubkey}} + </span> + </h3> + <h5 class="assertive"> + {{::'WOT.NOT_MEMBER_PARENTHESIS'|translate}} + </h5> + <h4 class="gray"> + <span ng-if="cert.uid"> + <i class="ion-key"></i> + {{::cert.pubkey | formatPubkey}} + </span> + <span class="gray"> | {{::cert.time|formatDate}}</span> + <span class="gray" ng-if="$root.settings.expertMode"> | {{::cert.pending ? 'WOT.SIGNED_ON_BLOCK' : 'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> + </h4> + </span> + <div class="badge badge-stable" ng-if="cert.expiresIn"> + {{::cert.expiresIn | formatDurationTo}} + </div> + <div class="badge badge-assertive" ng-if="!cert.expiresIn"> + {{::'WOT.EXPIRED' | translate}} + </div> diff --git a/www/templates/wot/tabs/view_certifications.html b/www/templates/wot/tabs/view_certifications.html index efa84a6b915f64989b5eccb66f2918a3e791de4f..44e141c2b61b84c7aa0b20975a3fced291ddef66 100644 --- a/www/templates/wot/tabs/view_certifications.html +++ b/www/templates/wot/tabs/view_certifications.html @@ -11,76 +11,41 @@ <span id="helptip-wot-view-certifications-count" class="badge" - ng-class="{'badge-balanced': formData.certificationCount >= formData.sigQty, - 'badge-energized': formData.certificationCount < formData.sigQty && formData.certificationCount + formData.pendingCertificationCount >= formData.sigQty, - 'badge-assertive': formData.certificationCount + formData.pendingCertificationCount < formData.sigQty}"> - <span ng-if="formData.certificationCount || !formData.pendingCertificationCount"> - <i ng-if="formData.certificationCount >= formData.sigQty" class="ion-android-done"></i> - {{formData.certificationCount}} + ng-class="{'badge-balanced': formData.received_cert.length >= formData.sigQty, + 'badge-energized': formData.received_cert.length < formData.sigQty && formData.received_cert.length + formData.received_cert_pending.length >= formData.sigQty, + 'badge-assertive': formData.received_cert.length + formData.received_cert_pending.length < formData.sigQty}"> + <span ng-if="formData.received_cert.length || !formData.received_cert_pending.length"> + <i ng-if="formData.received_cert.length >= formData.sigQty" class="ion-android-done"></i> + {{formData.received_cert.length}} </span> - <span ng-if="formData.pendingCertificationCount"> - <ng-if ng-if="formData.certificationCount">+ </ng-if> + <span ng-if="formData.received_cert_pending.length"> + <ng-if ng-if="formData.received_cert.length">+ </ng-if> <i class="ion-clock"></i> - {{formData.pendingCertificationCount}} + {{formData.received_cert_pending.length}} </span> </span> </div> + <!-- Error certifications count --> + <div class="item item-icon-left item-text-wrap ink" ng-if="formData.received_cert_error.length"> + <i class="icon ion-alert-circled"></i> + <span translate>WOT.CERTIFICATIONS.ERROR</span> + + <span class="badge badge-assertive" > + {{formData.received_cert_error.length}} + </span> + </div> + <!-- pending certifications --> - <span class="item item-divider" ng-if="formData.pendingCertificationCount"> + <span class="item item-divider" ng-if="formData.received_cert_pending.length"> <span translate>WOT.CERTIFICATIONS.PENDING_LIST</span> <div class="badge item-note" style="text-align: right !important;" translate>WOT.NOT_WRITTEN_EXPIRE_IN</div> </span> <a class="item ink" - ng-if="formData.pendingCertificationCount" - ng-repeat="cert in formData.certifications | filter: {pending: true}" + ng-repeat="cert in formData.received_cert_pending" ui-sref="app.wot_view_identity({pubkey:cert.pubkey, uid:cert.uid})"> - <span ng-if="cert.isMember"> - <h3> - <i class="icon ion-clock"> </i> - <span class="positive"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - </h3> - <h4 class="gray"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.SIGNED_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <span ng-if="!cert.isMember"> - <h3> - <i class="icon ion-clock"> </i> - <span ng-if="cert.uid" class="dark"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - <span ng-if="!cert.uid" class="gray"> - <i class="ion-key"> </i> - {{::cert.pubkey | formatPubkey}} - </span> - </h3> - <h5 class="assertive"> - {{::'WOT.NOT_MEMBER_PARENTHESIS'|translate}} - </h5> - <h4 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - </span> - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.SIGNED_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <div class="badge badge-stable" ng-if="cert.expiresIn"> - {{::cert.expiresIn | formatDurationTo}} - </div> - <div class="badge badge-assertive" ng-if="!cert.expiresIn"> - {{::'WOT.EXPIRED' | translate}} - </div> + <ng-include src="'templates/wot/tabs/item_certification.html'"></ng-include> </a> <!-- valid certifications --> @@ -89,51 +54,12 @@ <div class="badge item-note" translate>WOT.EXPIRE_IN</div> </span> - <span class="item gray" ng-if="!formData.certificationCount" + <span class="item gray" ng-if="!formData.received_cert.length" translate>WOT.NO_CERTIFICATION</span> <a class="item ink" - ng-repeat="cert in formData.certifications | filter: {pending: false}" + ng-repeat="cert in formData.received_cert" ui-sref="app.wot_view_identity({pubkey:cert.pubkey, uid:cert.uid})"> - <span ng-if="cert.isMember"> - <h3 class="positive"> - <i class="ion-person"></i> - {{::cert.uid}} - </h3> - <h4 class="gray"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <span ng-if="!cert.isMember"> - <h3 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - <span ng-if="!cert.uid"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - </span> - </h3> - <h5 class="assertive">{{::'WOT.NOT_MEMBER_PARENTHESIS'|translate}}</h5> - <h4 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - </span> - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <div class="badge" ng-if="cert.expiresIn" - ng-class="{'badge-balanced': !cert.willExpire, 'badge-energized': cert.willExpire}"> - {{::cert.expiresIn | formatDurationTo}} - </div> - <div class="badge badge-assertive" ng-if="!cert.expiresIn"> - {{::'WOT.EXPIRED' | translate}} - </div> + <ng-include src="'templates/wot/tabs/item_certification.html'"></ng-include> </a> </div> diff --git a/www/templates/wot/tabs/view_given_certifications.html b/www/templates/wot/tabs/view_given_certifications.html index b30dd67743eb928283ad465c8b0b4d552b9878bc..a4fb101720898b7f5f847821a29c1670d051fc10 100644 --- a/www/templates/wot/tabs/view_given_certifications.html +++ b/www/templates/wot/tabs/view_given_certifications.html @@ -11,75 +11,40 @@ <span translate>WOT.GIVEN_CERTIFICATIONS.SENT</span> <span class="badge" - ng-class="{'badge-calm': formData.givenCertificationCount < formData.sigStock, 'badge-assertive': formData.givenCertificationCount >= formData.sigStock}"> + ng-class="{'badge-calm': formData.given_cert.length < formData.sigStock, 'badge-assertive': formData.given_cert.length >= formData.sigStock}"> <span> - <i ng-if="formData.givenCertificationCount" class="ion-android-done"></i> - {{formData.givenCertificationCount}} + <i ng-if="formData.given_cert.length" class="ion-android-done"></i> + {{formData.given_cert.length}} </span> - <span ng-if="formData.pendingGivenCertificationCount"> - (<ng-if ng-if="formData.givenCertificationCount">+ </ng-if> + <span ng-if="formData.given_cert_pending.length"> + (<ng-if ng-if="formData.given_cert.length">+ </ng-if> <i class="ion-clock"></i> - {{formData.pendingGivenCertificationCount}}) + {{formData.given_cert_pending.length}}) </span> <small>/ {{formData.sigStock}}</small> </span> </div> + <!-- Error certifications count --> + <div class="item item-icon-left item-text-wrap ink" ng-if="formData.given_cert_error.length"> + <i class="icon ion-alert-circled"></i> + <span translate>WOT.GIVEN_CERTIFICATIONS.ERROR</span> + + <span class="badge badge-assertive" > + {{formData.given_cert_error.length}} + </span> + </div> + <!-- pending given certifications --> - <span class="item item-divider" ng-if="formData.pendingGivenCertificationCount"> + <span class="item item-divider" ng-if="formData.given_cert_pending.length"> <span translate>WOT.GIVEN_CERTIFICATIONS.PENDING_LIST</span> <div class="badge item-note" style="text-align: right !important;" translate>WOT.NOT_WRITTEN_EXPIRE_IN</div> </span> <a class="item ink" - ng-if="formData.pendingGivenCertificationCount" - ng-repeat="cert in formData.givenCertifications | filter:{pending:true}" + ng-repeat="cert in formData.given_cert_pending" ui-sref="app.wot_view_identity({pubkey:cert.pubkey, uid:cert.uid})"> - <span ng-if="cert.isMember"> - <h3> - <i class="icon ion-clock"> </i> - <span class="positive"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - </h3> - <h4 class="gray"> - <i class="icon ion-key"></i> - {{::cert.pubkey | formatPubkey}} - <span class="gray"> | {{cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{'WOT.SIGNED_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <span ng-if="!cert.isMember"> - <h3> - <i class="icon ion-clock"> </i> - <span ng-if="cert.uid" class="dark"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - <span ng-if="!cert.uid" class="gray"> - <i class="ion-key"> </i> - {{::cert.pubkey | formatPubkey}} - </span> - </h3> - <h5 class="assertive"> - {{::'WOT.NOT_MEMBER_PARENTHESIS'|translate}} - </h5> - <h4 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-key"> </i> - {{::cert.pubkey | formatPubkey}} - </span> - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.SIGNED_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <div class="badge badge-stable" ng-if="cert.expiresIn"> - {{::cert.expiresIn | formatDurationTo}} - </div> - <div class="badge badge-assertive" ng-if="!cert.expiresIn"> - {{::'WOT.EXPIRED' | translate}} - </div> + <ng-include src="'templates/wot/tabs/item_certification.html'"></ng-include> </a> <!-- validated given certifications --> @@ -88,52 +53,13 @@ <div class="badge item-note" translate>WOT.EXPIRE_IN</div> </span> - <span class="item gray" ng-if="!formData.givenCertificationCount" translate> + <span class="item gray" ng-if="!formData.given_cert.length" translate> WOT.NO_GIVEN_CERTIFICATION </span> <a class="item ink" - ng-repeat="cert in formData.givenCertifications | filter:{pending:false}" + ng-repeat="cert in formData.given_cert" ui-sref="app.wot_view_identity({pubkey:cert.pubkey, uid:cert.uid})"> - <span ng-if="cert.isMember"> - <h3 class="positive"> - <i class="icon ion-person"></i> - {{::cert.uid}} - </h3> - <h4 class="gray"> - <i class="icon ion-key"></i> - {{::cert.pubkey | formatPubkey}} - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <span ng-if="!cert.isMember"> - <h3 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-person"> </i> - {{::cert.uid}} - </span> - <span ng-if="!cert.uid"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - </span> - </h3> - <h5 class="assertive">{{::'WOT.NOT_MEMBER_PARENTHESIS'|translate}}</h5> - <h4 class="gray"> - <span ng-if="cert.uid"> - <i class="ion-key"></i> - {{::cert.pubkey | formatPubkey}} - </span> - <span class="gray"> | {{::cert.time|formatDate}}</span> - <span class="gray" ng-if="$root.settings.expertMode"> | {{::'WOT.WRITTEN_ON_BLOCK' | translate:cert}}</span> - </h4> - </span> - <div class="badge" ng-if="cert.expiresIn" - ng-class="{'badge-balanced': !cert.willExpire, 'badge-energized': cert.willExpire}"> - {{::cert.expiresIn | formatDurationTo}} - </div> - <div class="badge badge-assertive" ng-if="!cert.expiresIn"> - {{::'WOT.EXPIRED' | translate}} - </div> + <ng-include src="'templates/wot/tabs/item_certification.html'"></ng-include> </a> </div> diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index 7aad86998f5183272af3bb8e012de0d7d13be182..50bc57f81c65fa0cbd6a7d8ad944efa13a143446 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -55,17 +55,17 @@ <span translate>ACCOUNT.CERTIFICATION_COUNT</span> <span id="helptip-wot-view-certifications-count" class="badge" - ng-class="{'badge-balanced': formData.certificationCount >= formData.sigQty, - 'badge-energized': formData.certificationCount < formData.sigQty && formData.certificationCount + formData.pendingCertificationCount >= formData.sigQty, - 'badge-assertive': formData.certificationCount < formData.sigQty}"> - <span ng-if="formData.certificationCount || !formData.pendingCertificationCount"> - <i ng-if="formData.certificationCount >= formData.sigQty" class="ion-android-done"></i> - {{formData.certificationCount}} + ng-class="{'badge-balanced': formData.received_cert.length >= formData.sigQty, + 'badge-energized': formData.received_cert.length < formData.sigQty && formData.received_cert.length + formData.received_cert_pending.length >= formData.sigQty, + 'badge-assertive': formData.received_cert.length < formData.sigQty}"> + <span ng-if="formData.received_cert.length || !formData.received_cert_pending.length"> + <i ng-if="formData.received_cert.length >= formData.sigQty" class="ion-android-done"></i> + {{formData.received_cert.length}} </span> - <span ng-if="formData.pendingCertificationCount"> + <span ng-if="formData.received_cert_pending.length"> <ng-if ng-if="formData.certificationCount">+ </ng-if> <i class="ion-clock"></i> - {{formData.pendingCertificationCount}} + {{formData.received_cert_pending.length}} </span> </span> <i class="gray icon ion-ios-arrow-right"></i>