From 2a3d8fcd286d58c51e35331aea859492d3737142 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 21 Apr 2014 00:47:24 -0400 Subject: Add initial edition of README Still have some parts to fill in, but getting an outline going and added some relevant sections already. --- README.rdoc | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 README.rdoc (limited to 'README.rdoc') diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..4050873 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,103 @@ += django-sneak-peek +## Description ## + + +== Requirements +Requires Django 1.4 or higher. Currently not configured for Django 1.7, but I'll be updating the package to add support for it once released. + +{South}[https://pypi.python.org/pypi/South/0.8.4] is required for migrations. django-sneak-peek includes a data migration that adds a ContentType and Permission. The permission is used to determine whether or not a user can view sneak peek content. + + +== Installation +1. Install via pip: + + $ pip install django-sneak-peek + +2. Add sneak_peek_tag to INSTALLED_APPS in settings.py: + + INSTALLED_APPS = ( + ... + 'sneak_peek_tag', + ... + ) + +3. Run migrations: + + $ python manage.py migrate sneak_peek_tag + +4. Run collectstatic to grab the CSS and image: + + $ python manage.py collectstatic + + +== Usage +django-sneak-peek defines a template tag called sneak_peek. Markup that you want to conditionally hide gets wrapped in this template tag. + +Add the django-sneak-peek CSS file to all pages where you plan to use the template tag: + + + +Load sneak_peek in your template: + + {% load sneak_peek %} + +Wrap secret markup in sneak_peek tags: + + {% sneak_peek %} +
+

Secret pre-release feature

+ +

+ This entire div is hidden from users who don't have the + sneak_peek permission. +

+
+ {% endsneak_peek %} + + +== Additional Options +By default, markup under sneak peek will appear with a yellow and black "under construction" border: + +## Screenshot ## + +Sneak peek works by wrapping your code in a
and applying styles to that element with the .django-sneak-peek class and several modifiers. + +Modifiers change the appearance of the sneak peek block. + +Here are the available modifiers and different combinations thereof. + +=== Outline + +=== Borderless + +=== Inline + +=== Inline-Block + + +== CSS Class Modifiers +* Default: Yellow & black "under construction" border +* .outline: Sets border: none; and uses an outline instead +* .borderless: Sets border: none;. Markup will appear without superfluous extra styles applied by django-sneak-peek, but will still be surrouded by an
wrapper (as always). +* .inline: Sets display: inline; +* .inline-block: Sets display: inline-block; + + +== Customising +As you may have guessed, you can add custom display styles to django-sneak-peek. In addition to overriding the existing CSS classes, you can also create your own. + +Here's an example of a class you can add to your CSS to add custom styles to a sneak peek element: + + .django-sneak-peek.green-border { + border-color: green; + border-width: 5px; + } + +This custom class can be applied with: + + {% sneak_peek "green-border" %} + ... + {% endsneak_peek %} + + +== License -- cgit v1.2.3