comparison doc/customizing.txt @ 5714:a5f5c044049f

Documentation additions by Tom Ekberg to add example of performing silent submit. Light editing by John Rouillard.
author John Rouillard <rouilj@ieee.org>
date Wed, 24 Apr 2019 17:50:55 -0400
parents 2692a1c48484
children 39082e29d2b4
comparison
equal deleted inserted replaced
5713:95dfdbaf5aa6 5714:a5f5c044049f
5367 5367
5368 4. Use the usual "new" action as the ``@action`` on the final page, and 5368 4. Use the usual "new" action as the ``@action`` on the final page, and
5369 you're done (the standard context/submit method can do this for you). 5369 you're done (the standard context/submit method can do this for you).
5370 5370
5371 5371
5372 Silent Submit
5373 ~~~~~~~~~~~~~
5374
5375 When working on an issue, most of the time the people on the nosy list
5376 need to be notified of changes. There are cases where a user wants to
5377 add a comment to an issue and not bother other users on the nosy
5378 list.
5379 This feature is called Silent Submit because it allows the user to
5380 silently modify an issue and not tell anyone.
5381
5382 There are several parts to this change. The main activity part
5383 involves editing the stock detectors/nosyreaction.py file in your
5384 tracker. Insert the following lines near the top of the nosyreaction
5385 function::
5386
5387 # Did user click button to do a silent change?
5388 try:
5389 if db.web['submit'] == "silent_change":
5390 return
5391 except (AttributeError, KeyError) as err:
5392 # The web attribute or submit key don't exist.
5393 # That's fine. We were probably triggered by an email
5394 # or cli based change.
5395 pass
5396
5397 This checks the submit button to see if it is the silent type. If there
5398 are exceptions trying to make that determination they are ignored and
5399 processing continues. You may wonder how db.web gets set. This is done
5400 by creating an extension. Add the file extensions/edit.py with
5401 this content::
5402
5403 from roundup.cgi.actions import EditItemAction
5404
5405 class Edit2Action(EditItemAction):
5406 def handle(self):
5407 self.db.web = {} # create the dict
5408 # populate the dict by getting the value of the submit_button
5409 # element from the form.
5410 self.db.web['submit'] = self.form['submit_button'].value
5411
5412 # call the core EditItemAction to process the edit.
5413 EditItemAction.handle(self)
5414
5415 def init(instance):
5416 '''Override the default edit action with this new version'''
5417 instance.registerAction('edit', Edit2Action)
5418
5419 This code is a wrapper for the roundup EditItemAction. It checks the
5420 form's submit button to save the value element. The rest of the changes
5421 needed for the Silent Submit feature involves editing
5422 html/issue.item.html to add the silent submit button. In
5423 the stock issue.item.html the submit button is on a line that contains
5424 "submit button". Replace that line with something like the following::
5425
5426 <input type="submit" name="submit_button"
5427 tal:condition="context/is_edit_ok"
5428 value="Submit Changes">&nbsp;
5429 <button type="submit" name="submit_button"
5430 tal:condition="context/is_edit_ok"
5431 title="Click this to submit but not send nosy email."
5432 value="silent_change" i18n:translate="">
5433 Silent Change</button>
5434
5435 Note the difference in the value attribute for the two submit buttons.
5436 The value "silent_change" in the button specification must match the
5437 string in the nosy reaction function.
5438
5372 Debugging Trackers 5439 Debugging Trackers
5373 ================== 5440 ==================
5374 5441
5375 There are three switches in tracker configs that turn on debugging in 5442 There are three switches in tracker configs that turn on debugging in
5376 Roundup: 5443 Roundup:

Roundup Issue Tracker: http://roundup-tracker.org/