Bug 1321675 - Add form to device modal for adding devices. r=gl

MozReview-Commit-ID: 2CejxW5VuqK
This commit is contained in:
J. Ryan Stinnett
2017-01-30 18:26:12 -06:00
parent 16c62492e8
commit 414a61e09e
18 changed files with 359 additions and 51 deletions

View File

@@ -17,9 +17,10 @@ module.exports = createClass({
propTypes: {
devices: PropTypes.shape(Types.devices).isRequired,
selectedDevice: PropTypes.string.isRequired,
viewportId: PropTypes.number.isRequired,
onChangeDevice: PropTypes.func.isRequired,
onResizeViewport: PropTypes.func.isRequired,
onUpdateDeviceModalOpen: PropTypes.func.isRequired,
onUpdateDeviceModal: PropTypes.func.isRequired,
},
mixins: [ addons.PureRenderMixin ],
@@ -27,20 +28,21 @@ module.exports = createClass({
onSelectChange({ target }) {
let {
devices,
viewportId,
onChangeDevice,
onResizeViewport,
onUpdateDeviceModalOpen,
onUpdateDeviceModal,
} = this.props;
if (target.value === OPEN_DEVICE_MODAL_VALUE) {
onUpdateDeviceModalOpen(true);
onUpdateDeviceModal(true, viewportId);
return;
}
for (let type of devices.types) {
for (let device of devices[type]) {
if (device.name === target.value) {
onResizeViewport(device.width, device.height);
onChangeDevice(device);
onChangeDevice(device, type);
return;
}
}