Permalink
Browse files

first commit

Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
  • Loading branch information...
0 parents commit db6d5d5c99fb0c30ee069afe8caef2a7394c7c4c @fcurella fcurella committed Jul 21, 2011
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (C) <year> by <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,2 @@
+include README.rst
+recursive-include tests *.py
@@ -0,0 +1,21 @@
+Django-Clippy
+======================================
+
+Provides a template tag for a 'copy to clipboard' button, based on GitHub's Clippy.
+
+Instructions
+------------
+
+1. Add `clippy` to `INSTALLED_APPS`
+
+2. In your template:
+
+```
+ {% load clippy %}
+ <div id="mycode"><a href=""><img src="" alt="" /></a></div>
+ {% clippy <element_id> <size> <bgcolor> <wmode> %}
+```
+
+The `element_id` parameter is mandatory. All other parameters are optional. Defaults are `size='14x210'`, `bgcolor='#FFFFFF'`, `wmode='opaque'`
+
+Clippy's template can be overridden creating your own template file at `clippy/clippy.html` in your templates directory.
@@ -0,0 +1 @@
+VERSION = (0, 0, 1)
Binary file not shown.
@@ -0,0 +1,10 @@
+<object {% if height %}height="{{height}}" {% endif %}{% if width %}width="{{width}}" {% endif %}class="clippy" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" style="">
+ <param value="{{STATIC_URL}}swf/clippy.swf?v5" name="movie">
+ <param value="always" name="allowScriptAccess">
+ <param value="high" name="quality">
+ <param value="noscale" name="scale">
+ <param value="id={{element_id}}" name="FlashVars">
+ <param value="{{bgcolor}}" name="bgcolor">
+ <param value="{{wmode}}" name="wmode">
+ <embed {% if height %}height="{{height}}" {% endif %}{% if width %}width="{{width}}" {% endif %}wmode="{{wmode}}" bgcolor="{{bgcolor}}" flashvars="id={{element_id}}" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high" name="clippy" src="{{STATIC_URL}}swf/clippy.swf?v5">
+</object>
No changes.
@@ -0,0 +1,24 @@
+from django import template
+register = template.Library()
+
+from django.conf import settings
+
+@register.inclusion_tag('clippy/clippy.html')
+def clippy(element_id, size='14x110', bgcolor='#FFFFFF', wmode='opaque'):
+ static_url = getattr(settings, 'STATIC_URL', 'MEDIA_URL') # backwards comaptibility with Django 1.2
+ data = {
+ 'element_id':element_id,
+ 'STATIC_URL':static_url,
+ 'wmode': wmode,
+ 'bgcolor': bgcolor,
+ }
+ if size is not None:
+ assert 'x' in size
+ w, h = size.split('x')
+ if w != '':
+ data['width'] = w
+ if h != '':
+ data['height'] = h
+
+ return data
+
@@ -0,0 +1,6 @@
+[nosetests]
+with-coverage = true
+cover-package = clippy
+cover-html = true
+cover-erase = true
+cover-inclusive = true
@@ -0,0 +1,34 @@
+import os
+from setuptools import setup, find_packages
+
+from clippy import VERSION
+
+def read(fname):
+ return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+requirements = []
+
+setup(
+ name = "django-clippy",
+ version = ".".join(map(str, VERSION)),
+ description = "",
+ long_description = read('README.rst'),
+ url = '',
+ license = 'MIT',
+ author = 'Flavio Curella',
+ author_email = 'flavio.curella@curella.org',
+ packages = find_packages(exclude=['tests']),
+ classifiers = [
+ 'Development Status :: 3 - Alpha',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Information Technology',
+ 'License :: OSI Approved :: MIT License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Framework :: Django',
+ ],
+ install_requires = requirements,
+ tests_require = ["nose",],
+ test_suite = "nose.collector",
+)
No changes.

0 comments on commit db6d5d5

Please sign in to comment.