trigger a backup when flagging and unflagging quiz questions

Fixes #CNVS-2434

Test plan:
* On master, using Safari, flag and unflag questions on a one
  question at a time quiz and navigate around using next/prev
  buttons and the sidebar navigation. The flags do not stick.

* On this branch, flagging and unflagging both trigger a quiz
  backup, so the flags should be saved properly.

Change-Id: I1f265f8636567e0db094c8abcffe55d95dde35b7
Reviewed-on: https://gerrit.instructure.com/16471
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Add new permissions management ui (role overrides)

When editing permissions for an account, course
or admin section the UI has changed to use
drop downs instead of a 6 state check box. It
has also been switched to use 100% backbonejs to
handle creating and editing roles. This works with
the roles api and allows you to create custom
roles for courses.

fixes #CNVS-1165

Test Plan

Apply this test in two places. The Site Admin and
a custom university.

1. Go to the "permissions" tab
2. Notice permissions are available per role in a
table.

------------ Adding/Removing Roles --------------
1. When under the "Account Role" tab click
"Add Role"
2. Enter a role name and click "Create/Add"
3. A new role should appear automatically.
4. You should be able to delete this role by
clicking the x next to it's name.

------------ Editing Permissions ----------------
1. Go to a role in the permissions tab.
2. Try to edit one of it's permissions. It should
have a drop down with options to select
permissions. You should be able to enable/disable
or set to default and lock the permission.
Read only permissions cannot be clicked on.
3. Buttons with default set should have a special
"default" class added to the button representing
its permission.

------------ Organization of Roles --------------
1. In the course role tab, add a few roles with
different base types (use the dropwdown)
2. Roles should be grouped together by base role
type.

------------ Automatic Saving ------------------
1. Change a permission on a role
2. The role should automatically save the
the permission after selecting the option you want

Change-Id: I343afc36b85183e5913c8eef6111ea2c5ae62726
Reviewed-on: https://gerrit.instructure.com/16323
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
log the ErrorReport id after creating it

And log some basic ErrorReport info if creating it fails

Change-Id: I4853569f6a1107321bc3bc05e7fa413a69996a6e
Reviewed-on: https://gerrit.instructure.com/15981
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
add section name to title of per-section events in C2

fixes #CNVS-2013

the title is formatted "event name (section name)"

test plan
- create an event with per-section dates
- ensure that in calendar2, the events show the section names
  in their titles

Change-Id: I1f6eebdbb839b0d5154db5877266e6de9d55a341
Reviewed-on: https://gerrit.instructure.com/16360
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fix popover positioning on calendar 2

this: http://cl.ly/image/0J0j0p393P3N
instead of: http://cl.ly/image/2q060C2H393R

Change-Id: Ie59206a5957097bc33fa096ed96de4c7ba48375a
Reviewed-on: https://gerrit.instructure.com/16332
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
don't include submission comments in stream items, fixes #CNVS-2506

also limit number of root discussion entries (they still need to be there
per the current api implementation)

test plan:
1. as a student, submit some homework
2. as a teacher, grade the homework and add a comment
3. as both users, ensure the dashboard loads correctly (submission stuff
   doesn't show on the stream, so there are no visible changes)
4. as a teacher, start a discussion
5. as a student, comment on the discussion
6. as both users, ensure the dashboard loads and you see the discussion
   under recent activity

Change-Id: Iaa2569b2890c0ead1dc96252d327f59527be6568
Reviewed-on: https://gerrit.instructure.com/16488
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
don't include submissions in recent_stream_items

dashboards don't show these, and existing ones can be a little crazy if
they have lots of submission comments

also change cache key so these get regenerated

test plan:
1. dashboards should work
2. stream item api should work
3. specs should pass

Change-Id: I245f4464189a507f0e1a8c9dc1c4c1e9fd4b7566
Reviewed-on: https://gerrit.instructure.com/16502
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
additional spec coverage for enrollment permissions

refs #CNVS-2036

Added these specs while exploring the story
regarding teachers and the manage_sections
permission.  Per brianp and cody, this may
not really be a bug, so it may not require
any work, but these specs are still valid
for the current behavior of the system
so it seems valuable to keep them.

TEST PLAN:
No production code has changed.  If the
specs pass jenkins, we're good.

Change-Id: I6f46bf997df43149de46561fe8473faddbd8a8bc
Reviewed-on: https://gerrit.instructure.com/16397
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
allow account admins to edit notifications warning pref.

fixes #CNVS-2530

account admins now have the permissions to edit the
external notifications warning preference. previously
this permission was only given to people with
:manage_site_settings permissions on the site admin
account.

test plan:
  * create an account admin user;
  * on the account settings page, click the notifications
    tab, check the external notifications warning checkbox,
    reload the page, save your changes, and verify that
    they've persisted across page loads.

Change-Id: I0b2a6403e3ae3e8bf5372b0bd2f9ea9887e0c89c
Reviewed-on: https://gerrit.instructure.com/16520
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
improve AR.wildcard to support case-sensitive wildcards

Change-Id: I93bfd1462da3fd787fd71d00380a53ef5cb72ddb
Reviewed-on: https://gerrit.instructure.com/14709
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix outcome state standards pagination

we were filtering the common core group in the wrong place which caused
a javascript error, which in turn broke any further pages from loading via
ajax.

fixes #CNVS-2526

test plan:
- in an environment where there is a page of state standards after the page
  that contains the common core group
- make sure they all load
- make sure common core still works correctly as well, and is excluded from the
  state standards folder

Change-Id: I7c636a263fc8dc2a4a5a9cadc5595c160f693848
Reviewed-on: https://gerrit.instructure.com/16514
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
use .build instead of .new when generating calendar event

It seems that for some courses, calling
course.calendar_events.new.context returns nil, instead of the course.
For other courses it works, I'm trying to determine what the difference
is, but using .build instead of .new fixes things to work correctly.

fixes #CNVS-2542

test plan: Since this only happens on some courses, it may be difficult
to reproduce until we know exactly what triggers the bad behavior. In
any case, you should be able to visit /calendar without seeing an error
page, and you should be able to create new calendar events from that
page.

Change-Id: I3d4c17676b39382f61ef8ebffb35cf47eec39fa5
Reviewed-on: https://gerrit.instructure.com/16526
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
add id to query results on outcome report

test plan
 * run report where there are over 1000 results
 * report should run and generate without error

Change-Id: I61e32f31f9719a577b3ffc0497da815ecf6f0f27
Reviewed-on: https://gerrit.instructure.com/16507
Reviewed-by: Duane Johnson <duane@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
don't expand dashboard category on link click

fixes #CNVS-2369

test plan:
1. On the dashboard recent activity, click a
   course/group link in a category header.
2. The category should not expand

Change-Id: I114cbf59a4fb5e012b6f42d70d86f5be06076351
Reviewed-on: https://gerrit.instructure.com/16375
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
conversations transitionary commit

so plugins can start passing users to to conversation methods

Change-Id: If8cf75de862f7e96bf9b69daf809a79f6c5d0aa0
Reviewed-on: https://gerrit.instructure.com/16534
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
use overridden due dates on modules page

indicates multiple overridden due dates on multiple sections if
they are visible to a teacher/ta/designer

if there are different dates, it sends all the information back
this json info can be used in the future for a detailed popup

but for now, simply indicate with text that there are
multiple due dates for the assignment

if they are a student, then only show them the latest override
that applies to them

test plan:
* create an assignment
* create a module, add the assignment as an item
* create another course section
* override the assignment date for one section,
then override it to another date for the other section
* go to modules page, should see "Multiple Due Dates"

* create a ta/teacher/designer/student, restrict them to one section
* login as the ta/teacher/designer/student, should see one due date

closes #CNVS-2010 #CNVS-2011

Change-Id: Ieab089a27e4e4e7bea26b1c597859bf8b77dc802
Reviewed-on: https://gerrit.instructure.com/16401
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
allow plugins to define additional periodic jobs

refs #CNVS-2333, #CNVS-2334, #CNVS-2335, #CNVS-2336

test plan:
n/a, this change doesn't do anything until a plugin defines some jobs

Change-Id: Ie7330f6f1d9e8704891dc729f7b304a55b506cdb
Reviewed-on: https://gerrit.instructure.com/16469
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
update assignments api to handle frozen assignments

Allows several new fields in the Assignments API to both update existing
assignments and set attributes on freshly created assignments.

test plan:
  - run through the api trying each field in the generated
    documentation.
  - Make sure you can create assignments with every field, and update
    assignments with every field available in the documentation. The
    specs do this so they should pass as well.

closes #CNVS-2190

Change-Id: I0d67e379777b5a313f45289f23852122b1e61a37
Reviewed-on: https://gerrit.instructure.com/16114
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
add groups to collaborators table, add api endpoint.

refs #CNVS-1160

adds group_id to collaborators table to identify
collaborators associated w/ a group versus collaborators
added as individuals.

also adds a new API endpoint to return collaborators for
a given collaboration.

test plan:
  * run migrations to add the group_id column;
  * create new collaboration and add at least one user
    as a collaborator;
  * in the console, add a group as a collaborator, giving
    it a group_id and no user_id;
  * make a GET to /api/v1/collaborations/:id/members
    and verify that users added as individuals are
    returned as type 'user' and that users added with
    group_ids are returned as type 'group' and not
    displayed as individuals.
  * verify that one record exists for each collaborator
    regardless of type;
  * verify that adding per_page params will paginate
    requests to the endpoint.

Change-Id: Id509fd0e7eebe6a889b2ca86e8d7d8d1a9e93c63
Reviewed-on: https://gerrit.instructure.com/16203
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
improve accessibility of conversations gear menus.

fixes #CNVS-1330

replace custom conversations gear menus w/ menus used
everywhere else in canvas to make them more usable by
persons w/ screen readers.

test plan:
  * using a screen reader, navigate to conversations;
  * navigate to the actions menu of an existing
    conversation and click it w/ the keyboard;
  * verify that you can navigate to each menu item, that
    it is properly read, and that menu items can be
    clicked using the keyboard.

Change-Id: Ic67bb56e684702a871b2199fdbdb9615625aae81
Reviewed-on: https://gerrit.instructure.com/16394
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>