Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

QR code on printed gift card template #333

Merged
merged 2 commits into from
Feb 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions assets/gift-card.scss.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $colorGiftText: #999; // note, this is always on a white background
$colorGiftBorder: {{ settings.color_primary }};

// Sizes
$gutter: 24px;
$gutter: 30px;

/*============================================================================
#Sass Mixins
Expand Down Expand Up @@ -74,13 +74,13 @@ $gutter: 24px;
.giftcard-header {
padding: ($gutter * 2) 0;
font-size: 1em;
text-align: center;
-webkit-animation: fadein 0.5s ease-in-out both 0.4s;
animation: fadein 0.5s ease-in-out both 0.4s;
}

.shop-url {
display: none;
text-align: center;
}

.giftcard {
Expand Down Expand Up @@ -368,6 +368,17 @@ $gutter: 24px;
vertical-align: baseline;
}

#QrCode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a bit late in the game, but I was wondering about the fact this says #QrCode and not #qr-code.

In the default template provided by Shopify they're using #qr-code. Also, in the mark up Kevin asked us to copy from, the id used is #qr-code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timber follows our internal styleguide, and in it we use PascalCase for IDs.

display: none;

img {
padding: $gutter;
border: 1px solid $colorBorder;
border-radius: 4px;
margin: 0 auto $gutter;
}
}


/*============================================================================
#Media Queries
Expand Down Expand Up @@ -460,6 +471,10 @@ $gutter: 24px;
background-color: #fff;
}

.giftcard-header {
padding: 10px 0;
}

.giftcard__content,
.giftcard__border {
border: 0 none;
Expand All @@ -472,6 +487,11 @@ $gutter: 24px;
display: none;
}

.giftcard__title {
float: none;
text-align: center;
}

.giftcard__code__text {
color: #555;
}
Expand All @@ -483,6 +503,10 @@ $gutter: 24px;
.logo {
color: #58686F;
}

#QrCode {
display: block;
}
}

/*============================================================================
Expand Down
14 changes: 10 additions & 4 deletions templates/gift_card.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
{{ 'timber.scss.css' | asset_url | stylesheet_tag }}
{{ 'gift-card.scss.css' | asset_url | stylesheet_tag }}
{{ 'modernizr.gift-card.js' | shopify_asset_url | script_tag }}

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{{ 'vendor/qrcode.js' | shopify_asset_url | script_tag }}

</head>

Expand Down Expand Up @@ -97,6 +94,15 @@
{{ 'gift_cards.issued.redeem' | t }}
</p>

<div id="QrCode"></div>
<script>
new QRCode(document.getElementById('QrCode'), {
text: "{{ gift_card.qr_identifier }}",
width: 100,
height: 100
});
</script>

<div class="giftcard__actions">
<a href="{{ shop.url }}" class="btn" target="_blank">{{ 'gift_cards.issued.shop_link' | t }}</a>
<a href="#" class="action-link" onclick="window.print();">
Expand Down