Skip to content

Commit

Permalink
Updated code documentation #12
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Jan 15, 2015
1 parent 9827355 commit dc4f0a2
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 11 deletions.
10 changes: 10 additions & 0 deletions src/javascript/dialogs/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@

/**
* Alert/Message Dialog
*
* @param String msg Message
* @param Function onClose Callback on close => fn(button)
* @param Object args List of arguments (Will be passed on to StandardDialog)
*
* @api OSjs.Dialogs.AlertDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var AlertDialog = function(msg, onClose, args) {
args = Utils.mergeObject({title: API._('DIALOG_ALERT_TITLE'), message: msg, buttonCancel: false, buttonOkLabel: API._('DIALOG_CLOSE')}, (args || {}));
Expand Down
10 changes: 10 additions & 0 deletions src/javascript/dialogs/applicationchooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@

/**
* Application Chooser Dialog
*
* @param OSjs.VFS.File file The requested File
* @param Array list The list of applications
* @param Function onClose Callback on close => fn(button)
*
* @api OSjs.Dialogs.ApplicationChooserDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var ApplicationChooserDialog = function(file, list, onClose) {
this.filename = Utils.filename(file.path);
Expand Down
9 changes: 9 additions & 0 deletions src/javascript/dialogs/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@

/**
* Color Dialog
*
* @param Object opts Options
* @param Function onClose Callback on close => fn(button, rgb, hex, alpha)
*
* @api OSjs.Dialogs.ColorDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var ColorDialog = function(opts, onClose) {
opts = opts || {};
Expand Down
10 changes: 10 additions & 0 deletions src/javascript/dialogs/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@

/**
* Confirmation Dialog
*
* @param String msg Confirm message
* @param Function onClose Callback on close => fn(button)
* @param Object args List of arguments (Will be passed on to StandardDialog)
*
* @api OSjs.Dialogs.ConfirmDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var ConfirmDialog = function(msg, onClose, args) {
args = Utils.mergeObject({title: API._('DIALOG_CONFIRM_TITLE'), message: msg}, (args || {}));
Expand Down
8 changes: 8 additions & 0 deletions src/javascript/dialogs/errormessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@

/**
* ErrorDialog implementation
*
* THIS IS FOR INTERNAL USAGE ONLY
*
* @api OSjs.Dialogs.ErrorDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var ErrorDialog = function() {
this.data = {title: 'No title', message: 'No message', error: ''};
Expand Down
31 changes: 20 additions & 11 deletions src/javascript/dialogs/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,27 @@
'use strict';

/**
* Init
* File Chooser Dialog
*
* Arguments:
* type Dialog type: "open" or "save"
* select Selection type: "file" or "dir"
* path Current path
* filename Current filename
* mime Current file MIME
* mimes Browse filetype filter (defaults to [none] all files)
* filetypes Save filetypes dict (ext => mime)
* defaultFilename Default filename
* defaultFilemime Default filemime (defaults to given MIME)
*
* @param Object args Options
* @param Function onClose Callback on close => fn(button, file)
*
* @option args String type Dialog type: "open" or "save"
* @option args String select Selection type: "file" or "dir"
* @option args String path Current path
* @option args String filename Current filename
* @option args String mime Current file MIME
* @option args String mimes Browse filetype filter (defaults to [none] all files)
* @option args String filetypes Save filetypes dict (ext => mime)
* @option args String defaultFilename Default filename
* @option args String defaultFilemime Default filemime (defaults to given MIME)
*
* @api OSjs.Dialogs.FileDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var FileDialog = function(args, onClose) {
args = args || {};
Expand Down
9 changes: 9 additions & 0 deletions src/javascript/dialogs/fileinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@

/**
* File Information Dialog
*
* @param OSjs.VFS.File file The requested File
* @param Function onClose Callback on close => fn(button)
*
* @api OSjs.Dialogs.FileInformationDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var FileInformationDialog = function(file, onClose) {
this.path = file ? file.path : null;
Expand Down
26 changes: 26 additions & 0 deletions src/javascript/dialogs/fileprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@

/**
* File Progress dialog
*
* @param String title Dialog title/message
*
* @api OSjs.Dialogs.FileProgressDialog
* @see OSjs.Core.DialogWindow
*
* @extends DialogWindow
* @class
*/
var FileProgressDialog = function(title) {
DialogWindow.apply(this, ['FileProgressDialog', {width:400, height:120}]);
Expand Down Expand Up @@ -69,11 +77,29 @@
this.$desc = desc;
};

/**
* Set the description
*
* @param String d Description
*
* @return void
*
* @method FileProgressDialog::setDescription()
*/
FileProgressDialog.prototype.setDescription = function(d) {
if ( !this.$desc ) { return; }
this.$desc.innerHTML = d;
};

/**
* Set the progress
*
* @param int p Percentage
*
* @return void
*
* @method FileProgressDialog::setProgress()
*/
FileProgressDialog.prototype.setProgress = function(p) {
var el = this._getGUIElement('FileProgressBar');
if ( el ) {
Expand Down
10 changes: 10 additions & 0 deletions src/javascript/dialogs/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@

/**
* File Upload Dialog
*
* @param String dest Destination path
* @param [File] file File to upload (If null, you will be asked)
* @param Function onClose Callback on close => fn(button)
*
* @api OSjs.Dialogs.FileUploadDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var FileUploadDialog = function(dest, file, onClose) {
this.dest = dest;
Expand Down
19 changes: 19 additions & 0 deletions src/javascript/dialogs/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@

/**
* Font Dialog
*
* @param Object args Options
* @param Function onClose Callback on close => fn(button, fontName, fontSize)
*
* @option args String name Default font name (optional)
* @option args int size Default font size (optional)
* @option args String background Background color (default=#ffffff)
* @option args String color Foreground color (default=#000000)
* @option args Array list List of fonts (optional)
* @option args String sizeType Font size type (default=px)
* @option args String text Text to display on preview (optional)
* @option args int minSize Minimum font size (optional)
* @option args int maxSize Maximum font size (optional)
*
* @api OSjs.Dialogs.FontDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var FontDialog = function(args, onClose) {
args = args || {};
Expand Down
11 changes: 11 additions & 0 deletions src/javascript/dialogs/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@

/**
* Input Dialog
*
* @param String msg Message to display
* @param String val Default input value (optional)
* @param Function onClose Callback on close => fn(button, input)
* @param Function onCreated Callback on input init/create
*
* @api OSjs.Dialogs.InputDialog
* @see OSjs.Dialogs.StandardDialog
*
* @extends StandardDialog
* @class
*/
var InputDialog = function(msg, val, onClose, onCreated) {
StandardDialog.apply(this, ['InputDialog', {title: API._('DIALOG_INPUT_TITLE'), message: msg}, {width:300, height:150}, onClose]);
Expand Down

0 comments on commit dc4f0a2

Please sign in to comment.