Permalink
Browse files

Merge branch 'master' of github.com:ozten/sudosocial

  • Loading branch information...
2 parents 44f45e3 + 73c818e commit 4655537d53c1c6e90d5df66b8334d8aee6ce80a2 @ozten committed Aug 31, 2010
Showing with 12,517 additions and 580 deletions.
  1. +5 −1 apps/lifestream/models.py
  2. +19 −4 apps/patchouli_auth/preferences.py
  3. +2 −3 apps/patchouli_auth/templates/index.html
  4. +6 −6 apps/patchouli_auth/views.py
  5. +1 −3 apps/streamManager/templates/feed_editor.html
  6. +20 −18 apps/streamManager/templates/stream_editor.html
  7. +1 −1 apps/streamManager/templates/template.html
  8. +5 −0 apps/streamManager/templates/widgets/add_stream_button.html
  9. +1 −0 apps/streamManager/templates/widgets/delete_stream_panel.html
  10. +3 −1 apps/streamManager/urls.py
  11. +54 −14 apps/streamManager/views.py
  12. +5 −0 bin/dev_merge.sh
  13. +5 −0 bin/merge.sh
  14. +2 −0 bin/verify.sh
  15. +52 −0 docs/database/migrations/0.6-add-webpage-to-stream.py
  16. +143 −0 static/css/editor-stylo-kitchen-sink.css
  17. +6 −149 static/css/editor-stylo.css
  18. +229 −0 static/css/editor-stylo.min.css
  19. +145 −0 static/css/general-site-kitchen-sink.css
  20. +2 −200 static/css/general-site.css
  21. +204 −0 static/css/general-site.min.css
  22. +52 −0 static/css/lib/reset.css
  23. +8 −0 static/css/widgets/add_stream_button.css
  24. +10 −0 static/css/widgets/buttons.css
  25. +7 −0 static/css/widgets/delete_stream_panel.css
  26. +4 −0 static/css/widgets/footer.css
  27. +33 −0 static/js/README.markdown
  28. +20 −17 static/js/behavior.js
  29. +32 −0 static/js/effects/checkbox_disable_panel.js
  30. +20 −37 static/js/feed_editor.js
  31. +1,632 −0 static/js/feed_editor.min.js
  32. 0 static/js/{ → lib}/jquery-1.4.1.min.js
  33. +6,241 −0 static/js/lib/jquery-1.4.2.js
  34. 0 static/js/{ → lib}/jquery-1.4.min.js
  35. 0 static/js/{ → lib}/jquery.scrollTo-min.js
  36. 0 static/js/{ → lib}/jquery.serialScroll-min.js
  37. +1,307 −0 static/js/lib/require.js
  38. +93 −126 static/js/stream_editor.js
  39. +1,848 −0 static/js/stream_editor.min.js
  40. +30 −0 static/js/widgets/#stream_editor_stream_panel.js#
  41. +1 −0 static/js/widgets/.#stream_editor_stream_panel.js
  42. +56 −0 static/js/widgets/add_feed_panel.js
  43. +37 −0 static/js/widgets/add_stream_button.js
  44. +29 −0 static/js/widgets/delete_stream_panel.js
  45. +20 −0 static/js/widgets/feed_editor_delete_feed.js
  46. +30 −0 static/js/widgets/stream_editor_stream_panel.js
  47. +50 −0 static/js/widgets/stream_preview.js
  48. +47 −0 static/js/widgets/streams/show_hide.js
@@ -31,6 +31,7 @@ class Stream(models.Model):
""" A stream is composed of Feeds. """
user = models.ForeignKey(User)
name = models.CharField(max_length=140)
+ webpage = models.ForeignKey(Webpage) # Added in 0.6 migration
# StreamConfig
config = models.TextField()
# StreamEditList
@@ -146,7 +147,10 @@ def _recent_entries(user, stream, feed_id, count=150, only_visible=True):
query = (Entry.objects.order_by('-last_published_date')
.filter(feed__user=user,
feed__url_hash=a_feed_id,
- feed__streams__id = stream_id))
+# TODO .... Why constrain by Stream? We want to reuse feeds, right?
+# the cron somehow repairs the links betwee a feed and all the streams it lives in
+ feed__streams__id = stream_id
+))
# Visible is special, we want to see hidden items in the editor
if only_visible:
query = query.filter(streamentry__visible=True)
@@ -3,6 +3,7 @@
import simplejson
import patchouli_auth.models
+import lifestream.models
def getPreferences(user):
# Put all known preferences here...
@@ -60,16 +61,30 @@ def getPageProperties(page):
'processing_js': '',
- 'stream_names': []
+ 'stream_ids': []
}
existingProps = simplejson.loads(page.config)
pageProps.update(existingProps)
- if 0 == len(pageProps['stream_names']):
- # This should be page.id instead
- pageProps['stream_names'] = [page.name]
+ if 0 == len(pageProps['stream_ids']):
+ # Repair and save
+ streams = (lifestream.models.Stream.objects.all()
+ .order_by('id')
+ .filter(webpage__id = page.id))
+ for stream in streams:
+ pageProps['stream_ids'].append(stream.id)
+ savePageOrStreamProperties(page, pageProps)
return pageProps
+def removeStreamFromPage(webpage, stream):
+ props = getPageProperties(webpage)
+ if stream.id in props['stream_ids']:
+ props['stream_ids'].remove(stream.id)
+ savePageOrStreamProperties(webpage, props)
+ stream.delete()
+ return True
+ return False
+
def savePageOrStreamProperties(model, properties):
""" Given a Page or Stream model, persists the
properties """
@@ -44,6 +44,5 @@ <h1 class="logo"><a href="/"><strong><code>sudo</code>Social</strong></a></h1>
{% endif %}
</div><!-- /#content -->
-<script src="/static/js/jquery-1.4.1.min.js" type="text/javascript"></script>
-<script src="/static/js/stream_editor.js" type="text/javascript"></script>
-{% endblock %}
+<script src="/static/js/stream_editor.min.js" type="text/javascript"></script>
+{% endblock %}
@@ -22,8 +22,8 @@ def account_checkauth(request):
if request.user.is_authenticated():
manageUrl = "/manage/account/%s" % request.user.username.encode('utf-8')
try:
- stream = lifestream.models.Stream.objects.get(user__exact=request.user)
- encoded_url = django.utils.encoding.iri_to_uri(manageUrl)
+ _ = lifestream.models.Stream.objects.all().filter(user=request.user)
+ encoded_url = django.utils.encoding.iri_to_uri(manageUrl)
resp = django.http.HttpResponseRedirect(encoded_url)
except lifestream.models.Stream.DoesNotExist:
log.debug("Account didn't exist")
@@ -66,7 +66,7 @@ def profile(request, username):
return render_to_response('index.html',
{ 'show_delete': True,
- 'css_url': '/static/css/general-site.css',
+ 'css_url': '/static/css/general-site.min.css',
'username': request.user.username,
'email': request.user.email,
@@ -92,7 +92,7 @@ def delete_profile(request, username):
else:
return render_to_response('confirm_delete.html',
{
- 'css_url': '/static/css/general-site.css',
+ 'css_url': '/static/css/general-site.min.css',
'lang_dir': 'LTR',
'page_lang': 'en',
},
@@ -135,7 +135,7 @@ def confirm_profile(request):
avatar_url = "http://www.gravatar.com/avatar/%s.jpg?d=monsterid&s=80" % gravatarHash
return render_to_response('index.html',
- { 'css_url': '/static/css/general-site.css',
+ { 'css_url': '/static/css/general-site.min.css',
'username': request.user.username,
'email': request.user.email,
@@ -172,4 +172,4 @@ def session_status(request):
amstatus = "none;"
resp = django.http.HttpResponse("X-Account-Managment-Status will be %s" % amstatus)
resp['X-Account-Management-Status'] = amstatus
- return resp
+ return resp
@@ -46,7 +46,5 @@
</div><!-- #feed_preview -->
</div><!-- #feed_panel -->
- <script type="text/javascript" src="/static/js/jquery-1.4.1.min.js"></script>
- <script src="/static/js/feed_editor.js" type="text/javascript"></script>
- <script src="/static/js/stream_editor.js" type="text/javascript"></script>
+ <script src="/static/js/feed_editor.min.js" type="text/javascript"></script>
{% endblock %}
@@ -6,61 +6,64 @@
<li>New Page</li>
<li>All Pages</li>
</ul>
-
+ {% include 'widgets/add_stream_button.html' %}
{% endblock %}
{% block content %}
<h1>Stream Editor</h1>
<div id="stream-editor-panel" lang="{{page_props.page_lang}}" dir="{{page_props.page_lang_dir}}">
<ul class="tabs">
- <li id="edit-stream" class="tab editor"><a href="#">Edit </a>{% if first_stream %}<strong id="stream{{first_stream.id}}" class="stream-name">{{first_stream.name}}</strong> Stream Page{% endif %}</li>
+ <!-- TODO: Is stream1 used ? (first_stream.id). Change to page.id ? -->
+ <li id="edit-stream" class="tab editor"><a href="#">Edit </a>{% if first_stream %}<strong id="stream{{first_stream.id}}" class="page-name">{{page_name}}</strong> Stream Page{% endif %}</li>
<li id="design-stream" class="tab design xactive-tab"><a href="#">Design</a></li>
<li id="page-widgets" class="tab pagewidget active-tab"><a href="#">Page Widgets</a></li>
- {% if first_stream %}<li><a id="preview" href="/u/{{username}}/s/{{first_stream.name}}" target="_new" title="View your currenly published Stream in a new window">View</a></li>{% endif %}
+ {% if first_stream %}<li><a id="preview" href="/u/{{username}}/s/{{page_name}}" target="_new" title="View your currenly published Stream in a new window">View</a></li>{% endif %}
</ul>
<!--------------------- Edit Stream Panel ------------------------->
<div id="edit-stream-panel" class="panel">
+
+
{% for stream in streams %}
<div class="streams-panel"><!-- streams panel contains the metadata and preview -->
<div class="stream-metadata-panel">
<h2 class="new-feed">Add A Source</h2>
<p>Paste in the Url to a website or any Atom or RSS feed <img src="/static/img/feed-icon-14x14.png" width="14" height="14" alt="Feed Icon" />.</p>
- <form id="add-url-form" action="/manage/urls/{{request.user.username}}" method="post">
- <p><label for="id_url">Url:</label> <input id="id_url" type="text" name="url" maxlength="2048" /></p>
+ <form class="add-url-form" action="/manage/urls/{{request.user.username}}" method="post">
+ <p><label for="id_url">Url:</label> <input class="id_url" type="text" name="url" maxlength="2048" /></p>
<p>
<label for="id_streams">Streams:</label>
- <input type="hidden" name="streams" id="id_streams" value="{{stream.name}}" /></p>
+ <!-- TODO test add feed form -->
+ <input type="hidden" name="streams" class="id_streams" value="{{stream.id}}" /></p>
<input type="submit" value="Add Feed" />
</p>
</form>
<h2>Stream Sources</h2>
- <ul id="user_streams">
+ <ul class="user_streams">
{% for feed in stream.feeds %}
<li>
<a href="{{ feed.url }}" class="stream-feed-source"> {% if feed.title %}{{ feed.title }}{% else %} {{ feed.url }} {% endif %}</a>
{% if not feed.enabled %} <strong title="{{feed.disabled_reason}}">Disabled</strong>{% endif %}
<a href="/manage/account/{{username}}/stream/{{stream.id}}/feed/{{feed.pk}}" class="button">Edit</a>
</li>
{% empty %}
- <li id="no-stream-feed-blurb"><a href="#" class="stream-feed-source"></a><a href="{{ feed.pk }}" class="feed-delete" title="Delete this feed."></a>You have no stream sources, add a new feed.</li>
+ <li class="no-stream-feed-blurb"><a href="#" class="stream-feed-source"></a>You have no stream sources, add a new feed.
+ <!-- Empty case we have to add the stream and feed ids... and show -->
+ <a href="/manage/account/{{username}}/stream/" class="button" style="display:none">Edit</a></li>
{% endfor %}
- <li id="base-stream-feed-link" style="display:none"><a href="{{ feed.url }}" class="stream-feed-source">sample</a>
- <div class="feed-entries-visible-default shown" title="New Items are shown automatically"></div>
- <a href="#" class="feed-edit" title="Edit this feed.">Edit</a></li>
+ <li class="base-stream-feed-link" style="display:none"><a href="{{ feed.url }}" class="stream-feed-source">sample</a>
+ <a href="#" class="feed-edit button" title="Edit this feed.">Edit</a></li>
</ul>
- <p>After 5 minutes, Feed entries should start appearing in <a href="/u/{{username}}/s/{{stream.name}}" target="_new" title="View your currenly published Stream in a new window">your stream.</a></p>
+ <p>After 5 minutes, Feed entries should start appearing in <a href="/u/{{username}}/s/{{page_name}}" target="_new" title="View your currenly published Stream in a new window">your stream.</a></p>
+ {% include 'widgets/delete_stream_panel.html' %}
</div><!-- /.stream-metadata-panel -->
<div class="stream-preview-panel">
{% include 'feed_editor_preview.html' %}
</div><!-- /.stream-preview-panel -->
</div><!-- /.streams-panel -->
{% endfor %}
- <!-- div class="add-stream-panel">
- <p class="callout">A page can have multiple streams. <a href="#todo" class="button">Add Another Stream</a>.</p>
- </div -->
</div><!-- /#edit-stream-panel -->
<!--------------------- Page Widgets Panel ------------------------->
@@ -132,7 +135,7 @@ <h2 class="new-feed">Add A Source</h2>
</div><!-- /optional-widget -->
<div class="stream-icon">
- <h3>Your {{stream.name}} Stream</h3>
+ <h3>Your {{page_name}} Stream</h3>
<img src="/static/img/StreamDiagram_25perc.jpg" width="76" height="95" />
</div>
@@ -212,6 +215,5 @@ <h2 class="new-feed">Add A Source</h2>
</div><!-- /design-stream -->
</div><!-- /stream-editor-panel -->
-<script src="/static/js/jquery-1.4.1.min.js" type="text/javascript"></script>
-<script src="/static/js/stream_editor.js" type="text/javascript"></script>
+<script src="/static/js/stream_editor.min.js" type="text/javascript"></script>
{% endblock %}
@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>{% block title %}SudoSocial{% endblock %}</title>
- <link href="/static/css/editor-stylo.css" type="text/css" rel="stylesheet">
+ <link href="/static/css/editor-stylo.min.css" type="text/css" rel="stylesheet">
{%block page_css_link %} {% endblock %}
<link rel="icon" href="/static/img/favicon.png" type="image/png">
</head>
@@ -0,0 +1,5 @@
+<div class="add-stream-panel">
+ <p class="callout">A page can have multiple streams.</p>
+ <p><a href="/manage/streams/{{username}}/p/{{page_name}}" class="add-stream button">Add Another Stream</a>.</p>
+ <p class="creating">Creating Stream</p>
+</div>
@@ -0,0 +1 @@
+<p class="stream-delete-panel"><a href="{{stream.id}}" class="stream-delete button">Delete</a></p>
@@ -6,7 +6,9 @@
(r'^account/(?P<username>\w+)/stream/(?P<stream_id>\d+)/preview_feed/(?P<feed_id>\w+)$', 'views.preview_feed'),
(r'^stream/design$', 'views.manage_page_design'),
(r'^stream/(?P<username>\w+)/s/(?P<page_name>\w+)$', 'views.manage_page'),
-
+ (r'^stream/(?P<username>\w+)/sid/(?P<stream_id>\w+)$', 'views.stream'),
+ (r'^streams/(?P<username>\w+)/p/(?P<page_name>\w+)$', 'views.streams', {}, 'streams'),
+
(r'^page/(?P<page_name>\w+)$', 'views.manage_page_widgets'),
(r'^urls/(?P<username>\w+)$', 'views.urls'),
Oops, something went wrong.

0 comments on commit 4655537

Please sign in to comment.