Skip to content

Commit

Permalink
Merge pull request #26 from ripe-tech/acaldas/ssi
Browse files Browse the repository at this point in the history
added initials support
  • Loading branch information
joamag authored Feb 19, 2018
2 parents 8659c77 + 0521694 commit fd009fb
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/js/base/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ ripe.Ripe.prototype._getImageURL = function(options) {
query += options.height ? "&height=" + options.height : "";
query += options.size ? "&size=" + options.size : "";
query += options.background ? "&background=" + options.background : "";
query += options.profile ? "&initials_profile=" + options.profile.join(",") : "";

var initials = options.initials === "" ? "$empty" : options.initials;
query += initials ? "&initials=" + initials : "";

return this.url + "compose?" + query;
};

Expand Down
16 changes: 15 additions & 1 deletion src/js/base/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ripe.Ripe.prototype.init = function(brand, model, options) {
this.variant = this.options.variant || null;
this.url = this.options.url || "https://sandbox.platforme.com/api/";
this.parts = this.options.parts || {};
this.initials = "";
this.engraving = null;
this.country = this.options.country || null;
this.currency = this.options.currency || null;
this.format = this.options.format || "jpeg";
Expand Down Expand Up @@ -99,6 +101,16 @@ ripe.Ripe.prototype.setParts = function(update, noUpdate) {
this.trigger("parts", this.parts);
};

ripe.Ripe.prototype.setInitials = function(initials, engraving, noUpdate) {
this.initials = initials;
this.engraving = engraving;

if (noUpdate) {
return;
}
this.update();
};

ripe.Ripe.prototype.getFrames = function(callback) {
if (this.options.frames) {
callback(this.options.frames);
Expand Down Expand Up @@ -144,7 +156,9 @@ ripe.Ripe.prototype.deselectPart = function(part, options) {

ripe.Ripe.prototype._getState = function() {
return {
parts: this.parts
parts: this.parts,
initials: this.initials,
engraving: this.engraving,
};
};

Expand Down
Loading

0 comments on commit fd009fb

Please sign in to comment.