From 22c8a87bc8b6acc3376239af1942f644a7dab1a3 Mon Sep 17 00:00:00 2001
From: Anna Philips <ms.annaphilips@gmail.com>
Date: Jul 04 2018 22:24:37 +0000
Subject: [PATCH 1/3] Add share buttons


---

diff --git a/assets/css/custom.css b/assets/css/custom.css
index d564d63..c118c49 100644
--- a/assets/css/custom.css
+++ b/assets/css/custom.css
@@ -11,7 +11,7 @@ h1, h2, h3, h4, h5, h6 {
 }
 
 a, a:hover {
-    color: #F64747;
+    color: #294172;
 }
 
 aside {
@@ -78,16 +78,16 @@ blockquote {
 
 .btn {
     background: white;
-    border: 1px solid #F64747;
-    color: #F64747;
+    border: 1px solid #294172;
+    color: #294172;
     text-transform: uppercase;
     padding: 0.9em 1.3em;
 }
 
 .btn:hover {
-    background: #F64747;
+    background: #294172;
     color: white;
-    border: 1px solid #F64747;
+    border: 1px solid #294172;
 }
 
 .row.content {
@@ -115,9 +115,9 @@ blockquote {
         width: 25%;
         height: calc(100% + 20px);
         position: fixed;
-        background: -moz-linear-gradient(top,  #F23030 0%, #f64747 27%, #f64747 27%, #F23030 100%);
-        background: -webkit-linear-gradient(top,  #F23030 0%,#f64747 27%,#f64747 27%,#F23030 100%);
-        background: linear-gradient(to bottom,  #F23030 0%,#f64747 27%,#f64747 27%,#F23030 100%);
+        background: -moz-linear-gradient(top,  #3c6eb4 0%, #3c6eb4 27%, #3c6eb4 27%, #3c6eb4 100%);
+        background: -webkit-linear-gradient(top,  #3c6eb4 0%, #3c6eb4 27%, #3c6eb4 27%, #3c6eb4 100%);
+        background: linear-gradient(to bottom,  #3c6eb4 0%, #3c6eb4 27%, #3c6eb4 27%, #3c6eb4 100%);
     }
 
     aside .sidebar {
@@ -169,3 +169,35 @@ blockquote {
     color: white;
     border: none;
 }
+
+.sharebutton {
+    position: relative;
+    height: 28px;
+    box-sizing: border-box;
+    background-color: #3B5998;
+    padding: 1px 10px 1px 9px;
+    color: #fff;
+    font-weight: 500;
+    cursor: pointer;
+    inherit: none;
+    display: inline-block;
+    vertical-align: top;
+    font: normal normal normal 11px/18px 'Helvetica Neue',Arial,sans-serif;
+    font-size: 13px;
+    line-height: 26px;
+    border-radius: 4px;
+}
+
+.sharebutton:hover {
+    text-decoration: none;
+    color: #fff;
+    background-color: #2f4779;
+}
+
+.google{
+    background-color: #d34836;
+}
+
+.google:hover{
+    background-color: #b72213;
+}
diff --git a/templates/base.html b/templates/base.html
index 80a9498..301ead2 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -12,6 +12,7 @@
     <link href="{% static 'css/datepicker.css' %}" rel="stylesheet">
     <link href="{% static 'css/custom.css' %}" rel="stylesheet">
     <link href="{% static 'images/favicon.ico' %}" rel="icon" type="image/x-icon">
+    <script src="https://apis.google.com/js/platform.js" async defer></script>
 
     <!--[if lt IE 8]>
         <link href="{% static 'css/bootstrap-ie7.css' %}" rel="stylesheet">
@@ -20,6 +21,7 @@
 </head>
 
 <body>
+    {% include "facebook.html" %}
     <aside>
         <div class="sidebar">
             {% url 'messaging:start' as url %}
@@ -69,6 +71,10 @@
             </div>
             <footer><small>
                 <hr>
+                <a class="g-interactivepost sharebutton google" data-contenturl="https://happinesspackets.fedorainfracloud.org/" data-clientid="427442962349-biuc5ks65luss5h3v5oqtj15jigaqoib.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-prefilltext="#FedoraAppreciationWeek2k18" data-calltoactionurl="http://plus.google.com/pages/create"><i class="fab fa-google-plus-g fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+                <script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>
+                <a id="fb" class="sharebutton"><i class="fab fa-facebook fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+                <script>document.getElementById('fb').onclick = function() {FB.ui({method: 'share', mobile_iframe: true, hashtag: '#FedoraAppreciationWeek2k18', href: 'https://happinesspackets.fedorainfracloud.org/',}, function(response){});}</script>
                 <a href="https://twitter.com/intent/tweet?button_hashtag=FedoraAppreciationWeek2k18" class="twitter-hashtag-button" data-size="large" data-dnt="true">Tweet #FedoraAppreciationWeek2k18</a>
                 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
                 <br>
diff --git a/templates/facebook.html b/templates/facebook.html
new file mode 100644
index 0000000..eef5970
--- /dev/null
+++ b/templates/facebook.html
@@ -0,0 +1,17 @@
+<script>
+    window.fbAsyncInit = function() {
+      FB.init({
+        appId            : '240221016763634',
+        autoLogAppEvents : true,
+        xfbml            : true,
+        version          : 'v3.0'
+      });
+    };
+    (function(d, s, id){
+       var js, fjs = d.getElementsByTagName(s)[0];
+       if (d.getElementById(id)) {return;}
+       js = d.createElement(s); js.id = id;
+       js.src = "https://connect.facebook.net/en_US/sdk.js";
+       fjs.parentNode.insertBefore(js, fjs);
+     }(document, 'script', 'facebook-jssdk'));
+  </script>

From b49f7df96b67fe73b78bad9263d7eab6af030ee4 Mon Sep 17 00:00:00 2001
From: Anna Philips <ms.annaphilips@gmail.com>
Date: Jul 08 2018 23:59:01 +0000
Subject: [PATCH 2/3] Add share buttons


---

diff --git a/templates/base.html b/templates/base.html
index 301ead2..8f9e496 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -71,13 +71,10 @@
             </div>
             <footer><small>
                 <hr>
-                <a class="g-interactivepost sharebutton google" data-contenturl="https://happinesspackets.fedorainfracloud.org/" data-clientid="427442962349-biuc5ks65luss5h3v5oqtj15jigaqoib.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-prefilltext="#FedoraAppreciationWeek2k18" data-calltoactionurl="http://plus.google.com/pages/create"><i class="fab fa-google-plus-g fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
-                <script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>
-                <a id="fb" class="sharebutton"><i class="fab fa-facebook fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
-                <script>document.getElementById('fb').onclick = function() {FB.ui({method: 'share', mobile_iframe: true, hashtag: '#FedoraAppreciationWeek2k18', href: 'https://happinesspackets.fedorainfracloud.org/',}, function(response){});}</script>
-                <a href="https://twitter.com/intent/tweet?button_hashtag=FedoraAppreciationWeek2k18" class="twitter-hashtag-button" data-size="large" data-dnt="true">Tweet #FedoraAppreciationWeek2k18</a>
-                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
+                {% block footer %}
+                {% include "follow.html" %}
                 <br>
+                {% endblock %}
                 Fedora Happiness Packets is a fork of <a href="https://github.com/mxsasha/happinesspackets/">Happiness Packets</a> and part of GSoC 2018.
                 <br>
                 Need help? <a href="mailto:fedora.happinesspackets@gmail.com">fedora.happinesspackets@gmail.com</a>
diff --git a/templates/follow.html b/templates/follow.html
new file mode 100644
index 0000000..84faa2f
--- /dev/null
+++ b/templates/follow.html
@@ -0,0 +1,6 @@
+<a class="g-interactivepost sharebutton google" data-contenturl="https://happinesspackets.fedorainfracloud.org/" data-clientid="427442962349-biuc5ks65luss5h3v5oqtj15jigaqoib.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-prefilltext="#FedoraAppreciationWeek2k18" data-calltoactionurl="http://plus.google.com/pages/create"><i class="fab fa-google-plus-g fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+<script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>
+<a id="fb" class="sharebutton"><i class="fab fa-facebook fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+<script>document.getElementById('fb').onclick = function() {FB.ui({method: 'share', mobile_iframe: true, hashtag: '#FedoraAppreciationWeek2k18', href: 'https://happinesspackets.fedorainfracloud.org/',}, function(response){});}</script>
+<a href="https://twitter.com/intent/tweet?button_hashtag=FedoraAppreciationWeek2k18" class="twitter-hashtag-button" data-size="large" data-dnt="true">Tweet #FedoraAppreciationWeek2k18</a>
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
diff --git a/templates/messaging/message_sender_confirmation_sent.html b/templates/messaging/message_sender_confirmation_sent.html
index 16eb8b5..4781904 100644
--- a/templates/messaging/message_sender_confirmation_sent.html
+++ b/templates/messaging/message_sender_confirmation_sent.html
@@ -9,5 +9,12 @@
     <p>
         We sent you a confirmation link to your email address. Follow the link to finalize sending your message.
     </p>
+    <a class="g-interactivepost sharebutton google" data-contenturl="https://happinesspackets.fedorainfracloud.org/" data-clientid="427442962349-biuc5ks65luss5h3v5oqtj15jigaqoib.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-prefilltext="I just sent a happiness packet to thank a @fedora community member #FedoraAppreciationWeek2k18" data-calltoactionurl="http://plus.google.com/pages/create"><i class="fab fa-google-plus-g fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+    <script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>
+    <a id="fb" class="sharebutton"><i class="fab fa-facebook fa-lg"></i> Share #FedoraAppreciationWeek2k18</a>
+    <script>document.getElementById('fb').onclick = function() {FB.ui({method: 'share', mobile_iframe: true, hashtag: '#FedoraAppreciationWeek2k18', href: 'https://happinesspackets.fedorainfracloud.org/',}, function(response){});}</script>
+    <a href="https://twitter.com/intent/tweet?button_hashtag=FedoraAppreciationWeek2k18&text=I%20just%20sent%20a%20happiness%20packet%20to%20thank%20a%20@fedora%20community%20member" class="twitter-hashtag-button" data-size="large" data-dnt="true">Tweet #FedoraAppreciationWeek2k18</a>
+    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
+    {% block footer %}{% endblock %}
 
 {% endblock content %}

From a50759275cd86a33878b10593e8bf1b48ee08e2d Mon Sep 17 00:00:00 2001
From: Anna Philips <ms.annaphilips@gmail.com>
Date: Jul 09 2018 05:29:05 +0000
Subject: [PATCH 3/3] Add pagination


---

diff --git a/happinesspackets/messaging/views.py b/happinesspackets/messaging/views.py
index a86bfb7..704083d 100644
--- a/happinesspackets/messaging/views.py
+++ b/happinesspackets/messaging/views.py
@@ -21,6 +21,7 @@ logger = logging.getLogger(__name__)
 
 class ArchiveListView(ListView):
     model = Message
+    paginate_by = 5
 
     def get_queryset(self):
         queryset = super(ArchiveListView, self).get_queryset()
diff --git a/templates/messaging/_message_list.html b/templates/messaging/_message_list.html
index 02818f9..0d9ffd6 100644
--- a/templates/messaging/_message_list.html
+++ b/templates/messaging/_message_list.html
@@ -1,12 +1,33 @@
 {% for message in message_list %}
-    <h4>
+<h4>
         {% if message.sender_approved_public_named and message.recipient_approved_public_named %}
             From {{ message.sender_name }} to {{ message.recipient_name }}
         {% else %}
             Anonymous message
         {% endif %}
     </h4>
-    <blockquote>
-        {{ message.message|linebreaksbr }}
-    </blockquote>
-{% endfor %}
+<blockquote>
+  {{ message.message|linebreaksbr }}
+</blockquote>
+{% endfor %} {% block pagination %} {% if is_paginated %}
+<div class="pagination">
+  {% if page_obj.has_previous %}
+  <li class="page-item">
+    <a href="{{ request.path }}?page={{ page_obj.previous_page_number }}">
+            <span aria-hidden="true">&laquo;</span>
+            <span class="sr-only">Previous</span>
+          </a>
+  </li>
+  {% endif %} {% for i in paginator.page_range %}
+  <li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
+  {% endfor %} {% if page_obj.has_next %}
+  <li class="page-item">
+    <a href="{{ request.path }}?page={{ page_obj.next_page_number }}">
+              <span aria-hidden="true">&raquo;</span>
+              <span class="sr-only">Next</span>
+            </a>
+  </li>
+  {% endif %}
+</div>
+
+{% endif %} {% endblock %}

