From 67f5c1839d9ec6589eb929b4a99fdede12b48391 Mon Sep 17 00:00:00 2001 From: "valeria.lecca" Date: Mon, 13 Oct 2014 17:21:43 +0200 Subject: [PATCH] api web demo --- examples/most/static/js/demo/exam.js | 98 ++++++++++++ examples/most/static/js/demo/section.js | 58 +++++++ examples/most/static/js/demo/visit.js | 108 +++++++++++++ examples/most/templates/base_modal.html | 18 +++ examples/most/templates/exams/base_modal.html | 10 -- examples/most/templates/exams/demo.html | 144 ++++++++++++++++-- examples/most/templates/exams/exam.html | 11 +- .../most/templates/exams/exam/add_section.html | 158 +++++++++++++++++-- examples/most/templates/exams/exam/delete.html | 120 +++++++++++++-- examples/most/templates/exams/exam/get_info.html | 119 +++++++++++++-- .../most/templates/exams/exam/list_sections.html | 119 +++++++++++++-- examples/most/templates/exams/exam/new.html | 78 ++++++++-- .../most/templates/exams/exam/remove_section.html | 138 +++++++++++++++-- examples/most/templates/exams/exam/search.html | 77 ++++++++-- .../most/templates/exams/exam/set_clinician.html | 165 ++++++++++++++++++-- examples/most/templates/exams/section.html | 11 +- examples/most/templates/exams/section/delete.html | 108 +++++++++++-- .../most/templates/exams/section/get_info.html | 107 +++++++++++-- examples/most/templates/exams/section/new.html | 78 ++++++++-- examples/most/templates/exams/section/search.html | 77 ++++++++-- examples/most/templates/exams/visit.html | 11 +- examples/most/templates/exams/visit/add_exam.html | 168 +++++++++++++++++++-- examples/most/templates/exams/visit/delete.html | 118 +++++++++++++-- .../most/templates/exams/visit/get_full_info.html | 117 ++++++++++++-- examples/most/templates/exams/visit/get_info.html | 117 ++++++++++++-- .../most/templates/exams/visit/list_exams.html | 117 ++++++++++++-- examples/most/templates/exams/visit/new.html | 78 ++++++++-- .../most/templates/exams/visit/remove_exam.html | 161 ++++++++++++++++++-- examples/most/templates/exams/visit/search.html | 77 ++++++++-- .../templates/exams/visit/set_parent_visit.html | 166 ++++++++++++++++++-- src/most/web/exams/models.py | 3 +- 31 files changed, 2693 insertions(+), 242 deletions(-) create mode 100644 examples/most/static/js/demo/exam.js create mode 100644 examples/most/static/js/demo/section.js create mode 100644 examples/most/static/js/demo/visit.js create mode 100644 examples/most/templates/base_modal.html delete mode 100644 examples/most/templates/exams/base_modal.html diff --git a/examples/most/static/js/demo/exam.js b/examples/most/static/js/demo/exam.js new file mode 100644 index 0000000..464b3ae --- /dev/null +++ b/examples/most/static/js/demo/exam.js @@ -0,0 +1,98 @@ +/*! + * Project MOST - Moving Outcomes to Standard Telemedicine Practice + * http://most.crs4.it/ + * + * Copyright 2014, CRS4 srl. (http://www.crs4.it/) + * Dual licensed under the MIT or GPL Version 2 licenses. + * See license-GPLv2.txt or license-MIT.txt + */ + +$(function() { + $('#exam_func_1').click(function(){ + console.log('in exam_func_1 click event'); + $( '#api-launcher' ).load('/exam/new/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_2').click(function(){ + console.log('in exam_func_2 click event'); + $( '#api-launcher' ).load('/exam/edit/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_3').click(function(){ + console.log('in exam_func_3 click event'); + $( '#api-launcher' ).load('/exam/delete/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_4').click(function(){ + console.log('in exam_func_4 click event'); + $( '#api-launcher' ).load('/exam/search/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_5').click(function(){ + console.log('in exam_func_5 click event'); + $( '#api-launcher' ).load('/exam/get_info/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_6').click(function(){ + console.log('in exam_func_6 click event'); + $( '#api-launcher' ).load('/exam/list_sections/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_7').click(function(){ + console.log('in exam_func_7 click event'); + $( '#api-launcher' ).load('/exam/add_section/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_8').click(function(){ + console.log('in exam_func_8 click event'); + $( '#api-launcher' ).load('/exam/remove_section/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#exam_func_9').click(function(){ + console.log('in exam_func_9 click event'); + $( '#api-launcher' ).load('/exam/set_clinician/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); diff --git a/examples/most/static/js/demo/section.js b/examples/most/static/js/demo/section.js new file mode 100644 index 0000000..b240514 --- /dev/null +++ b/examples/most/static/js/demo/section.js @@ -0,0 +1,58 @@ +/*! + * Project MOST - Moving Outcomes to Standard Telemedicine Practice + * http://most.crs4.it/ + * + * Copyright 2014, CRS4 srl. (http://www.crs4.it/) + * Dual licensed under the MIT or GPL Version 2 licenses. + * See license-GPLv2.txt or license-MIT.txt + */ + +$(function() { + $('#section_func_1').click(function(){ + console.log('in section_func_1 click event'); + $( '#api-launcher' ).load('/section/new/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#section_func_2').click(function(){ + console.log('in section_func_2 click event'); + $( '#api-launcher' ).load('/section/edit/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#section_func_3').click(function(){ + console.log('in section_func_3 click event'); + $( '#api-launcher' ).load('/section/delete/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#section_func_4').click(function(){ + console.log('in section_func_4 click event'); + $( '#api-launcher' ).load('/section/search/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#section_func_5').click(function(){ + console.log('in section_func_5 click event'); + $( '#api-launcher' ).load('/section/get_info/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); diff --git a/examples/most/static/js/demo/visit.js b/examples/most/static/js/demo/visit.js new file mode 100644 index 0000000..326fca6 --- /dev/null +++ b/examples/most/static/js/demo/visit.js @@ -0,0 +1,108 @@ +/*! + * Project MOST - Moving Outcomes to Standard Telemedicine Practice + * http://most.crs4.it/ + * + * Copyright 2014, CRS4 srl. (http://www.crs4.it/) + * Dual licensed under the MIT or GPL Version 2 licenses. + * See license-GPLv2.txt or license-MIT.txt + */ + +$(function() { + $('#visit_func_1').click(function(){ + console.log('in visit_func_1 click event'); + $( '#api-launcher' ).load('/visit/new/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_2').click(function(){ + console.log('in visit_func_2 click event'); + $( '#api-launcher' ).load('/visit/edit/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_3').click(function(){ + console.log('in visit_func_3 click event'); + $( '#api-launcher' ).load('/visit/delete/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_4').click(function(){ + console.log('in visit_func_4 click event'); + $( '#api-launcher' ).load('/visit/search/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_5').click(function(){ + console.log('in visit_func_5 click event'); + $( '#api-launcher' ).load('/visit/get_info/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_6').click(function(){ + console.log('in visit_func_6 click event'); + $( '#api-launcher' ).load('/visit/get_full_info/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_7').click(function(){ + console.log('in visit_func_7 click event'); + $( '#api-launcher' ).load('/visit/list_exams/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_8').click(function(){ + console.log('in visit_func_8 click event'); + $( '#api-launcher' ).load('/visit/add_exam/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_9').click(function(){ + console.log('in visit_func_9 click event'); + $( '#api-launcher' ).load('/visit/remove_exam/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); + +$(function() { + $('#visit_func_10').click(function(){ + console.log('in visit_func_10 click event'); + $( '#api-launcher' ).load('/visit/set_parent_visit/', {'caller':$( this ).text()}, function() { + console.log('loaded'); + $( '#api-launcher' ).modal().show(); + }) + }); +}); diff --git a/examples/most/templates/base_modal.html b/examples/most/templates/base_modal.html new file mode 100644 index 0000000..4759d8a --- /dev/null +++ b/examples/most/templates/base_modal.html @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/examples/most/templates/exams/base_modal.html b/examples/most/templates/exams/base_modal.html deleted file mode 100644 index 19a0fbd..0000000 --- a/examples/most/templates/exams/base_modal.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/examples/most/templates/exams/demo.html b/examples/most/templates/exams/demo.html index 19a0fbd..31c3c99 100644 --- a/examples/most/templates/exams/demo.html +++ b/examples/most/templates/exams/demo.html @@ -1,10 +1,136 @@ - - - - - - - +{% extends "base.html" %} +{% block title %}MOST WEB EXAMPLES{% endblock %} +{% block content %} +

WEB API EXAMPLE

+
+ + - - \ No newline at end of file + + +
+ +
+
+{% endblock %} +{% block script %} + + + + +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam.html b/examples/most/templates/exams/exam.html index 19a0fbd..94d9808 100644 --- a/examples/most/templates/exams/exam.html +++ b/examples/most/templates/exams/exam.html @@ -1,10 +1 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base.html" %} diff --git a/examples/most/templates/exams/exam/add_section.html b/examples/most/templates/exams/exam/add_section.html index 19a0fbd..3886f1c 100644 --- a/examples/most/templates/exams/exam/add_section.html +++ b/examples/most/templates/exams/exam/add_section.html @@ -1,10 +1,150 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/delete.html b/examples/most/templates/exams/exam/delete.html index 19a0fbd..51e815e 100644 --- a/examples/most/templates/exams/exam/delete.html +++ b/examples/most/templates/exams/exam/delete.html @@ -1,10 +1,112 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/get_info.html b/examples/most/templates/exams/exam/get_info.html index 19a0fbd..9430d30 100644 --- a/examples/most/templates/exams/exam/get_info.html +++ b/examples/most/templates/exams/exam/get_info.html @@ -1,10 +1,111 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/list_sections.html b/examples/most/templates/exams/exam/list_sections.html index 19a0fbd..525a12f 100644 --- a/examples/most/templates/exams/exam/list_sections.html +++ b/examples/most/templates/exams/exam/list_sections.html @@ -1,10 +1,111 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/new.html b/examples/most/templates/exams/exam/new.html index 19a0fbd..ab07ca3 100644 --- a/examples/most/templates/exams/exam/new.html +++ b/examples/most/templates/exams/exam/new.html @@ -1,10 +1,70 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/remove_section.html b/examples/most/templates/exams/exam/remove_section.html index 19a0fbd..18027a2 100644 --- a/examples/most/templates/exams/exam/remove_section.html +++ b/examples/most/templates/exams/exam/remove_section.html @@ -1,10 +1,130 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/search.html b/examples/most/templates/exams/exam/search.html index 19a0fbd..8361a72 100644 --- a/examples/most/templates/exams/exam/search.html +++ b/examples/most/templates/exams/exam/search.html @@ -1,10 +1,67 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/exam/set_clinician.html b/examples/most/templates/exams/exam/set_clinician.html index 19a0fbd..ba425e4 100644 --- a/examples/most/templates/exams/exam/set_clinician.html +++ b/examples/most/templates/exams/exam/set_clinician.html @@ -1,10 +1,157 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/section.html b/examples/most/templates/exams/section.html index 19a0fbd..94d9808 100644 --- a/examples/most/templates/exams/section.html +++ b/examples/most/templates/exams/section.html @@ -1,10 +1 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base.html" %} diff --git a/examples/most/templates/exams/section/delete.html b/examples/most/templates/exams/section/delete.html index 19a0fbd..05f8092 100644 --- a/examples/most/templates/exams/section/delete.html +++ b/examples/most/templates/exams/section/delete.html @@ -1,10 +1,100 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/section/get_info.html b/examples/most/templates/exams/section/get_info.html index 19a0fbd..02f148c 100644 --- a/examples/most/templates/exams/section/get_info.html +++ b/examples/most/templates/exams/section/get_info.html @@ -1,10 +1,99 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/section/new.html b/examples/most/templates/exams/section/new.html index 19a0fbd..1d7c0c2 100644 --- a/examples/most/templates/exams/section/new.html +++ b/examples/most/templates/exams/section/new.html @@ -1,10 +1,70 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/section/search.html b/examples/most/templates/exams/section/search.html index 19a0fbd..7fc9f77 100644 --- a/examples/most/templates/exams/section/search.html +++ b/examples/most/templates/exams/section/search.html @@ -1,10 +1,67 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit.html b/examples/most/templates/exams/visit.html index 19a0fbd..94d9808 100644 --- a/examples/most/templates/exams/visit.html +++ b/examples/most/templates/exams/visit.html @@ -1,10 +1 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base.html" %} diff --git a/examples/most/templates/exams/visit/add_exam.html b/examples/most/templates/exams/visit/add_exam.html index 19a0fbd..16d09a0 100644 --- a/examples/most/templates/exams/visit/add_exam.html +++ b/examples/most/templates/exams/visit/add_exam.html @@ -1,10 +1,160 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/delete.html b/examples/most/templates/exams/visit/delete.html index 19a0fbd..b968427 100644 --- a/examples/most/templates/exams/visit/delete.html +++ b/examples/most/templates/exams/visit/delete.html @@ -1,10 +1,110 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/get_full_info.html b/examples/most/templates/exams/visit/get_full_info.html index 19a0fbd..6f6e999 100644 --- a/examples/most/templates/exams/visit/get_full_info.html +++ b/examples/most/templates/exams/visit/get_full_info.html @@ -1,10 +1,109 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/get_info.html b/examples/most/templates/exams/visit/get_info.html index 19a0fbd..da3e5a9 100644 --- a/examples/most/templates/exams/visit/get_info.html +++ b/examples/most/templates/exams/visit/get_info.html @@ -1,10 +1,109 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/list_exams.html b/examples/most/templates/exams/visit/list_exams.html index 19a0fbd..dcfc03f 100644 --- a/examples/most/templates/exams/visit/list_exams.html +++ b/examples/most/templates/exams/visit/list_exams.html @@ -1,10 +1,109 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/new.html b/examples/most/templates/exams/visit/new.html index 19a0fbd..6ba1948 100644 --- a/examples/most/templates/exams/visit/new.html +++ b/examples/most/templates/exams/visit/new.html @@ -1,10 +1,70 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/remove_exam.html b/examples/most/templates/exams/visit/remove_exam.html index 19a0fbd..95dde42 100644 --- a/examples/most/templates/exams/visit/remove_exam.html +++ b/examples/most/templates/exams/visit/remove_exam.html @@ -1,10 +1,153 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/search.html b/examples/most/templates/exams/visit/search.html index 19a0fbd..650f80f 100644 --- a/examples/most/templates/exams/visit/search.html +++ b/examples/most/templates/exams/visit/search.html @@ -1,10 +1,67 @@ - - - - - - - - - - \ No newline at end of file +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/examples/most/templates/exams/visit/set_parent_visit.html b/examples/most/templates/exams/visit/set_parent_visit.html index 19a0fbd..948518a 100644 --- a/examples/most/templates/exams/visit/set_parent_visit.html +++ b/examples/most/templates/exams/visit/set_parent_visit.html @@ -1,10 +1,158 @@ - - - - - - - +{% extends "base_modal.html" %} +{% block modal_body %} +
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/src/most/web/exams/models.py b/src/most/web/exams/models.py index e76a983..82e8821 100644 --- a/src/most/web/exams/models.py +++ b/src/most/web/exams/models.py @@ -99,7 +99,8 @@ def to_dictionary(self): u'summary': u'%s' % self.summary if self.summary else None, u'start_datetime': u'%s' % self.start_datetime.strftime('%d %b %Y') if self.start_datetime else None, u'end_datetime': u'%s' % self.end_datetime.strftime('%d %b %Y') if self.end_datetime else None, - u'clinician': self.clinician.to_dictionary(exclude_user=True), + u'clinician': u'%s' % self.clinician, + # u'clinician': self.clinician.to_dictionary(exclude_user=True), u'is_active': self.is_active, u'is_remote': self.is_remote, }