1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +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';
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="sidebar-wrapper">
<div class="document-sidebar-content">
<div class="document-sidebar-common">
{{#if model.document.template}}
<div class="is-template">TEMPLATE</div>
{{/if}}

View file

@ -1,3 +1,5 @@
$document-sidebar-width: 400px;
#wrapper {
padding-right: 0;
margin-left: 60px;
@ -8,11 +10,9 @@
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 {
// z-index: 1000;

View file

@ -1,4 +1,4 @@
.document-sidebar-content {
.document-sidebar-common {
display: inline-block;
width: 340px;
padding: 40px 20px;
@ -16,127 +16,127 @@
padding: 50px 0 0 0;
}
.xxxx {
// .xxxx {
.is-template {
color: $color-goldy;
font-weight: bold;
font-size: 1.5em;
margin-bottom: 30px;
padding-bottom: 5px;
border-bottom: 1px dotted $color-goldy;
}
// .is-template {
// color: $color-goldy;
// font-weight: bold;
// font-size: 1.5em;
// margin-bottom: 30px;
// padding-bottom: 5px;
// border-bottom: 1px dotted $color-goldy;
// }
@extend .no-select;
// @extend .no-select;
.stuck-toc {
position: fixed;
top: 20px;
-webkit-animation: fadein 1s;
-moz-animation: fadein 1s;
-ms-animation: fadein 1s;
-o-animation: fadein 1s;
animation: fadein 1s;
}
// .stuck-toc {
// position: fixed;
// top: 20px;
// -webkit-animation: fadein 1s;
// -moz-animation: fadein 1s;
// -ms-animation: fadein 1s;
// -o-animation: fadein 1s;
// animation: fadein 1s;
// }
.section-tool {
position: absolute;
top: 130px;
right: -18px;
z-index: 999;
}
// .section-tool {
// position: absolute;
// top: 130px;
// right: -18px;
// z-index: 999;
// }
.scroll-tool {
position: absolute;
top: 130px;
right: -18px;
z-index: 999;
-webkit-animation: fadein 1s;
-moz-animation: fadein 1s;
-ms-animation: fadein 1s;
-o-animation: fadein 1s;
animation: fadein 1s;
}
// .scroll-tool {
// position: absolute;
// top: 130px;
// right: -18px;
// z-index: 999;
// -webkit-animation: fadein 1s;
// -moz-animation: fadein 1s;
// -ms-animation: fadein 1s;
// -o-animation: fadein 1s;
// animation: fadein 1s;
// }
.stuck-tool {
position: fixed !important;
top: 130px !important;
right: 0;
left: 0;
-webkit-animation: fadein 1s;
-moz-animation: fadein 1s;
-ms-animation: fadein 1s;
-o-animation: fadein 1s;
animation: fadein 1s;
}
// .stuck-tool {
// position: fixed !important;
// top: 130px !important;
// right: 0;
// left: 0;
// -webkit-animation: fadein 1s;
// -moz-animation: fadein 1s;
// -ms-animation: fadein 1s;
// -o-animation: fadein 1s;
// animation: fadein 1s;
// }
.close-action {
float: right;
// .close-action {
// float: right;
> .round-button-mono {
color: $color-stroke;
border-color: $color-stroke;
// > .round-button-mono {
// color: $color-stroke;
// border-color: $color-stroke;
> .material-icons {
color: $color-stroke;
}
}
}
// > .material-icons {
// color: $color-stroke;
// }
// }
// }
.document-structure {
> .toc-controls {
margin: 0;
color: $color-gray;
// .document-structure {
// > .toc-controls {
// margin: 0;
// color: $color-gray;
> .round-button-mono {
color: $color-green;
border-color: $color-green;
// > .round-button-mono {
// color: $color-green;
// border-color: $color-green;
> .material-icons {
color: $color-green;
}
}
// > .material-icons {
// color: $color-green;
// }
// }
> .disabled {
@extend .cursor-not-allowed;
color: $color-stroke;
border-color: $color-stroke;
// > .disabled {
// @extend .cursor-not-allowed;
// color: $color-stroke;
// border-color: $color-stroke;
> .material-icons {
color: $color-stroke;
}
}
}
// > .material-icons {
// color: $color-stroke;
// }
// }
// }
.entries {
padding: 0;
list-style: none;
font-size: 13px;
overflow-x: hidden;
list-style-type: none;
margin: 20px 0 0;
font-family: $font-semibold;
// .entries {
// padding: 0;
// list-style: none;
// font-size: 13px;
// overflow-x: hidden;
// list-style-type: none;
// margin: 20px 0 0;
// font-family: $font-semibold;
.item {
padding: 4px 0;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: nowrap;
overflow: hidden;
// .item {
// padding: 4px 0;
// text-overflow: ellipsis;
// word-wrap: break-word;
// white-space: nowrap;
// overflow: hidden;
> .link {
color: $color-gray;
// > .link {
// color: $color-gray;
&:hover {
color: $color-link;
}
}
// &:hover {
// color: $color-link;
// }
// }
> .selected {
color: $color-link;
font-weight: bold;
}
}
}
}
}
// > .selected {
// color: $color-link;
// 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 }}">
{{#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
onEdit=(action 'onEdit') onSavePageAsBlock=(action 'onSavePageAsBlock')
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage')}}
{{section/base-renderer page=page}}
{{else}}
{{document/document-editor document=document folder=folder page=page meta=meta onCancel=(action 'onCancelEdit') onAction=(action 'onSavePage')}}
{{/unless}}
{{/if}}
</div>

View file

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