Skip to content

Adds image view and link component for clinical assistance and config improvements. #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"eslintFix": "eslint --ext .js --ext .jsx ./src ./test --fix",
"start": "webpack-dev-server --hot --progress --colors",
"ci": "yarn run clean && yarn run build && yarn run compress",
"watch": "webpack --watch"
"watch": "webpack --watch",
"watch-dev": "webpack --watch --config webpack.dev.config.js",
"watch-dev-form-controls": "webpack --watch --config webpack.dev-form-controls.config.js"
},
"author": "",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/form-builder/components/ControlPropertiesContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class ControlPropertiesContainer extends Component {

displayPropertyEditor() {
const { selectedControl, selectedControl: { id, concept } } = this.props;
if (concept || selectedControl.type === 'section') {
if (concept || selectedControl.type === 'section' || selectedControl.type === 'imageView') {
return (
<PropertyEditor
metadata={selectedControl}
Expand Down
14 changes: 11 additions & 3 deletions src/form-builder/components/Property.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class Property extends Component {
><i aria-hidden="true" className="fa fa-code" /></button>);
case 'dropdown':
return (
<select
className="fr"
<select
className="fr property"
defaultValue={this.props.value}
key={`${this.props.name}:${this.props.id}`}
onChange={(e) => this.updateProperty(e, elementType)}
Expand All @@ -40,6 +40,14 @@ export class Property extends Component {
onChange={(e) => this.updateProperty(e, elementType)}
type="text"
/>);
case 'number':
return (<input
className="fr property"
defaultValue={this.props.value}
key={`${this.props.name}:${this.props.id}`}
onChange={(e) => this.updateProperty(e, elementType)}
type="number"
/>);
default:
return (<input
checked={this.props.value}
Expand All @@ -52,7 +60,7 @@ export class Property extends Component {

updateProperty(e, elementType) {
const { name } = this.props;
if (elementType === 'text' || elementType === 'dropdown') {
if (elementType === 'text' || elementType === 'dropdown' || elementType === 'number') {
this.props.onPropertyUpdate({ [name]: e.target.value });
} else {
this.props.onPropertyUpdate({ [name]: e.target.checked });
Expand Down
2 changes: 1 addition & 1 deletion src/form-builder/reducers/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const translations = (store = {}, action) => {
switch (action.type) {
case 'GENERATE_TRANSLATIONS': {
const { type, label } = action.control;
if (type === 'label' || type === 'section') {
if (type === 'label' || type === 'section' || type === 'imageView' || type === 'link') {
return Object.assign({}, store,
{ labels: getLabelTranslations(store.labels, (label || action.control)) });
} else if (type === 'table') {
Expand Down
10 changes: 10 additions & 0 deletions styles/common/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ em {
.fl, .left {float: left;}
.fr, .right {float: right;}

.property {
width: 100px;
background-color: $bahmniPageBg;
border: 1px solid $gray400;
@include box-shadow-for-section;
border-radius: 3px;
display: inline-block;
position: relative;
}

.overflow-hidden {
overflow: hidden;
}
Expand Down
26 changes: 26 additions & 0 deletions webpack.dev-form-controls.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

let config = require('./webpack.dev.config');
const fs = require('fs');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const doesDirectoryExist = fs.existsSync(path.join(__dirname, '../form-controls'));

if (!doesDirectoryExist) {
throw "Attention: form-controls repository must exist on the same level as implementer-interface repository for this webpack config!";
}

config.plugins.push(
new CopyWebpackPlugin([
{
from: path.join(__dirname, '../form-controls/dist'), to: path.join(__dirname, 'node_modules/bahmni-form-controls/dist'),
}
],
{
copyUnmodified: true
}
)
);

module.exports = config;