Skip to content

Commit

Permalink
basic docs and demo for messagebox widget
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgee committed Jan 23, 2017
1 parent c8eca6d commit 8cf96a8
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
80 changes: 80 additions & 0 deletions config/messagebox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
define({
isDebug: true,

mapOptions: {
basemap: 'streets',
center: [-96.59179687497497, 39.09596293629694],
zoom: 5,
sliderStyle: 'small'
},

titles: {
header: 'CMV MessageBox Widget',
subHeader: 'This is an example of Confirm and Alert MessageBoxes',
pageTitle: 'CMV MessageBox Widget'
},

panes: {
left: {
collapsible: false,
style: 'display:none'
}
},

operationalLayers: [],

widgets: {

// widget to create the MessageBox
messagebox: {
include: true,
id: 'messagebox',
type: 'invisible',
path: 'widgets/MessageBox',
options: {
nameSpace: 'app' // optional namespace
}
},

// simple widget to show how to open
// and respond to a message box
callMeAMessageBox: {
include: true,
id: 'callMeAMessageBox',
type: 'invisible',
path: 'dijit/_WidgetBase',
options: {
map: true,
startup: function () {
// waiting a second. not normally needed when used in your code
window.setTimeout(function () {

// use the same namespace defined in the messagebox options above
// can be called from anywhere in your code
var mb = window.app.MessageBox;
mb.confirm({
title: 'Delete Feature?',
content: 'Are you sure you want to delete this feature?<br/><br/>This action cannot be undone.'
}).then(
function (result) {
// respond based on the results returned from the confirm MessageBox
if (result === mb.okMessage) {
mb.alert({
title: 'Feature Deleted',
content: 'You chose to delete the feature.'
});
} else if (result === mb.cancelMessage) {
mb.alert({
title: 'NOT Deleted',
content: 'You chose NOT to delete the feature.'
});
}
},
function (/* result */) {}
);
}, 1000);
}
}
}
}
});
Binary file added images/messagebox1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions widgets/MessageBox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Message Box for CMV
Show a modal Confirmation or Alert dialog box. Intended to be called from other widgets.

---
## Configurable Options

| Parameter | Type | Description |
| :----: | :--: | ----------- |
| `nameSpace` | String | Default is null Optional Namespace. If omitted, the global window Namespace is used. |
| `okMessage` | String | Default is 'MessageBox.OK'. |
| `cancelMessage` | String | Default is 'MessageBox.Cancel'. |


---
## Example Configuration:
``` javascript
messagebox: {
include: true,
id: 'messagebox',
type: 'invisible',
path: 'widgets/MessageBox',
options: {
nameSpace: 'app' // optional namespace
}
}
```
## Screenshot:
![Screenshot](https://tmcgee.github.io/cmv-widgets/images/messagebox1.jpg)

0 comments on commit 8cf96a8

Please sign in to comment.