Skip to content

Commit a1ff73b

Browse files
committed
Merge branch 'gh-pages' of https://github.com/spring-projects/gh-pages into gh-pages
2 parents c1f7465 + bf15ee8 commit a1ff73b

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

README.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ Assuming you're already within your project's clone directory, and you've alread
9595

9696
### Install jekyll if you have not already
9797

98-
> **Note:** Jekyll 1.1.2 is a known good version.
98+
> **Note:** Jekyll 1.1.2 is a known good version, and it is specifically referred to in `Gemfile.lock` so you have to use `bundle` (not `gem install ...`) to install it:
9999
100-
gem install jekyll
100+
gem install bundler
101+
bundle
101102

102103
### Run jekyll
103104

_includes/widget_templates.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@
2929
</div>
3030
</script>
3131

32+
<script type="text/html" id="project-courses-widget-template">
33+
<h2>Related Courseware</h2>
34+
{@ if(hasCourses) { @}
35+
<h3 id="education">Pivotal Education</h3>
36+
<ul>
37+
{@ _.each(courses, function(course) { @}
38+
<li><a href="{@= course.url @}">{@= course.name @}</a></li>
39+
{@ }); @}
40+
</ul>
41+
{@ } @}
42+
{@ if(hasTalks) { @}
43+
<h3 id="talks">Engineering Talks</h3>
44+
<ul>
45+
{@ _.each(talks, function(talk) { @}
46+
<li><a href="{@= talk.url @}">{@= talk.name @}</a></li>
47+
{@ }); @}
48+
</ul>
49+
{@ } @}
50+
</script>
51+
3252
<script type="text/html" id="project-download-widget-controls-template">
3353
<div class="js-download-widget-selector">
3454
<select class='selector selectpicker'>

js/projectDocumentationWidget.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@ Spring.ProjectDocumentationWidget = function () {
1111
var quickStartEl = $('[data-download-widget-controls]');
1212
var mavenWidgetEl = $('.js-download-maven-widget');
1313
var documentationEl = $('.js-documentation-widget');
14+
var resourcesEl = $('.project-sidebar-resource--wrapper');
1415

1516
var projectUrl = apiBaseUrl + "/project_metadata/" + projectId;
1617
var promise = Spring.loadProject(projectUrl);
18+
var coursesPromise = Spring.loadCourses("https://pivotallms.biglms.com/api/courses");
1719

1820
promise.then(function (project) {
1921
Spring.buildDocumentationWidget(documentationEl, project);
2022
Spring.buildQuickStartWidget(quickStartEl, mavenWidgetEl, project);
2123
});
24+
coursesPromise.then(function(courseware) {
25+
Spring.buildCoursesWidget(resourcesEl, courseware);
26+
});
2227
};
2328

2429
Spring.buildDocumentationWidget = function (documentationEl, project) {
@@ -29,6 +34,17 @@ Spring.buildDocumentationWidget = function (documentationEl, project) {
2934
}).render();
3035

3136
}
37+
Spring.buildCoursesWidget = function (resourcesEl, courseware) {
38+
if(courseware.hasContent) {
39+
var tpl = $("#project-courses-widget-template").text();
40+
var view = new Spring.CoursesWidgetView({
41+
el: resourcesEl,
42+
model: courseware,
43+
template: $("#project-courses-widget-template").text()
44+
});
45+
view.render();
46+
}
47+
}
3248
Spring.buildQuickStartWidget = function (quickStartEl, mavenWidgetEl, project) {
3349
new Spring.QuickStartSelectorView({
3450
el: quickStartEl,
@@ -47,6 +63,13 @@ Spring.loadProject = function (url) {
4763
});
4864
}
4965

66+
Spring.loadCourses = function (url) {
67+
return $.getJSON(url)
68+
.then(function(data) {
69+
return new Spring.Courseware(data);
70+
});
71+
}
72+
5073
Spring.Release = function (data) {
5174
_.extend(this, data);
5275
}
@@ -63,6 +86,15 @@ Spring.Release.prototype = {
6386
}
6487
}
6588

89+
Spring.Courseware = function (data) {
90+
this.courses = data["edu1"];
91+
this.talks = data["eng1"];
92+
this.hasCourses = this.courses != null;
93+
this.hasTalks = this.talks != null;
94+
this.hasContent = this.hasTalks || this.hasCourses;
95+
return this;
96+
};
97+
6698
Spring.Project = function (data) {
6799
_.extend(this, data);
68100
var self = this;
@@ -87,6 +119,20 @@ Spring.DocumentationWidgetView = Backbone.View.extend({
87119
}
88120
});
89121

122+
Spring.CoursesWidgetView = Backbone.View.extend({
123+
initialize: function () {
124+
this.template = _.template(this.options.template);
125+
_.bindAll(this, "render");
126+
},
127+
128+
render: function () {
129+
this.$el.append(
130+
this.template(this.model)
131+
);
132+
return this;
133+
}
134+
});
135+
90136
Spring.SnippetView = Backbone.View.extend({
91137
initialize: function () {
92138
var snippetType = this.options.snippetType;

0 commit comments

Comments
 (0)