From d26993de640db8602f3d0798062fd461b8a3634c Mon Sep 17 00:00:00 2001 From: Mike Larsson Date: Tue, 20 Nov 2012 11:01:46 -0500 Subject: [PATCH] Consolidate badge detail tables into a single partial --- static/js/backpack.js | 7 +++- views/badge-data.html | 71 ++++++++++++++++++++++++++++++++ views/badge-details.html | 80 ++----------------------------------- views/portfolio-editor.html | 61 +--------------------------- views/portfolio.html | 68 +------------------------------ 5 files changed, 82 insertions(+), 205 deletions(-) create mode 100644 views/badge-data.html diff --git a/static/js/backpack.js b/static/js/backpack.js index 642c634c..6719c856 100644 --- a/static/js/backpack.js +++ b/static/js/backpack.js @@ -355,7 +355,12 @@ Details.View = Backbone.View.extend({ }, render: function () { - this.el = template('badge-details.html', this.model.attributes); + this.el = template('badge-details.html', { + badge: { + attributes: this.model.attributes + }, + disownable: true + }); this.setElement(this.el); this.$el.data('view', this); return this; diff --git a/views/badge-data.html b/views/badge-data.html new file mode 100644 index 00000000..6b0c175f --- /dev/null +++ b/views/badge-data.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + {% if badge.attributes.body.badge.issuer.org %} + + + + + {% endif %} + + + + + + + + + + + + + + + + + + {% if badge.attributes.body.evidence %} + + + + + {% endif %} + + {% if badge.attributes.body.issued_on %} + + + + + {% endif %} + + {% if badge.attributes.body.expires %} + + + + + {% endif %} + +
+ + {% if disownable %} + + {% endif %} + Issuer Details
Name{{badge.attributes.body.badge.issuer.name}}
URL{{badge.attributes.body.badge.issuer.origin}}
Organization{{badge.attributes.body.badge.issuer.org}}
Badge Details
Name{{badge.attributes.body.badge.name|escape}}
Description{{badge.attributes.body.badge.description|escape}}
Criteria{{badge.attributes.body.badge.criteria}}
Evidence{{badge.attributes.body.evidence}}
Issued{{badge.attributes.body.issued_on}}
Expiration{{badge.attributes.body.expires}}
+ diff --git a/views/badge-details.html b/views/badge-details.html index 79a8f178..a45cc474 100644 --- a/views/badge-details.html +++ b/views/badge-details.html @@ -1,7 +1,7 @@ diff --git a/views/portfolio-editor.html b/views/portfolio-editor.html index a1dc0c6c..a77a46b5 100644 --- a/views/portfolio-editor.html +++ b/views/portfolio-editor.html @@ -17,66 +17,7 @@

{{badge.attributes.body.badge.name}}

- - - - - - - - - - - - - - {% if badge.attributes.body.badge.issuer.org %} - - - - - {% endif %} - - - - - - - - - - - - - - - - - - {% if evidence %} - - - - - {% endif %} - - {% if issued_on %} - - - - - {% endif %} - - {% if expires %} - - - - - {% endif %} - -
- - Issuer Details
Name{{badge.attributes.body.badge.issuer.name}}
URL{{badge.attributes.body.badge.issuer.origin}}
Organization{{badge.attributes.body.badge.issuer.org}}
Badge Details
Name{{badge.attributes.body.badge.name|escape}}
Description{{badge.attributes.body.badge.description|escape}}
Criteria{{badge.attributes.body.badge.criteria}}
Evidence{{badge.attributes.body.evidence}}
Issued{{badge.attributes.body.issued_on}}
Expiration{{badge.attributes.body.expires}}
+ {% include 'badge-data.html' %} {% endfor %} diff --git a/views/portfolio.html b/views/portfolio.html index 1120f8b6..693f74f0 100644 --- a/views/portfolio.html +++ b/views/portfolio.html @@ -35,73 +35,7 @@

{{badge.attributes.body.badge.name}}

{{badge.attributes.body._userStory}}

- - - - - - - - - - - - - - - - - - - - - {% if badge.attributes.body.badge.issuer.org %} - - - - - {% endif %} - - - - - - - - - - - - - - - - - - {% if badge.attributes.body.evidence %} - - - - - {% endif %} - - {% if badge.attributes.body.issued_on %} - - - - - {% endif %} - - {% if badge.attributes.body.expires %} - - - - - {% endif %} - -
- - Issuer Details
Name{{badge.attributes.body.badge.issuer.name}}
URL{{badge.attributes.body.badge.issuer.origin}}
Organization{{badge.attributes.body.badge.issuer.org}}
Badge Details
Name{{badge.attributes.body.badge.name|escape}}
Description{{badge.attributes.body.badge.description|escape}}
Criteria{{badge.attributes.body.badge.criteria}}
Evidence{{badge.attributes.body.evidence}}
Issued{{badge.attributes.body.issued_on}}
Expiration{{badge.attributes.body.expires}}
+ {% include 'badge-data.html' %} {% endfor %}