canvas-lms/app/jsx
August Thornton 13711dc255 don't save null value if no value is provided
fixes PLAT-1762

test plan:
* Add a manual external app
* Enter valid settings but leave the description and domain blank
* Save the app
* Edit the same app and save again
* Edit and ensure the domain and description are not "null"

Change-Id: I7046ef564790acd8ae790c42611d832ae9f803e6
Reviewed-on: https://gerrit.instructure.com/88861
Reviewed-by: Pedro Fajardo <pfajardo@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2016-09-07 17:04:13 +00:00
..
account_course_user_search improve new account course/user search performance 2016-07-26 13:21:59 +00:00
assignments prevent posting of moderated assignment with unselected grades 2016-07-18 15:38:03 +00:00
authentication_providers Update AuthenticationTypePicker to work with React 0.13.3 2015-11-19 00:32:45 +00:00
calendar/scheduler add state for selected course 2016-09-01 20:59:05 +00:00
collaborations Add loading spinner on collaborations 2016-07-15 20:50:43 +00:00
conditional_release_stats student breakdown details sidebar 2016-08-29 19:50:05 +00:00
context_modules Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00
course_link_validator improve course link validator handling with head requests 2016-04-29 17:26:20 +00:00
course_settings Add loading indicator to modal while upload is happening 2016-08-09 15:13:26 +00:00
course_wizard fix a11y issues with course setup checklist 2016-04-25 16:16:37 +00:00
custom_help_link_settings Move js file to being jsx to prevent errors with compilation 2016-08-11 14:20:12 +00:00
dashboard_card Make Course Card consistent between screen readers 2016-09-01 19:43:39 +00:00
discussion_topics Reactify discussion keyboard shortcut modal 2016-01-12 17:41:26 +00:00
due_dates Update React to 0.14.8 2016-06-27 15:25:04 +00:00
editor clean up RCE abstraction layer and service sidebar 2016-03-30 18:03:24 +00:00
epub_exports Update FriendlyDatetime component to work with React 0.13.3 2015-11-19 00:33:37 +00:00
external_apps don't save null value if no value is provided 2016-09-07 17:04:13 +00:00
files fix file access option dialog inside hidden folders 2016-09-02 18:54:38 +00:00
gradebook fixup aria-label escaping in gradebook 2016-07-28 18:04:24 +00:00
gradebook2 load notes data when 'Show Notes' clicked 2016-06-27 14:25:48 +00:00
grading Revert close date commits 2016-08-16 21:19:28 +00:00
groups prevent users from double-joining groups 2016-03-10 17:13:22 +00:00
help_dialog launch help links in new window 2016-09-07 04:12:09 +00:00
login manage focus switching between login and forgot password 2016-05-18 05:42:01 +00:00
navigation_header Bump version of react-tray to 2.0.1 2016-08-08 21:16:43 +00:00
notification_preferences notification preferences radio button a11y fix 2016-08-24 22:10:40 +00:00
outcomes Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00
quizzes focus on the close button when dialog opens 2016-06-28 23:18:14 +00:00
shared fix mastery paths frame is label 2016-08-30 19:00:34 +00:00
styleguide Update react-modals in Canvas 2015-12-15 13:52:34 +00:00
theme_editor prevent double-submit in theme editor "apply" button 2016-07-15 19:46:43 +00:00
README.md Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00
railsFlashNotificationsHelper.jsx fix flash notifications escaping links 2016-07-15 22:45:22 +00:00

README.md

This directory is temporary until we rework the front-end build This is where we are headed.

Stuff you can do in Canvas JSX files

BUT WAIT!

Your file needs to:

  1. Have a file name with the .jsx extension.

JSX

function foo(paths) {
  return <svg>{paths}</svg>;
}

Arrow Functions

Arrow Function Reference

var arr = ['hydrogen', 'helium', 'lithium'];

// es5
var a = arr.map(function(s){ return s.length });

// es6
var b = arr.map( s => s.length );

// with curlies requires normal return
var b = arr.map( (s) => {
  return s.length
});

// lexical `this`
var obj = {
  multiplier: 3,

  multiplyStuff (stuff) {
    return stuff.map((x) =>
      // no bind!
      return this.multiplier * x;
    )
  }
};

Classes

Class Reference

class EventEmitter {
  constructor() {
    // called when created
  }
  emit() {
    // ...
  }
  on() {
    // ...
  }
  once() {
    // ...
  }
  removeListener() {
    // ...
  }
  removeAllListeners() {
    // ...
  }
}

Extending and calling super.

class Domain extends EventEmitter {
  constructor() {
    super();
    this.members = [];
  }
}

Creating instances

var domain = new Domain();

Destructuring

// es5
var map = _.map;
var each = _.each;

// es6
var {map, each} = _;

Concise Object Methods

// es5
var obj = {
  foo: function() {}
  bar: function() {}
};

// es6
var obj = {
  foo() {}
  bar() {}
};

Object Short Notation

// es5
function() {
  // ...
  return {foo: foo, bar: bar, x: 10};
}

// es6
function() {
  // ...
  return {foo, bar, x: 10};
}

Rest Parameters

Rest Parameters Reference

// es5
function multiply(multiplier) {
  var numbers = Array.prototype.slice.call(arguments, 0);
  return number.map(function(n) { return multiplier * n; });
}

// es6
function multiply(multiplier, ...numbers) {
  return numbers.map( n => multiplier * n);
}

String Templates

String Template Reference

Multiline strings:

// es5
console.log("string text line 1" +
"string text line 2");

// es6
console.log(`string text line 1
string text line 2`);

Interpolated strings

var a = 5;
var b = 10;

// es5
console.log("Fifteen is " + (a + b) + " and not " + (2 * a + b) + ".");

// es6
console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`);