Permalink
Browse files

Refactor how the phileo widget works

  • Loading branch information...
1 parent 68d607f commit 065ccae0f80155c84e871d42d1bc302405bd3498 @paltman paltman committed Aug 20, 2012
View
@@ -1,3 +1,2 @@
include README.rst
-recursive-include phileo/static *
recursive-include phileo/templates *
View
@@ -5,8 +5,9 @@ Phileo
a liking app
-Attribution
------------
+Commercial Support
+------------------
-The default liking AJAX liking widget that ships with this package uses the Iconic icons packaged
-into a typeface from http://somerandomdude.com/work/iconic/.
+This app, and many others like it, have been built in support of many of Eldarion's
+own sites, and sites of our clients. We would love to help you on your next project
+so get in touch by dropping us a note at info@eldarion.com.
View
@@ -7,14 +7,18 @@ ChangeLog
---
- Added permission checking
-
+- Added rendering of HTML in the ajax response to liking
+- Got rid of all the js/css cruft; up to site owner now but ships with bootstrap/bootstrap-ajax enabled templates
Backward Incompatibilities
^^^^^^^^^^^^^^^^^^^^^^^^^^
- Added an auth_backend to check permissions, you can just add the `phileo.auth_backends.PermCheckBackend`
and do nothing else, or you can implement you own backend checking the `phileo.can_like`
permission against the object and user according to your own business logic.
+- No more ``phileo_css``, ``phileo_js``, or ``phileo_widget_js`` tags.
+- ``PHILEO_LIKABLE_MODELS`` has changed from a ``list`` to a ``dict``
+- ``phileo_widget`` optional parameters have been removed and instead put into per model settings
0.3
View
@@ -14,6 +14,12 @@ Installation
"phileo",
)
+* Add the models that you want to be likeable to ``PHILEO_LIKABLE_MODELS``:
+
+ PHILEO_LIKABLE_MODELS = {
+ "app.Model": {} # can override default config settings for each model here
+ }
+
* Add ``'phileo.auth_backends.CanLikeBackend'`` to your ``AUTHENTICATION_BACKENDS``
(or use your own custom version checking against the ``phileo.can_like`` permission):
View
@@ -14,16 +14,6 @@ This simple returns the count of likes for a given object::
Template Tags
=============
-likes_css
----------
-
-This renders some css style sheets that will style the widget.::
-
- {% phileo_css %}
-
-It renders "phileo/_css.html" and can be overridden as desired.
-
-
render_like
-----------
@@ -47,38 +37,19 @@ basis:
* phileo/_like.html
-phileo_js
----------
-
-This renders some script tags that are needed to make the widget work.::
-
- {% phileo_js %}
-
-It renders "phileo/_js.html" and can be overridden as desired.
-
-
phileo_widget
-------------
+-------------
This renders a fragement of html that will be what the user will click
on to unlike or like objects. It only has two required parameters, which
are the user and the object.::
- {% likes_widget user object like_text="Like|Unlike" counts_text="like|likes" [widget_id="unique_id" like_type="likes" toggle_class="phileo-liked"] %}
+ {% likes_widget user object %}
It renders "phileo/_widget.html" and can be overridden as desired.
-phileo_widget_js
-----------------
-
-This renders a script tag that will use the jquery plugin that `phileo_js`
-includes into the page.
-
-It renders "phileo/_widget_js.html" and can be overriden as desired.
-
-
liked
-----
View
@@ -25,16 +25,6 @@ to load the tags::
{% load phileo_tags %}
-Then in the <head> section of your template load the css::
-
- {% phileo_css %}
-
-
-Load the required JavaScript file, wherever you load your JavaScript libraries::
-
- {% phileo_js %}
-
-
In the body where you want the liking widget to go, add::
{% phileo_widget request.user post %}
View
@@ -0,0 +1,21 @@
+from collections import defaultdict
+
+from django.conf import settings
+
+
+DEFAULT_LIKE_CONFIG = getattr(settings, "PHILEO_DEFAULT_LIKE_CONFIG", {
+ "css_class_on": "icon-heart",
+ "css_class_off": "icon-heart-empty",
+ "like_text_on": "Unlike",
+ "like_text_off": "Like",
+ "count_text_singular": "like",
+ "count_text_plural": "likes"
+})
+
+LIKABLE_MODELS = getattr(settings, "PHILEO_LIKABLE_MODELS", defaultdict(dict))
+
+for model in LIKABLE_MODELS:
+ custom_data = LIKABLE_MODELS[model].copy()
+ default_data = DEFAULT_LIKE_CONFIG.copy()
+ LIKABLE_MODELS[model] = default_data
+ LIKABLE_MODELS[model].update(custom_data)
@@ -1,97 +0,0 @@
-@font-face {
- font-family: 'IconicStroke';
- src: url("iconic_stroke.eot");
- src: local('IconicStroke'),
- url("iconic_stroke.svg#iconic") format('svg'),
- url("iconic_stroke.otf") format('opentype');
-}
-
-.iconic {
- color:inherit;
- font-family: "IconicStroke";
-}
-
-a.iconic:hover {
- color:inherit;
-}
-
-.iconic.home:before { content: '!'; }
-.iconic.at:before { content: "@"; }
-.iconic.quote:before { content: '"'; }
-.iconic.quote-alt:before { content: "'"; }
-.iconic.arrow-up:before { content: "3"; }
-.iconic.arrow-right:before { content: "4"; }
-.iconic.arrow-bottom:before { content: "5"; }
-.iconic.arrow-left:before { content: "6"; }
-.iconic.arrow-up-alt:before { content: "#"; }
-.iconic.arrow-right-alt:before { content: "$"; }
-.iconic.arrow-bottom-alt:before { content: "%"; }
-.iconic.arrow-left-alt:before { content: "^"; }
-.iconic.move:before { content: "9"; }
-.iconic.move-vertical:before { content: "8"; }
-.iconic.move-horizontal:before { content: "7"; }
-.iconic.move-alt:before { content: "("; }
-.iconic.move-vertical-alt:before { content: "*"; }
-.iconic.move-horizontal-alt:before { content: "&"; }
-.iconic.cursor:before { content: ")"; }
-.iconic.plus:before { content: "+"; }
-.iconic.plus-alt:before { content: "="; }
-.iconic.minus:before { content: "-"; }
-.iconic.minus-alt:before { content: "_"; }
-.iconic.new-window:before { content: "1"; }
-.iconic.dial:before { content: "2"; }
-.iconic.lightbulb:before { content: "0"; }
-.iconic.link:before { content: "/"; }
-.iconic.image:before { content: "?"; }
-.iconic.article:before { content: ">"; }
-.iconic.read-more:before { content: "."; }
-.iconic.headphones:before { content: ","; }
-.iconic.equalizer:before { content: "<"; }
-.iconic.fullscreen:before { content: ":"; }
-.iconic.exit-fullscreen:before { content: ";"; }
-.iconic.spin:before { content: "["; }
-.iconic.spin-alt:before { content: "{"; }
-.iconic.moon:before { content: "]"; }
-.iconic.sun:before { content: "}"; }
-.iconic.map-pin:before { content: "\\"; }
-.iconic.pin:before { content: "|"; }
-.iconic.eyedropper:before { content: "~"; }
-.iconic.denied:before { content: "`"; }
-.iconic.calendar:before { content: "a"; }
-.iconic.calendar-alt:before { content: "A"; }
-.iconic.bolt:before { content: "b"; }
-.iconic.clock:before { content: "c"; }
-.iconic.document:before { content: "d"; }
-.iconic.book:before { content: "e"; }
-.iconic.book-alt:before { content: "E"; }
-.iconic.magnifying-glass:before { content: "f"; }
-.iconic.tag:before { content: "g"; }
-.iconic.heart:before { content: "h"; }
-.iconic.info:before { content: "i"; }
-.iconic.chat:before { content: "j"; }
-.iconic.chat-alt:before { content: "J"; }
-.iconic.key:before { content: "k"; }
-.iconic.unlocked:before { content: "l"; }
-.iconic.locked:before { content: "L"; }
-.iconic.mail:before { content: "m"; }
-.iconic.mail-alt:before { content: "M"; }
-.iconic.phone:before { content: "n"; }
-.iconic.box:before { content: "o"; }
-.iconic.pencil:before { content: "p"; }
-.iconic.pencil-alt:before { content: "P"; }
-.iconic.comment:before { content: "q"; }
-.iconic.comment-alt:before { content: "Q"; }
-.iconic.rss:before { content: "r"; }
-.iconic.star:before { content: "s"; }
-.iconic.trash:before { content: "t"; }
-.iconic.user:before { content: "u"; }
-.iconic.volume:before { content: "v"; }
-.iconic.mute:before { content: "V"; }
-.iconic.cog:before { content: "w"; }
-.iconic.cog-alt:before { content: "W"; }
-.iconic.x:before { content: "x"; }
-.iconic.x-alt:before { content: "X"; }
-.iconic.check:before { content: "y"; }
-.iconic.check-alt:before { content: "Y"; }
-.iconic.beaker:before { content: "z"; }
-.iconic.beaker-alt:before { content: "Z"; }
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 065ccae

Please sign in to comment.