Skip to content
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

Hotfix: opts.messages, sourcemaps #495

Merged
merged 3 commits into from
May 25, 2017
Merged
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
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
formBuilder is open source to the core and contributions are always welcome. In this document we'll cover some dependencies and installation process to get your local development environment up and running.

## Submitting an Issue
<img width="298" align="left" src="https://cloud.githubusercontent.com/assets/1457540/26318680/dfcf092a-3f13-11e7-83bf-f9a2dd1fb8f1.png"> When submitting an Issue, be sure to includes details to help others get on the same page as your usage. Details can include the options used in calling formBuilder, environment details such as browser and plugin version and steps to reproduce if you are reporting a bug.
When submitting an Issue, be sure to includes details to help others get on the same page as your usage. Details can include the options used in calling formBuilder, environment details such as browser and plugin version and steps to reproduce if you are reporting a bug.

Labeling your Issue helps project maintainers triage. Whether you're submitting a bug, feature request or just have a question, please label your issue accordingly.
### Maintaining Issues
<img width="298" align="left" src="https://cloud.githubusercontent.com/assets/1457540/26318680/dfcf092a-3f13-11e7-83bf-f9a2dd1fb8f1.png"> Maintainers are encouraged to label issues. Labeling helps triage issues so developers have an idea of priority.
<br clear="left">

## Development
Expand Down
2 changes: 1 addition & 1 deletion demo/assets/js/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified demo/assets/js/form-builder.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/assets/js/form-render.min.js

Large diffs are not rendered by default.

Binary file modified demo/assets/js/form-render.min.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion dist/control_plugins/starRating.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/control_plugins/textarea.trumbowyg.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified dist/form-builder.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/form-render.min.js

Large diffs are not rendered by default.

Binary file modified dist/form-render.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/js/control/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ export default class controlSelect extends control {
groupRequired() {
const checkboxes = this.element.getElementsByTagName('input');
const setValidity = (checkbox, isValid) => {
let minReq = control.mi18n('minSelectionRequired', 1);
if (!isValid) {
let minReq = control.mi18n('minSelectionRequired', 1);
checkbox.setCustomValidity(minReq);
} else {
checkbox.setCustomValidity('');
Expand Down
7 changes: 7 additions & 0 deletions src/js/form-render.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'babel-polyfill';
import 'babel-regenerator-runtime';
import '../sass/form-render.scss';
import mi18n from 'mi18n';
import utils from './utils';
import events from './events';
import layout from './layout';
import control from './control';
import './control/index';
import controlCustom from './control/custom';
import {defaultI18n} from './config';

/**
* FormRender Class
Expand All @@ -28,6 +30,7 @@ class FormRender {
container: false,
dataType: 'json',
formData: false,
i18n: Object.assign({}, defaultI18n),
// subtypes: defaultSubtypes, // @todo - removed this - is it needed now?
messages: {
formRendered: 'Form Rendered',
Expand All @@ -54,6 +57,10 @@ class FormRender {
};
this.options = $.extend(true, defaults, options);

if (!mi18n.current) {
mi18n.init(this.options.i18n);
}

// parse any passed formData
(() => {
if (!this.options.formData) {
Expand Down
3 changes: 1 addition & 2 deletions src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {config} from './config';
import control from './control';
import controlCustom from './control/custom';

const opts = config.opts;
const m = utils.markup;

/**
Expand Down Expand Up @@ -404,7 +403,7 @@ export default class Helpers {
const disabledFields = stage.querySelectorAll('.disabled-field');
utils.forEach(disabledFields, index => {
let field = disabledFields[index];
let title = opts.messages.fieldNonEditable;
let title = mi18n.get('fieldNonEditable');

if (title) {
let tt = utils.markup('p', title, {className: 'frmb-tt'});
Expand Down
1 change: 0 additions & 1 deletion src/sass/_controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
.frmb-control {
margin: 0;
padding: 0;
padding: 1px;
border-radius: 5px;

li {
Expand Down
8 changes: 8 additions & 0 deletions src/sass/form-builder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
.cb-wrap,
.stage-wrap {
vertical-align: top;

&.pull-right {
float: right;
}

&.pull-left {
float: left;
}
}

.stage-wrap h4 {
Expand Down
41 changes: 19 additions & 22 deletions tools/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ try {
}

const PRODUCTION = process.argv.includes('-p');
const devtool = PRODUCTION ? false : 'cheap-module-eval-source-map';
const outputDir = resolve(__dirname, '../', 'demo/assets/js/');

const bannerTemplate = [
Expand All @@ -22,31 +23,10 @@ const bannerTemplate = [
`Author: ${pkg.author}`
].join('\n');

let plugins = [
new ExtractTextPlugin({
filename: '[name].[contenthash].css'
}),
new BabiliPlugin({
removeDebugger: true
}, {
comments: false
}),
new BannerPlugin(bannerTemplate),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.(js)$/,
threshold: 10240,
minRatio: 0.8
})
];

const extractSass = new ExtractTextPlugin({
filename: '[name].[contenthash].css'
});

const devtool = PRODUCTION ? false : 'source-map';

const webpackConfig = {
context: outputDir,
entry: {
Expand Down Expand Up @@ -114,7 +94,24 @@ const webpackConfig = {
})
}]
},
plugins,
plugins: [
new ExtractTextPlugin({
filename: '[name].[contenthash].css'
}),
new BabiliPlugin({
removeDebugger: PRODUCTION
}, {
comments: !PRODUCTION
}),
new BannerPlugin(bannerTemplate),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.(js)$/,
threshold: 10240,
minRatio: 0.8
})
],
devtool,
resolve: {
modules: [
Expand Down