-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
738 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,35 @@ | ||
*.log | ||
*.pot | ||
*.pyc | ||
local_settings.py | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject |
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 @@ | ||
Changelog | ||
========= | ||
|
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,55 @@ | ||
Nova Style Commandments | ||
======================= | ||
|
||
Step 1: Read http://www.python.org/dev/peps/pep-0008/ | ||
Step 2: Read http://www.python.org/dev/peps/pep-0008/ again | ||
Step 3: Read on | ||
|
||
Imports | ||
------- | ||
- thou shalt not import objects, only modules | ||
- thou shalt not import more than one module per line | ||
- thou shalt not make relative imports | ||
- thou shalt "from nova import vendor" before importing third party code | ||
- thou shalt organize your imports according to the following template | ||
|
||
:: | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
{{stdlib imports in human alphabetical order}} | ||
\n | ||
from nova import vendor | ||
{{vendor imports in human alphabetical order}} | ||
\n | ||
{{nova imports in human alphabetical order}} | ||
\n | ||
\n | ||
{{begin your code}} | ||
|
||
|
||
General | ||
------- | ||
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc) | ||
- thou shalt put one newline twixt methods in classes and anywhere else | ||
- thou shalt not write "except:", use "except Exception:" at the very least | ||
- thou shalt include your name with TODOs as in "TODO(termie)" | ||
- thou shalt not name anything the same name as a builtin or reserved word | ||
- thou shalt not violate causality in our time cone, or else | ||
|
||
|
||
Human Alphabetical Order Examples | ||
--------------------------------- | ||
:: | ||
import httplib | ||
import logging | ||
import random | ||
import StringIO | ||
import time | ||
import unittest | ||
|
||
|
||
|
||
Tool to make code PEP8 compliant | ||
-------------------------------- | ||
- Install : https://github.com/cburroughs/pep8 | ||
- Usage in your project directory : pep8 --statistics --filename=*.py --show-source --show-pep8 . | ||
|
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,4 @@ | ||
global-exclude *.pyc | ||
include README.rst | ||
include MIT-LICENSE.txt | ||
recursive-include common_notification * |
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,6 @@ | ||
common_notification | ||
=================== | ||
|
||
common_notification module | ||
|
||
. |
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,12 @@ | ||
|
||
Release Process | ||
=============== | ||
|
||
1. Update version info | ||
* README.rst | ||
* common_notification/__init__.py | ||
* docs/conf.py | ||
|
||
2. git tag -a vX.Y.Z -m 'Version X.Y.Z' | ||
|
||
3. python setup.py sdist upload |
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,6 @@ | ||
==== | ||
TODO | ||
==== | ||
|
||
|
||
|
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,24 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# | ||
# Common Notification License | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (C) 2011-2012 Star2Billing S.L. | ||
# | ||
# The Initial Developer of the Original Code is | ||
# Arezqui Belaid <info@star2billing.com> | ||
# | ||
|
||
# :copyright: (c) 2011 - 2012 by Arezqui Belaid. | ||
# :license: MPL 2.0, see COPYING for more details. | ||
|
||
VERSION = (0, 1, 0, "Beta") | ||
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:]) | ||
__author__ = "Arezqui Belaid" | ||
__contact__ = "info@star2billing.com" | ||
__homepage__ = "http://www.star2billing.org" | ||
__docformat__ = "restructuredtext" |
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,21 @@ | ||
# | ||
# Common Notification License | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (C) 2011-2012 Star2Billing S.L. | ||
# | ||
# The Initial Developer of the Original Code is | ||
# Arezqui Belaid <info@star2billing.com> | ||
# | ||
from django.utils.translation import ugettext_lazy as _ | ||
from common.utils import Choice | ||
|
||
|
||
class NOTICE_COLUMN_NAME(Choice): | ||
message = _('Message') | ||
notice_type = _('Notice type') | ||
sender = _('Sender') | ||
date_field = _('Date') |
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,30 @@ | ||
[ | ||
{ | ||
"pk":1, | ||
"model":"notification.notice", | ||
"fields":{ | ||
"archived":false, | ||
"added":"2012-08-17T01:27:05", | ||
"sender":1, | ||
"on_site":true, | ||
"notice_type":1, | ||
"unseen":true, | ||
"message":"Campaign started", | ||
"recipient":1 | ||
} | ||
}, | ||
{ | ||
"pk":2, | ||
"model":"notification.notice", | ||
"fields":{ | ||
"archived":false, | ||
"added":"2012-08-17T01:27:05", | ||
"sender":1, | ||
"on_site":true, | ||
"notice_type":1, | ||
"unseen":true, | ||
"message":"Campaign started", | ||
"recipient":1 | ||
} | ||
} | ||
] |
152 changes: 152 additions & 0 deletions
152
common_notification/templates/frontend/common_notification/user_notification.html
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,152 @@ | ||
{% extends "frontend/master.html" %} | ||
{% load i18n pagination_tags common_tags common_notification_tags %} | ||
|
||
{% block extra_header %} | ||
<script type="text/javascript" language="javascript"> | ||
function toggleChecked(status) { | ||
$(".checkbox").each( function() { | ||
$(this).attr("checked", status); | ||
}) | ||
} | ||
|
||
$(document).ready(function() { | ||
$('#ListForm').submit(function(e) { | ||
|
||
var currentForm = this; | ||
e.preventDefault(); | ||
|
||
var $fields = $(this).find('input[name="select"]:checked'); | ||
|
||
if (!$fields.length) { | ||
msg = '{% trans "You must check at least one box!" %}'; | ||
bootbox.alert(msg); | ||
return false; // The form will *not* submit | ||
} | ||
else | ||
{ | ||
var confirm_string; | ||
if(document.location.href.search("/user_notification/") != -1) { | ||
confirm_string = $fields.length + '{% trans " notification(s) are going to be deleted?" %}'; | ||
|
||
if(document.getElementById('id_mark_read') && document.getElementById('id_mark_read').value == 'true') { | ||
confirm_string = $fields.length + '{% trans " notification(s) are going to be marked as read?" %}'; | ||
} | ||
} | ||
|
||
bootbox.confirm(confirm_string, function(result) { | ||
if (result) { | ||
currentForm.submit(); | ||
} | ||
}); | ||
|
||
return false; | ||
} | ||
}); | ||
|
||
}); | ||
</script> | ||
{% endblock %} | ||
|
||
{% block content_header %} | ||
<h1>{% trans "Notifications" %} <small></small></h1> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
{% if msg_note %} | ||
<div class="alert alert-success"> | ||
<strong>{% trans "Alert" %} : </strong> {{ msg_note }} | ||
</div> | ||
{% endif %} | ||
<div class="span12"> | ||
<div class="row"> | ||
<div class="btn-group"> | ||
<button class="btn">{% trans "Action" %}</button> | ||
<button class="btn dropdown-toggle" data-toggle="dropdown"> | ||
<span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu"> | ||
<li><a href="#" onclick="make_read_button()">{% trans "Mark as read" %}</a></li> | ||
<li><a href="#" onclick="delete_button()">{% trans "Delete notifications" %}</a></li> | ||
</ul> | ||
</div> | ||
<a class="btn btn-info" href="#" onclick="mark_read_all_button()">{% trans "Mark all as read" %}</a> | ||
</div> | ||
</div> | ||
<br/><br/> | ||
<div class="span12"> | ||
<div class="row"> | ||
<form method="POST" action="del/0/" enctype="multipart/form-data" id="ListForm"> | ||
{% csrf_token %} | ||
|
||
<table class="table table-striped table-bordered table-condensed"> | ||
<thead> | ||
<tr> | ||
<th><input type="checkbox" onclick="toggleChecked(this.checked)"></th> | ||
<th>{% sort_link NOTICE_COLUMN_NAME.message col_name_with_order.message %}</th> | ||
<th>{% sort_link NOTICE_COLUMN_NAME.notice_type col_name_with_order.notice_type %}</th> | ||
<th>{% sort_link NOTICE_COLUMN_NAME.sender col_name_with_order.sender %}</th> | ||
<th>{% sort_link NOTICE_COLUMN_NAME.date_field col_name_with_order.added %}</th> | ||
<th>{% trans "Action" %}</th> | ||
</tr> | ||
</thead> | ||
{% if user_notification %} | ||
{% autopaginate user_notification PAGE_SIZE %} | ||
{% for row in user_notification %} | ||
<tr> | ||
<td><input type="checkbox" name="select" class="checkbox" value="{{ row.id }}" /></td> | ||
<td>{{ row.message }}</td> | ||
<td>{{ row.notice_type }}</td> | ||
<td>{{ row.sender }}</td> | ||
<td>{{ row.added }}</td> | ||
<td> | ||
<a href="../update_notification/{{ row.id }}/"> | ||
<span class="label {{ row.unseen|notification_style }}">{{ row.unseen|notification_status }}</span> | ||
</a> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
{% else %} | ||
<tr> | ||
<td colspan="6" align="center"> | ||
{% trans "no records found"|title %} | ||
</td> | ||
</tr> | ||
{% endif %} | ||
</table> | ||
{% if user_notification %} | ||
{% paginate %} | ||
{% endif %} | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
function make_read_button() | ||
{ | ||
$('<input>').attr({ | ||
type: 'hidden', | ||
id: 'id_mark_read', | ||
name: 'mark_read', | ||
value: 'true', | ||
}).appendTo('#ListForm'); | ||
|
||
$('#ListForm').submit(); | ||
} | ||
function delete_button() | ||
{ | ||
$('<input>').attr({ | ||
type: 'hidden', | ||
id: 'id_mark_read', | ||
name: 'mark_read', | ||
value: 'false', | ||
}).appendTo('#ListForm'); | ||
|
||
$('#ListForm').submit(); | ||
} | ||
function mark_read_all_button() | ||
{ | ||
window.location.replace("/user_notification/?notification=mark_read_all"); | ||
} | ||
</script> | ||
|
||
{% endblock %} |
Empty file.
Oops, something went wrong.