Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
add grid layout option to palette
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Apr 28, 2014
1 parent c402422 commit de48d80
Show file tree
Hide file tree
Showing 21 changed files with 227 additions and 20 deletions.
90 changes: 90 additions & 0 deletions assets/cog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-drawer-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-firebase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-header-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-icon-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-pages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-submenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/core-tooltip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 19 additions & 1 deletion elements/designer-element/designer-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@

<core-icon-button icon="maximize" on-tap="{{fullscreenAction}}"></core-icon-button>

<core-selector id="viewSelector" selected="{{selected}}">
<span style="padding-right: 16px;"></span>

<core-selector selected="{{paletteMode}}">
<core-icon-button icon="list" name="menu"></core-icon-button>
<core-icon-button icon="modules" name="grid"></core-icon-button>
</core-selector>

<span style="padding-right: 16px;"></span>

<core-selector selected="{{selected}}">
<core-icon-button src="assets/design.png" name="design"></core-icon-button>
<core-icon-button src="assets/code.png" name="code"></core-icon-button>
</core-selector>
Expand Down Expand Up @@ -78,6 +87,7 @@

Polymer('designer-element', {
selected: 'design',
paletteMode: 'grid',
remoteHtml: '',

ready: function() {
Expand Down Expand Up @@ -174,6 +184,10 @@
this.designer.selectParentElement();
},

selectParentElement: function(event) {
this.designer.selectParentElement();
},

selectedChanged: function() {
if (this.selected == 'code') {
this.designToCode();
Expand All @@ -185,6 +199,10 @@
}
},

paletteModeChanged: function() {
this.designer.paletteMode = this.paletteMode;
},

//

// TODO(sorvell): probably should factor this code setup to be elsewhere
Expand Down
34 changes: 34 additions & 0 deletions elements/designer-element/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!doctype html>
<html>
<head>
<title>Polymer Designer</title>

<script src="../../components/platform/platform.js"></script>
<script>
window.parent.postMessage('designer-loading', location.href);
</script>

<link rel="import" href="../x-designer/x-designer.html">

<style>

body {
font-size: 12px;
font-family: 'Helvetica Neue', Helvetica, Roboto, Arial;
overflow: hidden;
}

x-designer {
-webkit-transform: translateZ(0);
transform: translateZ(0);
}

</style>

</head>
<body unresolved>

<x-designer metaUrls="['../components/core-elements/metadata.html']",></x-designer>

</body>
</html>
1 change: 1 addition & 0 deletions elements/x-designer/x-designer.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
bottom: 0;
left: 0;
outline: 0;
-webkit-user-select: none;
}

#canvas {
Expand Down
11 changes: 9 additions & 2 deletions elements/x-designer/x-designer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="import" href="../x-palette/x-palette.html">
<link rel="import" href="../x-tree/x-tree.html">

<polymer-element name="x-designer" attributes="selected maximized">
<polymer-element name="x-designer" attributes="selected maximized paletteMode metaUrls">
<template>

<link rel="stylesheet" href="x-designer.css">
Expand All @@ -15,7 +15,7 @@

<section id="tools">
<core-layout vertical></core-layout>
<x-palette core-flex id="palette" on-palette-drag="{{paletteDrag}}"></x-palette>
<x-palette core-flex id="palette" on-palette-drag="{{paletteDrag}}" mode="{{paletteMode}}"></x-palette>
<polymer-ui-splitter direction="down"></polymer-ui-splitter>
<x-tree id="tree" canvas="{{$.canvas}}" selected="{{selected}}"></x-tree>
</section>
Expand All @@ -29,6 +29,7 @@

maximized: false,
selectedTab: 'design',
metaUrls: [],

ready: function() {
this.fire('designer-ready');
Expand All @@ -40,6 +41,12 @@
this.$.canvas.dragDisabled = this.maximized;
},

metaUrlsChanged: function() {
if (this.metaUrls) {
this.import(this.metaUrls);
}
},

//
// choreograph composed objects
//
Expand Down
41 changes: 41 additions & 0 deletions elements/x-palette/x-palette.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
-ms-user-select: none;
}

#grid {
background-color: #F2F2F2;
position: absolute;
top: 0;
right: 0px;
left: 0px;
bottom: 0px;
padding: 0;
overflow-x: hidden;
overflow-y: auto;
font-size: 15px;
-webkit-overflow-scrolling: touch;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}

.group-item {
font-weight: 500;
}
Expand All @@ -37,6 +54,30 @@
white-space: nowrap;
}

.grid-item {
display: inline-block;
border: 1px dotted silver;
border-left: none;
border-top: none;
width: 106px;
height: 116px;
font-size: 11px;
cursor: pointer;
color: #000;
overflow: hidden;
text-align: center;
padding: 12px;
background-color: white;
}

.grid-item > * {
pointer-events: none;
}

img {
vertical-align: middle;
}

[ishidden] {
display: none;
}
44 changes: 30 additions & 14 deletions elements/x-palette/x-palette.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,58 @@
<link rel="import" href="../../components/core-menu/core-menu.html">
<link rel="import" href="../../components/core-menu/core-submenu.html">
<link rel="import" href="../../components/core-drag-drop/core-drag-drop.html">
<link rel="import" href="../../components/core-layout/core-layout.html">
<link rel="import" href="../../components/x-meta/x-meta.html">

<polymer-element name="x-palette">
<polymer-element name="x-palette" attributes="mode">

<template>

<link rel="stylesheet" href="x-palette.css">

<x-meta id="meta" categories="{{categories}}"></x-meta>

<div id="list">
<core-drag-drop on-drag-start="{{dragStart}}"></core-drag-drop>

<core-drag-drop on-drag-start="{{dragStart}}"></core-drag-drop>
<template if="{{mode == 'menu'}}">
<div id="list">

<core-menu selectedClass="palette-selected">
<core-menu selectedClass="palette-selected">
<template repeat="{{categories}}">
<core-submenu class="group-item" label="{{name}}">

<template repeat="{{categories}}">

<core-submenu class="group-item" label="{{name}}">
<template repeat="{{list}}">
<div class="simple-item" tag="{{id}}" loaded?="{{importsLoaded}}" ishidden?="{{isHidden}}">{{label}}</div>
</template>

<template repeat="{{list}}">
<div class="simple-item" tag="{{id}}" loaded?="{{importsLoaded}}" ishidden?="{{isHidden}}">{{label}}</div>
</template>
</core-submenu>
</template>
</core-menu>

</core-submenu>
</div>
</template>

</template>
<template if="{{mode == 'grid'}}">
<div id="grid">
<template repeat="{{categories}}">
<template repeat="{{list}}">

</core-menu>
<div class="grid-item" tag="{{id}}">
<div style="height: 64px; line-height: 64px;"><img src="../../assets/{{id}}.png" onerror="this.src='../../assets/cog.svg';"></div>
<br>
<div>{{label}}</div>
</div>

</div>
</template>
</template>
</div>
</template>

</template>
<script>

Polymer('x-palette', {
mode: 'grid',

dragStart: function(event, dragInfo) {
// decorate dragInfo
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<script>
var metadata = [
'../components/core-elements/metadata.html',
'../components/paper-elements/metadata.html',
'../components/more-elements/metadata.html',
'../components/polytype/metadata.html'
//'../components/paper-elements/metadata.html',
//'../components/more-elements/metadata.html',
//'../components/polytype/metadata.html'
];
</script>

Expand Down

0 comments on commit de48d80

Please sign in to comment.