Commit Graph

29 Commits

Author SHA1 Message Date
James Williams a354602ea8 rails 5.1: bunch of other specs
Change-Id: Ic6e4f64874021639f5e8950e2fe42f714ae31250
Reviewed-on: https://gerrit.instructure.com/120225
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-27 12:35:30 +00:00
Landon Wilkins 241f6be120 da licença part 2
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ic8161ac858d70976f53f78e01572f3eb9bb61990
Reviewed-on: https://gerrit.instructure.com/110019
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
2017-04-27 21:09:03 +00:00
Cody Cutrer 6751891617 rails 5: fix lots of deprecation warnings
mostly s/uniq/distinct/, and choosing a content type for render :text

Change-Id: I53a2e77d23ecc43162f70b4fd88303cc1539c20b
Reviewed-on: https://gerrit.instructure.com/104762
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-13 19:07:11 +00:00
Cody Cutrer 556f0b64bf rails 5: s/_filter/_action/g
fixes CNVS-34832

the arguments to these methods have not changed, just their names. and the
new methods became available in Rails 4, so we can start using them now

and prevent someone from doing old-style in the future

Change-Id: I61aa5512995dc8f25f3f7bd009a6cfa0a030e274
Reviewed-on: https://gerrit.instructure.com/101401
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-02-09 23:03:40 +00:00
Cody Cutrer 1f03606627 aws sdk v2 support for attachments
closes CNVS-33615

test plan:
 * upload and download files using S3
 * submit an assignment
 * do an SIS import with parallel
 * do a course copy
 * export and import a course
 * upload some custom css file in theme editor
 * test a canvadoc and crocodoc preview

Change-Id: I9145b39728938e7e5903d23c4a4598fc8df4ef45
Reviewed-on: https://gerrit.instructure.com/93002
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2017-01-24 21:09:14 +00:00
Simon Williams 3616d2a0a4 add tests for brand_configs_controller
test plan: specs should pass

Change-Id: I433371f421ac755a20ed28f3db316835ae53c2e1
Reviewed-on: https://gerrit.instructure.com/94200
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2016-11-02 16:45:24 +00:00
Ryan Shaw 9501380c34 remove all occurrences of use_new_styles? from ruby code
closes: CNVS-31371

test plan:

* do an lti launch, it should work
* check a couple pages in this list of changes,
  they should work

Change-Id: I8005162dd7e45711cc74204f47a76f9133870a6d
Reviewed-on: https://gerrit.instructure.com/89024
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2016-09-12 15:31:07 +00:00
Ryan Shaw 9f21168d68 fix so the previews of ThemeCards show the right default colors
fixes: CNVS-29360

test plan:

*in root account set a primary color purple
* go to "Themes" for sub account
* the preview for the "Default Theme" should
  have purple stuff in it
* you set other colors / images and make sure
  those show up in the theme card preview as well

Change-Id: Id07899ddf0f473090cd616268b5781d7af318433
Reviewed-on: https://gerrit.instructure.com/81708
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2016-07-12 22:19:03 +00:00
Simon Williams d4a0ef4a71 only allow access to theme urls if new ui is enabled
fixes CNVS-29847

test plan:
- disable new ui
- try to go to /accounts/x/brand_configs
- you should get a message telling you to enable new ui

Change-Id: Ifefe15bf5da2d3da16cb07fdc6d71619e9a868d1
Reviewed-on: https://gerrit.instructure.com/82596
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-06-20 20:25:05 +00:00
Rob Orton ce1bdc0931 fix typo s/accout/account/g
Change-Id: I84fa5c042a6fcdf2411501d8fb28b6b3081642d1
Reviewed-on: https://gerrit.instructure.com/82356
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2016-06-13 18:08:05 +00:00
Ryan Shaw bcd0569251 handle regenerating all sub account themes & shared themes
fixes: CNVS-28400

test plan:

test 1.
for root account with unbranded child but branded
grandchild. aka:
When you have Acct (with Theme A) -> 
Sub Acct (with no theme) -> 
Sub Sub Account (with theme B), 
and update Theme A, Theme B is not updated to inherit 
from the new A.

* start with root no brand config, child no brand
* create a theme for grandchild with red buttons
  and js file with "console.log('from grandchild')"
* go to root. set a theme with blue nav bg &
  js file with "console.log('from root')"
* you should see progress for generating grandchild
  when you hit "save"
* go to page in grandchild. buttons should be red,
  nav bg should be blue. js console should have
  "from root" logged first, then "from grandchild"

test 2:
* create a bunch of saved themes in child and grandchild
* save a new theme to "root"
* when any of the saved themes are applied they
  should be based on the new root's theme (use
  colors and console.log's to verify)


Change-Id: Ic9dbeea1524034ef60b758398eca30bc019aa32e
Reviewed-on: https://gerrit.instructure.com/79739
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2016-05-18 22:22:39 +00:00
Ryan Shaw 1bee29bc66 All of the stuff from the save_a_theme dev branch
this commit is the result of squashing a bunch of
others together.  this is everything that was
already on the dev/save_a_theme branch as well as
the "Add specs" commit.

I left the test plans from some of the squashed
commits in case they are helpful for QA

Test plan:
- Recompile assets, restart Canvas and clear browser
  cache
- Go to Admin > [Your school name]
- Click on Themes in the context menu
- You should now see a collections page with
  a theme card for all the themes you have in
  Theme Editor: http://screencast.com/t/lb5vozF7
- Note: it might be my database, but on my end,
  I don't see a theme card for my Canvas default
  theme. There are also some brand colors missing
  for my theme cards. I'll be interested to see
  if you hit the same thing. These are issues that
  we can resolve with Ryan when he is back.
- You should be able to click on the Apply and Delete
  buttons and see the confirm-overlays. We still need
  final copy for these.

Test plan:
- Go to your institution's Settings page and click
  Themes on the context menu.
- You should now see a page listing all the default
  and user-created themes in your Canvas installation.
- Clicking on each theme will open it inside theme
  editor.
- The current/active theme will be correctly styled
  with a green outline

change redirect targets and messages in theme editor

test plan:
exiting theme editor
should redirect you back to the /accounts/x/themes page
instead of /acounts/x

make room for footer in theme editor

test plan:
in theme editor, scroll the preview to the bottom
you should be able to scroll all the way, without
having the bottom cut off by the footer

remove "theme editor" button from account user/course search

this is not needed since "Themes" now shows up
in the left nav.

test plan:
turn on the 'Course and User Search' feature flag
go to accounts/x
you should not see a "theme editor" button on the right
aka, not like this: http://cl.ly/2G2C3p3s3n0C

fix "Exit" button in theme editor

we were warning "you will lose unsaved changes"
even when you hand not made any changes

add specs to "Save A theme" stuff

closes: CNVS-27961

test plan:
do a whole regression test on the theme editor

don't show both "k12 theme" and "canvas default" as options

fixes: CNVS-25495

description (and test plan):

if you are a k12 school, rather than seeing both
"Canvas Default" and "K12 Theme"
as options on the tiles of system themes to start from,
you should now just see "Canvas Default".
if you pick that, it should show the k12 theme.

Change-Id: I5c2512e576dcb2aedaa899e17080d9c106e159ca
Reviewed-on: https://gerrit.instructure.com/78163
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2016-05-18 22:01:25 +00:00
Ryan Shaw 298e6808d5 get sub account branding and custom css/includes working
fixes: CNVS-24787
fixes: CNVS-23964
fixes: CNVS-23957 - Handle parent account custom css/js for new_styles
test plan:
* set up a root account, child account, and grandchild account
* use theme editor to set a custom css/js file for each
  (eg: for css `* {color:red}` and for js 'console.log("from grandchild")`
* make a course & a group in the grandchild account
* load a page in that course and group and make sure
  you see grandchild account's branding, and root's,
  child's, and then grandchild's css loaded on the page
  (grandchild should be loaded last so you see it's css
  effects override root or child's and you should see
  the console.log from root then child then grandchild)
* view a page in "child". it should have root and child's
  css/js but not grandchild
* as a user that only has enrollments (account associations)
  in "child", go to the dashboard. you should see
  css/js for both root and child but not grandchild

fixes: CNVS-25051 Opening Theme Editor for
sub-accounts shows incorrect theme preview
test plan:
* Go to a sub-account in theme editor and change
  settings so the Branding is different and save.
* the preview on the right should reflect your
  changes both after you "apply" and "save"
  (and not just show the preview of the root
  account's branding)

fixes: CNVS-23406 - global JS and CSS files are being
included when Global CSS/JavaScript includes is false
test plan:
* go to /accounts/self/, and go to theme editor and
  upload a css_override
* see that that css is loaded on pages
* back in root account settings disable Global
  CSS/JavaScript includes
* check that the css is no longer loaded.
* do the same thing checking a subaccount's custom css

fixes: CNVS-25558 - load whole chain of custom css/js 
in native app api requests

test plan:
* make api request for a wiki page in course in a 
  subaccount that has custom css/js within a root 
  account that also has custom css/js
* you should see both the root account's css/js and 
  the child account's returned in the response

to test grandchild js issue jeremyp found:
* go to theme editor for a grandchild account
* choose a js override file (like: `console.log('first')`)
* preview & apply
* you should see "first" in console
* go back to theme editor, pick a new file (like: `console.log('second')`)
* preview & apply
* you should only see "second" in console. not "first"

Change-Id: I8d9047948f5da94be41e0205844629a170f980af
Reviewed-on: https://gerrit.instructure.com/68249
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
2015-12-19 02:47:39 +00:00
James Williams bed6e2350a translate brandable css variable names
test plan:
* theme editor variable names, group names and helper text
  should all be lolcalized

closes #CNVS-23768

Change-Id: I01846a0c0354342cc5593d6ac153f117ccc39b64
Reviewed-on: https://gerrit.instructure.com/65809
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-27 18:26:39 +00:00
Michael Nomitch 0ef67dacb4 dont mutate BrandableCSS::BRANDABLE_VARIABLES
fixes CNVS-23329

test plan:
  - turn new UI on for several unrelated
    accounts & change button color (and nothing
    else)
  - edit a parent account to have a logo
  - edit a subaccount of this parent to
    have some custom colors
  - try to sign into one of the unrelated
    accounts
  - it does not show the wrong logo

Change-Id: I21354452c7743e91154a5f23d6e3dc688c2e11b6
Reviewed-on: https://gerrit.instructure.com/64717
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2015-10-08 21:00:17 +00:00
Rob Orton d252a7f2b4 mobile css and js overrides
closes CNVS-19900

test plan:
 - create a brand_config for an account
 - apply brand_config
 - add ?mobile=1 to an api request that returns a
   body (like a wiki page);
   observe no additional stylesheets in the body
 - go to /accounts/self/, and go to brand
   config and upload a mobile_css_override
 - add ?mobile=1 and check the api result again
   your stylesheet should be there appended to the
   body of the wiki page
 - back in brand_config, remove the uploaded file
 - check your source again - there should not be
   an empty stylesheet tag

Change-Id: Ief728a397d185282a57f8cede0916c7ffe4a2584
Reviewed-on: https://gerrit.instructure.com/61885
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-09-28 19:24:55 +00:00
Michael Nomitch 8f443fe92d subaccount theme progress bars
fixes CNVS-22541

test plan:
  - go to account that has sub accounts
    with their own themes already made
  - redo the style of the parent account
  - hit Apply
  - you see the progress of each of the children
  - each child progress bar goes away when
    it is done
  - once all are done you are redirected to the
    account settings page

Change-Id: I109ed9f17acd549dc527a3c62813aeb3ab1bc634
Reviewed-on: https://gerrit.instructure.com/62392
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Colleen Palmer <colleen@instructure.com>
2015-09-22 16:17:59 +00:00
Michael Nomitch 89e455b521 account settings to allow branding on subaccounts
refs CNVS-21426

test plan:
  - make an account (parent) with a child and
    a grand child
  - on the parent go to settings and
    enable subaccount branding
    (check "Let sub-accounts customize themes
    and add additional includes")
  - go to the grand childs account and they
    are able to open the theme editor
    - make a theme
    - it works
  - disable subaccount branding on the parent
    - both the child and grandchild cannot open
      the theme editor and lose their specific
      custom css (they have the root css tho)
  - turning it from the parent makes it all work again

Change-Id: I0b4c043de891c9201a4f58b867c3a9430b9c6b75
Reviewed-on: https://gerrit.instructure.com/61603
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2015-09-09 23:02:02 +00:00
Michael Nomitch 8a6819e85d subaccount branding (creation and trickle down)
fixes CNVS-21426

changes theme_editor routes to nest under accounts
show correct brand_config for subaccount
be able to theme subaccounts
parent account changes trickle down to subs
theme editor default values are that of parent account
add not in preview text that subaccounts dont show

test plan:
  simple creation
  - create a sub-account
  - brand it differently from parent
  - if you go to courses belonging to
    this subaccount, it gets their css
  - if you go to courses belonging to
    the parent you get the parent css
  - if you go to a user dashboard
    you get the parent branding
    (maybe we can add smarts to this
     later in case you only are in
     the subaccount?)

  trickle down
  - rebrand two values on the parent
    - one that the subaccount explicitly sets
    - and one that doesnt
  - apply this config on the parent
  - wait a little and go to the child account
    - its theme inherits values for the parent,
      but... if it explicitly sets those values
      itself then it doesnt inherit it
  - go to the editor for the subaccount
    - the placeholder values are those
      of the parent account (or the canvas
      default if the parent hasnt set it)

  - test trickle down with a sub-account and
  a sub-sub-account

still to do on different patch sets:
  - account settings to allow subaccount branding
  - show the progress of all the child compilation

Change-Id: Iaddba7036f564965427807c2fd8b0a6a5d524366
Reviewed-on: https://gerrit.instructure.com/61285
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
2015-09-08 20:30:22 +00:00
Michael Nomitch 039a996bc8 hide k12 styles unless flag is on
fixes CNVS-22216

test plan:
  - with k12 feature flag off
    - go to theme editor
    - it doesnt show k12 brand config
  - turn flag on
    - go back to theme editor
    - it does show k12 brand conifg
  - turn flag off and check that it goes away
  (note: it may take a little bit for the
   change to kick in)

Change-Id: Ic4ab4557d5330426128d26890d739ee6feb98a7b
Reviewed-on: https://gerrit.instructure.com/60783
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
2015-08-17 15:53:46 +00:00
Jennifer Stern 84933275d7 Add Upload CSS/JS tab to Theme Editor
refs CNVS-21431, CNVS-21425

Test scenarios: https://gist.github.com/junyper/7481e6a2b65a1b799bad

Change-Id: I28b24bce592952acfd33cb1303496b8178f0d4b4
Reviewed-on: https://gerrit.instructure.com/58780
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Reviewed-by: Colleen Palmer <colleen@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2015-07-28 22:35:52 +00:00
Michael Nomitch 65d278d56e theme editor - fix undo image error
fixes CNVS-22073

test plan:
  - go to theme editor
  - add an image and then undo
    having added that image
  - if that is the only thing youve
    changed so far, you do not get
    a preview button
  - once you change something else
    you can hit preview and it saves
    properly

  - apply theme with a non-default image
  - go to the editor and change back
    to default
  - you get an option to preview with
    the default
  - preview is successful

  - color & image changes act normally

Change-Id: Ia5de701177137625e65434ac316c22aec0e1dd39
Reviewed-on: https://gerrit.instructure.com/59056
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
Tested-by: Jenkins
2015-07-28 18:16:50 +00:00
Jennifer Stern c8f7ca0aae Redirect back to account settings when exiting the Theme Editor
refs CNVS-22055

This change replaces the 'X' close button with a 'Cancel' button.
Also now, whenever you exit out of the Theme Editor, via either
'Apply' or 'Cancel' you will be redirected back to the account
settings page instead of the preview iframe location.

These changes should make things work better once CNVS-2196 is
implemented.

This change also cleans up the Theme Editor header a bit, adding
the Canvas logo, and adjusting some padding/margins.

Test plan:
1. Open Theme Editor and click 'Cancel'. You should be redirected back
account settings page and the appropriate message should display.
2. Open Theme Editor, make some changes, click 'Preview', click 'Cancel'.
You should be redirected to the account settings page, the theme changes
should be reset/removed and the appropriate message should display.
3. Open Theme Editor, make some changes, click 'Preview', click 'Apply'.
You should be redirected to the account settings page and the appropriate
message should display.

Change-Id: If5f1aa67a87a1587d8f26b9134ccf9d33a299229
Reviewed-on: https://gerrit.instructure.com/58913
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Reviewed-by: Colleen Palmer <colleen@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2015-07-22 19:19:58 +00:00
Ryan Shaw 1e2d787cf9 show progress of them editor preview
closes: CNVS-21013

when the user hits 'preview' in the theme editor,
it fires off a delayed job to create the css files
and push them to s3. we need to show the user the
the progress of that job as it is working and
then reload the page when it is done.

I made a screencast to show how it should work and
what to look for:
http://screencast.com/t/x6EeOBiQT6d

test plan:

* go to the theme editor,
* make some changes (be sure to test both colors
  and images)
* press 'preview'
* notice the ProgressBar that comes up in a modal
* try exiting the theme editor, it should warn
  you if you have unsaved changes

Change-Id: I3f14beefba227b5ba23b33acf84e04542f48954e
Reviewed-on: https://gerrit.instructure.com/57626
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Foong <afoong@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2015-07-18 20:08:53 +00:00
Ryan Shaw f1727e48bf make K12 theme chosen by default if K12 is turned on
closes: CNVS-21850

test plan:
* turn on k12 feature flag
* you should see new icons and a new color theme
* go to theme editor, in the list of "start from
  a default" it should have "K12 Theme" selected
  by default.
* change some values, press preview
* it should still show the k12 icons but it should
  have your new branding colors.
* "K12 Theme" shouldn't be selected by default
  in the drop down.

Change-Id: I33ce7f51b57aa06da0bd5286e168d532e00821b3
Reviewed-on: https://gerrit.instructure.com/58344
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
2015-07-18 01:01:35 +00:00
Rob Orton 594a8693a2 allow account admins to use brand configs
fixes CNVS-21826

test plan
 - as an account admin you should be able to use
   brand configs

Change-Id: I907e856a9b675681c5d1bc099cec6b7c3cab7b34
Reviewed-on: https://gerrit.instructure.com/58521
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-07-16 22:39:27 +00:00
Ryan Shaw 87eba38b3e don't blow away the brandConfig someone else is working on
closes: CNVS-21804

this will also do a better job of cleaning up
the app/stylesheets/brandable_css_brands dir
(so when you compile sass, it won't do stuff
for brandConfigs that aren't being used anymore)

test plan:
open theme editor, make some changes, hit preview.
as a different user in a different browser,
open theme editor, make changes, press save.
now in the first window, try to hit save.
before it would break, now it will work

Change-Id: I094f737d35c854764a7c361bec4798b8a2203410
Reviewed-on: https://gerrit.instructure.com/58102
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
Tested-by: Jenkins
QA-Review: Nathan Rogowski <nathan@instructure.com>
2015-07-16 21:59:10 +00:00
Ryan Shaw 8530998c7d Add ability to close out the Theme Editor
fixes: CNVS-21433

test plan:
* open theme editor
* make a change, hit preview,
* notice how colors look different for you now
* click "cancel changes" in the top left
* it should take you to whatever page was open in the
  preview iframe
* you should not see the theme editor, and canvas
  should use the colors it had before you opened
  the theme editor

Change-Id: I47d4b1c736e3d7d4767151c1b17a3075ec822f07
Reviewed-on: https://gerrit.instructure.com/57559
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
2015-07-15 18:07:31 +00:00
Ryan Shaw 84a7192a36 A new way of doing css/sass & New Canvas Theme Editor
what this does:
* Changes the way we generate css so we are able to generate custom
  css for people that use the theme editor.
* Sets everything up so we can push all of our static assets
  (js, fonts, css, images, etc) to s3 pre-deploy and serve them
  from cloudfront. Yay! faster canvas for everyone!
* as part of that, this enables the rails asset pipeline just so we
  can use it to put md5s in our urls.  we don't use it for any of the
  coffeescript/sass/sprockets transformer stuff.
* adds a new "Theme editor" functionality (only for people that have
  have the use-new-styles feature flag turned on) where an admin for
  an account can pick their own colors/images for all the users
  at their account/school.
* when the user is done saving things in theme editor, it will,
  in a delayed job, generate all the css with against the variables
  that user specified and push it to s3 so it will be available to
  anyone else that requests it.  (the delayed job will shell
  out to a node.js executable called `brandable_css`).
* ability to pick an existing shared theme and to reset to
  blank theme. closes: CNVS-19685
* gets rid of jammit.

test plan:
(this is exaustive, so not every person has to do every step
but we should make sure at least someone does each of these things.
maybe as part of the review add a comment if you have done one of these
bulletpoints)

* before you check this out, compile all css and copy the
  public/stylsheets_compiled directory somewhere. after you check out
  this code and regenerate all the css. make sure there are no
  significant changes to the css output. (we updated the versions of
  node-sass and autoprefixer that we use so we want to make sure they
  don't change things in a way we weren't expecting)

* make sure the way we load css for handlebars templates still works.
  eg: if there is a handlebars template at
  app/views/jst/some/template.handlebars
  if there is also a scss file at
  app/stylesheets/jst/some/template.scss
  then that stylesheet should get loaded when that template is rendered

* check out the code and run migrations. browse around canvas,
  make sure css and js files load correctly as before.

* cody, jacob, or someone on queso: look at the db migrations and
  make sure everything looks good and that I am handling sharding
  correctly.
* verify that both rake canvas:compile_assets and guard, works as well
  as `node_modules/.bin/brandable_css` (note: if you have
  "node_modules/.bin" in your PATH (which you should), it will also
  work with just `brandable_css`)

* verify that passing the --watch option to
  `.bin/node_modules/brandable_css` works and picks up changes to
  sass files, images, fonts, or any other resource that goes into
  a css file. and that it only recompiles the css files that actually
  depend on that file.

* go to https://github.com/ryankshaw/brandable_css and check out the
  code there. that is what is actually doing the sass compiling

* create a config/canvas_cdn.yml file and add aws access creds and
  an s3 bucket and cdn hostname (for testing, you can use the credentials
  for instructure_uploads_engineering from
  https://gollum.instructure.com/OtherServiceTestAccounts ). for a test
  cdn hostname you can use https://diu0rq5m1weh1.cloudfront.net. that
  is a cloudfront bucket I set up on my personal account that points to
  instructure_uploads_engineering

* run rake canvas:compile_assets again, this time, at the end, you
  should see it run the assets:precompile task that puts md5s in filenames
  and, gzipps them, and copys them to public/assets.
  then you should see it run canvas:cdn:upload_to_s3
  (look at log/development.log for progress),
  which pushes everything to s3.
  closes: CNVS-17333 CNVS-17430 CNVS-17337

* try out the theme editor: turn on new styles, go to accounts/x
  (where x is the @domain root acount you are testing from) and click
  the "theme editor" button on the right side of the page.
  that should take you to a page that has the ability to pick colors/images
  on the left side and preview your changes in an iframe on the right
  closes: CNVS-19360 CNVS-20551

* test the "preview", "save", "reset", and "choose existing" functionality
  closes: CNVS-17339 CNVS-17338 CNVS-19685

* make sure that the themeeditor works both if you have
  config/canvas_cdn.yml set up and enabled as well as if you don't.
  if it is enabled, you should see it push the css for just that new
  brand config to s3 when you hit preview, and the css
  should be accessible from the cdn you configured.

Change-Id: Ie0a812d04f5eeb40e7df7e71941ff63ea51a4d22
Reviewed-on: https://gerrit.instructure.com/53873
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2015-07-02 22:42:18 +00:00