1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 23:29:42 +02:00

idiomatic code for {{component}} helper

This commit is contained in:
Harvey Kandola 2017-03-07 10:09:36 +00:00
parent 8d13d78092
commit 6d481c335a
6 changed files with 117 additions and 122 deletions

View file

@ -12,9 +12,4 @@
import Ember from 'ember'; import Ember from 'ember';
export default Ember.Component.extend({ export default Ember.Component.extend({
didReceiveAttrs() {
this._super(...arguments);
this.set('rendererType', 'section/' + this.get('page.contentType') + '/type-renderer');
}
}); });

View file

@ -1,7 +1,7 @@
<div id="wrapper" class={{if toggled 'toggled'}}> <div id="wrapper" class={{if toggled 'toggled'}}>
<div id="sidebar-wrapper"> <div id="sidebar-wrapper">
<div class="document-sidebar-content"> <div class="document-sidebar-common">
{{#if model.document.template}} {{#if model.document.template}}
<div class="is-template">TEMPLATE</div> <div class="is-template">TEMPLATE</div>
{{/if}} {{/if}}

View file

@ -1,3 +1,5 @@
$document-sidebar-width: 400px;
#wrapper { #wrapper {
padding-right: 0; padding-right: 0;
margin-left: 60px; margin-left: 60px;
@ -8,11 +10,9 @@
background-color: $color-off-white; background-color: $color-off-white;
} }
$document-sidebar-width: 400px; // #wrapper.toggled {
// padding-right: $document-sidebar-width;
#wrapper.toggled { // }
// padding-right: $document-sidebar-width;
}
#sidebar-wrapper { #sidebar-wrapper {
// z-index: 1000; // z-index: 1000;

View file

@ -1,4 +1,4 @@
.document-sidebar-content { .document-sidebar-common {
display: inline-block; display: inline-block;
width: 340px; width: 340px;
padding: 40px 20px; padding: 40px 20px;
@ -16,127 +16,127 @@
padding: 50px 0 0 0; padding: 50px 0 0 0;
} }
.xxxx { // .xxxx {
.is-template { // .is-template {
color: $color-goldy; // color: $color-goldy;
font-weight: bold; // font-weight: bold;
font-size: 1.5em; // font-size: 1.5em;
margin-bottom: 30px; // margin-bottom: 30px;
padding-bottom: 5px; // padding-bottom: 5px;
border-bottom: 1px dotted $color-goldy; // border-bottom: 1px dotted $color-goldy;
} // }
@extend .no-select; // @extend .no-select;
.stuck-toc { // .stuck-toc {
position: fixed; // position: fixed;
top: 20px; // top: 20px;
-webkit-animation: fadein 1s; // -webkit-animation: fadein 1s;
-moz-animation: fadein 1s; // -moz-animation: fadein 1s;
-ms-animation: fadein 1s; // -ms-animation: fadein 1s;
-o-animation: fadein 1s; // -o-animation: fadein 1s;
animation: fadein 1s; // animation: fadein 1s;
} // }
.section-tool { // .section-tool {
position: absolute; // position: absolute;
top: 130px; // top: 130px;
right: -18px; // right: -18px;
z-index: 999; // z-index: 999;
} // }
.scroll-tool { // .scroll-tool {
position: absolute; // position: absolute;
top: 130px; // top: 130px;
right: -18px; // right: -18px;
z-index: 999; // z-index: 999;
-webkit-animation: fadein 1s; // -webkit-animation: fadein 1s;
-moz-animation: fadein 1s; // -moz-animation: fadein 1s;
-ms-animation: fadein 1s; // -ms-animation: fadein 1s;
-o-animation: fadein 1s; // -o-animation: fadein 1s;
animation: fadein 1s; // animation: fadein 1s;
} // }
.stuck-tool { // .stuck-tool {
position: fixed !important; // position: fixed !important;
top: 130px !important; // top: 130px !important;
right: 0; // right: 0;
left: 0; // left: 0;
-webkit-animation: fadein 1s; // -webkit-animation: fadein 1s;
-moz-animation: fadein 1s; // -moz-animation: fadein 1s;
-ms-animation: fadein 1s; // -ms-animation: fadein 1s;
-o-animation: fadein 1s; // -o-animation: fadein 1s;
animation: fadein 1s; // animation: fadein 1s;
} // }
.close-action { // .close-action {
float: right; // float: right;
> .round-button-mono { // > .round-button-mono {
color: $color-stroke; // color: $color-stroke;
border-color: $color-stroke; // border-color: $color-stroke;
> .material-icons { // > .material-icons {
color: $color-stroke; // color: $color-stroke;
} // }
} // }
} // }
.document-structure { // .document-structure {
> .toc-controls { // > .toc-controls {
margin: 0; // margin: 0;
color: $color-gray; // color: $color-gray;
> .round-button-mono { // > .round-button-mono {
color: $color-green; // color: $color-green;
border-color: $color-green; // border-color: $color-green;
> .material-icons { // > .material-icons {
color: $color-green; // color: $color-green;
} // }
} // }
> .disabled { // > .disabled {
@extend .cursor-not-allowed; // @extend .cursor-not-allowed;
color: $color-stroke; // color: $color-stroke;
border-color: $color-stroke; // border-color: $color-stroke;
> .material-icons { // > .material-icons {
color: $color-stroke; // color: $color-stroke;
} // }
} // }
} // }
.entries { // .entries {
padding: 0; // padding: 0;
list-style: none; // list-style: none;
font-size: 13px; // font-size: 13px;
overflow-x: hidden; // overflow-x: hidden;
list-style-type: none; // list-style-type: none;
margin: 20px 0 0; // margin: 20px 0 0;
font-family: $font-semibold; // font-family: $font-semibold;
.item { // .item {
padding: 4px 0; // padding: 4px 0;
text-overflow: ellipsis; // text-overflow: ellipsis;
word-wrap: break-word; // word-wrap: break-word;
white-space: nowrap; // white-space: nowrap;
overflow: hidden; // overflow: hidden;
> .link { // > .link {
color: $color-gray; // color: $color-gray;
&:hover { // &:hover {
color: $color-link; // color: $color-link;
} // }
} // }
> .selected { // > .selected {
color: $color-link; // color: $color-link;
font-weight: bold; // font-weight: bold;
} // }
} // }
} // }
} // }
} // }

View file

@ -1,10 +1,10 @@
<div id="page-{{ page.id }}" class="is-a-page wysiwyg" data-id="{{ page.id }}" data-type="{{ page.contentType }}"> <div id="page-{{ page.id }}" class="is-a-page wysiwyg" data-id="{{ page.id }}" data-type="{{ page.contentType }}">
{{#unless editMode}} {{#if editMode}}
{{document/document-editor document=document folder=folder page=page meta=meta onCancel=(action 'onCancelEdit') onAction=(action 'onSavePage')}}
{{else}}
{{document/page-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor tabMode=tabMode {{document/page-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor tabMode=tabMode
onEdit=(action 'onEdit') onSavePageAsBlock=(action 'onSavePageAsBlock') onEdit=(action 'onEdit') onSavePageAsBlock=(action 'onSavePageAsBlock')
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage')}} onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage')}}
{{section/base-renderer page=page}} {{section/base-renderer page=page}}
{{else}} {{/if}}
{{document/document-editor document=document folder=folder page=page meta=meta onCancel=(action 'onCancelEdit') onAction=(action 'onSavePage')}}
{{/unless}}
</div> </div>

View file

@ -1,3 +1,3 @@
<div id="page-data-{{ page.id }}" class="wysiwyg"> <div id="page-data-{{ page.id }}" class="wysiwyg">
{{component rendererType page=page}} {{component (concat "section/" page.contentType "/type-renderer") page=page}}
</div> </div>