Merge branch 'master' into css-refactor

# Conflicts:
#	ionic/components/action-sheet/action-sheet.ts
This commit is contained in:
Brandy Carney
2015-12-04 14:09:48 -05:00
7 changed files with 88 additions and 18 deletions

View File

@ -122,7 +122,17 @@ export class ActionSheet {
* public API, and most often you will only use ActionSheet.open()
*
* @param {Object} [opts={}] An object containing optional settings.
* @param {String} [opts.pageType='action-sheet'] The page type that determines how the page renders and animates.
* - `[Object]` `buttons` Which buttons to show. Each button is an object with a `text` field.
* - `{string}` `titleText` The title to show on the action sheet.
* - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.
* - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.
* - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or
* the hardware back button is pressed.
* - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,
* with the index of the button that was clicked and the button object. Return true to close
* the action sheet, or false to keep it opened.
* - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.
* Return true to close the action sheet, or false to keep it opened.
* @param {String} [opts.enterAnimation='action-sheet-slide-in'] The class used to animate an actionSheet that is entering.
* @param {String} [opts.leaveAnimation='action-sheet-slide-out'] The class used to animate an actionSheet that is leaving.
* @return {Promise} Promise that resolves when the action sheet is open.

View File

@ -0,0 +1,42 @@
import {Component, Control, ControlGroup} from 'angular2/angular2';
import {App, Storage, LocalStorage, SqlStorage} from 'ionic/ionic';
@App({
templateUrl: 'main.html'
})
class IonicApp {
constructor() {
this.local = new Storage(LocalStorage);
this.sql = new Storage(SqlStorage);
}
getLocal() {
this.local.get('name').then(value => {
alert('Your name is: ' + value);
});
}
setLocal() {
let name = prompt('Your name?');
this.local.set('name', name);
}
removeLocal() {
this.local.remove('name');
}
getSql() {
this.sql.get('name').then(value => {
alert('Your name is: ' + value);
}, (errResult) => {
console.error('Unable to get item from SQL db:', errResult);
});
}
setSql() {
let name = prompt('Your name?');
this.sql.set('name', name);
}
removeSql() {
this.sql.remove('name');
}
}

View File

@ -0,0 +1,11 @@
<ion-content padding>
<h2>Local Storage</h2>
<button primary (click)="getLocal()">Get</button>
<button primary (click)="setLocal()">Set</button>
<button primary (click)="removeLocal()">Remove</button>
<h2>SQL Storage</h2>
<button primary (click)="getSql()">Get</button>
<button primary (click)="setSql()">Set</button>
<button primary (click)="removeSql()">Remove</button>
</ion-content>

View File

@ -44,6 +44,7 @@ ion-segment {
ion-segment-button[button][outline].activated,
ion-segment-button[button][outline].segment-activated {
background-color: transparent;
opacity: 1;
}
}

View File

@ -22,7 +22,7 @@ const DB_NAME = '__ionicstorage';
* });
*
* // Sql storage also exposes the full engine underneath
* storage.query('insert into projects(name, data) values('Cool Project', 'blah');'
* storage.query('insert into projects(name, data) values('Cool Project', 'blah')');
* storage.query('select * from projects').then((resp) => {})
* ```
*
@ -39,7 +39,7 @@ export class SqlStorage extends StorageEngine {
static BACKUP_LIBRARY = 1
static BACKUP_DOCUMENTS = 0
constructor(options) {
constructor(options={}) {
super();
let dbOptions = util.defaults(options, {
@ -98,19 +98,25 @@ export class SqlStorage extends StorageEngine {
*/
query(query, ...params) {
return new Promise((resolve, reject) => {
this._db.transaction((tx) => {
tx.executeSql(query, params, (tx, res) => {
resolve({
tx: tx,
res: res
});
}, (tx, err) => {
reject({
tx: tx,
err: err
});
})
});
try {
this._db.transaction((tx) => {
tx.executeSql(query, params, (tx, res) => {
resolve({
tx: tx,
res: res
});
}, (tx, err) => {
reject({
tx: tx,
err: err
});
})
}, err => {
reject(err);
});
} catch(e) {
reject(e);
}
})
}

View File

@ -1,6 +1,6 @@
{
"name": "ionic-framework",
"version": "2.0.0-alpha.39",
"version": "2.0.0-alpha.40",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -151,8 +151,8 @@ Delegate: <$ doc.delegate $>
<@ endif -@>
<h2>Usage</h2>
<@ if doc.usage @>
<h2>Usage</h2>
<@ block usage @>
<$ doc.usage | marked $>
<@ endblock @>