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

Commit

Permalink
✨ Add classes to card. (#591)
Browse files Browse the repository at this point in the history
closes: TryGhost/Ghost#8179
- previously all cards just had a `__mobiledoc-card` class on them, this update replaces them with a class `kg-card` and adds an additional class of `kg-{{card_name}}`
  • Loading branch information
disordinary authored and kevinansfield committed Mar 20, 2017
1 parent 569fe05 commit 41b035d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 8 additions & 8 deletions app/styles/addons/gh-koenig/gh-koenig.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@

}

.__mobiledoc-card {
.kg-card {
position: relative;
display: block; /* required for cursor movement around card */
width: 100%;
}

.__mobiledoc-card:hover {
.kg-card:hover {
box-shadow: var(--blue) 0 0 0 1px;
}

.__mobiledoc-card .card-handle {
.kg-card .card-handle {
position: absolute;
right: 0px;
top: 0px;
Expand All @@ -61,23 +61,23 @@
display: none;
}

.__mobiledoc-card:hover .card-handle {
.kg-card:hover .card-handle {
display: block;
}

.__mobiledoc-card .card-handle label {
.kg-card .card-handle label {
font-size: 10px;
}


.__mobiledoc-card .card-handle button {
.kg-card .card-handle button {
background-color: var(--lightgrey);
border: 1px solid var(--midgrey);
font-size: 10px;
min-width: 80px;
}

.__mobiledoc-card textarea {
.kg-card textarea {
min-height: 333px;
max-width: 900px;
outline: none;
Expand Down Expand Up @@ -155,7 +155,7 @@ textarea.ed_code {
}


.__mobiledoc-card .gh-image-uploader .upload-form {
.kg-card .gh-image-uploader .upload-form {
width: 100%;
height: 350px;
background: color(var(--lightgrey) l(+4%));
Expand Down
16 changes: 14 additions & 2 deletions lib/gh-koenig/addon/components/koenig-card.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import Component from 'ember-component';
import layout from '../templates/components/koenig-card';
import run from 'ember-runloop';

export default Component.extend({
layout,
classNames: ['koenig-card'],

init() {
this._super(...arguments);
this.set('isEditing', false);
},
didRender() {
// add the classname to the wrapping card as generated by mobiledoc.
// for some reason `this` on did render actually refers to the editor object and not the card object, after render it seems okay.
run.schedule('afterRender', this,
() => {
let {env: {name}} = this.get('card');
let mobiledocCard = this.$().parents('.__mobiledoc-card');

mobiledocCard.removeClass('__mobiledoc-card');
mobiledocCard.addClass('kg-card');
mobiledocCard.addClass(name ? `kg-${name}` : '');
}
);
},
actions: {
save() {
this.set('doSave', Date.now());
Expand Down

0 comments on commit 41b035d

Please sign in to comment.