-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from opus1269/new
Add background setting. fix bug with 500px photo loadng. remove all preload code - all done by iron-image
- Loading branch information
Showing
14 changed files
with
226 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
app/elements/setting-background/setting-background.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<!-- | ||
@@license | ||
--> | ||
<link rel="import" href="../../bower_components/polymer/polymer.html"> | ||
<link rel="import" href="../../bower_components/paper-styles/paper-styles.html"> | ||
<link rel="import" href="../../bower_components/iron-localstorage/iron-localstorage.html"> | ||
<link rel="import" href="../../bower_components/iron-flex-layout/classes/iron-flex-layout.html"> | ||
<link rel="import" href="../../bower_components/iron-selector/iron-selector.html"> | ||
<link rel="import" href="../../bower_components/iron-label/iron-label.html"> | ||
<link rel="import" href="../../bower_components/paper-item/paper-item.html"> | ||
<link rel="import" href="../../bower_components/paper-item/paper-item-body.html"> | ||
<link rel="import" href="../../bower_components/paper-ripple/paper-ripple.html"> | ||
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html"> | ||
|
||
<dom-module id="setting-background"> | ||
<template> | ||
<style include="shared-styles"></style> | ||
<style> | ||
|
||
:host { | ||
display: block; | ||
position: relative; | ||
} | ||
|
||
:host([disabled]) { | ||
pointer-events: none; | ||
} | ||
|
||
:host paper-item { | ||
display: block; | ||
position: relative; | ||
cursor: pointer; | ||
} | ||
|
||
:host([indent]) paper-item { | ||
padding-left: 24px; | ||
} | ||
|
||
:host .container { | ||
width: 640px; | ||
} | ||
|
||
:host .background { | ||
width: 200px; | ||
height: 112px; | ||
border: 2px solid white; | ||
} | ||
|
||
:host .iron-selected { | ||
border: 2px solid red; | ||
} | ||
|
||
:host .selected-background { | ||
width: 100px; | ||
height: 56px; | ||
} | ||
|
||
</style> | ||
|
||
<paper-dialog id="dialog" modal entry-animation="scale-up-animation" | ||
exit-animation="fade-out-animation"> | ||
<h2>Select background style</h2> | ||
<iron-selector class="container horizontal layout wrap" attr-for-selected="id" selected="{{selected}}"> | ||
<div id="b1" class="background" style="background:linear-gradient(to bottom, #3a3a3a, #b5bdc8)"></div> | ||
<div id="b2" class="background" style="background:linear-gradient(to bottom, #003973 10%, #E5E5BE 90%)"></div> | ||
<div id="b3" class="background" style="background:linear-gradient(to top, #649173 10%, #DBD5A4 90%)"></div> | ||
<div id="b4" class="background" style="background:radial-gradient(ellipse at center, #ebe9f9 0%, #ebe9f9 23%, #d8d0ef 50%, #cec7ec 51%, #ebe9f9 77%, #c1bfea 100%)"></div> | ||
<div id="b5" class="background" style="background:radial-gradient(ellipse farthest-corner at 0px 0px , #fd5c6e 0%, rgba(0, 0, 255, 0) 50%, #0ce4e1 95%)"></div> | ||
<div id="b6" class="background" style="background:black"></div> | ||
</iron-selector> | ||
<div class="buttons"> | ||
<paper-button dialog-dismiss>CANCEL</paper-button> | ||
<paper-button dialog-confirm autofocus on-tap="_onOK">OK</paper-button> | ||
</div> | ||
</paper-dialog> | ||
|
||
<div class="section-title setting-label" tabindex="-1" hidden$="[[!sectionTitle]]">{{sectionTitle}}</div> | ||
|
||
<paper-item class="center horizontal layout" on-tap="_onTap"> | ||
<paper-item-body class="flex" two-line> | ||
<div class="setting-label" hidden$="[[!mainLabel]]">{{mainLabel}}</div> | ||
<div class="setting-label" secondary hidden$="[[!secondaryLabel]]">{{secondaryLabel}}</div> | ||
</paper-item-body> | ||
<div class="selected-background" style$="[[value]]"></div> | ||
<paper-ripple center></paper-ripple> | ||
</paper-item> | ||
<hr hidden$="[[noseparator]]" /> | ||
<iron-localstorage name="{{name}}" value="{{value}}" on-iron-localstorage-load-empty="_init"></iron-localstorage> | ||
|
||
</template> | ||
</dom-module> | ||
|
||
<script> | ||
'use-strict'; | ||
|
||
Polymer({ | ||
is: 'setting-background', | ||
|
||
hostAttributes: { | ||
role: 'group', | ||
tabIndex: -1 | ||
}, | ||
|
||
properties: { | ||
|
||
name: { | ||
type: String, | ||
value: 'store' | ||
}, | ||
|
||
selected: { | ||
type: String, | ||
value: 'b1', | ||
notify: true | ||
}, | ||
|
||
value: { | ||
type: String, | ||
value: 'background:linear-gradient(to bottom, #3a3a3a, #b5bdc8)', | ||
notify: true | ||
}, | ||
|
||
mainLabel: { | ||
type: String, | ||
value: '' | ||
}, | ||
|
||
secondaryLabel: { | ||
type: String, | ||
value: '' | ||
}, | ||
|
||
sectionTitle: { | ||
type: String, | ||
value: '' | ||
}, | ||
|
||
disabled: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
noseparator: { | ||
type: Boolean, | ||
value: false | ||
} | ||
|
||
}, | ||
|
||
// initialize value if it is not in localstorage | ||
_init: function() { | ||
this.set('value', 'background:linear-gradient(to bottom, #3a3a3a, #b5bdc8)'); | ||
}, | ||
|
||
_onTap: function() { | ||
this.$.dialog.open(); | ||
}, | ||
|
||
// save the currently selected background | ||
_onOK: function() { | ||
var el = document.getElementById(this.selected); | ||
this.set('value','background:' + el.style.background); | ||
} | ||
|
||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.