mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-09 06:04:26 +02:00
parent
1e213b9ea0
commit
6ba36de6b7
3 changed files with 19 additions and 14 deletions
|
@ -281,7 +281,6 @@ var LevelDropdownView = ContainedBase.extend({
|
||||||
// also go find the series and update the about
|
// also go find the series and update the about
|
||||||
_.each(this.seriesViews, function(view) {
|
_.each(this.seriesViews, function(view) {
|
||||||
if (view.levelIDs.indexOf(id) === -1) {
|
if (view.levelIDs.indexOf(id) === -1) {
|
||||||
view.resetAbout();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
view.updateAboutForLevelID(id);
|
view.updateAboutForLevelID(id);
|
||||||
|
@ -354,8 +353,7 @@ var SeriesView = BaseView.extend({
|
||||||
template: _.template($('#series-view').html()),
|
template: _.template($('#series-view').html()),
|
||||||
events: {
|
events: {
|
||||||
'click div.levelIcon': 'click',
|
'click div.levelIcon': 'click',
|
||||||
'mouseenter div.levelIcon': 'enterIcon',
|
'mouseenter div.levelIcon': 'enterIcon'
|
||||||
'mouseleave div.levelIcon': 'leaveIcon'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
@ -365,7 +363,11 @@ var SeriesView = BaseView.extend({
|
||||||
this.levels = LevelStore.getLevelsInSequence(this.name);
|
this.levels = LevelStore.getLevelsInSequence(this.name);
|
||||||
|
|
||||||
this.levelIDs = [];
|
this.levelIDs = [];
|
||||||
|
var firstLevelInfo = null;
|
||||||
_.each(this.levels, function(level) {
|
_.each(this.levels, function(level) {
|
||||||
|
if (firstLevelInfo === null) {
|
||||||
|
firstLevelInfo = intl.getName(LevelStore.getLevel(level.id));
|
||||||
|
}
|
||||||
this.levelIDs.push(level.id);
|
this.levelIDs.push(level.id);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -375,6 +377,7 @@ var SeriesView = BaseView.extend({
|
||||||
this.JSON = {
|
this.JSON = {
|
||||||
displayName: intl.getIntlKey(this.info, 'displayName'),
|
displayName: intl.getIntlKey(this.info, 'displayName'),
|
||||||
about: intl.getIntlKey(this.info, 'about') || " ",
|
about: intl.getIntlKey(this.info, 'about') || " ",
|
||||||
|
levelInfo: firstLevelInfo,
|
||||||
ids: this.levelIDs
|
ids: this.levelIDs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -396,13 +399,8 @@ var SeriesView = BaseView.extend({
|
||||||
return $(element).attr('data-id');
|
return $(element).attr('data-id');
|
||||||
},
|
},
|
||||||
|
|
||||||
resetAbout: function() {
|
|
||||||
this.$('p.about').text(intl.getIntlKey(this.info, 'about'))
|
|
||||||
.css('font-style', 'inherit');
|
|
||||||
},
|
|
||||||
|
|
||||||
setAbout: function(content) {
|
setAbout: function(content) {
|
||||||
this.$('p.about').text(content).css('font-style', 'italic');
|
this.$('p.levelInfo').text(content);
|
||||||
},
|
},
|
||||||
|
|
||||||
enterIcon: function(ev) {
|
enterIcon: function(ev) {
|
||||||
|
@ -412,11 +410,10 @@ var SeriesView = BaseView.extend({
|
||||||
|
|
||||||
updateAboutForLevelID: function(id) {
|
updateAboutForLevelID: function(id) {
|
||||||
var level = LevelStore.getLevel(id);
|
var level = LevelStore.getLevel(id);
|
||||||
this.setAbout(intl.getName(level));
|
// hack -- parse out the level number from
|
||||||
},
|
// the ID
|
||||||
|
var levelNumber = id.replace(/[^0-9]/g, '');
|
||||||
leaveIcon: function() {
|
this.setAbout(levelNumber + ': ' + intl.getName(level));
|
||||||
this.resetAbout();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
click: function(ev) {
|
click: function(ev) {
|
||||||
|
|
|
@ -865,6 +865,7 @@ div.displayName h3 {
|
||||||
div.iconHolder {
|
div.iconHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.seriesView p.levelInfo,
|
||||||
div.seriesView p.about {
|
div.seriesView p.about {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
@ -872,6 +873,10 @@ div.seriesView p.about {
|
||||||
color: #CCC;
|
color: #CCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.seriesView p.levelInfo {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
div.levelIcon {
|
div.levelIcon {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
|
|
@ -222,6 +222,9 @@
|
||||||
<p class="about">
|
<p class="about">
|
||||||
<%= about %>
|
<%= about %>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="levelInfo">
|
||||||
|
<%= levelInfo %>
|
||||||
|
</p>
|
||||||
<div class="iconHolder box horizontal">
|
<div class="iconHolder box horizontal">
|
||||||
<% for (var i = 0; i < ids.length; i++) { %>
|
<% for (var i = 0; i < ids.length; i++) { %>
|
||||||
<div class="levelIcon box center centerAlign vertical" id="levelIcon-<%=ids[i]%>" data-id="<%=ids[i]%>">
|
<div class="levelIcon box center centerAlign vertical" id="levelIcon-<%=ids[i]%>" data-id="<%=ids[i]%>">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue