Skip to content

Commit ef3c723

Browse files
marcgurneyrueckstiess
authored andcommitted
added transitions and logic for showing, hiding next, previous buttons and get started button
1 parent b72db05 commit ef3c723

File tree

3 files changed

+74
-14
lines changed

3 files changed

+74
-14
lines changed

src/tour/index.jade

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@
1111
p.feature-description See a list of collections in the left sidebar. Select a collection and Compass will instantly start analyzing the schema data. Use the search filter at the top to narrow your list of collections.
1212
#f1-content.feature-content
1313
h3.feature-title Browse the Schema
14-
p.feature-description Once a collection is loaded Compass will visualize the collection schema. Field are listed as rows in the main view. The left side of the row displays the field name and datatype distribution. The right side of the row displays a visualization of some of the data stored in the field.
14+
p.feature-description Once a collection is loaded Compass will visualize the collection schema. Field are listed as rows in the main view. The left side of the row displays the field name and datatype distribution, the right side displays a visualization of the data.
1515
#f2-content.feature-content
1616
h3.feature-title View Data Distribution
17-
p.feature-description -------
17+
p.feature-description View the charts in the right-hand column of each row to see data distribution at a high level. Hover over charts to see more detail.
1818
#f3-content.feature-content
1919
h3.feature-title Build Queries
20-
p.feature-description -------
20+
p.feature-description Click on charts to build MongoDB queries. Click and drag within bar charts to select multiple values. Edit your query by typing directly into the query bar.
2121
#f4-content.feature-content
2222
h3.feature-title View Documents
23-
p.feature-description -------
23+
p.feature-description Open the document drawer on the right to view the raw JSON documents in the result set.
2424
.pager
25-
a.previous-slide Previous
25+
a.previous-slide.hide Previous
2626
ul
2727
li#f0.selected(data-n="0", title="Choose a collection")
2828
li#f1(data-n="1", title="Browse schema")
2929
li#f2(data-n="2", title="View data distribution")
3030
li#f3(data-n="3", title="Build queries")
3131
li#f4(data-n="4", title="View documents")
3232
a.next-slide Next
33-
//- button#tour-remove(type="button", class="btn btn-info") Get Started
33+
.get-started-button-holder
34+
button#tour-remove.hide(type="button", class="btn btn-info") Get Started
3435

src/tour/index.js

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,25 @@ var TourView = View.extend({
2727
this.$animationGIF = this.query('#animation-gif');
2828
this.$tourRemove = this.query('#tour-remove');
2929
},
30+
showHidePreviousNextButtons: function() {
31+
if(this.tourCount === 0) {
32+
$('.previous-slide').addClass('hide');
33+
} else {
34+
$('.previous-slide').removeClass('hide');
35+
}
36+
37+
if(this.tourCount === 4) {
38+
$('.next-slide').addClass('hide');
39+
$('#tour-remove').removeClass('hide');
40+
} else {
41+
$('.next-slide').removeClass('hide');
42+
$('#tour-remove').addClass('hide');
43+
}
44+
},
3045
showFeature: function(ev) {
31-
var nCLick = ev.target.getAttribute('data-n');
46+
var nCLick = ev.target.getAttribute('data-n'),
47+
that = this;
48+
3249
if (nCLick === null) {
3350
return false;
3451
}
@@ -40,39 +57,63 @@ var TourView = View.extend({
4057

4158
// select new
4259
ev.target.className = 'selected';
43-
this.$animationGIF.src = this.tourImagesFolder + ev.target.id + '.gif';
60+
61+
$('#animation-gif').one('webkitTransitionEnd', function(event) {
62+
that.$animationGIF.src = that.tourImagesFolder + ev.target.id + '.gif';
63+
$('#animation-gif').css('opacity', '1');
64+
});
65+
$('#animation-gif').css('opacity', '0');
66+
4467
$('.feature-content#f' + nFeature + '-content').addClass('active');
68+
4569
this.tourCount = nFeature;
70+
this.showHidePreviousNextButtons();
4671
},
4772
showPreviousFeature: function(ev) {
48-
var currentFeature = this.tourCount;
49-
var previousFeature = this.tourCount - 1;
73+
var currentFeature = this.tourCount,
74+
previousFeature = this.tourCount - 1,
75+
that = this;
5076

5177
// deselect old
5278
$('#features li.selected').removeClass('selected');
5379
$('.feature-content.active').removeClass('active');
5480

5581
// select new
5682
$('#features li#f' + previousFeature).addClass('selected');
57-
this.$animationGIF.src = this.tourImagesFolder + 'f' + previousFeature + '.gif';
83+
84+
$('#animation-gif').one('webkitTransitionEnd', function(event) {
85+
that.$animationGIF.src = that.tourImagesFolder + 'f' + previousFeature + '.gif';
86+
$('#animation-gif').css('opacity', '1');
87+
});
88+
$('#animation-gif').css('opacity', '0');
89+
5890
$('.feature-content#f' + previousFeature + '-content').addClass('active');
5991

6092
this.tourCount = previousFeature;
93+
this.showHidePreviousNextButtons();
6194
},
6295
showNextFeature: function(ev) {
63-
var currentFeature = this.tourCount;
64-
var nextFeature = this.tourCount + 1;
96+
var currentFeature = this.tourCount,
97+
nextFeature = this.tourCount + 1,
98+
that = this;
6599

66100
// deselect old
67101
$('#features li.selected').removeClass('selected');
68102
$('.feature-content.active').removeClass('active');
69103

70104
// select new
71105
$('#features li#f' + nextFeature).addClass('selected');
72-
this.$animationGIF.src = this.tourImagesFolder + 'f' + nextFeature + '.gif';
106+
107+
$('#animation-gif').one('webkitTransitionEnd', function(event) {
108+
that.$animationGIF.src = that.tourImagesFolder + 'f' + nextFeature + '.gif';
109+
$('#animation-gif').css('opacity', '1');
110+
});
111+
$('#animation-gif').css('opacity', '0');
112+
73113
$('.feature-content#f' + nextFeature + '-content').addClass('active');
74114

75115
this.tourCount = nextFeature;
116+
this.showHidePreviousNextButtons();
76117
},
77118
tourRemove: function() {
78119
this.remove();

src/tour/index.less

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
@keyframes fade-in {
2+
0% { opacity: 0; }
3+
100% { opacity: 1; }
4+
}
5+
16
#tour-out {
27
position: absolute;
38
top: 0;
@@ -32,18 +37,22 @@
3237
width: 66%;
3338

3439
img {
40+
// opacity: 0;
3541
width: 90%;
3642
margin: 20px auto 40px;
3743
display: block;
3844
border: 1px @gray6 solid;
3945
box-shadow: 0 8px 15px rgba(0,0,0,0.1);
46+
// animation: fade-in 1000ms ease-out forwards;
47+
transition: opacity 250ms ease-out;
4048
}
4149
}
4250
#features {
4351
width: 30%;
4452

4553
.feature-content {
4654
display: none;
55+
animation: fade-in 500ms ease-out;
4756

4857
&.active {
4958
display: block;
@@ -106,5 +115,14 @@
106115
background: @green2;
107116
border-color: @green2;
108117
}
118+
.get-started-button-holder {
119+
text-align: center;
120+
margin-top: 100px;
121+
122+
#tour-remove {
123+
opacity: 0;
124+
animation: fade-in 750ms ease-out 500ms forwards;
125+
}
126+
}
109127
}
110128
}

0 commit comments

Comments
 (0)