mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-06-30 06:12:08 -06:00
commit
7bd0d57496
3 changed files with 46 additions and 30 deletions
|
|
@ -2,15 +2,21 @@
|
|||
<div class="backdrop">
|
||||
<div class="popup-container">
|
||||
<div class="popup">
|
||||
<div class="popup-head">
|
||||
<h3 class="popup-title">{{title}}</h3>
|
||||
{{#if subTitle}}
|
||||
<h5 class="popup-sub-title">{{subTitle}}</h5>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="popup-body">
|
||||
{{{template}}}
|
||||
</div>
|
||||
{{#if hasHead}}
|
||||
<div class="popup-head">
|
||||
{{#if title}}
|
||||
<h3 class="popup-title">{{title}}</h3>
|
||||
{{/if}}
|
||||
{{#if subTitle}}
|
||||
<h5 class="popup-sub-title">{{subTitle}}</h5>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if template}}
|
||||
<div class="popup-body">
|
||||
{{{template}}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if buttons.length}}
|
||||
<div class="popup-buttons">
|
||||
{{#each buttons}}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ IonPopup = {
|
|||
show: function (options) {
|
||||
this.template = Template.ionPopup;
|
||||
this.buttons = [];
|
||||
var innerTemplate;
|
||||
|
||||
for (var i = 0; i < options.buttons.length; i++) {
|
||||
var button = options.buttons[i];
|
||||
|
|
@ -14,10 +13,11 @@ IonPopup = {
|
|||
});
|
||||
}
|
||||
|
||||
//Figure out if a template or just a html string was passed
|
||||
// Figure out if a template or just a html string was passed
|
||||
var innerTemplate = '';
|
||||
if (options.templateName) {
|
||||
innerTemplate = Template[options.templateName].renderFunction().value;
|
||||
} else {
|
||||
} else if (options.template) {
|
||||
innerTemplate = '<span>' + options.template + '</span>';
|
||||
}
|
||||
|
||||
|
|
@ -63,14 +63,6 @@ IonPopup = {
|
|||
template: options.template,
|
||||
templateName: options.templateName,
|
||||
buttons: [
|
||||
{
|
||||
text: options.okText ? options.okText : 'Ok',
|
||||
type: options.okType ? options.okType : 'button-positive',
|
||||
onTap: function (event, template) {
|
||||
if (options.onOk) options.onOk(event, template);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: options.cancelText ? options.cancelText : 'Cancel',
|
||||
type: options.cancelType ? options.cancelType : 'button-default',
|
||||
|
|
@ -78,6 +70,14 @@ IonPopup = {
|
|||
if (options.onCancel) options.onCancel(event, template);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: options.okText ? options.okText : 'Ok',
|
||||
type: options.okType ? options.okType : 'button-positive',
|
||||
onTap: function (event, template) {
|
||||
if (options.onOk) options.onOk(event, template);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -85,12 +85,15 @@ IonPopup = {
|
|||
|
||||
prompt: function (options) {
|
||||
|
||||
var template = '';
|
||||
if (options.templateName) {
|
||||
template = Template[options.templateName].renderFunction().value;
|
||||
} else {
|
||||
template = '<span>' + options.template + '</span>';
|
||||
} else if (options.template) {
|
||||
template = '<span class="popup-prompt-text">' + options.template + '</span>';
|
||||
}
|
||||
|
||||
options.inputType = options.inputType || 'text';
|
||||
options.inputPlaceholder = options.inputPlaceholder || '';
|
||||
template += '<input type="' + options.inputType + '" placeholder="' +
|
||||
options.inputPlaceholder + '" name="prompt" >';
|
||||
|
||||
|
|
@ -99,6 +102,14 @@ IonPopup = {
|
|||
subTitle: options.subTitle,
|
||||
template: template,
|
||||
buttons: [
|
||||
{
|
||||
text: options.cancelText ? options.cancelText : 'Cancel',
|
||||
type: options.cancelType ? options.cancelType : 'button-default',
|
||||
onTap: function (event, template) {
|
||||
if (options.onCancel) options.onCancel(event, template);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: options.okText ? options.okText : 'Ok',
|
||||
type: options.okType ? options.okType : 'button-positive',
|
||||
|
|
@ -107,14 +118,6 @@ IonPopup = {
|
|||
if (options.onOk) options.onOk(event, inputVal);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: options.cancelText ? options.cancelText : 'Cancel',
|
||||
type: options.cancelType ? options.cancelType : 'button-default',
|
||||
onTap: function (event, template) {
|
||||
if (options.onCancel) options.onCancel(event, template);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -167,3 +170,9 @@ Template.ionPopup.events({
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
Template.ionPopup.helpers({
|
||||
hasHead: function() {
|
||||
return this.title || this.subTitle;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ Package.onUse(function(api) {
|
|||
|
||||
"components/ionView/ionView.html",
|
||||
"components/ionView/ionView.js"
|
||||
|
||||
], "client");
|
||||
|
||||
api.export("Platform");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue