From b2ed9a9cf5d45216ca811c720359965772098f2d Mon Sep 17 00:00:00 2001 From: ethan-nelson Date: Sat, 9 May 2015 19:35:18 -0500 Subject: [PATCH 1/2] preventing self-validation --- osmtm/templates/task.state.done.mako | 30 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/osmtm/templates/task.state.done.mako b/osmtm/templates/task.state.done.mako index e24db7bb..678ec5e7 100644 --- a/osmtm/templates/task.state.done.mako +++ b/osmtm/templates/task.state.done.mako @@ -18,16 +18,32 @@ done = task.cur_state and task.cur_state.state == TaskState.state_done ${_('Invalidate')} % if done: + % if user == task.states[0].user and not (user.is_admin or user.is_project_manager): +<% +validation_message = _("You cannot validate a task that you have marked done.") +%> + +
+ + ${validation_message} +
+ % else: <% tooltip = _("Validate this task if you consider that the work is complete.") %> - + + % endif % endif % endif From fc0c525f58650e0b2f18385b26a125a0af1ccb64 Mon Sep 17 00:00:00 2001 From: Ethan Date: Sun, 17 May 2015 13:42:16 -0500 Subject: [PATCH 2/2] rearranging self-validation prevention A single button is employed. Now, we apply attributes as to whether the user is allowed to validate or not. If they can, we add `type="submit"`. Otherwise, we add `type="button" disabled` and also include a div explaining that the user cannot self-validate. --- osmtm/templates/task.state.done.mako | 29 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/osmtm/templates/task.state.done.mako b/osmtm/templates/task.state.done.mako index 678ec5e7..f4d68fc6 100644 --- a/osmtm/templates/task.state.done.mako +++ b/osmtm/templates/task.state.done.mako @@ -18,32 +18,31 @@ done = task.cur_state and task.cur_state.state == TaskState.state_done ${_('Invalidate')} % if done: +<% +tooltip = _("Validate this task if you consider that the work is complete.") +%> % if user == task.states[0].user and not (user.is_admin or user.is_project_manager): <% -validation_message = _("You cannot validate a task that you have marked done.") +selfvalidatestate = """ type="button" disabled """ +selfvalidatetext = _("You cannot validate a task that you have personally marked as done.") +selfvalidatediv = """
+ """ + \ + selfvalidatetext + """
""" %> - -
- - ${validation_message} -
% else: <% -tooltip = _("Validate this task if you consider that the work is complete.") +selfvalidatestate = """ type="submit" """ +selfvalidatediv = """""" %> - - % endif + ${selfvalidatediv | n} % endif % endif