-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new activity app; markdown; new editor #51
- Loading branch information
Showing
11 changed files
with
83 additions
and
37 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
This file demonstrates writing tests using the unittest module. These will pass | ||
when you run "manage.py test". | ||
Replace this with more appropriate tests for your application. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
|
||
class SimpleTest(TestCase): | ||
def test_basic_addition(self): | ||
""" | ||
Tests that 1 + 1 always equals 2. | ||
""" | ||
self.assertEqual(1 + 1, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Create your views here. | ||
|
||
import os | ||
import random | ||
from django.conf import settings | ||
from django.contrib.auth import get_user_model | ||
from django.shortcuts import redirect | ||
from django.views.generic import TemplateView, View | ||
from braces.views import LoginRequiredMixin, JSONResponseMixin, AjaxResponseMixin | ||
import misaka as m | ||
|
||
|
||
__all__ = ( | ||
'StreamView', | ||
'ChatSendView' | ||
) | ||
|
||
|
||
|
||
class StreamView(LoginRequiredMixin, TemplateView): | ||
template_name = 'activity/stream.html' | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super(StreamView, self).get_context_data(**kwargs) | ||
return context | ||
|
||
|
||
class ChatSendView(LoginRequiredMixin, JSONResponseMixin, AjaxResponseMixin, View): | ||
def post_ajax(self, request, *args, **kwargs): | ||
import pusher | ||
|
||
p = pusher.Pusher( | ||
app_id=settings.PUSHER_APPID, | ||
key=settings.PUSHER_KEY, | ||
secret=settings.PUSHER_SECRET | ||
) | ||
p['activity'].trigger('my_event', { | ||
'message': m.html(self.request.POST['message']), | ||
'user': self.request.user.username, | ||
'type': 'chat', | ||
}) | ||
json_dict = { | ||
"success": True | ||
} | ||
return self.render_json_response(json_dict) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ | |
'emergent', | ||
'zen', | ||
'rpg', | ||
'activity', | ||
|
||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
margin-top: 20px; | ||
min-height: 400px; | ||
} | ||
#chat_send{ | ||
float: right; | ||
margin-top: 6px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters