From c12237ab5666f7bc2e752ccfd874926dd844d186 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 31 Mar 2014 13:40:12 +0200 Subject: [PATCH] Add the annoying 1 percent bar. --- fnpdjango/static/fnpdjango/annoy/annoy.css | 58 +++++++++++++++++++ fnpdjango/static/fnpdjango/annoy/annoy.js | 40 +++++++++++++ fnpdjango/static/fnpdjango/annoy/procent.png | Bin 0 -> 1971 bytes fnpdjango/templates/fnpdjango/annoy.html | 17 ++++++ fnpdjango/templatetags/fnp_annoy.py | 16 +++++ fnpdjango/templatetags/macros.py | 0 setup.py | 4 +- 7 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 fnpdjango/static/fnpdjango/annoy/annoy.css create mode 100644 fnpdjango/static/fnpdjango/annoy/annoy.js create mode 100644 fnpdjango/static/fnpdjango/annoy/procent.png create mode 100644 fnpdjango/templates/fnpdjango/annoy.html create mode 100644 fnpdjango/templatetags/fnp_annoy.py mode change 100755 => 100644 fnpdjango/templatetags/macros.py diff --git a/fnpdjango/static/fnpdjango/annoy/annoy.css b/fnpdjango/static/fnpdjango/annoy/annoy.css new file mode 100644 index 0000000..fb5b458 --- /dev/null +++ b/fnpdjango/static/fnpdjango/annoy/annoy.css @@ -0,0 +1,58 @@ +#annoy-on { + font-size: 13px; + line-height: 1.15em; + + padding: .1em 1em; + background: orange; + z-index: 200; + font-family: Arial, sans-serif; + display: block; + padding: 0 1em; + width: 1em; + text-align:center; + border-radius: 0 0 0 1em; + position: absolute; + top: 0; + right: 0; + color: black; + box-shadow: .5em 0 1em black; +} + +#annoy { + font-size: 13px; + line-height: 1.15em; + padding: 1em 5em 1em 0; + display: none; + background: orange; + font-family: Arial, sans-serif; + position: relative; + z-index: 200; + box-shadow: 0 0 1em black; +} +#annoy p { + margin: 0 0 0 10em;; +} +#annoy a { + color: #4E56C8; +} +#annoy img { + float: left; + margin: 0 2em; +} + +#annoy a#annoy-off { + padding: .5em 1em .5em; + width: 1em; + text-align:center; + font-family: Arial, sans-serif; + display: block; + + border-radius: 0 0 0 1em; + position: absolute; + top: 0; + right: 0; + color: black; +} +#annoy a#annoy-off:hover { + cursor: pointer; +} diff --git a/fnpdjango/static/fnpdjango/annoy/annoy.js b/fnpdjango/static/fnpdjango/annoy/annoy.js new file mode 100644 index 0000000..ad1444d --- /dev/null +++ b/fnpdjango/static/fnpdjango/annoy/annoy.js @@ -0,0 +1,40 @@ +(function($) { +$(function() { + +$("#annoy").each(function(i, annoy) { + + var edition = "annoyed" + new Date().getFullYear(); + + var have_localstorage; + try { + localStorage.setItem("test", "test"); + localStorage.removeItem("test"); + have_localstorage = true; + } catch(e) { + have_localstorage = false; + } + + $("#annoy-on").click(function(e) { + e.preventDefault(); + $(annoy).slideDown('fast'); + $(this).hide(); + if (have_localstorage) localStorage.removeItem(edition); + }); + + $("#annoy-off").click(function() { + $(annoy).slideUp('fast'); + $("#annoy-on").show(); + if (have_localstorage) localStorage[edition] = true; + }); + + if (have_localstorage) { + if (!localStorage[edition]) { + $("#annoy-on").hide(); + $(annoy).show(); + } + } + }); + + +}); +})(jQuery); diff --git a/fnpdjango/static/fnpdjango/annoy/procent.png b/fnpdjango/static/fnpdjango/annoy/procent.png new file mode 100644 index 0000000000000000000000000000000000000000..3d0f82d815d719aa741e69013b32e4fdcf90f23e GIT binary patch literal 1971 zcmV;k2Tb^hP)s~o#s}TN3M;9*AsdYBh&aTB6^IEqXMDh&YMB5%F)7hgCR?a&9!%1m1>l zyN~#Fb+Jd&?l7Hrizrtjd=j|W!zptdwj;7Y>>8G+@Q_b+zv;51yhC3c3qMZR%TuC%#(cmb54xqRjmnWSN>A2BzfXU144Gd*i zlCndESpYfT)CD`i9x0Kpc(E2DvA`pI-TNkeqyRdJ`QXO(K&X8K^sLLhWr;wU2a3DRd@<` zzW>p@2#*N_KI9|00;^-nOi}Lg%ezLt{HqDMObmX~*VG{NV6c2vQvW-Y4}n81hq4Z} zf%fdv4?7{B03IGncQ`n@QYMy_@oq0o;c+Xe_X5x)x7#+WfOw8CI+c~Atp9h zt-7y}ABE=Uc|mnGJ-~mwG=X>IexE!+IfD;{ujYPCzL*Yt8$o|N$^%wXJBslm62YKR zU4?@_>U&eQ@@T47Hk6d`TgYF~McEIKPRL48RtL7LJmbbKNBTOj0g*4K*7GjYVWtX)<4HXZkXkPb z1il@jZW{*6Xw;sO*p6H<`k|_o0|z|-QVDsh2=@bKkcJ4iRkZ4{k(!LuG#L_25<~bo zFfE9!!nfjWI;ziyH%u^6X}&MMt=EI!SH`(>v^JtUO*}}~%2FY8Q9RxYx6-KYXzfHk z7^ynBT;SdicCWZBpWdOTp)aMEQLZ4v->Nq23&XV)>0tb8ja)RLlwE{m?M3-Yyo!D4 zgw(6B5twcOm|)jR8rWu8G!?tMM0(AbP|Dpva8^s$S)$x$+x$_5W?;HcA`X1bw%LEC zUaE_+7ujIg3HcK6=@9nwI+4}ALI;EMAbwooX4pZK6zppxgJIXo2M}69*smGFQhl9| zsBlX$?Wr)|wpmk1E^@)>t`Q5^2}}qSP}Wqm=@A2N2;lA)VFR$o&k*=nA=}XkMw1vl z20sNZ4de^ktaiN*0A;R^`uo^cV4>T%$czjX8VL4B6+Yv?msNOjup}GJ4FAY(wRw=f4F8abMlhOW z0^#2s->ppQul+>J;vV2gkrrNwW%ynpAp`%-l2N#1NtNKwJ!>vb!`jq}~vSx9MY!!6gWvRhJvAq%NGcRZkVtt7_A~S6a+>4XzWVLE(oe zn}9`Ka7|^0KI7L(uama}OT07}I>U-po^fI<%ataK7UNm0;>VeKsdh3v5LB!p3SuYN z!{7?Pa|n+p9LU|wj}(z8V=|a5FbCyE2Co-;t#%f?S>Wa=a5Dh1!*vB@PjD9wx?!Le zwEvu8C3UxHG8@=CPL7>#>@`hh=W0N~S0UU-xp2#+{|8M#p8QSOo{j(j002ovPDHLk FV1he1% +
+ + Logo akcji 1% +

Droga użytkowniczko, drogi użytkowniku!

+

Fundacja Nowoczesna Polska to + organizacja pożytku publicznego działająca na rzecz wolności korzystania + z dóbr kultury. Wesprzyj nasze działania, przeznaczając na nie 1% swojego podatku. + Możesz to zrobić, wpisując w zeznaniu podatkowym numer + KRS 0000070056.

+ +

Dowiedz się więcej

+ + x +
+
diff --git a/fnpdjango/templatetags/fnp_annoy.py b/fnpdjango/templatetags/fnp_annoy.py new file mode 100644 index 0000000..c4a7dec --- /dev/null +++ b/fnpdjango/templatetags/fnp_annoy.py @@ -0,0 +1,16 @@ +from django.conf import settings +from django import template +register = template.Library() + + +@register.simple_tag +def annoy(): + """Annoy people with 1-percent tax plead. + + To use, set FNP_ANNOY to True + and add fnpdjango/annoy/annoy.{css,js} to your template. + """ + if getattr(settings, 'FNP_ANNOY', False): + return template.loader.render_to_string('fnpdjango/annoy.html') + else: + return u"" diff --git a/fnpdjango/templatetags/macros.py b/fnpdjango/templatetags/macros.py old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py index 6444a5c..080b75b 100755 --- a/setup.py +++ b/setup.py @@ -22,13 +22,13 @@ def whole_trees(package_dir, paths): setup( name='fnpdjango', - version='0.1.17', + version='0.1.18', author='Radek Czajka', author_email='radekczajka@nowoczesnapolska.org.pl', url = '', packages=find_packages(), package_data={ - 'fnpdjango': whole_trees('fnpdjango', ['templates', 'locale']), + 'fnpdjango': whole_trees('fnpdjango', ['templates', 'locale', 'static']), 'fnpdjango.deploy': ['templates/*.template'], 'fnpdjango.management.commands': ['babel.cfg'], }, -- 2.20.1