Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kudos : add share button #2688

Merged
merged 5 commits into from
Nov 12, 2018
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
3 changes: 3 additions & 0 deletions app/assets/v2/css/kudos/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/assets/v2/css/kudos/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,11 @@ a.cellarius-partner:before {
border-bottom: 1px solid #C8C8C8;
padding-bottom: 0.8rem;
margin-bottom: 1rem;

img {
position: relative;
top: -2px;
}
}

.kudos-details__price {
Expand Down
20 changes: 20 additions & 0 deletions app/assets/v2/js/pages/kudos_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@ var stop_kudos_levitate = function() {

};

window.onclick = (event) => {
if (event.target.id == 'share-modal') {
$('#share-modal').css('display', 'none');
}
};

$('#share-button').on('click', () => {
$('#share-modal').css('display', 'block');
});

$('#share-modal .fa-times').on('click', () => {
$('#share-modal').css('display', 'none');
});

$('#copyLink').on('click', () => {
$('#shareLink').select();
document.execCommand('copy');
$('.tooltip-share .title-tooltip').html('Copied Link');
});

// $('#getKudos').click(function() {


Expand Down
60 changes: 31 additions & 29 deletions app/kudos/templates/kudos_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<link rel="stylesheet" href="{% static "v2/css/kudos/styles.css" %}" />
<script src="{% static 'v2/js/tweenlite.js' %}"></script>
<link rel="stylesheet" href="{% static "v2/css/jquery-ui.css" %}" />

<meta property="twitter:image" content="{% static kudos.image %}" />
<meta property="og:image" content="{% static kudos.image %}" />
<meta property="og:description" content="{{ kudos.name|humanize_name }} Kudos" />

</head>
<body class="{{ active }} bg-light g-font-muli">
Expand All @@ -28,14 +30,10 @@
<section class="container my-5 pb-5">
<div class="row justify-content-around">
<div class="col-md-6 col-lg-5 mb-5">

<div class="kudos_msg" style="">
<div class="kudos_msg">
<strong></strong>
<p>

</p>
</div>

<p></p>
</div>
<div id="kudos-image" class="sticky-top w-100">
{% include 'shared/kudos_levitate.html' %}
<img src="{% static kudos.image %}" alt="{{ kudos.name }}" class="w-100">
Expand All @@ -51,23 +49,31 @@ <h3 id="kudosName" class="kudos-details__title">{{ kudos.name|humanize_name }} {
<p>{{ kudos.description }}</p>
</div>
<div class="kudos-details__subtitle">
<img src="{% static 'v2/images/kudos/assets/kudos-diamond.svg' %}" alt=""> MARKETPLACE STATS
<img class="mr-2" src="{% static 'v2/images/kudos/assets/kudos-diamond.svg' %}" alt="">{% trans "MARKETPLACE STATS" %}
<i id="share-button" class="fas fa-share-alt float-right"></i>
</div>

<p><span class="text-color_blue text-weight_semibold">{{ kudos.rarity }}</span> ({{ kudos.num_clones_in_wild_counting_indirect_send }} out of {{ kudos.num_gen0_clones_allowed }}) <i data-toggle="tooltip" title="" data-html="true" data-original-title="<span class='title-tooltip'>Kudos Rarity</span>
<table class='text-left'>
<tr><td>One of a Kind:</td><td>1 clone</td></tr>
<tr><td>Legendary:</td><td>2 - 5 clones</td></tr>
<tr><td>Ultra:</td><td>6 - 15 clones</td></tr>
<tr><td>Very Rare:</td><td>16 - 35 clones</td></tr>
<tr><td>Rare:</td><td>36 - 100 clones</td></tr>
<tr><td>Special:</td><td>101 - 200 clones</td></tr>
<tr><td>Common:</td><td>201+</td></tr>
</table>" data-template='<div class="tooltip-kudos" role="tooltip"><div class="tooltip-inner"></div></div>' class="fas fa-question-circle text-color_blue"></i></p>
{% include 'share.html' %}
<p>
<span class="text-color_blue text-weight_semibold">
{{ kudos.rarity }}
</span>
({{ kudos.num_clones_in_wild_counting_indirect_send }} {% trans "out of" %} {{ kudos.num_gen0_clones_allowed }})
<i data-toggle="tooltip" title="" data-html="true" data-original-title="<span class='title-tooltip'>Kudos Rarity</span>
<table class='text-left'>
<tr><td>{% trans 'One of a Kind' %}:</td><td>1 clone</td></tr>
<tr><td>{% trans 'Legendary' %}:</td><td>2 - 5 clones</td></tr>
<tr><td>{% trans 'Ultra' %}:</td><td>6 - 15 clones</td></tr>
<tr><td>{% trans 'Very Rare' %}:</td><td>16 - 35 clones</td></tr>
<tr><td>{% trans 'Rare' %}:</td><td>36 - 100 clones</td></tr>
<tr><td>{% trans 'Special' %}:</td><td>101 - 200 clones</td></tr>
<tr><td>{% trans 'Common' %}:</td><td>201+</td></tr>
</table>" data-template='<div class="tooltip-kudos" role="tooltip"><div class="tooltip-inner"></div></div>' class="fas fa-question-circle text-color_blue">
</i>
</p>

<div class="mb-4">
<span id='kudosNumClonesAvailable' class="text-color_blue text-weight_semibold">{{ kudos.num_clones_available_counting_indirect_send }}</span> Total Available
<span id='kudosNumClonesAllowed' class="text-color_blue text-weight_semibold ml-5">{{ kudos.num_clones_in_wild_counting_indirect_send }}</span> Total minted
<span id='kudosNumClonesAvailable' class="text-color_blue text-weight_semibold">{{ kudos.num_clones_available_counting_indirect_send }}</span> {% trans "Total Available" %}
<span id='kudosNumClonesAllowed' class="text-color_blue text-weight_semibold ml-5">{{ kudos.num_clones_in_wild_counting_indirect_send }}</span> {% trans "Total minted" %}
</div>
<p class="mb-4 kudos-details__price" data-ethprice="{{ kudos.price_in_eth }}">{{ kudos.price_in_eth }} ETH <small></small></p>
<div class="row justify-content-start pb-4">
Expand All @@ -76,7 +82,7 @@ <h3 id="kudosName" class="kudos-details__title">{{ kudos.name|humanize_name }} {
<a href="/kudos/send?id={{ kudos.id}}" class="btn btn-gc-blue">{% trans "Send Kudos" %}</a>
{% elif kudos.num_clones_allowed != 0 and kudos.num_clones_available_counting_indirect_send == 0 %}
<button type="button" class="btn btn-gc-blue" disabled>{% trans "Not Available" %}</button>
<small class="d-block mt-2">There are no clones available due to popularity but you can still look at this awesome badge!</small>
<small class="d-block mt-2">{% trans "There are no clones available due to popularity but you can still look at this awesome badge!" %}</small>
{% endif %}
</div>
</div>
Expand Down Expand Up @@ -110,12 +116,8 @@ <h3 id="kudosName" class="kudos-details__title">{{ kudos.name|humanize_name }} {
</div>
</section>
<section class="container my-5 py-5">


{% include 'shared/disqus.html' with page_url=request.build_absolute_uri %}
</section>


{% include 'shared/disqus.html' with page_url=request.build_absolute_uri %}
</section>
{% include 'shared/footer.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' with slim=1 %}
Expand Down
137 changes: 137 additions & 0 deletions app/kudos/templates/share.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{% load kudos_extras %}
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
{% load i18n static %}
<style>
.modal {
display: none;
position: fixed;
z-index: 1025;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
max-width: 100%;
overflow-y: auto;
}

.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: none;
border-radius: 0;
width: 60%;
}

.fa-times:hover,
.fa-times:focus {
cursor: pointer;
}

.modal #kudos-image {
max-width: 12rem;
}

.tooltip-share {
z-index: 1036;
}

#share-modal button i {
font-style: normal;
color: #fff;
}

#shareLink {
background-color: #fff;
border: 1px solid #979797;
min-width: 18rem;
width: auto;
}

.tooltip-share .tooltip-inner {
padding: 5px;
width: 150px;
}

.tooltip-inner .title-tooltip {
font-size: 0.65rem;
}

@media (max-width: 991.98px) {

.modal-content {
width: 80%;
}

#share-modal p {
text-align: center;
}

#share-modal #kudos-image {
margin: auto;
}
}

@media (max-width: 767.98px) {

.modal-content {
width: 100%;
}

.share-button {
margin-bottom: 1rem;
}
}

@media (max-width: 575.98px) {
#shareLink {
min-width: auto;
width: 100%;
margin-bottom: 1rem;
}
}
</style>

<div id="share-modal" class="modal">
<div class="modal-content row">
<div class="col-12 text-right font-title">
<i class="fas fa-times"></i>
</div>
<div class="col-12 row">
<div class="col-12 text-center">
<h1 class="font-title-lg mb-4">{% trans "Share" %} Kudos!</h1>
</div>
<div id="kudos-image" class="col-12 offset-lg-4 col-lg-4">
<img src="{% static kudos.image %}" alt="{{ kudos.name }}" class="w-100">
</div>
<div class="col-12 col-lg-4 my-auto">
<p>
<span class="text-color_blue text-weight_semibold">{{ kudos.name|humanize_name }}</span> <br>
<span class="text-color_blue text-weight_semibold">{{ kudos.rarity }}</span>
({{ kudos.num_clones_in_wild_counting_indirect_send }} {% trans "out of" %} {{ kudos.num_gen0_clones_allowed }}) <br>
<span id='kudosNumClonesAvailable' class="text-color_blue text-weight_semibold">{{ kudos.num_clones_available_counting_indirect_send }}</span> {% trans "Total Available" %} <br>
<span id='kudosNumClonesAllowed' class="text-color_blue text-weight_semibold">{{ kudos.num_clones_in_wild_counting_indirect_send }}</span> {% trans "Total minted" %}
</p>
</div>
</div>
<div class="col-12 my-4 text-center">
<input class="form__input"type="text" value="{{ request.META.HTTP_HOST }}{% url 'kudos_details' kudos.id kudos.name %}" id="shareLink" readonly>
<button class="btn btn-gc-blue button__small font-body" id="copyLink">
<i data-toggle="tooltip" title="" data-html="true"
data-original-title="<span class='title-tooltip text-center'>{% trans 'Click To Copy' %}</span>"
data-template='<div class="tooltip-kudos tooltip-share" role="tooltip"><div class="tooltip-inner"></div></div>' class="text-color_blue">
{% trans "Copy Link" %}
</i>
</button>
</div>
<div class="col-12 text-center">
<a class="btn btn-gc-blue share-button font-body" target="_blank" rel="noopener noreferrer"
href="https://twitter.com/intent/tweet?text=Check%20out%20the%20{{kudos.name|humanize_name}}%20kudos%21%20{{ request.META.HTTP_HOST }}{% url 'kudos_details' kudos.id kudos.name %}"
data-size="large"><i class="fab fa-twitter mr-2"></i>{% trans "Share on" %} Twitter</a>
<a class="btn btn-gc-blue share-button font-body" target="_blank" rel="noopener noreferrer"
href="https://www.facebook.com/sharer/sharer.php?u={{ request.META.HTTP_HOST }}{% url 'kudos_details' kudos.id kudos.name %}"
data-size="large"><i class="fab fa-facebook mr-2"></i>{% trans "Share on" %} Facebook</a>
</div>
</div>
</div>