add social share

This commit is contained in:
Adrien Beudin 2016-04-06 20:34:05 +02:00
parent aba2e4fc59
commit 916bf03adc
7 changed files with 149 additions and 43 deletions

View File

@ -157,7 +157,7 @@ def main():
Image.target_dir = os.path.join(os.getcwd(), "build", gallery) Image.target_dir = os.path.join(os.getcwd(), "build", gallery)
template_to_render = page_template if gallery_settings.get("static") else gallery_index_template template_to_render = page_template if gallery_settings.get("static") else gallery_index_template
open(os.path.join("build", gallery, "index.html"), "w").write(template_to_render.render(settings=settings, gallery=gallery_settings, Image=Image).encode("Utf-8")) open(os.path.join("build", gallery, "index.html"), "w").write(template_to_render.render(settings=settings, gallery=gallery_settings, Image=Image, link=gallery).encode("Utf-8"))
front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"])) front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"]))

View File

@ -148,7 +148,6 @@ footer {
.back-to-home hr { .back-to-home hr {
width: 14%; width: 14%;
margin-top: 8em;
color: #DDD; color: #DDD;
} }
@ -253,3 +252,61 @@ footer a {
margin-right: 11.5%; margin-right: 11.5%;
} }
.center, .center-align {
text-align: center;
}
.share {
text-align: center;
height: auto;
position: relative;
bottom: 0;
padding: 0 0 10px 0;
}
ul.icon {
padding: 0;
margin: 10px 0 0 0;
}
ul.icon li {
padding: 0;
list-style-type: none;
display:inline-block;
}
ul.icon a {
display: block;
float: left;
background: url(../img/social-share.png) no-repeat;
background-size: 196px 23px;
border: none;
}
ul.icon li, ul.icon a {
width: 32px;
height: 32px;
text-indent: -999999em;
overflow: hidden;
list-style-type: none;
display: inline-block;
}
a.twitter {
background-position: 5px 0 !important;
}
a.facebook {
background-position: -57px 0 !important;
}
a.pinterest {
background-position: -114px 0 !important;
}
a.google {
background-position: -172px 0 !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -18,6 +18,10 @@
{% include "sections/" + section.type + ".html" %} {% include "sections/" + section.type + ".html" %}
{% endfor %} {% endfor %}
{% if settings.share %}
{% include "share.html" %}
{% endif %}
<div class="back-to-home"> <div class="back-to-home">
<hr> <hr>
<a href="../"> <a href="../">
@ -42,8 +46,8 @@
}); });
}); });
</script> </script>
<footer>
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p> {% include "footer.html" %}
</footer>
</body> </body>
</html> </html>

View File

@ -0,0 +1,17 @@
{% set absolute_url = settings.url + "/" + link -%}
<div class=share>
<ul class="icon">
<li>
<a class="twitter" href="https://twitter.com/share?text={{ gallery.name }}&url={{absolute_url}}&hashtags=weareawesome&via=bluleadz" target="_blank" class="twitter">Twitter</i></a>
</li>
<li>
<a class="facebook" href="http://www.facebook.com/share.php?u={{absolute_url}}" target="_blank" class="facebook">Facebook</a>
</li>
<li>
<a class="pinterest" href="http://www.pinterest.com/pin/create/button/?url={{absolute_url}}" target="_blank" class="linkedin">Pinterest</a>
</li>
<li>
<a class="google" href="https://plus.google.com/share?url={{absolute_url}}" target="_blank" class="google">Google +</a>
</li>
</ul>
</div>

View File

@ -21,11 +21,16 @@
{% include "sections/" + section.type + ".html" %} {% include "sections/" + section.type + ".html" %}
{% endfor %} {% endfor %}
{% if settings.share %}
{% include 'share.html' -%}
{% else -%}
<div class="fixed-action-btn" style="bottom: 45px; right: 24px;"> <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
<a href="../" class="btn-floating btn-large red"> <a href="../" class="btn-floating btn-large red">
<i class="mdi-action-home"></i> <i class="mdi-action-home"></i>
</a> </a>
</div> </div>
{% endif %}
<script type="text/javascript" src="../static/js/jquery-2.1.4.min.js" charset="utf-8"></script> <script type="text/javascript" src="../static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/js/materialize.min.js" charset="utf-8"></script> <script type="text/javascript" src="../static/js/materialize.min.js" charset="utf-8"></script>

View File

@ -0,0 +1,23 @@
{% set absolute_url = settings.url + "/" + link -%}
<div class="fixed-action-btn horizontal click-to-toggle" style="bottom: 45px; right: 24px;">
<a class="btn-floating btn-large red">
<i class="mdi-content-add"></i>
</a>
<ul>
<li>
<a href="../" class="btn-floating btn-large red"><i class="mdi-action-home"></i></a>
</li>
<li>
<a class="btn-floating grey lighten-3" href="https://twitter.com/share?text={{ gallery.name }}&url={{absolute_url}}&hashtags=weareawesome&via=bluleadz" target="_blank" class="twitter">Twitter</a>
</li>
<li>
<a class="btn-floating grey lighten-3" href="http://www.facebook.com/share.php?u={{absolute_url}}" target="_blank" class="facebook">Facebook</a>
</li>
<li>
<a class="btn-floating grey lighten-3" href="http://www.pinterest.com/pin/create/button/?url={{absolute_url}}" target="_blank" class="linkedin">Pinterest</a>
</li>
<li>
<a class="btn-floating grey lighten-3" href="https://plus.google.com/share?url={{absolute_url}}" target="_blank" class="google">Google +</a>
</li>
</ul>
</div>