Hide 'send and post' button to SDO Liaison Managers when they select their SDO in the from field. Fixes #577

- Legacy-Id: 2786
This commit is contained in:
Emilio A. Sánchez López 2011-02-01 17:32:50 +00:00
parent 79785fe75b
commit 53fae6e4c5
3 changed files with 18 additions and 2 deletions

View file

@ -47,6 +47,9 @@ class Entity(object):
def can_approve(self):
return []
def post_only(self, person):
return False
class IETFEntity(Entity):
@ -163,6 +166,9 @@ class SDOEntity(Entity):
return [manager.person]
return []
def post_only(self, person):
return bool(self.obj.liaisonmanagers_set.filter(person=person))
class EntityManager(object):

View file

@ -53,7 +53,7 @@ def get_info(request):
to_entity_id = request.GET.get('to_entity_id', None)
from_entity_id = request.GET.get('from_entity_id', None)
result = {'poc': [], 'cc': [], 'needs_approval': False}
result = {'poc': [], 'cc': [], 'needs_approval': False, 'post_only': False}
to_error = 'Invalid TO entity id'
if to_entity_id:
@ -74,7 +74,8 @@ def get_info(request):
'cc': [i.email() for i in to_entity.get_cc(person=person)] +\
[i.email() for i in from_entity.get_from_cc(person=person)],
'poc': [i.email() for i in to_entity.get_poc()],
'needs_approval': from_entity.needs_approval(person=person)})
'needs_approval': from_entity.needs_approval(person=person),
'post_only': from_entity.post_only(person=person)})
json_result = simplejson.dumps(result)
return HttpResponse(json_result, mimetype='text/javascript')

View file

@ -172,6 +172,14 @@
}
};
var checkPostOnly = function(post_only) {
if (post_only) {
$("input[name=send]").hide();
} else {
$("input[name=send]").show();
}
};
var updateInfo = function() {
var entity = organization;
var to_entity = from;
@ -189,6 +197,7 @@
render_mails_into(cc, response.cc);
render_mails_into(poc, response.poc);
toggleApproval(response.needs_approval);
checkPostOnly(response.post_only);
}
}
});