[checklist] Implement checklist templates in account pages

Review Request #7099 — Created March 21, 2015 and submitted

Information

rb-extension-pack
d09b682...

Reviewers

An additional functionality of the checklist extension is to allow users to create individual templates which can be quickly added to any existing checklists. This change does not enable checklist templates to be imported into existing checklists.

Checklist templates are stored with two attributes, their title as a string and their list of items in JSON format.

The form for users to modify their checklist templates is under their account preferences page. In the form, users can add checklist templates, remove checklist templates, or edit an existing checklist template.

The form will automatically add new item fields when it detects that the user is editing the last item field, or when the user presses enter.

On Chrome 41.0.2272 and Safari 8.0.2:

  • Basic CRUD functionality - adding, editing and removing - works as it should.
  • Does not accept templates without a title.
  • Empty items are not included upon form submission.
  • Tested and ensured that the UI shortcuts (enter, tab) work.
  • Verified that the issue where the menu entry will disappear has been resolved (after #7103).
  • Ensured that users can only view and edit their own templates.

Description From Last Updated

'AccountPageFormsHook' imported but unused

reviewbotreviewbot

Col: 50 E231 missing whitespace after ','

reviewbotreviewbot

Col: 56 E231 missing whitespace after ','

reviewbotreviewbot

Col: 80 E501 line too long (83 > 79 characters)

reviewbotreviewbot

Col: 1 W391 blank line at end of file

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

undefined name 'ObjectDoesNotExist'

reviewbotreviewbot

undefined name 'DOES_NOT_EXIST'

reviewbotreviewbot

undefined name 'webapi_response_errors'

reviewbotreviewbot

Two blank lines here

XU xuanyi

Two blank lines over here.

XU xuanyi

Two blank lines here.

XU xuanyi

Two blank lines here.

XU xuanyi

Two blank lines here.

XU xuanyi

Two blank lines here.

XU xuanyi

Two blank lines here.

XU xuanyi

No blank line here (django, djblets, and reviewboard are all "3rd party" from checklist's perspective).

daviddavid

No blank line here (django, djblets, and reviewboard are all "3rd party" from checklist's perspective).

daviddavid

These can also be chained, eliminating the need to define $itemLi (which seems to be missing a var statement anyway): …

daviddavid

These can be chained: this.$el .hide() .before(editView.$el);

daviddavid

In javascript, a trailing comma on the last entry in an array or object can break on some browsers.

daviddavid

We generally use _$ instead of $_ for internal jquery variables.

daviddavid

In javascript, a trailing comma on the last entry in an array or object can break on some browsers.

daviddavid

This needs to independently test keyCode against ENTER and 13. Right now this evaluates to only testing against ENTER: if …

daviddavid
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. checklist/checklist/extension.py (Diff revision 1)
     
     
    Show all issues
     'AccountPageFormsHook' imported but unused
    
  3. checklist/checklist/extension.py (Diff revision 1)
     
     
    Show all issues
    Col: 50
     E231 missing whitespace after ','
    
  4. checklist/checklist/extension.py (Diff revision 1)
     
     
    Show all issues
    Col: 56
     E231 missing whitespace after ','
    
  5. checklist/checklist/extension.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (83 > 79 characters)
    
  6. checklist/checklist/models.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     W391 blank line at end of file
    
  7. Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  8. Show all issues
     undefined name 'ObjectDoesNotExist'
    
  9. Show all issues
     undefined name 'DOES_NOT_EXIST'
    
  10. 
      
SU
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. Show all issues
     undefined name 'webapi_response_errors'
    
  3. 
      
SU
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/checklist.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. 
      
SU
SU
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. 
      
SU
SU
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. 
      
SU
XU
  1. 
      
  2. Show all issues

    Two blank lines here

  3. Show all issues

    Two blank lines over here.

  4. Show all issues

    Two blank lines here.

  5. Show all issues

    Two blank lines here.

  6. Show all issues

    Two blank lines here.

  7. Show all issues

    Two blank lines here.

  8. Show all issues

    Two blank lines here.

  9. 
      
SU
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    No blank line here (django, djblets, and reviewboard are all "3rd party" from checklist's perspective).

  3. Show all issues

    No blank line here (django, djblets, and reviewboard are all "3rd party" from checklist's perspective).

  4. Show all issues

    These can also be chained, eliminating the need to define $itemLi (which seems to be missing a var statement anyway):

    $('<li class="rbchecklist-template-item" />')
        .text(item)
        .appendTo($items);
    
  5. Show all issues

    These can be chained:

    this.$el
        .hide()
        .before(editView.$el);
    
  6. Show all issues

    In javascript, a trailing comma on the last entry in an array or object can break on some browsers.

  7. Show all issues

    We generally use _$ instead of $_ for internal jquery variables.

  8. Show all issues

    In javascript, a trailing comma on the last entry in an array or object can break on some browsers.

  9. Show all issues

    This needs to independently test keyCode against ENTER and 13. Right now this evaluates to only testing against ENTER:

    if (event.keyCode === $.ui.keyCode.ENTER ||
        event.keyCode === 13) {
    
  10. 
      
SU
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        checklist/checklist/models.py
        checklist/checklist/resources/checklist_template.py
        checklist/checklist/extension.py
        checklist/checklist/resources/__init__.py
        checklist/checklist/resources/checklist_resource.py
    
    Ignored Files:
        checklist/checklist/static/css/accountpage.less
        checklist/checklist/static/js/models/checklistTemplate.js
        checklist/checklist/static/js/views/checklistAccountPageView.js
    
    
  2. 
      
david
  1. I'm going to make some slight changes to the stylesheets and push this. Thanks!

  2. 
      
SU
Review request changed
Status:
Completed
Change Summary:
Pushed to master (b747249)