Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 10 files changed
  • 0 commit comments
  • 1 contributor
View
6 occupywallst/admin.py
@@ -73,7 +73,7 @@ class VerbiageAdmin(GeoAdmin):
class PhotoInline(admin.TabularInline):
model = db.Photo
extra = 1
- fields = ('original_image', 'url', 'caption')
+ fields = ('original_image', 'caption')
class CarouselAdmin(admin.ModelAdmin):
@@ -138,8 +138,8 @@ def user_column(obj):
class ArticleAdmin(GeoAdmin):
date_hierarchy = 'published'
- list_display = ('title', user_column, 'published', 'comment_count',
- 'is_visible', 'is_deleted')
+ list_display = ('title', user_column, 'published','comment_count',
+ 'is_visible', 'is_deleted','is_top')
list_filter = ('is_visible', 'is_deleted')
search_fields = ('title', 'content', 'author__username', 'ip')
ordering = ('-published',)
View
21 occupywallst/media/css/occupywallst.css
@@ -30,7 +30,7 @@ a{
img { border: none; }
h1 a{
- font-size: 1.8em;
+ font-size: 0.8em;
color:#121212;
}
h1 a:hover {
@@ -354,7 +354,7 @@ article h1:first-child { margin: 0; padding: 0; line-height: normal; }
article blockquote { color: #333; }
-article p.info { color: #777; font-size: 0.9em;
+p.info { color: #777; font-size: 0.9em;
margin-top: 12px; }
#articles article:last-child { border-bottom: none; margin-bottom: 0; }
@@ -487,3 +487,20 @@ a.button:active {
#sql-info .item p { margin: 0; padding: 0; text-indent: -3em; margin-left: 3em;
font: 8pt "DeJavu Sans Mono", monospace; }
#mapright { width: 600px; font-size: 0.9em; vertical-align: top; }
+
+#left_index{
+ float:left;
+ margin: 2px 0px 2px 2px;
+ width:417px;
+ padding: 11px;
+}
+#events{
+ float: left;
+}
+.column_titles{
+ text-align: center;
+ padding: 0;
+ margin: 0;
+ top: 10px;
+ position: relative;
+}
View
12 occupywallst/models.py
@@ -32,6 +32,7 @@
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from imagekit.models import ImageSpec
+from imagekit.processors import resize, Adjust
from occupywallst.utils import jsonify
from occupywallst import geo
@@ -67,13 +68,14 @@ def __unicode__(self):
class Photo(models.Model):
"""Stores a photo for a carousel
"""
- carousel = models.ForeignKey(Carousel, help_text="""
+ carousel = models.ForeignKey(Carousel, related_name="photos", help_text="""
The carousel to which this photo belongs.""")
caption = models.TextField()
- url = models.URLField()
+ #url = models.URLField()
original_image = models.ImageField(upload_to='photos')
formatted_image = ImageSpec(image_field='original_image', format='JPEG')
-
+ thumbnail = ImageSpec([Adjust(contrast=1.2, sharpness=1.1), resize.Fit(260, 260)], image_field='original_image', format='JPEG')
+
def get_absolute_url(self):
if self.formatted_image:
return self.formatted_image.url
@@ -346,12 +348,16 @@ class Article(models.Model):
allow_html = models.BooleanField(default=False, help_text="""
Should the markdown parser allow HTML? If a non-staff user
posted this, they will lose the ability to edit.""")
+
is_visible = models.BooleanField(default=False, help_text="""
Should it be listed on the website and syndicated?""")
is_forum = models.BooleanField(default=False, editable=False, help_text="""
Indicates this a thread on the message board forum.""")
is_event = models.BooleanField(default=False, editable=False, help_text="""
Indicates this an event""")
+
+ is_top = models.BooleanField(default=False, help_text="""
+ Indicates this a top story""")
is_deleted = models.BooleanField(default=False, help_text="""
Flag to indicate should no longer be shown on site.""")
View
11 occupywallst/templates/occupywallst/base.html
@@ -26,13 +26,15 @@
{% block stylesheets %}
{% endblock stylesheets %}
</head>
-<body class="{% block body_class %}{% endblock %}">
+<body class="{% block body_class %}{% endblock %}">
+ {{ verbiage.connect }}
+ <div id="outer_container">
{% block body %}
+
{% block header %}
<header>
<div id="userbox">
- {% trans "Welcome" %}
{% if user.is_authenticated %}
<a href="{{ user.get_absolute_url }}">{{ user.username }}</a> |
{% if user.is_staff %}
@@ -46,7 +48,7 @@
</div>
{{ verbiage.header }}
- {{ verbiage.connect }}
+
</header>
{% endblock header %}
<nav>
@@ -56,6 +58,8 @@
{% endblock nav %}
</nav>
+ <div style="clear: both">
+ </div>
<div id="content">
{% block content %}
{% endblock content %}
@@ -114,5 +118,6 @@
{% endblock js_init %}
});
</script>
+ </div>
</body>
</html>
View
29 occupywallst/templates/occupywallst/images.html
@@ -0,0 +1,29 @@
+{% extends base %}
+{% block title %} Images | {{ OWS_SITE_NAME }} {% endblock title %}
+
+{% block stylesheets %}
+ <link href="{{ MEDIA_URL }}lightbox/css/jquery.lightbox-0.5.css" media="all" rel="stylesheet" type="text/css"/>
+{% endblock stylesheets %}
+{% block scripts %}
+ <script src="{{ MEDIA_URL }}lightbox/js/jquery.lightbox-0.5.min.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ $(function() {
+ // Use this example, or...
+ $("a[rel='lightbox']").lightBox({ // Select all links that contains lightbox in the attribute rel
+ imageLoading: '{{ MEDIA_URL }}lightbox/images/lightbox-ico-loading.gif',
+ imageBtnClose: '{{ MEDIA_URL }}lightbox/images/lightbox-btn-close.gif',
+ imageBtnPrev: '{{ MEDIA_URL }}lightbox/images/lightbox-btn-prev.gif',
+ imageBtnNext: '{{ MEDIA_URL }}lightbox/images/lightbox-btn-next.gif',
+ });
+ });
+ </script>
+{% endblock scripts%}
+
+{% block content %}
+ {% for carousel in carousels %}
+ <h1>{{carousel.name}}</h1><hr>
+ {% for photo in carousel.photos.all %}
+ <a rel="lightbox" href="{{photo.original_image.url}}"><img src="{{photo.thumbnail.url}}"/></a>
+ {% endfor %}
+ {% endfor %}
+{% endblock content %}
View
87 occupywallst/templates/occupywallst/index.html
@@ -1,5 +1,6 @@
{% extends base %}
{% block stylesheets %}
+ <link href="{{ MEDIA_URL }}js/tweet/jquery.tweet.css" media="all" rel="stylesheet" type="text/css"/>
<style type="text/css">
#id_news{
text-decoration: none;
@@ -9,25 +10,77 @@
}
</style>
{% endblock stylesheets %}
+{% block scripts %}
+ <script src="{{ MEDIA_URL }}js/tweet/jquery.tweet.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ jQuery(function($){
+ $(".tweet").tweet({
+ join_text: "auto",
+ avatar_size: 32,
+ count: 4,
+ username: ["OccupyTheG8","OccupyChicago"],
+ loading_text: "searching twitter...",
+ refresh_interval: 60
+ });
+ });
+ </script>
+{% endblock scripts %}
{% load ows i18n l10n %}
{% block body_class %}news-page{% endblock %}
-
{% block content %}
- {{ verbiage.aboveindex }}
- <table style="width:100%"><tbody><tr><td id="left">
- <section id="articles">
- {% with read_more="True" %}
- {% for article in articles %}
- {% include "occupywallst/article_content.html" %}
+ <div id="left_index">
+ <div id="top">
+ {% for article in articles_top %}
+ <h1 class="column_titles" style="text-align: left;"><a href="{{ article.get_absolute_url }}">
+ {{ article.title }}
+ </a></h1>
+ <p class="info">
+ {% blocktrans with date=article.published|as_timezone:"US/Eastern"|date:"DATETIME_FORMAT" timesince=article.published|timesince_short username=article.author|userlink %}
+ Posted {{ timesince }} ago on {{ date }} EST by {{ username }}
+ {% endblocktrans %}
+ </p>
+ {% if article.allow_html %}
+ {{ article.content|read_more:article.get_absolute_url|markup_unsafe }}
+ {% else %}
+ {{ article.content|read_more:article.get_absolute_url|markup }}
+ {% endif %}
+ {% endfor %}
+ </div>
+ </div>
+ <div style="width:261px;" id="events">
+ <h3 class="column_titles">Upcoming Events</h3><hr>
+ {% for event in events %}
+ {% ifchanged event.start_date.day %} <span>{{ event.start_date|date:"SHORT_DATE_FORMAT"|center:8 }}</span><br/> {% endifchanged %}
+ <span><a href="{{ event.get_absolute_url }}">
+ {{ event.title|slice:":30"}}...
+ </a></span>
+
{% endfor %}
- {% endwith %}
- </section>
- <p style="font-weight:bold">
- <a href="/archive/page-2/">{% trans 'Older Posts' %}</a>
- </p>
- </td><td id="right">
- <section id="mission">
- {{ verbiage.index_sidebar }}
- </section>
- </td></tr></tbody></table>
+
+ <div id="wire">
+ <h3 class="column_titles" >The Wire</h3><hr>
+ {% for article in articles %}
+ <a style="display:block" href="{{ article.get_absolute_url }}">
+ {{ article.title|slice:":30" }}
+ </a>
+ {% endfor %}
+ </div>
+ <div>
+ <h3 class="column_titles" >Tweets</h3><hr>
+ <div class="tweet">
+
+ </div>
+ </div>
+ <div id="images">
+ <h2 class="column_titles">media</h2><hr>
+ {% for image in images %}
+ <a href="images/"><img src="{{image.thumbnail.url}}"/></a>
+ {% endfor %}
+ </div>
+ </div>
+
+ <div id="sidebar">
+ {{ verbiage.index_sidebar }}
+ </div>
{% endblock content %}
+
View
2,999 occupywallst/templates/occupywallst/trainingmaterials.html
2,999 additions, 0 deletions not shown
View
15 occupywallst/templatetags/ows.py
@@ -258,3 +258,18 @@ def show_comments(context, user, comments):
'depth': depth,
'can_reply': can_reply}))
return "".join(res)
+
+@register.filter
+def truncatechars(s, num):
+ """
+ Truncates a word after a given number of chars
+ Argument: Number of chars to truncate after
+ """
+ length = int(num)
+ string = []
+ for word in s.split():
+ if len(word) > length:
+ string.append(word[:length]+'...')
+ else:
+ string.append(word)
+ return u' '.join(string)
View
2  occupywallst/urls.py
@@ -35,11 +35,13 @@
url(r'^forum/comments/$', 'occupywallst.views.forum_comments', name='forum-comments'),
url(r'^forum/(?P<slug>[-_\d\w]+)/$', 'occupywallst.views.thread', name='forum-post'),
url(r'^notification/(?P<id>\d+)/$', 'occupywallst.views.notification', name='notification'),
+ url(r'^images/$', 'occupywallst.views.images', name='images'),
#cal
url(r'^calendar/(?P<month>\d+)/(?P<year>\d+)/$', 'occupywallst.views.calendar_render', name='calendar-render'),
url(r'^calendar/$', 'occupywallst.views.this_month', name='this-month'),
url(r'^events/$', 'occupywallst.views.events', name='event'),
url(r'^addevent/$', 'occupywallst.views.add_event', name='add-event'),
+
#rides
url(r'^rides/', include('rideshare.urls')),
View
25 occupywallst/views.py
@@ -57,17 +57,28 @@ def __my_cache(request, *args, **kwargs):
return __my_cache
return _my_cache
-
@my_cache(lambda r, per_page: 'index-%d' % (per_page))
def index(request, per_page=10):
articles = (db.Article.objects
- .select_related("author","event")
- .filter(is_visible=True, is_forum=False, is_deleted=False)
+ .filter(is_visible=True, is_forum=False, is_deleted=False, is_top=False, is_event=False)
+ .order_by('-published'))
+ articles_top = (db.Article.objects
+ .filter(is_visible=True, is_forum=False, is_deleted=False, is_top=True)
.order_by('-published'))
+
+ begin = datetime.now() - timedelta(days=1)
+ events = db.Event.objects.filter(is_event=True, is_deleted=False, start_date__gte=begin, ).order_by('start_date')
+ images = db.Photo.objects.filter(carousel__name="frontpage")
+
return render_to_response(
- 'occupywallst/index.html', {'articles': articles[:per_page]},
+ 'occupywallst/index.html',
+ {'articles': articles[:per_page],
+ 'articles_top':articles_top[:4],
+ 'events': events[:4],
+ 'images': images},
context_instance=RequestContext(request))
+
def _forum_search(query):
@@ -422,3 +433,9 @@ def add_event(request):
return render_to_response(
'occupywallst/event_form.html', {'form': form},
context_instance=RequestContext(request))
+
+def images(request):
+ carousels = db.Carousel.objects.select_related('photos').all()
+ return render_to_response(
+ 'occupywallst/images.html', {'carousels': carousels},
+ context_instance=RequestContext(request))

No commit comments for this range

Something went wrong with that request. Please try again.