Commit 1649f36f authored by HERBERT Ryan's avatar HERBERT Ryan
Browse files

controllers/notification.py viws/db_layout.html views/notfication/info.html

Moved notification info functionnality to index page
This makes the workflow more basic as add and edit redirect to index by default
parent 68a61656
......@@ -12,19 +12,7 @@ if request.env.http_origin:
ACCESS_DENIED = "access denied"
NOTIFICATION_CACHE_PREFIX = 'notification_'
# Deprecated
def index():
if not auth.is_admin() :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
query = db(db.notification).select(orderby=~db.notification.id)
return dict(message="Notifications",
query=query)
def info():
user_id = auth.user.id if auth.user else None
query = None
......
......@@ -2,7 +2,7 @@
<div id="db_menu">
<a class="button" onclick="db.call('patient/index');">patients</a>
<a class="button" onclick="db.call('notification/info');">notifications</a>
<a class="button" onclick="db.call('notification/index');">notifications</a>
{{if auth.is_admin():}}
- - -
<a class="button" onclick="db.call('config/index');">configs</a>
......
{{from gluon.contrib.markdown.markdown2 import markdown}}
{{extend 'db_layout.html'}}
<h3>{{=message}}</h3>
<h3>{{=query.title if query is not None else message}}</h3>
<div id="db_table_container">
<table class="db_table" id="table">
{{if query is not None:}}
<div class="db_block info_block">
{{=XML(markdown(query.message_content))}}
</div>
{{pass}}
<div id="db_table_container" {{if query is not None:}}class="info_table"{{pass}}>
<table class="db_table" id="table">
<thead>
<tr>
<td class="column_100"> Creator </td>
<td class="column_100"> Type </td>
<td class="column_100"> Priority </td>
<td class="column_100"> Title </td>
<td class="column_100"> Message </td>
<td class="column_100"> Expiration Date </td>
<td class="column5"> </td>
<td class="column_100"> Creation Date </td>
{{if auth.is_admin():}}
<td class="column_100"> Creator </td>
<td class="column_100"> Type </td>
<td class="column_100"> Priority </td>
<td class="column_100"> Expiration Date </td>
<td class="column5"> </td>
<td class="column5"> </td>
{{pass}}
</tr>
</thead>
<tbody>
{{for row in query:}}
<tr>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.creator}}</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.message_type}}</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.priority}}</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.title}}</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.message_content}}</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">{{=row.expiration}}</td>
<td class="pointer" onclick="db.call('notification/edit', {'id' : '{{=row.id}}'})">e</td>
<td class="pointer" onclick="db.call('notification/delete', {'id' : '{{=row.id}}'})">X</td>
</tr>
{{pass}}
{{for row in notifications:}}
<tr>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.title}}
</td>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.message_content}}
</td>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.creation_datetime}}
</td>
{{if auth.is_admin():}}
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.creator}}
</td>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.message_type}}
</td>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.priority}}
</td>
<td class="pointer" onclick="db.call('notification/index', {'id' : '{{=row.id}}'})">
{{=row.expiration}}
</td>
<td class="pointer" onclick="db.call('notification/edit', {'id' : '{{=row.id}}'})">
e
</td>
<td class="pointer" onclick="db.call('notification/delete', {'id' : '{{=row.id}}'})">
X
</td>
{{pass}}
</tr>
{{pass}}
</tbody>
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
<span class="button2" onclick="db.call('notification/add')"> + new notification </span>
\ No newline at end of file
{{if auth.is_admin():}}
<span class="button2" onclick="db.call('notification/add')"> + new notification </span>
{{pass}}
{{from gluon.contrib.markdown.markdown2 import markdown}}
{{extend 'db_layout.html'}}
<h3>{{=query.title if query is not None else message}}</h3>
{{if query is not None:}}
<div class="db_block info_block">
{{=XML(markdown(query.message_content))}}
</div>
{{pass}}
<div id="db_table_container" {{if query is not None:}}class="info_table"{{pass}}>
<table class="db_table" id="table">
<thead>
<tr>
<td class="column_100"> Title </td>
<td class="column_100"> Message </td>
<td class="column_100"> Creation Date </td>
{{if auth.is_admin():}}
<td class="column_100"> Creator </td>
<td class="column_100"> Type </td>
<td class="column_100"> Priority </td>
<td class="column_100"> Expiration Date </td>
<td class="column5"> </td>
<td class="column5"> </td>
{{pass}}
</tr>
</thead>
<tbody>
{{for row in notifications:}}
<tr>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.title}}
</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.message_content}}
</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.creation_datetime}}
</td>
{{if auth.is_admin():}}
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.creator}}
</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.message_type}}
</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.priority}}
</td>
<td class="pointer" onclick="db.call('notification/info', {'id' : '{{=row.id}}'})">
{{=row.expiration}}
</td>
<td class="pointer" onclick="db.call('notification/edit', {'id' : '{{=row.id}}'})">
e
</td>
<td class="pointer" onclick="db.call('notification/delete', {'id' : '{{=row.id}}'})">
X
</td>
{{pass}}
</tr>
{{pass}}
</tbody>
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
{{if auth.is_admin():}}
<span class="button2" onclick="db.call('notification/add')"> + new notification </span>
{{pass}}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment