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

Replace title when selecting visualizations #14838

Merged
merged 9 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Development
- Fix "Duplicate datasets" action in the dashboard ([#2023](https://github.com/CartoDB/support/issues/2023))
- CSS color variables refactor ([#14837](https://github.com/CartoDB/cartodb/pull/14837))
- Fix trial expired message without expiration date ([CartoDB/support#1997](https://github.com/CartoDB/support/issues/1997))
- Replace title for items number when selecting visualizations [#14832](https://github.com/CartoDB/cartodb/issues/14832)

4.26.0 (2019-03-11)
-------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ export default {
return this.$store.getters['user/canCreateDatasets'];
},
pageTitle () {
return this.$t(`DataPage.header.title['${this.appliedFilter}']`);
return this.selectedDatasets.length
? this.$t('BulkActions.selected', {count: this.selectedDatasets.length})
: this.$t(`DataPage.header.title['${this.appliedFilter}']`);
},
areAllDatasetsSelected () {
return Object.keys(this.datasets).length === this.selectedDatasets.length;
Expand Down
4 changes: 3 additions & 1 deletion lib/assets/javascripts/new-dashboard/components/MapsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default {
isFirstTimeViewingDashboard: state => state.config.isFirstTimeViewingDashboard
}),
pageTitle () {
return this.$t(`MapsPage.header.title['${this.appliedFilter}']`);
return this.selectedMaps.length
? this.$t('BulkActions.selected', {count: this.selectedMaps.length})
: this.$t(`MapsPage.header.title['${this.appliedFilter}']`);
},
areAllMapsSelected () {
return Object.keys(this.maps).length === this.selectedMaps.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ describe('DatasetsList.vue', () => {
expect(datasetsList).toMatchSnapshot();
});

it('should replace title for items number when selecting datasets', () => {
const store = createStore();
const propsData = {
asBulkActions: true,
canHoverCard: true
};
const datasetsList = createDatasetsList(store, propsData);

expect(datasetsList.vm.pageTitle).toBe(`DataPage.header.title['mine']`);

const dataset = datasets.visualizations[0];
datasetsList.setData({
selectedDatasets: [dataset]
});

expect(datasetsList.vm.pageTitle).toBe('BulkActions.selected');
});

describe('Methods', () => {
it('applyOrder: should dispatch datasets/order with order options', () => {
const store = createStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ describe('MapsList.vue', () => {
expect(mapsList).toMatchSnapshot();
});

it('should replace title for items number when selecting maps', () => {
const store = createStore();
const propsData = {
hasBulkActions: true,
canHoverCard: true,
canChangeViewMode: false,
isCondensedDefault: true,
showViewAll: true
};
const mapsList = createMapsList(store, propsData);

expect(mapsList.vm.pageTitle).toBe(`MapsPage.header.title['mine']`);

const map = maps.visualizations[0];
mapsList.setData({
selectedMaps: [map]
});

expect(mapsList.vm.pageTitle).toBe('BulkActions.selected');
});

describe('Methods', () => {
it('applyOrder: should dispatch maps/order with order options', () => {
const store = createStore();
Expand Down