fix ember quiz index edit link regression

closes CNVS-12256

regression introduced with the switch to ember-data.

test plan:
  - enable fabulous quizzes flag on Account.default.settings
  - as instructor navigate to quiz index
  - click drop down for any quiz
  - select the edit link
  - verify that quiz edit page loads for selected quiz

Change-Id: Id47c0c00509cad0e8de314a34ecdd23bf3cd63b5
Reviewed-on: https://gerrit.instructure.com/32982
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
disable ability to regrade a question if they change the question type

fixes CNVS-10868

test plan:
  - as a teacher
    - create a quiz with both multiple choice and multiple fill in the
      blank questions
    - publish the quiz

  - as a student
    - take the quiz

  - as a teacher
    1:
    - attempt to change the answer for the multiple choice question
    - regrade should be successful
    - view the results for the student's quiz - the answer should be regraded
      successfully

    2:
    - attempt to change the answer for the multiple fill in the blank
    - there shouldn't be an option to regrade
    - attempt to change the question type for the mfiib question to be a
      multiple choice question.
    - now try to change the answer
    - it should show you a message that regrade is disabled because you
      changed the question type
    - view the results for the student's quiz - all answers should show up
      and regrade should not be performed on the question

    3:
    - attempt to remove a question from the multiple choice question
    - attempt to change the answer and regrade
    - it should show you a message that regrade is disabled because you
      removed answers
    - view the results for the student's quiz - all answers should show up
      and regrade should not be performed on the question

Change-Id: I50f15a0f1485bb6e152a90d9bb9eefcffe1bd2e1
Reviewed-on: https://gerrit.instructure.com/32469
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
fix success flash color contrast

closes CNVS-6675

previous green color didnt have enough contrast for WebAIM - WCAG

Change-Id: I36ae6eaddff0d622eb62e043709753893bed55e7
Reviewed-on: https://gerrit.instructure.com/32978
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
export/import media file captions

test plan:
 - have a course with a video file embedded in content somewhere
   (such as a wiki page)
 - create captions for the video and verify that they play back
 - export this course to an .imscc
 - import it to a new course
 - ensure the captions play back in the copied course

fixes CNVS-10228

Change-Id: Ie15076bc31ad36efabf7a718d12bd8a9b12e45e1
Reviewed-on: https://gerrit.instructure.com/32680
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
fix editing due dates for courses which don't have a default section

Test Plan:
  For assignments, quizzes, and discussions:
  - Create a course without a default section
  - You should be able to save assignment overrides and due dates just
    fine.
  - Create a course with a default section
  - You should be able to save assignment overrides and due dates just
    fine.

fixes CNVS-5615

Change-Id: I6d98d0944b27e32b2eb7109acbdd126f5b231f64
Reviewed-on: https://gerrit.instructure.com/32856
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Stanley Stuart <stanley@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
add lock_version to context module progressions

preparation for rework of the context module progression evaluation

test plan:
 * automated tests pass

refs CNVS-11818

Change-Id: I10618e576c7b44aebce0a9803876b8f543d9b61b
Reviewed-on: https://gerrit.instructure.com/32904
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Mark Severson <markse@instructure.com>
use quiz namespace for module requirements

closes CNVS-12052

test plan:
  - do test plan with and without draft-state
    - create two modules, add pre-req in second for the first
    - add quiz to second module
    - do with and without a hard refresh
    - click second module gear icon and choose edit
      - click 'add requirement'
      - verify that you can add the quiz as a requirement
  - repeat using all possible quiz types

Change-Id: If44a1538427db22bde2da57514d52f834c2c62cd
Reviewed-on: https://gerrit.instructure.com/32966
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jason Madsen <jmadsen@instructure.com>
fix missing moderate link for practice quizzes

fixes CNVS-7865
The 'Moderate Quiz' link wasn't showing for practice quizzes because of
how JavaScript decides to display the right bar.  In quiz_show.js, it
checks to see if there are any <li> elements as descendants of
ul.page-action-list, and displays ul.page-action-list if there are.
The Moderate Quiz link wasn't wrapped in an <li> tag, and since there
were no other <li> elements rendered, ul.page-action-list wasn't displaying.
It would display after students had taken the test, since that would
render the Statistics link (which was properly wrapped in an <li>)

Test plan
- Create a practice quiz
- You should see the 'Moderate This Quiz' link in the right sidebar,
  regardless of whether or not students have taken the quiz yet.

Change-Id: I08f0cec724ada62a4e49c8218321149da9f5f83b
Reviewed-on: https://gerrit.instructure.com/32985
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
fix negative variable evaluation on formula questions

fixes CNVS-9970
If you use a negative variable as the first element in a formula
expression, formula question operation breaks.  For example, when you
put:

-[x]+5

in the body of the formula question,  and then attempt to put:

-x+5

in the formula definition, the formula question JavaScript does not know
how to parse the expression. This commit adds graceful logic for these cases.

Test plan
- Create a formula question with the initial variable cast as negative
- Formula definitions should be calculated correctly.
Regression
- Confirm that formula questions still work correctly with positive
  variables

Change-Id: I8d2c6f596bb0211e375c5a347dfa8a1ea2870271
Reviewed-on: https://gerrit.instructure.com/33003
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
move completion requirement text under module item title

fixes 12030

We are just moving where completion requirements are displayed.

Test Plan

As a Teacher and Student
When I go to the modules page
And I have module items with completion requirements
Then I should see those requirements listed under the title of the module
item

As a Teacher and Student
When I go to the modules page
And I have module item without a completion requirement
When I add a completion requirement via the edit button
Then I should see the completion requirement dynamically be added under
then title of the module item it's for

Change-Id: Iad565d37cc156014572d15597ae70e6bdb9fc297
Reviewed-on: https://gerrit.instructure.com/33042
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Sterling Cobb <sterling@instructure.com>
add better interaction and highlighting on content migration page

fixes CNVS-11644

When selecting content when doing a migration, there are some weird
things that happen with the blue highlighted line. This commit fixes
that so clicking an item will now highlight that item. Also hovering
over an item will have a color and the colors changed.

Test Plan
1. Migrate a course and select the content you want to migrate from
that course.
2. Pull up the Select Content dialog window .
3. Notice that when you hover over the tree items it has a hover state
color.
4. Clicking on an item should change its color to a darker blue.
5. You should be able to use your keyboard to navigate with your
arrows key right after selecting a treeitem.

Change-Id: I2cff94dc322f12eaff499a17287dff4174dcae46
Reviewed-on: https://gerrit.instructure.com/32476
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
Product-Review: Sterling Cobb <sterling@instructure.com>
bump canvas_connect to version 0.3.3

test plan:
* using rails 3, plugin settings should render for adobe connect

fixes #CNVS-12185

Change-Id: Ie220862400eac8b9a6f7200d611eeec8a632a1c3
Reviewed-on: https://gerrit.instructure.com/33053
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
returns blank avatar when avatar template is given nil user

fixes CNVS-12080

test plan
- as a student, make a submission to a graded discussion topic
- add the submission to the student's eportfolio
- view the eportfolio page
- ensure that no page error is produced

Change-Id: I63d3120f6bb26d37db90d9081e889fd2757fcfcd
Reviewed-on: https://gerrit.instructure.com/32972
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
discussions: fix "close for comments" text on reopened topics

fixes CNVS-12127

test plan:
  1. Log into a course as a teacher
  2. Create a discussion
  3. Navigate to the Discussion Index Page
  4. Close the discussion for comment
  5. Pin the discussion
  6. Open the cog menu and click on "Open for Comments"
  7. Open the cog menu again
  8. Verify that it gives you a "Close for Comments" option

Change-Id: I26036b0380beae75c79f893149099dfd572b71dd
Reviewed-on: https://gerrit.instructure.com/33048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
add option to force re-login for oauth, fixes CAT-68

test plan:
- login to canvas
- do an oauth login from an external app, or with a manual GET request
  according to Step 1 of the "Web Application Flow" at
  https://canvas.instructure.com/doc/api/file.oauth.html,
  and make sure you include the query param force_login=1
- verify that canvas sends you to /login
- verify that without the param force_login=1, canvas still sends you
  directly to /login/oauth2/confirm

Change-Id: I49cd43cc48edf46f192221f5cf8707ee00e0bd8a
Reviewed-on: https://gerrit.instructure.com/32988
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Reviewed-by: Nick Houle <nhoule@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fix auto submission of quizzes with due and lock dates

fixes CNVS-11703
This commit addresses a bug where due dates and lock dates were not
triggering auto submission by javascript when a quiz was taken.

Test plan
- Create a timed quiz with no due date
- take the quiz
- it should auto submit after the time is up.

- Create a quiz with a due date
- take the quiz
- it should auto submit when the due date is reached.

- Create a quiz with a lock date
- take the quiz
- it should auto submit when the lock date is reached.

Change-Id: I8e01b11d7ad060c49538eb53ceec77c5490c368f
Reviewed-on: https://gerrit.instructure.com/32778
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
calendar: upgrade color-slicer

fixes CNVS-12227

test plan:
  * create at least 20 courses
  * enable and open calendar 2
  * verify that all neighboring courses have visually
      distinctive colors

Change-Id: I2d3f9fb0e669cbc4fcda55a432cba07c18dbdfb5
Reviewed-on: https://gerrit.instructure.com/32931
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
fix selenium specs

fixes: CNVS-12304

test plan:

This only changes a spec file, shouldn't need other testing

Change-Id: I5e33b85c7df8d7c29b2562e46d9d3fa21ff15b69
Reviewed-on: https://gerrit.instructure.com/33108
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
gpa scale grading standard

fixes CNVS-8931

makes a new grading standard type called "gpa scale"
only allows for grades on the GPA scale
modifies GB2 dom elements if gpa scaled
modifies rubric_assessment response to properly change grade
adds dialog when selecting gpa scale grading type
refactors grading_standard.rb to use instance methods (not class)
added related tests

test plan:
  - As a Teacher, create an assignment with GPA Scaled grading type
    - Enter a grading scheme like the one in grading_standard.rb/default_gpa_scheme
    - Go to GB2 and grade this assignment
      - grades not in the schema should be "-"
      - letters that aren't in the scheme should be a "-"
      - if "3.0" is in the grading standard an input of 3 should
        switch to 3.0 automatically
      - letters in the scheme should work upper or lower case
      - setting default grade should work with the same rules
      - dom elements of this assignment should have a special class
    - Other assignments should work as usual in GB2
    - Go to Assignment Edit Page
      - when selecting Display Grade as "GPA Scale" a ? icon should pop up
      - clicking this icon should open a modal with sane text
    - Go to GB1
      - Grading an assignment should work like GB2
      - GB1 should work as expected for non GPA Scale Assignments
    - Go to the SpeedGrader
      - grading assignments that are GPA Scaled should work similarly to GB2
      - SpeedGrader should work as expected for non GPA Scale Assignments
    - Enable Rubric based grading on an assignment
      - once the rubric is filled out in SpeedGrader, the correctly rounded GPA should be inserted on save
      - once the rubric is filled out in Submission Edit page, the correctly rounded GPA should be inserted on save
      - rubrics should work as expected for non GPA Scale Assignments
    - Other areas in which GradingStandards are used should work as expected

Change-Id: Ide1ea5ca13a70116ae3535b2c8e105ece79a34c8
Reviewed-on: https://gerrit.instructure.com/29742
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
Refactor google docs to be standalone not mixin.

fixes: CNVS-12096

Change-Id: I6fa7d6d57bfc9063b49334a8e528aaaa9fc7f8c2
Reviewed-on: https://gerrit.instructure.com/32715
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>