Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use material design list formatting for session and project lists #50

Open
wants to merge 3 commits into
base: polymer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
node_modules
bower_components
lib
app
7 changes: 0 additions & 7 deletions src/elements/ptm-project-behavior/ptm-project-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
type: String,
computed: '_computeFoldIcon(expanded)'
},
_elevation: {
type: Number,
computed: '_computeElevation(expanded)'
},
_projectLinked: {
type: Boolean,
computed: '_computeProjectLinked(projectId)'
Expand Down Expand Up @@ -98,9 +94,6 @@
_focusedChanged: function(receivedFocusFromKeyboard) {
this.focused != this.focused;
},
_computeElevation: function(expanded) {
return expanded ? 2 : 0;
},
_computeFoldIcon: function(expanded) {
return expanded ? 'unfold-less' : 'unfold-more';
},
Expand Down
6 changes: 6 additions & 0 deletions src/elements/ptm-project-list/ptm-project-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
*:focus {
outline: none;
}

/* Hide the topmost border and avoid double borders */
ptm-session[expanded]:first-of-type,
ptm-session[expanded] + ptm-session[expanded] {
border-top: none;
}
</style>
<template>
<template id="repeat" is="dom-repeat" items="[[projects]]" filter="filter">
Expand Down
68 changes: 33 additions & 35 deletions src/elements/ptm-project/ptm-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="../../bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="../../bower_components/iron-selector/iron-selector.html">
Expand All @@ -37,8 +36,9 @@
:host:focus {
outline: none;
}
paper-material[expanded] {
margin: 0 0 1em 0;
:host([expanded]) {
border-top: 1px solid var(--divider-color);
border-bottom: 1px solid var(--divider-color);
}
paper-item > *:not(:first-child):not(:last-child) {
margin-right: 0 !important;
Expand All @@ -64,39 +64,37 @@
}
</style>
<template>
<paper-material elevation="[[_elevation]]" expanded$="[[expanded]]" animated>
<paper-item focused$="{{focused}}" tabindex="-1">
<paper-icon-button tabindex="-1" icon="[[_foldIcon]]" on-tap="toggle"></paper-icon-button>
<div class="title" on-tap="openProject" active$="[[_isNotRemovable(projectId)]]">
<!-- <paper-ripple></paper-ripple> -->
<span>{{projectTitle}}</span>
</div>
<template is="dom-if" if="[[expanded]]">
<paper-icon-button icon="create" on-tap="_onTapRename" tabindex="-1"></paper-icon-button>
<template is="dom-if" if="[[!_isNotRemovable()]]">
<paper-icon-button icon="delete" on-tap="_onTapRemove" tabindex="-1"></paper-icon-button>
</template>
<paper-item expanded$="{{expanded}}" focused$="{{focused}}" tabindex="-1">
<paper-icon-button tabindex="-1" icon="[[_foldIcon]]" on-tap="toggle"></paper-icon-button>
<div class="title" on-tap="openProject" active$="[[_isNotRemovable(projectId)]]">
<!-- <paper-ripple></paper-ripple> -->
<span>{{projectTitle}}</span>
</div>
<template is="dom-if" if="[[expanded]]">
<paper-icon-button icon="create" on-tap="_onTapRename" tabindex="-1"></paper-icon-button>
<template is="dom-if" if="[[!_isNotRemovable()]]">
<paper-icon-button icon="delete" on-tap="_onTapRemove" tabindex="-1"></paper-icon-button>
</template>
</paper-item>
<iron-collapse id="collapse" opened="[[expanded]]" tabindex="-1">
<template is="dom-if" if="[[!fields.length]]">
<paper-item class="layout">
<paper-icon-button icon="icons:warning"></paper-icon-button>
<span class="title">{{_l10n('no_bookmarks')}}</span>
</paper-item>
</template>
<template id="repeat" is="dom-repeat" items="[[fields]]">
<ptm-bookmark
url="[[item.url]]"
fav-icon-url="{{item.favIconUrl}}"
bookmark-id="[[item.id]]"
tab-id="[[item.tabId]]"
site-title="[[item.title]]"
project-id="[[projectId]]"
on-toggle-bookmark="_toggleBookmark"></ptm-bookmark>
</template>
</iron-collapse>
</paper-material>
</template>
</paper-item>
<iron-collapse id="collapse" opened="[[expanded]]" tabindex="-1">
<template is="dom-if" if="[[!fields.length]]">
<paper-item class="layout">
<paper-icon-button icon="icons:warning"></paper-icon-button>
<span class="title">{{_l10n('no_bookmarks')}}</span>
</paper-item>
</template>
<template id="repeat" is="dom-repeat" items="[[fields]]">
<ptm-bookmark
url="[[item.url]]"
fav-icon-url="{{item.favIconUrl}}"
bookmark-id="[[item.id]]"
tab-id="[[item.tabId]]"
site-title="[[item.title]]"
project-id="[[projectId]]"
on-toggle-bookmark="_toggleBookmark"></ptm-bookmark>
</template>
</iron-collapse>
</template>
</dom-module>

Expand Down
6 changes: 6 additions & 0 deletions src/elements/ptm-session-list/ptm-session-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
*:focus {
outline: none;
}

/* Hide the topmost border and avoid double borders */
ptm-session[expanded]:first-of-type,
ptm-session[expanded] + ptm-session[expanded] {
border-top: none;
}
</style>
<template>
<template id="repeat" is="dom-repeat" items="[[projects]]" filter="filter" sort="sort">
Expand Down
84 changes: 41 additions & 43 deletions src/elements/ptm-session/ptm-session.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="../../bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="../../bower_components/iron-selector/iron-selector.html">
Expand All @@ -36,8 +35,9 @@
*:focus {
outline: none;
}
paper-material[expanded] {
margin: 0 0 1em 0;
:host([expanded]) {
border-top: 1px solid var(--divider-color);
border-bottom: 1px solid var(--divider-color);
}
paper-item > *:not(:first-child):not(:last-child) {
margin-right: 0 !important;
Expand All @@ -63,49 +63,47 @@
}
</style>
<template>
<paper-material elevation="[[_elevation]]" expanded$="[[expanded]]" animated>
<paper-item focused$="{{focused}}" tabindex="-1">
<paper-icon-button tabindex="-1" icon="[[_foldIcon]]" on-tap="toggle"></paper-icon-button>
<div class="title" on-tap="openProject" active$="[[_computeActive(winId)]]">
<!-- <paper-ripple></paper-ripple> -->
<span>[[projectTitle]]</span>
</div>
<paper-item focused$="{{focused}}" tabindex="-1">
<paper-icon-button tabindex="-1" icon="[[_foldIcon]]" on-tap="toggle"></paper-icon-button>
<div class="title" on-tap="openProject" active$="[[_computeActive(winId)]]">
<!-- <paper-ripple></paper-ripple> -->
<span>[[projectTitle]]</span>
</div>
<template is="dom-if" if="[[!_projectLinked]]" restamp>
<template is="dom-if" if="[[!expanded]]" restamp>
<paper-icon-button icon="notification:folder-special" on-tap="_onTapNewProject" tabindex="-1"></paper-icon-button>
</template>
</template>
<template is="dom-if" if="[[expanded]]" restamp>
<template is="dom-if" if="[[!_projectLinked]]" restamp>
<template is="dom-if" if="[[!expanded]]" restamp>
<paper-icon-button icon="notification:folder-special" on-tap="_onTapNewProject" tabindex="-1"></paper-icon-button>
</template>
<paper-icon-button icon="icons:link" on-tap="_onTapLink" tabindex="-1"></paper-icon-button>
<paper-icon-button icon="notification:folder-special" on-tap="_onTapNewProject" tabindex="-1"></paper-icon-button>
</template>
<template is="dom-if" if="[[!_computeActive(winId)]]">
<paper-icon-button icon="icons:delete" on-tap="_onTapRemove" tabindex="-1"></paper-icon-button>
</template>
</template>
</paper-item>
<iron-collapse id="collapse" opened="[[expanded]]" tabindex="-1">
<div class="collapse-content">
<template is="dom-if" if="[[!fields.length]]">
<paper-item class="layout">
<paper-icon-button icon="icons:warning"></paper-icon-button>
<span class="title">{{_l10n('no_tabs')}}</span>
</paper-item>
</template>
<template is="dom-if" if="[[expanded]]" restamp>
<template is="dom-if" if="[[!_projectLinked]]" restamp>
<paper-icon-button icon="icons:link" on-tap="_onTapLink" tabindex="-1"></paper-icon-button>
<paper-icon-button icon="notification:folder-special" on-tap="_onTapNewProject" tabindex="-1"></paper-icon-button>
</template>
<template is="dom-if" if="[[!_computeActive(winId)]]">
<paper-icon-button icon="icons:delete" on-tap="_onTapRemove" tabindex="-1"></paper-icon-button>
</template>
<template id="repeat" is="dom-repeat" items="[[fields]]">
<ptm-bookmark
url="[[item.url]]"
fav-icon-url="{{item.favIconUrl}}"
bookmark-id="[[item.id]]"
tab-id="[[item.tabId]]"
site-title="[[item.title]]"
project-id="[[projectId]]"
on-toggle-bookmark="_toggleBookmark"></ptm-bookmark>
</template>
</paper-item>
<iron-collapse id="collapse" opened="[[expanded]]" tabindex="-1">
<div class="collapse-content">
<template is="dom-if" if="[[!fields.length]]">
<paper-item class="layout">
<paper-icon-button icon="icons:warning"></paper-icon-button>
<span class="title">{{_l10n('no_tabs')}}</span>
</paper-item>
</template>
<template id="repeat" is="dom-repeat" items="[[fields]]">
<ptm-bookmark
url="[[item.url]]"
fav-icon-url="{{item.favIconUrl}}"
bookmark-id="[[item.id]]"
tab-id="[[item.tabId]]"
site-title="[[item.title]]"
project-id="[[projectId]]"
on-toggle-bookmark="_toggleBookmark"></ptm-bookmark>
</template>
</div>
</iron-collapse>
</paper-material>
</div>
</iron-collapse>
</template>
</dom-module>

Expand Down