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

963 show layer sources #1029

Open
wants to merge 2 commits into
base: develop
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
9 changes: 8 additions & 1 deletion app/components/labs-ui/layer-group-toggle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@ember/component';
import { action } from '@ember/object';
import { action, computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import layout from '../../templates/components/labs-ui/layer-group-toggle';
Expand Down Expand Up @@ -57,6 +57,13 @@ export default class LayerGroupToggle extends Component {
@alias('layerGroup.visible')
active = true;

@computed
get sourceMetadata() {
const meta = this.get('layerGroup.sources.firstObject.meta') || {};

return meta;
}

// additional options
infoLinkIcon = 'external-link-alt';

Expand Down
8 changes: 8 additions & 0 deletions app/models/layer-group.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import LayerGroupModel from 'ember-mapbox-composer/models/layer-group';
import DS from 'ember-data';

const { hasMany } = DS;

export default LayerGroupModel.extend({
sources: hasMany('source', { async: false }),
});
4 changes: 3 additions & 1 deletion app/models/source.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import DS from 'ember-data';

export default DS.Model.extend({
meta: DS.attr(),
meta: DS.attr({
defaultValue: () => ({}),
}),
minzoom: DS.attr('number'),
});
5 changes: 5 additions & 0 deletions app/templates/components/labs-ui/icon-tooltip.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{~fa-icon icon=icon transform=transform fixedWidth=fixedWidth~}}

<EmberTooltip @side={{this.side}} @popperContainer='body'>
{{yield}}
</EmberTooltip>
10 changes: 8 additions & 2 deletions app/templates/components/labs-ui/layer-group-toggle.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@
</a>
{{/if}}
{{#if tooltip}}
{{labs-ui/icon-tooltip
tip=tooltip
{{#labs-ui/icon-tooltip
icon=tooltipIcon
side='left'
fixedWidth=true
}}
{{tooltip}}

{{#if sourceMetadata.description}}
<br/><br/>
<small>Source: {{sourceMetadata.description}} ({{sourceMetadata.updated_at}})</small>
{{/if}}
{{/labs-ui/icon-tooltip}}
{{/if}}
</div>
</div>
Expand Down