1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

use checkbox instead of toggle button

This commit is contained in:
Luke Pulverenti 2016-07-22 15:48:47 -04:00
parent 9272519d84
commit 20d1e9132d
18 changed files with 56 additions and 746 deletions

View file

@ -105,14 +105,36 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
return null;
}
function getListViewHtml(items, options) {
function getTextLinesHtml(textlines, isLargeStyle) {
if (arguments.length == 1) {
options = items;
items = options.items;
var html = '';
for (var i = 0, length = textlines.length; i < length; i++) {
if (i === 0) {
if (isLargeStyle) {
html += '<h2>';
} else {
html += '<div>';
}
} else {
html += '<div class="secondary">';
}
html += (textlines[i] || '&nbsp;');
if (i === 0 && isLargeStyle) {
html += '</h2>';
} else {
html += '</div>';
}
}
var index = 0;
return html;
}
function getListViewHtml(options) {
var items = options.items;
var groupTitle = '';
var action = options.action || 'link';
@ -125,7 +147,9 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var outerHtml = '';
outerHtml += items.map(function (item) {
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
var html = '';
@ -139,7 +163,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '</div>';
}
if (index == 0) {
if (i == 0) {
html += '<h1 class="listGroupHeader first">';
}
else {
@ -173,7 +197,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var collectionIdData = options.collectionId ? (' data-collectionid="' + options.collectionId + '"') : '';
var playlistIdData = options.playlistId ? (' data-playlistid="' + options.playlistId + '"') : '';
html += '<' + outerTagName + ' class="' + cssClass + '" data-index="' + index + '"' + playlistItemId + ' data-action="' + action + '" data-isfolder="' + item.IsFolder + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-mediatype="' + item.MediaType + '" data-type="' + item.Type + '"' + positionTicksData + collectionIdData + playlistIdData + '>';
html += '<' + outerTagName + ' class="' + cssClass + '" data-index="' + i + '"' + playlistItemId + ' data-action="' + action + '" data-isfolder="' + item.IsFolder + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-mediatype="' + item.MediaType + '" data-type="' + item.Type + '"' + positionTicksData + collectionIdData + playlistIdData + '>';
if (!clickEntireItem && options.dragHandle) {
html += '<button is="paper-icon-button-light" class="listViewDragHandle autoSize"><i class="md-icon">&#xE25D;</i></button>';
@ -238,14 +262,6 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
}
}
var lineCount = textlines.length;
if (!enableSideMediaInfo) {
lineCount++;
}
if (enableOverview && item.Overview) {
lineCount++;
}
cssClass = 'listItemBody';
if (!clickEntireItem) {
cssClass += ' itemAction';
@ -255,25 +271,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
var moreIcon = appHost.moreIcon == 'dots-horiz' ? '&#xE5D3;' : '&#xE5D4;';
for (var i = 0, textLinesLength = textlines.length; i < textLinesLength; i++) {
if (i == 0 && isLargeStyle) {
html += '<h2>';
}
else if (i == 0) {
html += '<div>';
} else {
html += '<div class="secondary">';
}
html += textlines[i] || '&nbsp;';
if (i == 0 && isLargeStyle) {
html += '</h2>';
} else if (i == 0) {
html += '</div>';
} else {
html += '</div>';
}
}
html += getTextLinesHtml(textlines, isLargeStyle);
if (!enableSideMediaInfo) {
html += '<div class="secondary listItemMediaInfo">' + mediaInfo.getPrimaryMediaInfoHtml(item) + '</div>';
@ -308,10 +306,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '</' + outerTagName + '>';
index++;
return html;
}).join('');
outerHtml += html;
}
return outerHtml;
}

View file

@ -1,48 +0,0 @@
{
"name": "paper-toggle-button",
"version": "1.0.14",
"description": "A material design toggle button control",
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"toggle",
"control"
],
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/paper-toggle-button"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-toggle-button",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.1.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"main": "paper-toggle-button.html",
"_release": "1.0.14",
"_resolution": {
"type": "version",
"tag": "v1.0.14",
"commit": "131f32adf5ce831f94be7f80c436865b44d7cd95"
},
"_source": "git://github.com/PolymerElements/paper-toggle-button.git",
"_target": "~1.0.5",
"_originalSource": "PolymerElements/paper-toggle-button"
}

View file

@ -1 +0,0 @@
bower_components

View file

@ -1,24 +0,0 @@
language: node_js
sudo: false
before_script:
- npm install web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- bower install
- npm install polylint
- polylint
env:
global:
- secure: T4tEkegUT5RhgMTQAUxtXQROsEEIGYyQZ3MzrEX9Xf8XjCYk7pZmK50UXuHa61xO5F5M1bQV0mu4lPcl41Nzws3GKOmKrprbwdhLGfJY5DsqRr6rVnWKvCf57T1jXciEbr17dQyW0kqP41m4LSvNRRJwxv52bk9Nxu22X1HMrD0=
- secure: rKcth+F7zQJu/nMxEdxRDgyNAR/IQVuduPEmrgbUShIsbN48QoI+Bwdqj38NPpKj8LdVE8pgpuiN7FkQ8cipsQNiXTp5cl9t9k/gKGmXfsKE0K85H4bHYoPv6OH2bSyRuUzVlFWQH4FVNXGdDLwSLV/4VQT4+P19MTZRSm4oG1A=
node_js: 4
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -1,72 +0,0 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
-->
# Polymer Elements
## Guide for Contributors
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
### Filing Issues
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
1. **Who will use the feature?** _“As someone filling out a form…”_
2. **When will they use the feature?** _“When I enter an invalid value…”_
3. **What is the users goal?** _“I want to be visually notified that the value needs to be corrected…”_
**If you are filing an issue to report a bug**, please provide:
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
```markdown
The `paper-foo` element causes the page to turn pink when clicked.
## Expected outcome
The page stays the same color.
## Actual outcome
The page turns pink.
## Steps to reproduce
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
### Submitting Pull Requests
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, #40
```
2. **A succinct description of the design** used to fix any related issues. For example:
```markdown
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
```
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so dont be afraid to ask us if you need help with that!

View file

@ -1,39 +0,0 @@
{
"name": "paper-toggle-button",
"version": "1.0.14",
"description": "A material design toggle button control",
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"toggle",
"control"
],
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/paper-toggle-button"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/paper-toggle-button",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.1.0",
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"main": "paper-toggle-button.html"
}

View file

@ -1,83 +0,0 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 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>
<title>paper-toggle-button demo</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../paper-toggle-button.html">
<style is="custom-style" include="demo-pages-shared-styles">
.vertical-section-container {
max-width: 500px;
}
paper-toggle-button {
margin-left: 10px;
margin-right: 10px;
}
</style>
</head>
<body unresolved>
<div class="vertical-section-container centered">
<h3>Toggle buttons can be checked and disabled</h3>
<demo-snippet class="centered-demo">
<template>
<paper-toggle-button>Toggle</paper-toggle-button>
<paper-toggle-button checked>Toggle</paper-toggle-button>
<paper-toggle-button disabled>Disabled</paper-toggle-button>
</template>
</demo-snippet>
<h3>Toggle buttons can hide the ripple effect using the <i>noink</i> attribute</h3>
<demo-snippet class="centered-demo">
<template>
<paper-toggle-button noink>Toggle</paper-toggle-button>
</template>
</demo-snippet>
<h3>Toggle buttons can be styled using custom properties</h3>
<demo-snippet class="centered-demo">
<template>
<style is="custom-style">
paper-toggle-button.green {
--paper-toggle-button-checked-bar-color: var(--paper-green-500);
--paper-toggle-button-checked-button-color: var(--paper-green-500);
--paper-toggle-button-checked-ink-color: var(--paper-green-500);
--paper-toggle-button-unchecked-bar-color: var(--paper-teal-500);
--paper-toggle-button-unchecked-button-color: var(--paper-teal-500);
--paper-toggle-button-unchecked-ink-color: var(--paper-teal-500);
}
paper-toggle-button.pink {
--paper-toggle-button-checked-bar-color: var(--paper-pink-500);
--paper-toggle-button-checked-button-color: var(--paper-pink-500);
--paper-toggle-button-checked-ink-color: var(--paper-pink-500);
--paper-toggle-button-unchecked-bar-color: var(--paper-indigo-900);
--paper-toggle-button-unchecked-button-color: var(--paper-indigo-900);
--paper-toggle-button-unchecked-ink-color: var(--paper-indigo-900);
}
</style>
<paper-toggle-button class="green">Toggle</paper-toggle-button>
<paper-toggle-button checked class="pink">Toggle</paper-toggle-button>
</template>
</demo-snippet>
</div>
</body>
</html>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
<g id="background" display="none">
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
</g>
<g id="label">
</g>
<g id="art">
<g>
<circle cx="123.8" cy="63" r="15.7"/>
<path d="M123,77H98.5c-7.7,0-14-6.3-14-14s6.3-14,14-14H123c7.7,0,14,6.3,14,14S130.7,77,123,77z M98.5,51c-6.6,0-12,5.4-12,12
s5.4,12,12,12H123c6.6,0,12-5.4,12-12s-5.4-12-12-12H98.5z"/>
</g>
<g id="ic_x5F_add_x0D_">
</g>
</g>
<g id="Guides">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 872 B

View file

@ -1,26 +0,0 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 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 name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View file

@ -1,250 +0,0 @@
<!--
@license
Copyright (c) 2015 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="../polymer/polymer.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../paper-styles/color.html">
<link rel="import" href="../paper-styles/default-theme.html">
<link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html">
<!--
Material design: [Switch](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-switch)
`paper-toggle-button` provides a ON/OFF switch that user can toggle the state
by tapping or by dragging the switch.
Example:
<paper-toggle-button></paper-toggle-button>
### Styling
The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------|-------------|----------
`--paper-toggle-button-unchecked-bar-color` | Slider color when the input is not checked | `#000000`
`--paper-toggle-button-unchecked-button-color` | Button color when the input is not checked | `--paper-grey-50`
`--paper-toggle-button-unchecked-ink-color` | Selected/focus ripple color when the input is not checked | `--dark-primary-color`
`--paper-toggle-button-checked-bar-color` | Slider button color when the input is checked | `--default-primary-color`
`--paper-toggle-button-checked-button-color` | Button color when the input is checked | `--default-primary-color`
`--paper-toggle-button-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
`--paper-toggle-button-unchecked-bar` | Mixin applied to the slider when the input is not checked | `{}`
`--paper-toggle-button-unchecked-button` | Mixin applied to the slider button when the input is not checked | `{}`
`--paper-toggle-button-checked-bar` | Mixin applied to the slider when the input is checked | `{}`
`--paper-toggle-button-checked-button` | Mixin applied to the slider button when the input is checked | `{}`
`--paper-toggle-button-label-color` | Label color | `--primary-text-color`
`--paper-toggle-button-label-spacing` | Spacing between the label and the button | `8px`
@group Paper Elements
@element paper-toggle-button
@hero hero.svg
@demo demo/index.html
-->
<dom-module id="paper-toggle-button">
<template strip-whitespace>
<style>
:host {
display: inline-block;
@apply(--layout-horizontal);
@apply(--layout-center);
}
:host([disabled]) {
pointer-events: none;
}
:host(:focus) {
outline:none;
}
.toggle-bar {
position: absolute;
height: 100%;
width: 100%;
border-radius: 8px;
pointer-events: none;
opacity: 0.4;
transition: background-color linear .08s;
background-color: var(--paper-toggle-button-unchecked-bar-color, #000000);
@apply(--paper-toggle-button-unchecked-bar);
}
.toggle-button {
position: absolute;
top: -3px;
height: 20px;
width: 20px;
border-radius: 50%;
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
transition: -webkit-transform linear .08s, background-color linear .08s;
transition: transform linear .08s, background-color linear .08s;
will-change: transform;
background-color: var(--paper-toggle-button-unchecked-button-color, --paper-grey-50);
@apply(--paper-toggle-button-unchecked-button);
}
.toggle-button.dragging {
-webkit-transition: none;
transition: none;
}
:host([checked]:not([disabled])) .toggle-bar {
opacity: 0.5;
background-color: var(--paper-toggle-button-checked-bar-color, --default-primary-color);
@apply(--paper-toggle-button-checked-bar);
}
:host([disabled]) .toggle-bar {
background-color: #000;
opacity: 0.12;
}
:host([checked]) .toggle-button {
-webkit-transform: translate(16px, 0);
transform: translate(16px, 0);
}
:host([checked]:not([disabled])) .toggle-button {
background-color: var(--paper-toggle-button-checked-button-color, --default-primary-color);
@apply(--paper-toggle-button-checked-button);
}
:host([disabled]) .toggle-button {
background-color: #bdbdbd;
opacity: 1;
}
.toggle-ink {
position: absolute;
top: -14px;
left: -14px;
width: 48px;
height: 48px;
opacity: 0.5;
pointer-events: none;
color: var(--paper-toggle-button-unchecked-ink-color, --primary-text-color);
}
:host([checked]) .toggle-ink {
color: var(--paper-toggle-button-checked-ink-color, --default-primary-color);
}
.toggle-container {
display: inline-block;
position: relative;
width: 36px;
height: 14px;
/* The toggle button has an absolute position of -3px; The extra 1px
/* accounts for the toggle button shadow box. */
margin: 4px 1px;
}
.toggle-label {
position: relative;
display: inline-block;
vertical-align: middle;
padding-left: var(--paper-toggle-button-label-spacing, 8px);
white-space: normal;
pointer-events: none;
color: var(--paper-toggle-button-label-color, --primary-text-color);
}
</style>
<div class="toggle-container">
<div id="toggleBar" class="toggle-bar"></div>
<div id="toggleButton" class="toggle-button"></div>
</div>
<div class="toggle-label"><content></content></div>
</template>
<script>
Polymer({
is: 'paper-toggle-button',
behaviors: [
Polymer.PaperCheckedElementBehavior
],
hostAttributes: {
role: 'button',
'aria-pressed': '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
*/
},
listeners: {
track: '_ontrack'
},
_ontrack: function(event) {
var track = event.detail;
if (track.state === 'start') {
this._trackStart(track);
} else if (track.state === 'track') {
this._trackMove(track);
} else if (track.state === 'end') {
this._trackEnd(track);
}
},
_trackStart: function(track) {
this._width = this.$.toggleBar.offsetWidth / 2;
/*
* keep an track-only check state to keep the dragging behavior smooth
* while toggling activations
*/
this._trackChecked = this.checked;
this.$.toggleButton.classList.add('dragging');
},
_trackMove: function(track) {
var dx = track.dx;
this._x = Math.min(this._width,
Math.max(0, this._trackChecked ? this._width + dx : dx));
this.translate3d(this._x + 'px', 0, 0, this.$.toggleButton);
this._userActivate(this._x > (this._width / 2));
},
_trackEnd: function(track) {
this.$.toggleButton.classList.remove('dragging');
this.transform('', this.$.toggleButton);
},
// customize the element's ripple
_createRipple: function() {
this._rippleContainer = this.$.toggleButton;
var ripple = Polymer.PaperRippleBehavior._createRipple();
ripple.id = 'ink';
ripple.setAttribute('recenters', '');
ripple.classList.add('circle', 'toggle-ink');
return ripple;
}
});
</script>
</dom-module>

View file

@ -1,90 +0,0 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 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">
<title>paper-toggle-button basic tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../paper-toggle-button.html">
</head>
<body>
<test-fixture id="Basic">
<template>
<paper-toggle-button id="button"></paper-toggle-button>
</template>
</test-fixture>
<script>
suite('defaults', function() {
var b1;
setup(function() {
b1 = fixture('Basic');
});
test('check button via click', function(done) {
b1.addEventListener('click', function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
});
MockInteractions.tap(b1);
});
test('toggle button via click', function(done) {
b1.checked = true;
b1.addEventListener('click', function() {
assert.isFalse(b1.getAttribute('aria-pressed') == 'true');
assert.isFalse(b1.checked);
done();
});
MockInteractions.tap(b1);
});
test('disabled button cannot be clicked', function(done) {
b1.disabled = true;
b1.checked = true;
MockInteractions.tap(b1);
setTimeout(function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
}, 1);
});
});
suite('a11y', function() {
var b1;
setup(function() {
b1 = fixture('Basic');
});
test('has aria role "button"', function() {
console.log(b1.getAttribute('role'));
assert.isTrue(b1.getAttribute('role') == 'button');
});
a11ySuite('Basic');
});
</script>
</body>
</html>

View file

@ -1,24 +0,0 @@
<!DOCTYPE html><!--
@license
Copyright (c) 2015 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 name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>paper-toggle-button tests</title>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'basic.html',
'basic.html?dom=shadow'
]);
</script>
</body></html>

View file

@ -4,7 +4,10 @@
<div class="content-primary">
<div class="readOnlyContent">
<div style="text-align: right; display: flex; justify-content: flex-end;">
<paper-toggle-button id="chkDebugLog">${LabelEnableDebugLogging}</paper-toggle-button>
<label style="width:auto;">
<input type="checkbox" is="emby-checkbox" id="chkDebugLog" />
<span>${LabelEnableDebugLogging}</span>
</label>
</div>
<br />
</div>

View file

@ -1,4 +1,4 @@
<div id="pluginCatalogPage" data-role="page" class="page type-interior pluginConfigurationPage withTabs fullWidthContent" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins" data-require="scripts/ratingdialog,scripts/plugincatalogpage,paper-toggle-button">
<div id="pluginCatalogPage" data-role="page" class="page type-interior pluginConfigurationPage withTabs fullWidthContent" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins" data-require="scripts/plugincatalogpage,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<div style="display: flex;align-items:center;">
@ -10,7 +10,10 @@
</select>
</div>
<div style="margin-left:auto;" class="optionAdultContainer">
<paper-toggle-button id="chkAdult">${OptionDisplayAdultContent}</paper-toggle-button>
<label style="width:auto;">
<input type="checkbox" is="emby-checkbox" id="chkAdult" />
<span>${OptionDisplayAdultContent}</span>
</label>
</div>
</div>

View file

@ -1,4 +1,4 @@
define(['datetime', 'jQuery', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (datetime, $) {
define(['datetime', 'listViewStyle'], function (datetime) {
return function (view, params) {
@ -33,13 +33,13 @@
logUrl += "&api_key=" + apiClient.accessToken();
var logHtml = '';
logHtml += '<paper-icon-item>';
logHtml += '<div class="listItem">';
logHtml += '<a item-icon class="clearLink" href="' + logUrl + '" target="_blank">';
logHtml += '<paper-fab mini icon="schedule" class="blue" item-icon></paper-fab>';
logHtml += '<a item-icon class="clearLink" href="' + logUrl + '" target="_blank" style="margin-left:1em;">';
logHtml += '<i class="md-icon listItemIcon">schedule</i>';
logHtml += "</a>";
logHtml += '<paper-item-body two-line>';
logHtml += '<div class="listItemBody">';
logHtml += '<a class="clearLink" href="' + logUrl + '" target="_blank">';
logHtml += "<div>" + log.Name + "</div>";
@ -50,12 +50,12 @@
text += ' ' + datetime.getDisplayTime(date);
logHtml += '<div secondary>' + text + '</div>';
logHtml += '<div class="secondary">' + text + '</div>';
logHtml += "</a>";
logHtml += '</paper-item-body>';
logHtml += '</div>';
logHtml += '</paper-icon-item>';
logHtml += '</div>';
return logHtml;
@ -64,7 +64,7 @@
html += '</div>';
$('.serverLogs', view).html(html);
view.querySelector('.serverLogs').innerHTML = html;
Dashboard.hideLoadingMsg();
});

View file

@ -208,7 +208,7 @@
html += "<div class='cardText' style='display:flex;align-items:center;'>";
if (plugin.avgRating) {
html += '<iron-icon icon="star" style="color:#666;height:20px;width:20px;min-height:20px;min-width:20px;margin-right:.25em;"></iron-icon>';
html += '<i class="md-icon" style="color:#cc3333;margin-right:.25em;">star</i>';
html += plugin.avgRating.toFixed(1);
}

View file

@ -1665,7 +1665,6 @@ var AppInfo = {};
define("paper-button", ["html!" + bowerPath + "/paper-button/paper-button.html"]);
define("paper-icon-button", ["html!" + bowerPath + "/paper-icon-button/paper-icon-button.html"]);
define("paper-toggle-button", ['webcomponentsjs', "html!" + bowerPath + "/paper-toggle-button/paper-toggle-button.html"]);
define("paper-textarea", ['webcomponentsjs', "html!" + bowerPath + "/paper-input/paper-textarea.html"]);
define("paper-item", ["html!" + bowerPath + "/paper-item/paper-item.html"]);
@ -2481,7 +2480,7 @@ var AppInfo = {};
defineRoute({
path: '/log.html',
dependencies: ['paper-toggle-button'],
dependencies: ['emby-checkbox'],
roles: 'admin',
controller: 'scripts/logpage'
});

View file

@ -404,18 +404,6 @@ div.dialogHeader {
padding-bottom: 100px;
}
.paper-toggle-button-0 .toggle-label.paper-toggle-button {
color: inherit;
}
paper-toggle-button #toggleButton, paper-toggle-button[checked] #toggleBar {
background-color: #52B54B;
}
paper-toggle-button paper-ripple {
color: #52B54B;
}
.formDialog.background-theme-b {
background-color: #181818;
}