Updated useraccounts, character settings to Polymer 1
This commit is contained in:
@@ -124,7 +124,7 @@ underscore@1.0.10
|
||||
url@1.0.11
|
||||
useraccounts:core@1.14.2
|
||||
useraccounts:iron-routing@1.14.2
|
||||
useraccounts:polymer@1.12.3
|
||||
useraccounts:polymer@1.14.2
|
||||
webapp@1.3.12
|
||||
webapp-hashing@1.0.9
|
||||
wizonesolutions:canonical@0.0.5
|
||||
|
||||
@@ -443,13 +443,13 @@ Characters.calculate = {
|
||||
}),
|
||||
};
|
||||
|
||||
var depreciated = function() {
|
||||
//var err = new Error("this function has been depreciated");
|
||||
var deprecated = function() {
|
||||
//var err = new Error("this function has been deprecated");
|
||||
var name = "";
|
||||
if (Template.instance()){
|
||||
name = Template.instance().view.name;
|
||||
}
|
||||
var logString = "this function has been depreciated \n";
|
||||
var logString = "this function has been deprecated \n";
|
||||
if (name){
|
||||
logString += "View: " + name + "\n\n";
|
||||
}
|
||||
@@ -464,56 +464,56 @@ Characters.helpers({
|
||||
//returns the value stored in the field requested
|
||||
//will set up dependencies on just that field
|
||||
getField : function(fieldName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.getField(this._id, fieldName);
|
||||
},
|
||||
//returns the value of a field
|
||||
fieldValue : function(fieldName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.fieldValue(this._id, fieldName);
|
||||
},
|
||||
attributeValue: function(attributeName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.attributeValue(this._id, attributeName);
|
||||
},
|
||||
attributeBase: function(attributeName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.attributeBase(this._id, attributeName);
|
||||
},
|
||||
skillMod: function(skillName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.skillMod(this._id, skillName);
|
||||
},
|
||||
proficiency: function(skillName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.proficiency(this._id, skillName);
|
||||
},
|
||||
passiveSkill: function(skillName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.passiveSkill(this._id, skillName);
|
||||
},
|
||||
advantage: function(skillName){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.advantage(this._id, skillName);
|
||||
},
|
||||
abilityMod: function(attribute){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.abilityMod(this._id, attribute);
|
||||
},
|
||||
passiveAbility: function(attribute){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.passiveAbility(this._id, attribute);
|
||||
},
|
||||
xpLevel: function(){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.xpLevel(this._id);
|
||||
},
|
||||
level: function(){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.level(this._id);
|
||||
},
|
||||
experience: function(){
|
||||
depreciated();
|
||||
deprecated();
|
||||
return Characters.calculate.experience(this._id);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -21,14 +21,6 @@ Router.map(function() {
|
||||
},
|
||||
});
|
||||
|
||||
this.route("testContent", {
|
||||
path: "/test",
|
||||
onAfterAction: function() {
|
||||
document.title = appName;
|
||||
},
|
||||
layoutTemplate: "testLayout",
|
||||
});
|
||||
|
||||
this.route("characterList", {
|
||||
path: "/characterList",
|
||||
waitOn: function(){
|
||||
|
||||
@@ -35,22 +35,6 @@ $thinColumnWidth: 240px;
|
||||
padding: 16px;
|
||||
border-bottom: rgba(0,0,0,0.12) solid 1px;
|
||||
}
|
||||
paper-checkbox::shadow #ink[checked] {
|
||||
color: #ffffff;
|
||||
}
|
||||
paper-checkbox::shadow #ink {
|
||||
color: #ffffff;
|
||||
}
|
||||
paper-checkbox::shadow #checkbox.checked {
|
||||
background-color: #ffffff;
|
||||
background-color: rgba(255,255,255,0.27);
|
||||
border-color: #ffffff;
|
||||
border-color: rgba(255,255,255,0.27);
|
||||
}
|
||||
paper-checkbox::shadow #checkbox {
|
||||
border-color: #ffffff;
|
||||
border-color: rgba(255,255,255,0.54);
|
||||
}
|
||||
}
|
||||
.bottom {
|
||||
padding: 16px;
|
||||
|
||||
@@ -63,6 +63,10 @@ paper-fab {
|
||||
background-color: #d13b2e;
|
||||
}
|
||||
|
||||
paper-fab.keyboard-focus {
|
||||
background: #630c05;
|
||||
}
|
||||
|
||||
//Buttons
|
||||
paper-button {
|
||||
color: #000;
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
<template name="characterSettings">
|
||||
{{#with character}}
|
||||
<div style="height: 100px;">
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td>Hide Spells tab</td>
|
||||
<td>
|
||||
<paper-toggle-button id="hideSpellcasting"
|
||||
checked={{settings.hideSpellcasting}}
|
||||
touch-action="pan-y">
|
||||
</paper-toggle-button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Use variant encumbrance</td>
|
||||
<td>
|
||||
<paper-toggle-button id="variantEncumbrance"
|
||||
checked={{settings.useVariantEncumbrance}}
|
||||
touch-action="pan-y">
|
||||
</paper-toggle-button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Character Settings</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
<paper-toggle-button id="hideSpellcasting" checked={{settings.hideSpellcasting}}>
|
||||
Hide Spells tab
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="variantEncumbrance" checked={{settings.useVariantEncumbrance}}>
|
||||
Use variant encumbrance
|
||||
</paper-toggle-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
{{/with}}
|
||||
<paper-button id="doneButton" affirmative> Done </paper-button>
|
||||
</template>
|
||||
|
||||
@@ -23,4 +23,7 @@ Template.characterSettings.events({
|
||||
);
|
||||
}
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
<template name="deleteCharacterConfirmation">
|
||||
<div>
|
||||
Deleting a character cannot be undone.<br>
|
||||
To continue type "{{name}}" into the box below.<br>
|
||||
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
|
||||
<paper-button id="deleteButton" style={{getStyle}} disabled={{cantDelete}}>Delete Character</paper-button>
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Delete Character</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
Deleting a character cannot be undone.<br>
|
||||
To continue type "{{name}}" into the box below.<br>
|
||||
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
|
||||
<paper-button id="deleteButton" style={{getStyle}} disabled={{cantDelete}}>Delete Character</paper-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="cancelButton"> Cancel </paper-button>
|
||||
</div>
|
||||
</div>
|
||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -18,11 +18,14 @@ Template.deleteCharacterConfirmation.events({
|
||||
var canDel = instance.find("#nameInput").value === this.name;
|
||||
instance.canDelete.set(canDel);
|
||||
},
|
||||
"tap #deleteButton": function(event, instance) {
|
||||
"click #deleteButton": function(event, instance) {
|
||||
if (instance.find("#nameInput").value === this.name) {
|
||||
GlobalUI.closeDialog();
|
||||
Router.go("/");
|
||||
popDialogStack();
|
||||
Router.go("/characterList");
|
||||
Characters.remove(this._id);
|
||||
}
|
||||
}
|
||||
},
|
||||
"click .cancelButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,54 +1,65 @@
|
||||
<template name="shareDialog">
|
||||
<div>
|
||||
<paper-dropdown-menu class="visibilityDropdown" label="Who can view this character">
|
||||
<paper-listbox class="dropdown-content" selected={{viewPermission}} attr-for-selected="name">
|
||||
<paper-item name="whitelist">Only people I share with</paper-item>
|
||||
<paper-item name="public">Anyone with link</paper-item>
|
||||
</paper-listbox>
|
||||
</paper-dropdown-menu>
|
||||
<div>
|
||||
{{#if readers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can View
|
||||
</div>
|
||||
{{#each id in readers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if writers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can Edit
|
||||
</div>
|
||||
{{#each id in writers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Share</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
<paper-dropdown-menu label="Who can view this character">
|
||||
<paper-listbox class="visibilityDropdown dropdown-content" selected={{viewPermission}} attr-for-selected="name">
|
||||
<paper-item name="whitelist">Only people I share with</paper-item>
|
||||
<paper-item name="public">Anyone with link</paper-item>
|
||||
</paper-listbox>
|
||||
</paper-dropdown-menu>
|
||||
<div class="layout horizontal center wrap">
|
||||
<paper-input class="flex" id="userNameOrEmailInput" label="Share with username or email" floatinglabel></paper-input>
|
||||
<paper-button id="shareButton"
|
||||
class="red-button"
|
||||
style="width: 80px; height: 37px; margin-top: 16px;"
|
||||
raised
|
||||
disabled={{shareButtonDisabled}}>Share</paper-button>
|
||||
<paper-radio-group id="accessLevelMenu" selected="read">
|
||||
<paper-radio-button name="read">View Only</paper-radio-button>
|
||||
<paper-radio-button name="write">Can Edit</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
<p style="color: red;">{{userFindError}}</p>
|
||||
<div>
|
||||
{{#if readers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can View
|
||||
</div>
|
||||
{{#each id in readers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if writers.length}}
|
||||
<div class="paper-font-subhead">
|
||||
Can Edit
|
||||
</div>
|
||||
{{#each id in writers}}
|
||||
<div class="layout horizontal center">
|
||||
{{#with id=id}}
|
||||
<paper-icon-button class="deleteShare" icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/with}}
|
||||
<div class="flex">{{username id}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
<div class="layout horizontal center">
|
||||
<paper-input flex id="userNameOrEmailInput" label="Share with username or email" floatinglabel></paper-input>
|
||||
<paper-button id="shareButton"
|
||||
class="red-button"
|
||||
style="width: 80px; height: 37px; margin-top: 16px;"
|
||||
raised
|
||||
disabled={{shareButtonDisabled}}>Share</paper-button>
|
||||
</div>
|
||||
<p style="color: red;">{{userFindError}}</p>
|
||||
<paper-radio-group id="accessLevelMenu" selected="read">
|
||||
<paper-radio-button name="read">View Only</paper-radio-button>
|
||||
<paper-radio-button name="write">Can Edit</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
<paper-button id="doneButton" affirmative> Done </paper-button>
|
||||
</template>
|
||||
|
||||
@@ -9,6 +9,13 @@ Template.shareDialog.onCreated(function(){
|
||||
});
|
||||
});
|
||||
|
||||
Template.shareDialog.onRendered(function(){
|
||||
// Polymer not mirroring selected attribute properly
|
||||
this.$("paper-listbox").each(function(){
|
||||
this.selected = this.getAttribute("selected");
|
||||
});
|
||||
});
|
||||
|
||||
Template.shareDialog.helpers({
|
||||
viewPermission: function() {
|
||||
var char = Characters.findOne(this._id, {fields: {settings: 1}});
|
||||
@@ -38,9 +45,8 @@ Template.shareDialog.helpers({
|
||||
});
|
||||
|
||||
Template.shareDialog.events({
|
||||
"change .visibilityDropdown": function(event){
|
||||
"iron-select .visibilityDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
if (!detail.isSelected) return;
|
||||
var value = detail.item.getAttribute("name");
|
||||
var char = Characters.findOne(this._id, {fields: {settings: 1}});
|
||||
if (value == char.settings.viewPermission) return;
|
||||
@@ -59,7 +65,7 @@ Template.shareDialog.events({
|
||||
}
|
||||
});
|
||||
},
|
||||
"tap #shareButton": function(event, instance){
|
||||
"click #shareButton": function(event, instance){
|
||||
var self = this;
|
||||
var permission = instance.find("#accessLevelMenu").selected;
|
||||
if (!permission) throw "no permission set";
|
||||
@@ -77,9 +83,12 @@ Template.shareDialog.events({
|
||||
});
|
||||
}
|
||||
},
|
||||
"tap .deleteShare": function(event, instance) {
|
||||
"click .deleteShare": function(event, instance) {
|
||||
Characters.update(instance.data._id, {
|
||||
$pull: {writers: this.id, readers: this.id}
|
||||
});
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -34,6 +34,6 @@ app-toolbar.medium-tall {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.character-menu paper-item{
|
||||
.character-menu paper-icon-item{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{{#if canEditCharacter _id}}
|
||||
{{> colorDropdown}}
|
||||
<paper-menu-button class="character-menu" horizontal-align="right">
|
||||
<paper-icon-button icon="more-vert" class="dropdown-trigger" tabindex="-1"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert" class="dropdown-trigger"></paper-icon-button>
|
||||
<paper-menu class="dropdown-content black87">
|
||||
<paper-icon-item id="deleteCharacter">
|
||||
<iron-icon icon="delete" item-icon></iron-icon>
|
||||
|
||||
@@ -7,13 +7,13 @@ Template.newCharacterDialog.onCreated(function(){
|
||||
race: {type: String, optional: true},
|
||||
});
|
||||
this.context = this.schema.newContext();
|
||||
this.context.runOnce = false;
|
||||
this.context.runOnce = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.newCharacterDialog.helpers({
|
||||
invalid(){
|
||||
let context = Template.instance().context;
|
||||
let valid = context.isValid() && context.runOnce;
|
||||
let valid = context.isValid() && context.runOnce.get();
|
||||
return !valid;
|
||||
},
|
||||
errorAtts(key){
|
||||
@@ -29,10 +29,11 @@ Template.newCharacterDialog.helpers({
|
||||
|
||||
changeFunction = function(field){
|
||||
return _.debounce(function(event, instance){
|
||||
console.log({field, event})
|
||||
instance.character[field] = event.currentTarget.value;
|
||||
instance.schema.clean(instance.character);
|
||||
instance.context.validate(instance.character);
|
||||
if (!instance.context.runOnce) instance.context.runOnce = true;
|
||||
if (!instance.context.runOnce.get()) instance.context.runOnce.set(true);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<app-header-layout mode="seamed" class="white">
|
||||
<div id="accountSummary">
|
||||
{{#if currentUser}}
|
||||
<a href="profile"
|
||||
<a href="/account"
|
||||
style="text-decoration: underline; cursor: pointer; font-size: 16px;">
|
||||
{{profileLink}}
|
||||
</a>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<link rel="import" href="/components/neon-animation/neon-animations.html">
|
||||
|
||||
<link rel="import" href="/components/paper-button/paper-button.html">
|
||||
<link rel="import" href="/components/paper-checkbox/paper-checkbox.html">
|
||||
<!--<link rel="import" href="/components/paper-checkbox/paper-checkbox.html"> Using custom one instead -->
|
||||
<link rel="import" href="/components/paper-dialog/paper-dialog.html">
|
||||
<link rel="import" href="/components/paper-dropdown-menu/paper-dropdown-menu.html">
|
||||
<link rel="import" href="/components/paper-fab/paper-fab.html">
|
||||
@@ -45,7 +45,10 @@
|
||||
<link rel="import" href="/components/paper-slider/paper-slider.html">
|
||||
<link rel="import" href="/components/paper-tabs/paper-tabs.html">
|
||||
<link rel="import" href="/components/paper-toast/paper-toast.html">
|
||||
<link rel="import" href="/components/paper-toggle-button/paper-toggle-button.html">
|
||||
<link rel="import" href="/components/paper-tooltip/paper-tooltip.html">
|
||||
|
||||
<link rel="import" href="/custom_components/paper-checkbox/paper-checkbox.html">
|
||||
<link rel="import" href="/custom_components/paper-diff-slider/paper-diff-slider.html">
|
||||
<link rel="import" href="/custom_components/app-theme.html">
|
||||
</head>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template name="colorDropdown">
|
||||
<paper-menu-button class="colorDropdown" horizontal-align="right" dynamic-align>
|
||||
<paper-icon-button icon="editor:format-paint" class="dropdown-trigger" tabindex="-1"></paper-icon-button>
|
||||
<paper-icon-button icon="editor:format-paint" class="dropdown-trigger"></paper-icon-button>
|
||||
<paper-menu class="dropdown-content" attr-for-selected="name" selected={{color}}>
|
||||
{{#each colors}}
|
||||
<paper-item name={{key}} class="colorMenuItem {{colorClass key}}">{{className}}</paper-item>
|
||||
|
||||
4
rpg-docs/client/views/user/profile/profile.css
Normal file
4
rpg-docs/client/views/user/profile/profile.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.profile #at-nav-button {
|
||||
color: #212121;
|
||||
color: rgba(0,0,0,0.87);
|
||||
}
|
||||
@@ -1,22 +1,47 @@
|
||||
<template name="profile">
|
||||
{{#with currentUser}}
|
||||
<app-toolbar class="blue-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div id="username" class="clickable" flex>
|
||||
{{profileName}}
|
||||
</div>
|
||||
</app-toolbar>
|
||||
<div id="userProfile" class="padded">
|
||||
<div>
|
||||
<h2>Email</h2>
|
||||
{{#each emails}}
|
||||
<div layout horizontal>
|
||||
<p>{{address}}</p>
|
||||
<app-header-layout has-scrolling-region fullbleed class="profile">
|
||||
<app-header class="app-grey white-text" fixed effects="waterfall">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div flex>Account</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="layout vertical center">
|
||||
<paper-material style="margin-top: 8px; padding: 16px; background: #fff;">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Username</td>
|
||||
<td>{{profileName}}</td>
|
||||
<td>
|
||||
<paper-icon-button icon="create" class="username-edit" style="background: #fff;">
|
||||
</paper-icon-button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email</td>
|
||||
<td class="layout vertical">
|
||||
{{#each emails}}
|
||||
<div>
|
||||
{{address}}
|
||||
{{#if verified}}
|
||||
<span>
|
||||
<iron-icon icon="check"></iron-icon>
|
||||
<paper-tooltip>Verified</paper-tooltip>
|
||||
</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="max-width: 250px">
|
||||
{{> atForm}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{> atNavButton }}
|
||||
</paper-material>
|
||||
</div>
|
||||
</div>
|
||||
{{> atForm}}
|
||||
{{> atNavButton }}
|
||||
</app-header-layout>
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
@@ -8,15 +8,15 @@ Template.profile.helpers({
|
||||
});
|
||||
|
||||
Template.profile.events({
|
||||
"tap #username": function(){
|
||||
"click .username-edit": function(event, instance){
|
||||
if (this._id === Meteor.userId()){
|
||||
GlobalUI.showDialog({
|
||||
heading: "Change Username",
|
||||
pushDialogStack({
|
||||
template: "usernameDialog",
|
||||
element: event.currentTarget,
|
||||
});
|
||||
}
|
||||
},
|
||||
"tap #verifyEmail": function(event, instance){
|
||||
"click #at-resend-verification-email": function(event, instance){
|
||||
if (!Meteor.user()) return;
|
||||
Accounts.sendVerificationEmail(Meteor.userId(), this.address);
|
||||
GlobalUI.toast({
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
<template name="usernameDialog">
|
||||
<div>
|
||||
<paper-input id="usernameInput" label="Username" value={{profileName}}></paper-input>
|
||||
<div class="fit layout vertical">
|
||||
<app-header-layout has-scrolling-region class="feedback flex">
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Feedback</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex">
|
||||
<div>
|
||||
<paper-input id="usernameInput" label="Username" value={{profileName}} invalid={{errorMessage}} error-message={{errorMessage}}></paper-input>
|
||||
</div>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button id="cancelButton">
|
||||
Cancel
|
||||
</paper-button>
|
||||
<paper-button id="changeButton" disabled={{invalid}}>
|
||||
Change Username
|
||||
</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="color: red;" class="vertMargin">{{errorMessage}}</div>
|
||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||
<paper-button id="changeButton" disabled={{invalid}} affirmative> Change Username </paper-button>
|
||||
</template>
|
||||
|
||||
@@ -4,7 +4,7 @@ var getUsername = function() {
|
||||
};
|
||||
|
||||
Template.usernameDialog.onCreated(function() {
|
||||
this.errorMessage = new ReactiveVar("");
|
||||
this.errorMessage = new ReactiveVar();
|
||||
this.username = new ReactiveVar(getUsername());
|
||||
});
|
||||
|
||||
@@ -32,12 +32,13 @@ Template.usernameDialog.events({
|
||||
if (userId && userId !== Meteor.userId())
|
||||
instance.errorMessage.set("This username is taken");
|
||||
else
|
||||
instance.errorMessage.set("");
|
||||
instance.errorMessage.set();
|
||||
});
|
||||
}
|
||||
},
|
||||
"tap #changeButton": function(event, instance){
|
||||
"click #changeButton": function(event, instance){
|
||||
var username = instance.find("#usernameInput").value;
|
||||
popDialogStack();
|
||||
username = username.trim().replace(/\s+/gm, " ");
|
||||
var profileName = username;
|
||||
username = username.toLowerCase().replace(/\s+/gm, "");
|
||||
@@ -46,4 +47,7 @@ Template.usernameDialog.events({
|
||||
{$set: {username: username, "profile.username": profileName}}
|
||||
);
|
||||
},
|
||||
"click #cancelButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<template name="titledAtForm">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div flex>
|
||||
|
||||
<app-header-layout has-scrolling-region fullbleed>
|
||||
<app-header class="app-grey white-text" fixed effects="waterfall">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div>
|
||||
<div class="layout vertical center" style="padding: 16px">
|
||||
<paper-material class="white" style="max-width: 400px;">
|
||||
{{> atForm}}
|
||||
</paper-material>
|
||||
</div>
|
||||
</div>
|
||||
</app-toolbar>
|
||||
<div class="scroll-y padded" fit layout vertical center center-justified>
|
||||
<paper-material class="white" style="max-width: 400px;">
|
||||
{{> atForm}}
|
||||
</paper-material>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
</template>
|
||||
|
||||
@@ -5,6 +5,7 @@ Meteor.methods({
|
||||
charId,
|
||||
{fields: {owner: 1, writers: 1}}
|
||||
);
|
||||
if (!char) return true;
|
||||
return (userId && char.owner === userId || _.contains(char.writers, userId));
|
||||
},
|
||||
});
|
||||
@@ -30,6 +31,7 @@ CHARACTER_SUBSCHEMA_ALLOW = {
|
||||
doc.charId,
|
||||
{fields: {owner: 1, writers: 1}}
|
||||
);
|
||||
if (!char) return true;
|
||||
return userId && char.owner === userId || _.contains(char.writers, userId);
|
||||
},
|
||||
fetch: ["charId"],
|
||||
|
||||
@@ -14,31 +14,42 @@ AccountsTemplates.configure({
|
||||
showAddRemoveServices: true,
|
||||
showForgotPasswordLink: true,
|
||||
showResendVerificationEmailLink: true,
|
||||
texts: {
|
||||
resendVerificationEmailLink_link: "Resend email verification",
|
||||
},
|
||||
});
|
||||
|
||||
AccountsTemplates.configureRoute("changePwd", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("enrollAccount", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("forgotPwd", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("resetPwd", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("signIn", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("signUp", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("verifyEmail", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
AccountsTemplates.configureRoute("resendVerificationEmail", {
|
||||
template: "titledAtForm",
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
|
||||
if (Meteor.isServer){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
canEditCharacter = function(charId, userId){
|
||||
userId = userId || Meteor.userId();
|
||||
var char = Characters.findOne(charId, {fields: {owner: 1, writers: 1}});
|
||||
if (!char) return false;
|
||||
if (!char) return true;
|
||||
return (userId === char.owner || _.contains(char.writers, userId));
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ canViewCharacter = function(charId, userId){
|
||||
charId,
|
||||
{fields: {owner: 1, writers: 1, readers: 1}}
|
||||
);
|
||||
if (!char) return false;
|
||||
if (!char) return true;
|
||||
return userId === char.owner ||
|
||||
_.contains(char.writers, userId) ||
|
||||
_.contains(char.readers, userId);
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
sudo: required
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
before_install:
|
||||
- "curl -L http://git.io/ejPSng | /bin/sh"
|
||||
env:
|
||||
- TEST_COMMAND=meteor
|
||||
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 splendido
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,48 +0,0 @@
|
||||
[](https://travis-ci.org/meteor-useraccounts/polymer)
|
||||
useraccounts:polymer
|
||||
=====================================
|
||||
|
||||
WORK IN PROGRESS - let us know about any problem you might encounter ;)
|
||||
|
||||
## TODOs
|
||||
|
||||
Add the following input types:
|
||||
|
||||
- checkbox input
|
||||
- select input
|
||||
- radio input
|
||||
|
||||
Find the proper solution for inheriting AT events for paper-button elements
|
||||
|
||||
|
||||
|
||||
This package depends on [useraccounts:core](https://atmospherejs.com/useraccounts/core)
|
||||
|
||||
Learn more [here](http://useraccounts.meteor.com) or have a look at the full [documentation](https://github.com/meteor-useraccounts/core).
|
||||
|
||||
|
||||
## Bring Your Own Polymer
|
||||
|
||||
Adding this package with `meteor add useraccounts:polymer` does not add any other packages providing Polymer .This is to let you choose the flavour you prefer! Or using an Atmosphere package, or straight up with bower!
|
||||
|
||||
|
||||
## ADD theses imports manually
|
||||
|
||||
This package does not automatically add the imports for the elements needed. If you don't have them imported already you should copy/paste these imports :
|
||||
|
||||
```HTML
|
||||
|
||||
<link rel="import" href="bower_components/paper-input/paper-input.html">
|
||||
<link rel="import" href="bower_components/paper-button/paper-button.html">
|
||||
<link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Anyone is welcome to contribute. Fork, make your changes, and then submit a pull request.
|
||||
|
||||
Thanks to all those who have contributed code changes to [this package](https://github.com/meteor-useraccounts/unstyled/graphs/contributors) as well as to the [core package](https://github.com/meteor-useraccounts/core/graphs/contributors) and all who have helped by submitting bug reports and feature ideas.
|
||||
@@ -1,7 +0,0 @@
|
||||
<template name="atError">
|
||||
<div class="at-error" horizontal center-justified layout>
|
||||
{{#each error}}
|
||||
<p>{{errorText}}</p>
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atError.helpers(AccountsTemplates.atErrorHelpers);
|
||||
@@ -1,39 +0,0 @@
|
||||
<template name="atForm">
|
||||
{{#unless hide}}
|
||||
<div class="at-form">
|
||||
{{#if showTitle}}
|
||||
{{> atTitle}}
|
||||
{{/if}}
|
||||
{{#if showOauthServices}}
|
||||
{{> atOauth}}
|
||||
{{/if}}
|
||||
{{#if showServicesSeparator}}
|
||||
{{> atSep}}
|
||||
{{/if}}
|
||||
{{#if showError}}
|
||||
{{> atError}}
|
||||
{{/if}}
|
||||
{{#if showResult}}
|
||||
{{> atResult}}
|
||||
{{/if}}
|
||||
{{#if showMessage}}
|
||||
{{> atMessage}}
|
||||
{{/if}}
|
||||
{{#if showPwdForm}}
|
||||
{{> atPwdForm}}
|
||||
{{/if}}
|
||||
{{#if showTermsLink}}
|
||||
{{> atTermsLink}}
|
||||
{{/if}}
|
||||
{{#if showSignInLink}}
|
||||
{{> atSigninLink}}
|
||||
{{/if}}
|
||||
{{#if showSignUpLink}}
|
||||
{{> atSignupLink}}
|
||||
{{/if}}
|
||||
{{#if showResendVerificationEmailLink}}
|
||||
{{> atResendVerificationEmailLink}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atForm.helpers(AccountsTemplates.atFormHelpers);
|
||||
@@ -1,81 +0,0 @@
|
||||
<template name="atInput">
|
||||
{{> Template.dynamic template=templateName}}
|
||||
</template>
|
||||
|
||||
<template name="atTextInput">
|
||||
<div class="at-input pure-control-group{{#if isValidating}}validating{{/if}} {{#if hasError}}has-error{{/if}} {{#if hasSuccess}}has-success{{/if}} {{#if feedback}}has-feedback{{/if}}">
|
||||
<!-- {{#if showLabels}}
|
||||
<label for="at-field-{{_id}}">
|
||||
{{displayName}} {{#unless required}}{{optionalText}}{{/unless}}
|
||||
</label>
|
||||
{{/if}}
|
||||
<input type="{{type}}" id="at-field-{{_id}}" name="at-field-{{_id}}" placeholder="{{placeholder}}" autocapitalize="none" autocorrect="off">
|
||||
{{#if hasIcon}}
|
||||
<span class="{{iconClass}}"></span>
|
||||
{{/if}}
|
||||
{{#if hasError}}
|
||||
<span>{{errorText}}</span>
|
||||
{{/if}}
|
||||
</div> -->
|
||||
|
||||
{{#if showLabels}}
|
||||
<paper-input-decorator label=" {{displayName}} {{#unless required}}{{optionalText}}{{/unless}}" error="{{errorText}}" floatinglabel="" layout="" vertical="" isInvalid="{{#if hasError}} true {{/if}}">
|
||||
<input type="{{type}}" id="at-field-{{_id}}" is="core-input" name="at-field-{{_id}}" placeholder="{{placeholder}}" autocapitalize="none" autocorrect="off">
|
||||
</paper-input-decorator>
|
||||
{{else}}
|
||||
|
||||
<paper-input-decorator error="{{errorText}}" isInvalid="{{#if hasError}} true {{/if}}">
|
||||
<input type="{{type}}" id="at-field-{{_id}}" is="core-input" name="at-field-{{_id}}" placeholder="{{placeholder}}" autocapitalize="none" autocorrect="off">
|
||||
</paper-input-decorator>
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{#if hasIcon}}
|
||||
<core-icon icon="{{iconClass}}"></core-icon>
|
||||
{{/if}}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<template name="atCheckboxInput">
|
||||
<div class="at-input">
|
||||
<core-label horizontal layout>
|
||||
<div flex>{{displayName}}</div>
|
||||
<paper-checkbox type="{{type}}" id="at-field-{{_id}}" name="at-field-{{_id}}" {{disabled}} for></paper-checkbox>
|
||||
</core-label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="atSelectInput">
|
||||
<div class="at-input">
|
||||
<core-label>
|
||||
<div for="at-field-{{_id}}">{{displayName}}</div>
|
||||
<core-selector id="at-field-{{_id}}" name="at-field-{{_id}}" valueattr="value" for horizontal layout center justified>
|
||||
{{#each values}}
|
||||
<div value="{{value}}">{{text}}</div>
|
||||
{{/each}}
|
||||
</core-selector>
|
||||
</core-label>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<template name="atRadioInput">
|
||||
<div class="at-input">
|
||||
<label>{{displayName}}</label>
|
||||
</div>
|
||||
<paper-radio-group role="radiogroup" vertical layout>
|
||||
{{#each values}}
|
||||
<paper-radio-button id="at-field-{{id}}-choice-{{value}}" name="t-field-{{id}}" label="{{text}}" value={{value}} toggles role="radio" tabindex="0" aria-checked="true" aria-label="{{text}}" class="core-selected"></paper-radio-button>
|
||||
{{/each}}
|
||||
</paper-radio-group>
|
||||
</template>
|
||||
|
||||
<template name="atHiddenInput">
|
||||
<input type="hidden" id="at-field-{{_id}}" name="at-field-{{_id}}">
|
||||
</template>
|
||||
@@ -1,25 +0,0 @@
|
||||
_.each(AccountsTemplates.atInputRendered, function(callback){
|
||||
Template.atInput.onRendered(callback);
|
||||
Template.atHiddenInput.onRendered(callback);
|
||||
});
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atInput.events(AccountsTemplates.atInputEvents);
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atTextInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atCheckboxInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atSelectInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atRadioInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atHiddenInput.helpers(AccountsTemplates.atInputHelpers);
|
||||
@@ -1,5 +0,0 @@
|
||||
<template name="atMessage">
|
||||
<div class="at-message">
|
||||
{{message}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atMessage.helpers(AccountsTemplates.atMessageHelpers);
|
||||
@@ -1,4 +0,0 @@
|
||||
<template name="atNavButton">
|
||||
<!-- <a id="at-nav-button">{{text}}</a> -->
|
||||
<paper-button id="at-nav-button" raised>{{text}}</paper-button>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atNavButton.helpers(AccountsTemplates.atNavButtonHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atNavButton.events(AccountsTemplates.atNavButtonEvents);
|
||||
@@ -1,7 +0,0 @@
|
||||
<template name="atOauth">
|
||||
<div class="at-oauth" horizontal center-justified layout>
|
||||
{{#each oauthService}}
|
||||
{{> atSocial}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atOauth.helpers(AccountsTemplates.atOauthHelpers);
|
||||
@@ -1,168 +0,0 @@
|
||||
.fullPageAtForm {
|
||||
margin: 0 auto;
|
||||
}
|
||||
.at-form {
|
||||
float: none;
|
||||
margin: auto;
|
||||
overflow: auto;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
}
|
||||
.at-form p {
|
||||
font-size: 15px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.at-title h3 {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
text-align: center;
|
||||
}
|
||||
.at-link.disabled {
|
||||
color: #444;
|
||||
}
|
||||
.at-signin-link {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
.at-error,
|
||||
.at-result {
|
||||
text-align: center;
|
||||
}
|
||||
.at-error {
|
||||
background-color: #FFF0F0;
|
||||
}
|
||||
.at-error p {
|
||||
width: 100%;
|
||||
color: #A94442;
|
||||
}
|
||||
.at-oauth {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.at-btn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
paper-button.at-social-btn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
margin-bottom: 10px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
paper-button.at-social-btn core-icon {
|
||||
float: left;
|
||||
width: 40px;
|
||||
font-size: 20px;
|
||||
margin-top: 1px;
|
||||
padding-right: 15px;
|
||||
padding-left: 5px;
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
paper-button.at-social-btn#at-facebook {
|
||||
background: #3B5998;
|
||||
color: #fff;
|
||||
}
|
||||
paper-button.at-social-btn#at-facebook.disabled {
|
||||
color: #ddd;
|
||||
background: #666666;
|
||||
}
|
||||
paper-button.at-social-btn#at-facebook:hover {
|
||||
background: #2C4780;
|
||||
}
|
||||
paper-button.at-social-btn#at-linkedin {
|
||||
background: #338AB0;
|
||||
color: #fff;
|
||||
}
|
||||
paper-button.at-social-btn#at-linkedin.disabled {
|
||||
color: #ddd;
|
||||
background: #666666;
|
||||
}
|
||||
paper-button.at-social-btn#at-linkedin:hover {
|
||||
background: #0571A6;
|
||||
}
|
||||
paper-button.at-social-btn#at-twitter {
|
||||
background: #4099FF;
|
||||
color: #fff;
|
||||
}
|
||||
paper-button.at-social-btn#at-twitter.disabled {
|
||||
color: #ddd;
|
||||
background: #666666;
|
||||
}
|
||||
paper-button.at-social-btn#at-twitter:hover {
|
||||
background: #3288EB;
|
||||
}
|
||||
paper-button.at-social-btn#at-google {
|
||||
background: #db5a3c;
|
||||
color: #fff;
|
||||
}
|
||||
paper-button.at-social-btn#at-google.disabled {
|
||||
color: #ddd;
|
||||
background: #666666;
|
||||
}
|
||||
paper-button.at-social-btn#at-google:hover {
|
||||
background: #CA4C2E;
|
||||
}
|
||||
paper-button.at-social-btn#at-github {
|
||||
background: #666;
|
||||
color: #fff;
|
||||
}
|
||||
paper-button.at-social-btn#at-github.disabled {
|
||||
color: #ddd;
|
||||
background: #666666;
|
||||
}
|
||||
paper-button.at-social-btn#at-github:hover {
|
||||
background: #555;
|
||||
}
|
||||
.at-sep {
|
||||
text-align: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.at-sep:before,
|
||||
.at-sep:after {
|
||||
display: block;
|
||||
content: " ";
|
||||
border-bottom: 1px solid #ddd;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 48%;
|
||||
}
|
||||
.at-sep:before {
|
||||
left: -60%;
|
||||
}
|
||||
.at-sep:after {
|
||||
right: -60%;
|
||||
}
|
||||
.at-input.validating * {
|
||||
cursor: progress;
|
||||
}
|
||||
.at-pwd-form > form {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.at-pwd-form > form label {
|
||||
margin-bottom: 5px;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
}
|
||||
#at-btn {
|
||||
font-size: 16px;
|
||||
padding: 10px 12px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.at-signup-link {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.at-terms-link {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<template name="atPwdForm">
|
||||
<div class="at-pwd-form">
|
||||
<form role="form" id="at-pwd-form" class="{{disabled}} pure-form pure-form-aligned" novalidate action="#" method="POST">
|
||||
{{#each fields}}
|
||||
{{> atInput}}
|
||||
{{/each}}
|
||||
{{#if showReCaptcha}}
|
||||
{{> atReCaptcha}}
|
||||
{{/if}}
|
||||
{{#if showForgotPasswordLink}}
|
||||
{{> atPwdLink}}
|
||||
{{/if}}
|
||||
{{> atPwdFormBtn}}
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atPwdForm.helpers(AccountsTemplates.atPwdFormHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atPwdForm.events(AccountsTemplates.atPwdFormEvents);
|
||||
@@ -1,8 +0,0 @@
|
||||
<template name="atPwdFormBtn">
|
||||
<div horizontal layout center-justified>
|
||||
<button type="submit" id="at-btn" hidden></button>
|
||||
<paper-button class="at-btn submit {{submitDisabled}}" role="button" id="at-btn-polymer" raised>
|
||||
{{buttonText}}
|
||||
</paper-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,10 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atPwdFormBtn.helpers(AccountsTemplates.atPwdFormBtnHelpers);
|
||||
|
||||
|
||||
Template.atPwdFormBtn.events = {
|
||||
'click #at-btn-polymer': function(event,template) {
|
||||
event.preventDefault();
|
||||
template.find('button[type=submit]').click();
|
||||
}
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
<template name="atPwdLink">
|
||||
<div class="at-pwd-link" horizontal layout center-justified>
|
||||
<p>
|
||||
{{preText}}
|
||||
<a href="{{forgotPwdLink}}" id="at-forgotPwd" class="at-link at-pwd {{disabled}}">{{linkText}}</a>
|
||||
{{suffText}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atPwdLink.helpers(AccountsTemplates.atPwdLinkHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atPwdLink.events(AccountsTemplates.atPwdLinkEvents);
|
||||
@@ -1,3 +0,0 @@
|
||||
<template name="atReCaptcha">
|
||||
<div class="g-recaptcha" data-sitekey='{{key}}' data-theme='{{theme}}' data-type='{{data_type}}'></div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' rendered callback from AccountsTemplates
|
||||
Template.atReCaptcha.rendered = AccountsTemplates.atReCaptchaRendered;
|
||||
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atReCaptcha.helpers(AccountsTemplates.atReCaptchaHelpers);
|
||||
@@ -1,8 +0,0 @@
|
||||
<template name="atResendVerificationEmailLink">
|
||||
<div class="at-resend-verification-email-link at-wrap" horizontal center-justified layout>
|
||||
<p>
|
||||
<a href="{{resendVerificationEmailLink}}" id="at-resend-verification-email" class="at-link at-resend-verification-email {{disabled}}">{{linkText}}</a>
|
||||
{{suffText}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atResendVerificationEmailLink.helpers(AccountsTemplates.atResendVerificationEmailLinkHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atResendVerificationEmailLink.events(AccountsTemplates.atResendVerificationEmailLinkEvents);
|
||||
@@ -1,5 +0,0 @@
|
||||
<template name="atResult">
|
||||
<div class="at-result">
|
||||
{{result}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atResult.helpers(AccountsTemplates.atResultHelpers);
|
||||
@@ -1,5 +0,0 @@
|
||||
<template name="atSep">
|
||||
<div class="at-sep" horizontal center-justified layout>
|
||||
<strong>{{sepText}}</strong>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atSep.helpers(AccountsTemplates.atSepHelpers);
|
||||
@@ -1,9 +0,0 @@
|
||||
<template name="atSigninLink">
|
||||
<div class="at-signin-link" horizontal center-justified layout>
|
||||
<p>
|
||||
{{preText}}
|
||||
<a href="{{signInLink}}" id="at-signIn" class="at-link at-signin {{disabled}}">{{linkText}}</a>
|
||||
{{suffText}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atSigninLink.helpers(AccountsTemplates.atSigninLinkHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atSigninLink.events(AccountsTemplates.atSigninLinkEvents);
|
||||
@@ -1,9 +0,0 @@
|
||||
<template name="atSignupLink">
|
||||
<div class="at-signup-link" horizontal center-justified layout>
|
||||
<p>
|
||||
{{preText}}
|
||||
<a href="{{signUpLink}}" id="at-signUp" class="at-link at-signup {{disabled}}">{{linkText}}</a>
|
||||
{{suffText}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atSignupLink.helpers(AccountsTemplates.atSignupLinkHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atSignupLink.events(AccountsTemplates.atSignupLinkEvents);
|
||||
@@ -1,6 +0,0 @@
|
||||
<template name="atSocial">
|
||||
<paper-button class="at-social-btn {{disabled}}" id="at-{{name}}" name="{{name}}" >
|
||||
<core-icon icon="social:post-{{iconClass}}"></core-icon>
|
||||
<span flex>{{buttonText}} </span>
|
||||
</paper-button>
|
||||
</template>
|
||||
@@ -1,18 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atSocial.helpers(AccountsTemplates.atSocialHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atSocial.events(AccountsTemplates.atSocialEvents);
|
||||
Template.atSocial.events({
|
||||
'click paper-button': AccountsTemplates.atSocialEvents["click button"]
|
||||
});
|
||||
|
||||
|
||||
Template.atSocial.helpers({
|
||||
iconClass: function() {
|
||||
var classStr = this._id;
|
||||
if (classStr[0] === "g" && classStr[1] === "o")
|
||||
classStr = "gplus";
|
||||
return classStr;
|
||||
},
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
<template name="atTermsLink">
|
||||
<div class="at-terms-link at-wrap" horizontal center-justified layout>
|
||||
<p>
|
||||
{{text}}
|
||||
{{#if privacyUrl}}
|
||||
<a href="{{privacyUrl}}" class="{{disabled}}">{{privacyLinkText}}</a>
|
||||
{{/if}}
|
||||
{{#if showTermsAnd}}
|
||||
{{and}}
|
||||
{{/if}}
|
||||
{{#if termsUrl}}
|
||||
<a href="{{termsUrl}}" class="{{disabled}}">{{termsLinkText}}</a>
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atTermsLink.helpers(AccountsTemplates.atTermsLinkHelpers);
|
||||
|
||||
// Simply 'inherites' events from AccountsTemplates
|
||||
Template.atTermsLink.events(AccountsTemplates.atTermsLinkEvents);
|
||||
@@ -1,5 +0,0 @@
|
||||
<template name="atTitle">
|
||||
<div class="at-title" horizontal center-justified layout>
|
||||
<h3>{{title}}</h3>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
// Simply 'inherites' helpers from AccountsTemplates
|
||||
Template.atTitle.helpers(AccountsTemplates.atTitleHelpers);
|
||||
@@ -1,7 +0,0 @@
|
||||
<template name="fullPageAtForm">
|
||||
|
||||
<div class="fullPageAtForm" vertical layout center>
|
||||
{{> atForm}}
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@@ -1,86 +0,0 @@
|
||||
Package.describe({
|
||||
summary: 'Accounts Templates for polymer',
|
||||
version: '1.12.3',
|
||||
name: 'useraccounts:polymer',
|
||||
git: 'https://github.com/meteor-useraccounts/polymer.git',
|
||||
});
|
||||
|
||||
Package.on_use(function(api, where) {
|
||||
api.versionsFrom('METEOR@1.0');
|
||||
|
||||
api.use([
|
||||
'templating',
|
||||
'underscore',
|
||||
], 'client');
|
||||
|
||||
api.use([
|
||||
'useraccounts:core',
|
||||
], ['client', 'server']);
|
||||
|
||||
// Requires all routing packages loads before this asking for weak dependencies.
|
||||
api.use('useraccounts:flow-routing@1.12.1', ['client', 'server'], {weak: true});
|
||||
api.use('useraccounts:iron-routing@1.12.1', ['client', 'server'], {weak: true});
|
||||
|
||||
api.imply([
|
||||
'useraccounts:core@1.12.3',
|
||||
], ['client', 'server']);
|
||||
|
||||
api.add_files([
|
||||
'lib/at_error.html',
|
||||
'lib/at_error.js',
|
||||
'lib/at_form.html',
|
||||
'lib/at_form.js',
|
||||
'lib/at_input.html',
|
||||
'lib/at_input.js',
|
||||
'lib/at_message.html',
|
||||
'lib/at_message.js',
|
||||
'lib/at_nav_button.html',
|
||||
'lib/at_nav_button.js',
|
||||
'lib/at_oauth.html',
|
||||
'lib/at_oauth.js',
|
||||
'lib/at_pwd_form.html',
|
||||
'lib/at_pwd_form.js',
|
||||
'lib/at_pwd_form_btn.html',
|
||||
'lib/at_pwd_form_btn.js',
|
||||
'lib/at_pwd_link.html',
|
||||
'lib/at_pwd_link.js',
|
||||
'lib/at_reCaptcha.html',
|
||||
'lib/at_reCaptcha.js',
|
||||
'lib/at_result.html',
|
||||
'lib/at_result.js',
|
||||
'lib/at_sep.html',
|
||||
'lib/at_sep.js',
|
||||
'lib/at_signin_link.html',
|
||||
'lib/at_signin_link.js',
|
||||
'lib/at_signup_link.html',
|
||||
'lib/at_signup_link.js',
|
||||
'lib/at_social.html',
|
||||
'lib/at_social.js',
|
||||
'lib/at_terms_link.html',
|
||||
'lib/at_terms_link.js',
|
||||
'lib/at_resend_verification_email_link.html',
|
||||
'lib/at_resend_verification_email_link.js',
|
||||
'lib/at_title.html',
|
||||
'lib/at_title.js',
|
||||
'lib/full_page_at_form.html',
|
||||
'lib/at_polymer.css'
|
||||
], ['client']);
|
||||
});
|
||||
|
||||
Package.on_test(function(api) {
|
||||
api.use([
|
||||
'useraccounts:polymer',
|
||||
'useraccounts:core@1.12.3',
|
||||
]);
|
||||
|
||||
api.use([
|
||||
'accounts-password',
|
||||
'less',
|
||||
'tinytest',
|
||||
'test-helpers'
|
||||
], ['client', 'server']);
|
||||
|
||||
api.add_files([
|
||||
'tests/tests.js'
|
||||
], ['client', 'server']);
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
// TODO: write tests!!!
|
||||
@@ -0,0 +1,311 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../components/polymer/polymer.html">
|
||||
<link rel="import" href="../../components/paper-styles/default-theme.html">
|
||||
<link rel="import" href="../../components/paper-behaviors/paper-checked-element-behavior.html">
|
||||
|
||||
<!--
|
||||
Material design: [Checkbox](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-checkbox)
|
||||
|
||||
`paper-checkbox` is a button that can be either checked or unchecked. User
|
||||
can tap the checkbox to check or uncheck it. Usually you use checkboxes
|
||||
to allow user to select multiple options from a set. If you have a single
|
||||
ON/OFF option, avoid using a single checkbox and use `paper-toggle-button`
|
||||
instead.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-checkbox>label</paper-checkbox>
|
||||
|
||||
<paper-checkbox checked> label</paper-checkbox>
|
||||
|
||||
### Styling
|
||||
|
||||
The following custom properties and mixins are available for styling:
|
||||
|
||||
Custom property | Description | Default
|
||||
----------------|-------------|----------
|
||||
`--paper-checkbox-unchecked-background-color` | Checkbox background color when the input is not checked | `transparent`
|
||||
`--paper-checkbox-unchecked-color` | Checkbox border color when the input is not checked | `--primary-text-color`
|
||||
`--paper-checkbox-unchecked-ink-color` | Selected/focus ripple color when the input is not checked | `--primary-text-color`
|
||||
`--paper-checkbox-checked-color` | Checkbox color when the input is checked | `--primary-color`
|
||||
`--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the input is checked | `--primary-color`
|
||||
`--paper-checkbox-checkmark-color` | Checkmark color | `white`
|
||||
`--paper-checkbox-label-color` | Label color | `--primary-text-color`
|
||||
`--paper-checkbox-label-checked-color` | Label color when the input is checked | `--paper-checkbox-label-color`
|
||||
`--paper-checkbox-label-spacing` | Spacing between the label and the checkbox | `8px`
|
||||
`--paper-checkbox-label` | Mixin applied to the label | `{}`
|
||||
`--paper-checkbox-label-checked` | Mixin applied to the label when the input is checked | `{}`
|
||||
`--paper-checkbox-error-color` | Checkbox color when invalid | `--error-color`
|
||||
`--paper-checkbox-size` | Size of the checkbox | `18px`
|
||||
`--paper-checkbox-ink-size` | Size of the ripple | `48px`
|
||||
`--paper-checkbox-margin` | Margin around the checkbox container | `initial`
|
||||
`--paper-checkbox-vertical-align` | Vertical alignment of the checkbox container | `middle`
|
||||
|
||||
This element applies the mixin `--paper-font-common-base` but does not import `paper-styles/typography.html`.
|
||||
In order to apply the `Roboto` font to this element, make sure you've imported `paper-styles/typography.html`.
|
||||
|
||||
@demo demo/index.html
|
||||
-->
|
||||
|
||||
<dom-module id="paper-checkbox">
|
||||
<template strip-whitespace>
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
--calculated-paper-checkbox-size: var(--paper-checkbox-size, 18px);
|
||||
/* -1px is a sentinel for the default and is replaced in `attached`. */
|
||||
--calculated-paper-checkbox-ink-size: var(--paper-checkbox-ink-size, -1px);
|
||||
@apply(--paper-font-common-base);
|
||||
line-height: 0;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
:host([hidden]) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
:host(:focus) {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#checkboxContainer {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: var(--calculated-paper-checkbox-size);
|
||||
height: var(--calculated-paper-checkbox-size);
|
||||
min-width: var(--calculated-paper-checkbox-size);
|
||||
margin: var(--paper-checkbox-margin, initial);
|
||||
vertical-align: var(--paper-checkbox-vertical-align, middle);
|
||||
background-color: var(--paper-checkbox-unchecked-background-color, transparent);
|
||||
}
|
||||
|
||||
#ink {
|
||||
position: absolute;
|
||||
|
||||
/* Center the ripple in the checkbox by negative offsetting it by
|
||||
* (inkWidth - rippleWidth) / 2 */
|
||||
top: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
|
||||
left: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
|
||||
width: var(--calculated-paper-checkbox-ink-size);
|
||||
height: var(--calculated-paper-checkbox-ink-size);
|
||||
color: var(--paper-checkbox-unchecked-ink-color, var(--primary-text-color));
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
:host-context([dir="rtl"]) #ink {
|
||||
right: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
|
||||
left: auto;
|
||||
}
|
||||
|
||||
#ink[checked] {
|
||||
color: var(--paper-checkbox-checked-ink-color, var(--primary-color));
|
||||
}
|
||||
|
||||
#checkbox {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
border: solid 2px;
|
||||
border-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
|
||||
border-radius: 2px;
|
||||
pointer-events: none;
|
||||
-webkit-transition: background-color 140ms, border-color 140ms;
|
||||
transition: background-color 140ms, border-color 140ms;
|
||||
}
|
||||
|
||||
/* checkbox checked animations */
|
||||
#checkbox.checked #checkmark {
|
||||
-webkit-animation: checkmark-expand 140ms ease-out forwards;
|
||||
animation: checkmark-expand 140ms ease-out forwards;
|
||||
}
|
||||
|
||||
@-webkit-keyframes checkmark-expand {
|
||||
0% {
|
||||
-webkit-transform: scale(0, 0) rotate(45deg) translateZ(0);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: scale(1, 1) rotate(45deg) translateZ(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes checkmark-expand {
|
||||
0% {
|
||||
transform: scale(0, 0) rotate(45deg) translateZ(0);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1, 1) rotate(45deg) translateZ(0);
|
||||
}
|
||||
}
|
||||
|
||||
#checkbox.checked {
|
||||
background-color: var(--paper-checkbox-checked-color, var(--primary-color));
|
||||
border-color: var(--paper-checkbox-checked-color, var(--primary-color));
|
||||
}
|
||||
|
||||
#checkmark {
|
||||
position: absolute;
|
||||
width: 36%;
|
||||
height: 70%;
|
||||
border-style: solid;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
border-right-width: calc(2/15 * var(--calculated-paper-checkbox-size));
|
||||
border-bottom-width: calc(2/15 * var(--calculated-paper-checkbox-size));
|
||||
border-color: var(--paper-checkbox-checkmark-color, white);
|
||||
-webkit-transform-origin: 97% 86%;
|
||||
transform-origin: 97% 86%;
|
||||
box-sizing: content-box; /* protect against page-level box-sizing */
|
||||
}
|
||||
|
||||
:host-context([dir="rtl"]) #checkmark {
|
||||
-webkit-transform-origin: 50% 14%;
|
||||
transform-origin: 50% 14%;
|
||||
}
|
||||
|
||||
/* label */
|
||||
#checkboxLabel {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
padding-left: var(--paper-checkbox-label-spacing, 8px);
|
||||
white-space: normal;
|
||||
line-height: normal;
|
||||
color: var(--paper-checkbox-label-color, var(--primary-text-color));
|
||||
@apply(--paper-checkbox-label);
|
||||
}
|
||||
|
||||
:host([checked]) #checkboxLabel {
|
||||
color: var(--paper-checkbox-label-checked-color, var(--paper-checkbox-label-color, var(--primary-text-color)));
|
||||
@apply(--paper-checkbox-label-checked);
|
||||
}
|
||||
|
||||
:host-context([dir="rtl"]) #checkboxLabel {
|
||||
padding-right: var(--paper-checkbox-label-spacing, 8px);
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
#checkboxLabel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* disabled state */
|
||||
|
||||
:host([disabled]) #checkbox {
|
||||
opacity: 0.5;
|
||||
border-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
|
||||
}
|
||||
|
||||
:host([disabled][checked]) #checkbox {
|
||||
background-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
:host([disabled]) #checkboxLabel {
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
/* invalid state */
|
||||
#checkbox.invalid:not(.checked) {
|
||||
border-color: var(--paper-checkbox-error-color, var(--error-color));
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="checkboxContainer">
|
||||
<div id="checkbox" class$="[[_computeCheckboxClass(checked, invalid)]]">
|
||||
<div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="checkboxLabel"><content></content></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'paper-checkbox',
|
||||
|
||||
behaviors: [
|
||||
Polymer.PaperCheckedElementBehavior
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
role: 'checkbox',
|
||||
'aria-checked': false,
|
||||
tabindex: 0
|
||||
},
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* Fired when the checked state changes due to user interaction.
|
||||
*
|
||||
* @event change
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the checked state changes.
|
||||
*
|
||||
* @event iron-change
|
||||
*/
|
||||
ariaActiveAttribute: {
|
||||
type: String,
|
||||
value: 'aria-checked'
|
||||
}
|
||||
},
|
||||
|
||||
attached: function() {
|
||||
var inkSize = this.getComputedStyleValue('--calculated-paper-checkbox-ink-size').trim();
|
||||
// If unset, compute and set the default `--paper-checkbox-ink-size`.
|
||||
if (inkSize === '-1px') {
|
||||
var checkboxSize = parseFloat(this.getComputedStyleValue('--calculated-paper-checkbox-size').trim());
|
||||
var defaultInkSize = Math.floor((8 / 3) * checkboxSize);
|
||||
|
||||
// The checkbox and ripple need to have the same parity so that their
|
||||
// centers align.
|
||||
if (defaultInkSize % 2 !== checkboxSize % 2) {
|
||||
defaultInkSize++;
|
||||
}
|
||||
|
||||
this.customStyle['--paper-checkbox-ink-size'] = defaultInkSize + 'px';
|
||||
this.updateStyles();
|
||||
}
|
||||
},
|
||||
|
||||
_computeCheckboxClass: function(checked, invalid) {
|
||||
var className = '';
|
||||
if (checked) {
|
||||
className += 'checked ';
|
||||
}
|
||||
if (invalid) {
|
||||
className += 'invalid';
|
||||
}
|
||||
return className;
|
||||
},
|
||||
|
||||
_computeCheckmarkClass: function(checked) {
|
||||
return checked ? '' : 'hidden';
|
||||
},
|
||||
|
||||
// create ripple inside the checkboxContainer
|
||||
_createRipple: function() {
|
||||
this._rippleContainer = this.$.checkboxContainer;
|
||||
return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* @license
|
||||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
|
||||
:host {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background-color: #fff;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
padding: 0.75em 0;
|
||||
}
|
||||
|
||||
#control {
|
||||
box-sizing: border-box;
|
||||
max-height: 2em;
|
||||
color: #757575;
|
||||
border-bottom: 1px solid #757575;
|
||||
}
|
||||
|
||||
#control[selected] {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#control > div {
|
||||
padding: 0.5em 0 0.25em;
|
||||
overflow: hidden;
|
||||
/* FIXME not working for some reason */
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
core-icon {
|
||||
margin: 0.3em 0 0.2em 0.25em;
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
`paper-dropdown-menu` works together with `paper-dropdown` and `core-menu` to
|
||||
implement a drop-down menu. The currently selected item is displayed in the
|
||||
control. If no item is selected, the `label` is displayed instead.
|
||||
|
||||
The child element with the class `dropdown` will be used as the drop-down
|
||||
menu. It should be a `paper-dropdown` or other overlay element. You should
|
||||
also provide a `core-selector` or other selector element, such as `core-menu`,
|
||||
in the drop-down. You should apply the class `menu` to the selector element.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-dropdown-menu label="Your favorite pastry">
|
||||
<paper-dropdown class="dropdown">
|
||||
<core-menu class="menu">
|
||||
<paper-item>Croissant</paper-item>
|
||||
<paper-item>Donut</paper-item>
|
||||
<paper-item>Financier</paper-item>
|
||||
<paper-item>Madeleine</paper-item>
|
||||
</core-menu>
|
||||
</paper-dropdown>
|
||||
</paper-dropdown-menu>
|
||||
|
||||
This example renders a drop-down menu with 4 options.
|
||||
|
||||
@group Paper Elements
|
||||
@element paper-dropdown-menu
|
||||
@extends core-dropdown-base
|
||||
@mixins Polymer.CoreFocusable https://github.com/polymer/core-focusable
|
||||
@status unstable
|
||||
@homepage github.io
|
||||
-->
|
||||
|
||||
<!--
|
||||
Fired when an item's selection state is changed. This event is fired both
|
||||
when an item is selected or deselected. The `isSelected` detail property
|
||||
contains the selection state.
|
||||
|
||||
@event core-select
|
||||
@param {Object} detail
|
||||
@param {boolean} detail.isSelected true for selection and false for deselection
|
||||
@param {Object} detail.item the item element
|
||||
-->
|
||||
<link href="../../components/polymer/polymer.html" rel="import">
|
||||
|
||||
<link href="../../components/core-a11y-keys/core-a11y-keys.html" rel="import">
|
||||
<link href="../../components/core-dropdown/core-dropdown-base.html" rel="import">
|
||||
<link href="../../components/core-focusable/core-focusable.html" rel="import">
|
||||
<link href="../../components/core-icon/core-icon.html" rel="import">
|
||||
<link href="../../components/core-icons/core-icons.html" rel="import">
|
||||
<link href="../../components/paper-shadow/paper-shadow.html" rel="import">
|
||||
|
||||
<style shim-shadowdom>
|
||||
html /deep/ #paper-dropdown-menu-dropdown {
|
||||
margin: 12px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
html /deep/ #paper-dropdown-menu-dropdown #menu {
|
||||
padding: 8px 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html /deep/ #paper-dropdown-menu-dropdown .menu-container {
|
||||
overflow: auto;
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<polymer-element name="paper-dropdown-menu" extends="core-dropdown-base" relative layout inline horizontal center tabindex="0">
|
||||
<template>
|
||||
|
||||
<style>
|
||||
:host {
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
padding: 0.5em 0 0.25em;
|
||||
margin: 0.75em 0;
|
||||
border-bottom: 1px solid #757575;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#label:not(.selectedItem), #arrow {
|
||||
color: #757575;
|
||||
}
|
||||
|
||||
#label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
<core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOverlay}}"></core-a11y-keys>
|
||||
|
||||
<div flex auto id="label">{{selectedItemLabel || label}}</div>
|
||||
<core-icon id="arrow" icon="{{opened ? openedIcon : closedIcon}}"></core-icon>
|
||||
|
||||
<content></content>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
|
||||
(function() {
|
||||
|
||||
var p = {
|
||||
|
||||
publish: {
|
||||
|
||||
/**
|
||||
* A label for the control. The label is displayed if no item is selected.
|
||||
*
|
||||
* @attribute label
|
||||
* @type string
|
||||
* @default 'Select an item'
|
||||
*/
|
||||
label: 'Select an item',
|
||||
|
||||
/**
|
||||
* The icon to display when the drop-down is opened.
|
||||
*
|
||||
* @attribute openedIcon
|
||||
* @type string
|
||||
* @default 'arrow-drop-up'
|
||||
*/
|
||||
openedIcon: 'arrow-drop-up',
|
||||
|
||||
/**
|
||||
* The icon to display when the drop-down is closed.
|
||||
*
|
||||
* @attribute closedIcon
|
||||
* @type string
|
||||
* @default 'arrow-drop-down'
|
||||
*/
|
||||
closedIcon: 'arrow-drop-down'
|
||||
|
||||
},
|
||||
|
||||
selectedItemLabel: '',
|
||||
|
||||
overlayListeners: {
|
||||
'core-overlay-open': 'openAction',
|
||||
'core-activate': 'activateAction',
|
||||
'core-select': 'selectAction'
|
||||
},
|
||||
|
||||
activateAction: function(e) {
|
||||
this.opened = false;
|
||||
},
|
||||
|
||||
selectAction: function(e) {
|
||||
var detail = e.detail;
|
||||
if (detail.isSelected) {
|
||||
this.$.label.classList.add('selectedItem');
|
||||
this.selectedItemLabel = detail.item.label || detail.item.textContent;
|
||||
var event = new CustomEvent('core-select', { 'detail': detail });
|
||||
this.dispatchEvent(event);
|
||||
} else {
|
||||
this.$.label.classList.remove('selectedItem');
|
||||
this.selectedItemLabel = '';
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Polymer.mixin2(p, Polymer.CoreFocusable);
|
||||
Polymer(p);
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
</polymer-element>
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "paper-dropdown",
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5",
|
||||
"core-animation": "Polymer/core-animation#^0.5",
|
||||
"core-collapse": "Polymer/core-collapse#^0.5",
|
||||
"core-dropdown": "Polymer/core-dropdown#^0.5",
|
||||
"core-transition": "Polymer/core-transition#^0.5",
|
||||
"core-icons": "Polymer/core-icons#^0.5",
|
||||
"paper-icon-button": "Polymer/paper-icon-button#^0.5",
|
||||
"paper-item": "Polymer/paper-item#^0.5",
|
||||
"paper-shadow": "Polymer/paper-shadow#^0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "web-component-tester#master"
|
||||
},
|
||||
"version": "0.5.6",
|
||||
"homepage": "https://github.com/Polymer/paper-dropdown",
|
||||
"_release": "0.5.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.6",
|
||||
"commit": "30db0c00276fd8740bc7488f58703ad9f2449e9d"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/paper-dropdown.git",
|
||||
"_target": "^0.5",
|
||||
"_originalSource": "Polymer/paper-dropdown"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
paper-dropdown
|
||||
==============
|
||||
|
||||
owner: @morethanreal
|
||||
|
||||
See the [component page](https://www.polymer-project.org/0.5/docs/elements/paper-dropdown.html) for more information.
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "paper-dropdown",
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5",
|
||||
"core-animation": "Polymer/core-animation#^0.5",
|
||||
"core-collapse": "Polymer/core-collapse#^0.5",
|
||||
"core-dropdown": "Polymer/core-dropdown#^0.5",
|
||||
"core-transition": "Polymer/core-transition#^0.5",
|
||||
"core-icons": "Polymer/core-icons#^0.5",
|
||||
"paper-icon-button": "Polymer/paper-icon-button#^0.5",
|
||||
"paper-item": "Polymer/paper-item#^0.5",
|
||||
"paper-shadow": "Polymer/paper-shadow#^0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "web-component-tester#master"
|
||||
},
|
||||
"version": "0.5.6"
|
||||
}
|
||||
@@ -1,456 +0,0 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<title>paper-dropdown</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
|
||||
<link href="../core-collapse/core-collapse.html" rel="import">
|
||||
<link href="../core-icons/core-icons.html" rel="import">
|
||||
<link href="../paper-icon-button/paper-icon-button.html" rel="import">
|
||||
<link href="../paper-item/paper-item.html" rel="import">
|
||||
|
||||
<link href="paper-dropdown.html" rel="import">
|
||||
|
||||
<style shim-shadowdom>
|
||||
body {
|
||||
font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
padding: 24px;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
section {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
section > div {
|
||||
padding: 14px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
x-trigger {
|
||||
z-index: auto;
|
||||
}
|
||||
|
||||
html /deep/ paper-dropdown:not(.no-padding)::shadow #scroller {
|
||||
box-sizing: border-box;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.with-margin {
|
||||
margin: 12px;
|
||||
}
|
||||
|
||||
.open-below {
|
||||
top: 38px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<polymer-element name="x-trigger" extends="paper-icon-button" relative on-tap="{{toggle}}" noink>
|
||||
<template>
|
||||
<shadow></shadow>
|
||||
<content></content>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
toggle: function() {
|
||||
if (!this.dropdown) {
|
||||
this.dropdown = this.querySelector('paper-dropdown');
|
||||
}
|
||||
this.dropdown && this.dropdown.toggle();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
<template is="auto-binding">
|
||||
|
||||
<section>
|
||||
|
||||
<div>Absolutely positioned dropdowns</div>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown>
|
||||
halign = left
|
||||
<br>
|
||||
valign = top
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown valign="bottom">
|
||||
halign = left
|
||||
<br>
|
||||
valign = bottom
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown halign="right">
|
||||
halign = right
|
||||
<br>
|
||||
valign = top
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown class="no-padding">
|
||||
<div class="menu">
|
||||
<paper-item>Item 1</paper-item>
|
||||
<paper-item>Item 2</paper-item>
|
||||
<paper-item>Item 3</paper-item>
|
||||
</div>
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<div>Layered dropdowns</div>
|
||||
|
||||
<button onclick="document.getElementById('collapse').toggle()">toggle core-collapse</button>
|
||||
|
||||
<br>
|
||||
|
||||
<core-collapse id="collapse">
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown layered>
|
||||
halign = left
|
||||
<br>
|
||||
valign = top
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
</core-collapse>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<div>Scrolling and margin</div>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown>
|
||||
no margin<br>
|
||||
<br>
|
||||
<template repeat="{{countries}}">
|
||||
{{name}}<br>
|
||||
</template>
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown class="with-margin">
|
||||
with margin<br>
|
||||
<br>
|
||||
<template repeat="{{countries}}">
|
||||
{{name}}<br>
|
||||
</template>
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<div>Custom position</div>
|
||||
|
||||
<x-trigger icon="menu">
|
||||
<paper-dropdown class="open-below">
|
||||
top: 38px
|
||||
</paper-dropdown>
|
||||
</x-trigger>
|
||||
|
||||
</section>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
scope = document.querySelector('template[is=auto-binding]');
|
||||
|
||||
scope.countries = [
|
||||
{name: 'Afghanistan', code: 'AF'},
|
||||
{name: 'Åland Islands', code: 'AX'},
|
||||
{name: 'Albania', code: 'AL'},
|
||||
{name: 'Algeria', code: 'DZ'},
|
||||
{name: 'American Samoa', code: 'AS'},
|
||||
{name: 'Andorra', code: 'AD'},
|
||||
{name: 'Angola', code: 'AO'},
|
||||
{name: 'Anguilla', code: 'AI'},
|
||||
{name: 'Antarctica', code: 'AQ'},
|
||||
{name: 'Antigua and Barbuda', code: 'AG'},
|
||||
{name: 'Argentina', code: 'AR'},
|
||||
{name: 'Armenia', code: 'AM'},
|
||||
{name: 'Aruba', code: 'AW'},
|
||||
{name: 'Australia', code: 'AU'},
|
||||
{name: 'Austria', code: 'AT'},
|
||||
{name: 'Azerbaijan', code: 'AZ'},
|
||||
{name: 'Bahamas', code: 'BS'},
|
||||
{name: 'Bahrain', code: 'BH'},
|
||||
{name: 'Bangladesh', code: 'BD'},
|
||||
{name: 'Barbados', code: 'BB'},
|
||||
{name: 'Belarus', code: 'BY'},
|
||||
{name: 'Belgium', code: 'BE'},
|
||||
{name: 'Belize', code: 'BZ'},
|
||||
{name: 'Benin', code: 'BJ'},
|
||||
{name: 'Bermuda', code: 'BM'},
|
||||
{name: 'Bhutan', code: 'BT'},
|
||||
{name: 'Bolivia', code: 'BO'},
|
||||
{name: 'Bosnia and Herzegovina', code: 'BA'},
|
||||
{name: 'Botswana', code: 'BW'},
|
||||
{name: 'Bouvet Island', code: 'BV'},
|
||||
{name: 'Brazil', code: 'BR'},
|
||||
{name: 'British Indian Ocean Territory', code: 'IO'},
|
||||
{name: 'Brunei Darussalam', code: 'BN'},
|
||||
{name: 'Bulgaria', code: 'BG'},
|
||||
{name: 'Burkina Faso', code: 'BF'},
|
||||
{name: 'Burundi', code: 'BI'},
|
||||
{name: 'Cambodia', code: 'KH'},
|
||||
{name: 'Cameroon', code: 'CM'},
|
||||
{name: 'Canada', code: 'CA'},
|
||||
{name: 'Cape Verde', code: 'CV'},
|
||||
{name: 'Cayman Islands', code: 'KY'},
|
||||
{name: 'Central African Republic', code: 'CF'},
|
||||
{name: 'Chad', code: 'TD'},
|
||||
{name: 'Chile', code: 'CL'},
|
||||
{name: 'China', code: 'CN'},
|
||||
{name: 'Christmas Island', code: 'CX'},
|
||||
{name: 'Cocos (Keeling) Islands', code: 'CC'},
|
||||
{name: 'Colombia', code: 'CO'},
|
||||
{name: 'Comoros', code: 'KM'},
|
||||
{name: 'Congo', code: 'CG'},
|
||||
{name: 'Congo, The Democratic Republic of the', code: 'CD'},
|
||||
{name: 'Cook Islands', code: 'CK'},
|
||||
{name: 'Costa Rica', code: 'CR'},
|
||||
{name: 'Cote D\'Ivoire', code: 'CI'},
|
||||
{name: 'Croatia', code: 'HR'},
|
||||
{name: 'Cuba', code: 'CU'},
|
||||
{name: 'Cyprus', code: 'CY'},
|
||||
{name: 'Czech Republic', code: 'CZ'},
|
||||
{name: 'Denmark', code: 'DK'},
|
||||
{name: 'Djibouti', code: 'DJ'},
|
||||
{name: 'Dominica', code: 'DM'},
|
||||
{name: 'Dominican Republic', code: 'DO'},
|
||||
{name: 'Ecuador', code: 'EC'},
|
||||
{name: 'Egypt', code: 'EG'},
|
||||
{name: 'El Salvador', code: 'SV'},
|
||||
{name: 'Equatorial Guinea', code: 'GQ'},
|
||||
{name: 'Eritrea', code: 'ER'},
|
||||
{name: 'Estonia', code: 'EE'},
|
||||
{name: 'Ethiopia', code: 'ET'},
|
||||
{name: 'Falkland Islands (Malvinas)', code: 'FK'},
|
||||
{name: 'Faroe Islands', code: 'FO'},
|
||||
{name: 'Fiji', code: 'FJ'},
|
||||
{name: 'Finland', code: 'FI'},
|
||||
{name: 'France', code: 'FR'},
|
||||
{name: 'French Guiana', code: 'GF'},
|
||||
{name: 'French Polynesia', code: 'PF'},
|
||||
{name: 'French Southern Territories', code: 'TF'},
|
||||
{name: 'Gabon', code: 'GA'},
|
||||
{name: 'Gambia', code: 'GM'},
|
||||
{name: 'Georgia', code: 'GE'},
|
||||
{name: 'Germany', code: 'DE'},
|
||||
{name: 'Ghana', code: 'GH'},
|
||||
{name: 'Gibraltar', code: 'GI'},
|
||||
{name: 'Greece', code: 'GR'},
|
||||
{name: 'Greenland', code: 'GL'},
|
||||
{name: 'Grenada', code: 'GD'},
|
||||
{name: 'Guadeloupe', code: 'GP'},
|
||||
{name: 'Guam', code: 'GU'},
|
||||
{name: 'Guatemala', code: 'GT'},
|
||||
{name: 'Guernsey', code: 'GG'},
|
||||
{name: 'Guinea', code: 'GN'},
|
||||
{name: 'Guinea-Bissau', code: 'GW'},
|
||||
{name: 'Guyana', code: 'GY'},
|
||||
{name: 'Haiti', code: 'HT'},
|
||||
{name: 'Heard Island and Mcdonald Islands', code: 'HM'},
|
||||
{name: 'Holy See (Vatican City State)', code: 'VA'},
|
||||
{name: 'Honduras', code: 'HN'},
|
||||
{name: 'Hong Kong', code: 'HK'},
|
||||
{name: 'Hungary', code: 'HU'},
|
||||
{name: 'Iceland', code: 'IS'},
|
||||
{name: 'India', code: 'IN'},
|
||||
{name: 'Indonesia', code: 'ID'},
|
||||
{name: 'Iran, Islamic Republic Of', code: 'IR'},
|
||||
{name: 'Iraq', code: 'IQ'},
|
||||
{name: 'Ireland', code: 'IE'},
|
||||
{name: 'Isle of Man', code: 'IM'},
|
||||
{name: 'Israel', code: 'IL'},
|
||||
{name: 'Italy', code: 'IT'},
|
||||
{name: 'Jamaica', code: 'JM'},
|
||||
{name: 'Japan', code: 'JP'},
|
||||
{name: 'Jersey', code: 'JE'},
|
||||
{name: 'Jordan', code: 'JO'},
|
||||
{name: 'Kazakhstan', code: 'KZ'},
|
||||
{name: 'Kenya', code: 'KE'},
|
||||
{name: 'Kiribati', code: 'KI'},
|
||||
{name: 'Korea, Democratic People\'S Republic of', code: 'KP'},
|
||||
{name: 'Korea, Republic of', code: 'KR'},
|
||||
{name: 'Kuwait', code: 'KW'},
|
||||
{name: 'Kyrgyzstan', code: 'KG'},
|
||||
{name: 'Lao People\'S Democratic Republic', code: 'LA'},
|
||||
{name: 'Latvia', code: 'LV'},
|
||||
{name: 'Lebanon', code: 'LB'},
|
||||
{name: 'Lesotho', code: 'LS'},
|
||||
{name: 'Liberia', code: 'LR'},
|
||||
{name: 'Libyan Arab Jamahiriya', code: 'LY'},
|
||||
{name: 'Liechtenstein', code: 'LI'},
|
||||
{name: 'Lithuania', code: 'LT'},
|
||||
{name: 'Luxembourg', code: 'LU'},
|
||||
{name: 'Macao', code: 'MO'},
|
||||
{name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK'},
|
||||
{name: 'Madagascar', code: 'MG'},
|
||||
{name: 'Malawi', code: 'MW'},
|
||||
{name: 'Malaysia', code: 'MY'},
|
||||
{name: 'Maldives', code: 'MV'},
|
||||
{name: 'Mali', code: 'ML'},
|
||||
{name: 'Malta', code: 'MT'},
|
||||
{name: 'Marshall Islands', code: 'MH'},
|
||||
{name: 'Martinique', code: 'MQ'},
|
||||
{name: 'Mauritania', code: 'MR'},
|
||||
{name: 'Mauritius', code: 'MU'},
|
||||
{name: 'Mayotte', code: 'YT'},
|
||||
{name: 'Mexico', code: 'MX'},
|
||||
{name: 'Micronesia, Federated States of', code: 'FM'},
|
||||
{name: 'Moldova, Republic of', code: 'MD'},
|
||||
{name: 'Monaco', code: 'MC'},
|
||||
{name: 'Mongolia', code: 'MN'},
|
||||
{name: 'Montserrat', code: 'MS'},
|
||||
{name: 'Morocco', code: 'MA'},
|
||||
{name: 'Mozambique', code: 'MZ'},
|
||||
{name: 'Myanmar', code: 'MM'},
|
||||
{name: 'Namibia', code: 'NA'},
|
||||
{name: 'Nauru', code: 'NR'},
|
||||
{name: 'Nepal', code: 'NP'},
|
||||
{name: 'Netherlands', code: 'NL'},
|
||||
{name: 'Netherlands Antilles', code: 'AN'},
|
||||
{name: 'New Caledonia', code: 'NC'},
|
||||
{name: 'New Zealand', code: 'NZ'},
|
||||
{name: 'Nicaragua', code: 'NI'},
|
||||
{name: 'Niger', code: 'NE'},
|
||||
{name: 'Nigeria', code: 'NG'},
|
||||
{name: 'Niue', code: 'NU'},
|
||||
{name: 'Norfolk Island', code: 'NF'},
|
||||
{name: 'Northern Mariana Islands', code: 'MP'},
|
||||
{name: 'Norway', code: 'NO'},
|
||||
{name: 'Oman', code: 'OM'},
|
||||
{name: 'Pakistan', code: 'PK'},
|
||||
{name: 'Palau', code: 'PW'},
|
||||
{name: 'Palestinian Territory, Occupied', code: 'PS'},
|
||||
{name: 'Panama', code: 'PA'},
|
||||
{name: 'Papua New Guinea', code: 'PG'},
|
||||
{name: 'Paraguay', code: 'PY'},
|
||||
{name: 'Peru', code: 'PE'},
|
||||
{name: 'Philippines', code: 'PH'},
|
||||
{name: 'Pitcairn', code: 'PN'},
|
||||
{name: 'Poland', code: 'PL'},
|
||||
{name: 'Portugal', code: 'PT'},
|
||||
{name: 'Puerto Rico', code: 'PR'},
|
||||
{name: 'Qatar', code: 'QA'},
|
||||
{name: 'Reunion', code: 'RE'},
|
||||
{name: 'Romania', code: 'RO'},
|
||||
{name: 'Russian Federation', code: 'RU'},
|
||||
{name: 'RWANDA', code: 'RW'},
|
||||
{name: 'Saint Helena', code: 'SH'},
|
||||
{name: 'Saint Kitts and Nevis', code: 'KN'},
|
||||
{name: 'Saint Lucia', code: 'LC'},
|
||||
{name: 'Saint Pierre and Miquelon', code: 'PM'},
|
||||
{name: 'Saint Vincent and the Grenadines', code: 'VC'},
|
||||
{name: 'Samoa', code: 'WS'},
|
||||
{name: 'San Marino', code: 'SM'},
|
||||
{name: 'Sao Tome and Principe', code: 'ST'},
|
||||
{name: 'Saudi Arabia', code: 'SA'},
|
||||
{name: 'Senegal', code: 'SN'},
|
||||
{name: 'Serbia and Montenegro', code: 'CS'},
|
||||
{name: 'Seychelles', code: 'SC'},
|
||||
{name: 'Sierra Leone', code: 'SL'},
|
||||
{name: 'Singapore', code: 'SG'},
|
||||
{name: 'Slovakia', code: 'SK'},
|
||||
{name: 'Slovenia', code: 'SI'},
|
||||
{name: 'Solomon Islands', code: 'SB'},
|
||||
{name: 'Somalia', code: 'SO'},
|
||||
{name: 'South Africa', code: 'ZA'},
|
||||
{name: 'South Georgia and the South Sandwich Islands', code: 'GS'},
|
||||
{name: 'Spain', code: 'ES'},
|
||||
{name: 'Sri Lanka', code: 'LK'},
|
||||
{name: 'Sudan', code: 'SD'},
|
||||
{name: 'Suriname', code: 'SR'},
|
||||
{name: 'Svalbard and Jan Mayen', code: 'SJ'},
|
||||
{name: 'Swaziland', code: 'SZ'},
|
||||
{name: 'Sweden', code: 'SE'},
|
||||
{name: 'Switzerland', code: 'CH'},
|
||||
{name: 'Syrian Arab Republic', code: 'SY'},
|
||||
{name: 'Taiwan, Province of China', code: 'TW'},
|
||||
{name: 'Tajikistan', code: 'TJ'},
|
||||
{name: 'Tanzania, United Republic of', code: 'TZ'},
|
||||
{name: 'Thailand', code: 'TH'},
|
||||
{name: 'Timor-Leste', code: 'TL'},
|
||||
{name: 'Togo', code: 'TG'},
|
||||
{name: 'Tokelau', code: 'TK'},
|
||||
{name: 'Tonga', code: 'TO'},
|
||||
{name: 'Trinidad and Tobago', code: 'TT'},
|
||||
{name: 'Tunisia', code: 'TN'},
|
||||
{name: 'Turkey', code: 'TR'},
|
||||
{name: 'Turkmenistan', code: 'TM'},
|
||||
{name: 'Turks and Caicos Islands', code: 'TC'},
|
||||
{name: 'Tuvalu', code: 'TV'},
|
||||
{name: 'Uganda', code: 'UG'},
|
||||
{name: 'Ukraine', code: 'UA'},
|
||||
{name: 'United Arab Emirates', code: 'AE'},
|
||||
{name: 'United Kingdom', code: 'GB'},
|
||||
{name: 'United States', code: 'US'},
|
||||
{name: 'United States Minor Outlying Islands', code: 'UM'},
|
||||
{name: 'Uruguay', code: 'UY'},
|
||||
{name: 'Uzbekistan', code: 'UZ'},
|
||||
{name: 'Vanuatu', code: 'VU'},
|
||||
{name: 'Venezuela', code: 'VE'},
|
||||
{name: 'Viet Nam', code: 'VN'},
|
||||
{name: 'Virgin Islands, British', code: 'VG'},
|
||||
{name: 'Virgin Islands, U.S.', code: 'VI'},
|
||||
{name: 'Wallis and Futuna', code: 'WF'},
|
||||
{name: 'Western Sahara', code: 'EH'},
|
||||
{name: 'Yemen', code: 'YE'},
|
||||
{name: 'Zambia', code: 'ZM'},
|
||||
{name: 'Zimbabwe', code: 'ZW'}
|
||||
];
|
||||
|
||||
scope.pastries = [
|
||||
'Apple fritter',
|
||||
'Croissant',
|
||||
'Donut',
|
||||
'Financier',
|
||||
'Jello',
|
||||
'Madeleine',
|
||||
'Pound cake',
|
||||
'Pretzel',
|
||||
'Sfogliatelle'
|
||||
];
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,22 +0,0 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../core-component-page/core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page sources='["paper-dropdown.html","paper-dropdown-transition.html"]'></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */
|
||||
|
||||
:host(.core-transition) #ripple,
|
||||
:host(.core-transition) #background {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
:host(.core-transition) #scroller {
|
||||
opacity: 0;
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<!--
|
||||
|
||||
`paper-dropdown-transition` is a transition for `paper-dropdown`.
|
||||
|
||||
Add the class `menu` to a `core-selector` child of the `paper-dropdown` to
|
||||
enable the optional list cascade transition.
|
||||
|
||||
@group Paper Elements
|
||||
@class paper-dropdown-transition
|
||||
@extends core-transition-css
|
||||
@status unstable
|
||||
-->
|
||||
<link href="../../components/polymer/polymer.html" rel="import">
|
||||
<link href="../../components/core-transition/core-transition-css.html" rel="import">
|
||||
<link href="../../components/core-animation/web-animations.html" rel="import">
|
||||
|
||||
<polymer-element name="paper-dropdown-transition" extends="core-transition-css">
|
||||
<template>
|
||||
<link href="paper-dropdown-transition.css" rel="stylesheet" no-shim>
|
||||
</template>
|
||||
<script>
|
||||
Polymer('paper-dropdown-transition', {
|
||||
|
||||
publish: {
|
||||
|
||||
/**
|
||||
* The duration of the transition in ms. You can also set the duration by
|
||||
* setting a `duration` attribute on the target:
|
||||
*
|
||||
* <paper-dropdown duration="1000"></paper-dropdown>
|
||||
*
|
||||
* @attribute duration
|
||||
* @type number
|
||||
* @default 500
|
||||
*/
|
||||
duration: 350
|
||||
|
||||
},
|
||||
|
||||
setup: function(node) {
|
||||
this.super(arguments);
|
||||
|
||||
var to = {
|
||||
'top': '0%',
|
||||
'left': '0%',
|
||||
'bottom': '100%',
|
||||
'right': '100%'
|
||||
};
|
||||
|
||||
var bg = node.$.background;
|
||||
bg.style.webkitTransformOrigin = to[node.halign] + ' ' + to[node.valign];
|
||||
bg.style.transformOrigin = to[node.halign] + ' ' + to[node.valign];
|
||||
},
|
||||
|
||||
transitionOpened: function(node, opened) {
|
||||
this.super(arguments);
|
||||
|
||||
if (opened) {
|
||||
if (this.player) {
|
||||
this.player.cancel();
|
||||
}
|
||||
|
||||
var duration = Number(node.getAttribute('duration')) || this.duration;
|
||||
|
||||
var anims = [];
|
||||
|
||||
var size = node.getBoundingClientRect();
|
||||
|
||||
var ink = node.$.ripple;
|
||||
// var offset = 40 / Math.max(size.width, size.height);
|
||||
var offset = 0.2;
|
||||
anims.push(new Animation(ink, [{
|
||||
'opacity': 0.9,
|
||||
'transform': 'scale(0)',
|
||||
}, {
|
||||
'opacity': 0.9,
|
||||
'transform': 'scale(1)'
|
||||
}], {
|
||||
duration: duration * offset,
|
||||
}));
|
||||
|
||||
// XXX: cancel() seems not to be working until chrome 41 so set the opacity for the
|
||||
// background here to prevent a flash.
|
||||
anims.push(new Animation(node.$.background, [{
|
||||
'opacity': 0,
|
||||
'transform': 'scale(0)'
|
||||
}, {
|
||||
'opacity': 0,
|
||||
'transform': 'scale(0)'
|
||||
}], {
|
||||
duration: 0,
|
||||
delay: 0,
|
||||
fill: 'forwards'
|
||||
}));
|
||||
|
||||
var bg = node.$.background;
|
||||
var sx = 40 / size.width;
|
||||
var sy = 40 / size.height;
|
||||
anims.push(new Animation(bg, [{
|
||||
'opacity': 0.9,
|
||||
'transform': 'scale(' + sx + ',' + sy + ')',
|
||||
}, {
|
||||
'opacity': 1,
|
||||
'transform': 'scale(' + Math.max(sx, 0.95) + ',' + Math.max(sy, 0.5) + ')'
|
||||
}, {
|
||||
'opacity': 1,
|
||||
'transform': 'scale(1, 1)'
|
||||
}], {
|
||||
delay: duration * offset,
|
||||
duration: duration * (1 - offset),
|
||||
fill: 'forwards'
|
||||
}));
|
||||
|
||||
var menu = node.querySelector('.menu');
|
||||
if (menu) {
|
||||
var items = menu.items || menu.children.array();
|
||||
var itemDelay = offset + (1 - offset) / 2;
|
||||
var itemDuration = duration * (1 - itemDelay) / items.length;
|
||||
var reverse = this.valign === 'bottom';
|
||||
|
||||
items.forEach(function(item, i) {
|
||||
anims.push(new Animation(item, [{
|
||||
'opacity': 0
|
||||
}, {
|
||||
'opacity': 1
|
||||
}], {
|
||||
delay: duration * itemDelay + itemDuration * (reverse ? items.length - 1 - i : i),
|
||||
duration: itemDuration,
|
||||
fill: 'both'
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
anims.push(new Animation(node.$.scroller, [{
|
||||
'opacity': 1
|
||||
}, {
|
||||
'opacity': 1
|
||||
}], {
|
||||
delay: duration * itemDelay,
|
||||
duration: itemDuration * items.length,
|
||||
fill: 'both'
|
||||
}));
|
||||
|
||||
} else {
|
||||
anims.push(new Animation(node.$.scroller, [{
|
||||
'opacity': 0
|
||||
}, {
|
||||
'opacity': 1
|
||||
}], {
|
||||
delay: duration * (offset + (1 - offset) / 2),
|
||||
duration: duration * 0.5,
|
||||
fill: 'both'
|
||||
}));
|
||||
}
|
||||
|
||||
var group = new AnimationGroup(anims/*, {
|
||||
easing: 'cubic-bezier(0.4, 0, 0.2, 1)'
|
||||
}*/);
|
||||
this.player = document.timeline.play(group);
|
||||
this.player.onfinish = function() {
|
||||
this.fire('core-transitionend', this, node);
|
||||
}.bind(this);
|
||||
|
||||
} else {
|
||||
this.fire('core-transitionend', this, node);
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
||||
<paper-dropdown-transition id="paper-dropdown-transition"></paper-dropdown-transition>
|
||||
@@ -1,115 +0,0 @@
|
||||
<!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
`paper-dropdown` is a `core-dropdown` with a `paper-shadow`. By default, it
|
||||
is animated on open with `paper-dropdown-transition`. Use this element with
|
||||
`paper-dropdown-menu` or `paper-menu-button` to implement UI controls that
|
||||
open a drop-down.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-dropdown>
|
||||
Hi!
|
||||
</paper-dropdown>
|
||||
|
||||
Theming
|
||||
-------
|
||||
|
||||
Style the background color of the dropdown with these selectors:
|
||||
|
||||
paper-dropdown::shadow #ripple,
|
||||
paper-dropdown::shadow #background {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
@group Paper Elements
|
||||
@element paper-dropdown
|
||||
@extends core-dropdown
|
||||
@status unstable
|
||||
-->
|
||||
|
||||
<link href="../../components/polymer/polymer.html" rel="import">
|
||||
<link href="../../components/core-dropdown/core-dropdown.html" rel="import">
|
||||
<link href="../../components/paper-shadow/paper-shadow.html" rel="import">
|
||||
|
||||
<!--<link href="paper-dropdown-transition.html" rel="import">-->
|
||||
|
||||
<style shim-shadowdom>
|
||||
html /deep/ paper-dropdown {
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
min-height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<polymer-element name="paper-dropdown" extends="core-dropdown">
|
||||
<template>
|
||||
|
||||
<style>
|
||||
#ripple {
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.26);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
:host([halign=right]) #ripple {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
:host([valign=bottom]) #ripple {
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
background-color: #fff;
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
#scroller {
|
||||
overflow: auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="ripple"></div>
|
||||
|
||||
<div id="background" fit>
|
||||
<paper-shadow fit></paper-shadow>
|
||||
</div>
|
||||
|
||||
<div id="scroller" relative>
|
||||
<content></content>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
|
||||
Polymer({
|
||||
publish: { //Chrome 52 breaks this
|
||||
// transition: 'paper-dropdown-transition'
|
||||
},
|
||||
ready: function() {
|
||||
this.super();
|
||||
this.sizingTarget = this.$.scroller;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</polymer-element>
|
||||
@@ -1,83 +0,0 @@
|
||||
<link rel="import" href="/components/polymer/polymer.html">
|
||||
|
||||
|
||||
<polymer-element name="swipe-detect" attributes="threshold">
|
||||
|
||||
<template>
|
||||
|
||||
<div id="swipeDetector" class="swipeDetector" touch-action="pan-y">
|
||||
<content></content>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
var isWebkit = document.body.style.webkitTransform !== undefined;
|
||||
|
||||
Polymer({
|
||||
|
||||
setupEventHandlers : function(){
|
||||
this.setupTrackStartEventHandler();
|
||||
this.setupTrackEventHandler();
|
||||
this.setupTrackEndEventHandler();
|
||||
},
|
||||
|
||||
setupTrackStartEventHandler : function(){
|
||||
PolymerGestures.addEventListener(this, "trackstart", function(event){
|
||||
//tracking started
|
||||
});
|
||||
},
|
||||
|
||||
setupTrackEventHandler : function(){
|
||||
PolymerGestures.addEventListener(this, "track", function(event){
|
||||
var userIsSwipingLeftwards = (event.dx < 0);
|
||||
var userIsSwipingRightwards = (event.dx > 0);
|
||||
//tracking events fired
|
||||
});
|
||||
},
|
||||
|
||||
setupTrackEndEventHandler : function(){
|
||||
PolymerGestures.addEventListener(this, "trackend", function(event){
|
||||
var userIsSwipingLeftwards = (event.dx < 0);
|
||||
var userIsSwipingRightwards = (event.dx > 0);
|
||||
|
||||
var thresholdWasCrossed = (Math.abs(event.dx) / this.getBoundingClientRect().width) > this.threshold;
|
||||
|
||||
if (thresholdWasCrossed){
|
||||
if (userIsSwipingRightwards){
|
||||
$(this).trigger("swiperight")
|
||||
}
|
||||
if (userIsSwipingLeftwards){
|
||||
$(this).trigger("swipeleft")
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
publish: {
|
||||
/**
|
||||
* Specifies the threshold the user must swipe in order to
|
||||
* cause a page transition.
|
||||
* Only accepts values between 0 and 1.
|
||||
* @attribute threshold
|
||||
* @default 0.3
|
||||
* @type Number
|
||||
*/
|
||||
threshold: 0.3,
|
||||
},
|
||||
|
||||
ready: function(){
|
||||
this.setupEventHandlers();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</polymer-element>
|
||||
Reference in New Issue
Block a user