Merge remote-tracking branch 'upstream-gh-pages/gh-pages' into gh-pages

This commit is contained in:
Gary Russell
2015-03-17 11:12:16 -04:00
3 changed files with 72 additions and 6 deletions

View File

@@ -15,8 +15,7 @@ From within your Spring project's git checkout directory:
### Remove all files
git rm -rf *
git rm -rf '.*'
git rm -rf `git ls-files` && rm -rf *
### Add the gh-pages-upstream remote
@@ -50,11 +49,11 @@ At this point you need to make a decision: is your project a "grouping project",
Based on your choice above, copy the correct sample page to `index.html`, e.g.:
$ cp sample-pages/project.html index.html
$ cp _sample-pages/project.html index.html
or
$ cp sample-pages/project_group.html index.html
$ cp _sample-pages/project_group.html index.html
## Edit the content of your home page
@@ -96,9 +95,10 @@ Assuming you're already within your project's clone directory, and you've alread
### Install jekyll if you have not already
> **Note:** Jekyll 1.1.2 is a known good version.
> **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:
gem install jekyll
gem install bundler
bundle
### Run jekyll

View File

@@ -29,6 +29,26 @@
</div>
</script>
<script type="text/html" id="project-courses-widget-template">
<h2>Related Courseware</h2>
{@ if(hasCourses) { @}
<h3 id="education">Pivotal Education</h3>
<ul>
{@ _.each(courses, function(course) { @}
<li><a href="{@= course.url @}">{@= course.name @}</a></li>
{@ }); @}
</ul>
{@ } @}
{@ if(hasTalks) { @}
<h3 id="talks">Engineering Talks</h3>
<ul>
{@ _.each(talks, function(talk) { @}
<li><a href="{@= talk.url @}">{@= talk.name @}</a></li>
{@ }); @}
</ul>
{@ } @}
</script>
<script type="text/html" id="project-download-widget-controls-template">
<div class="js-download-widget-selector">
<select class='selector selectpicker'>

View File

@@ -11,14 +11,19 @@ Spring.ProjectDocumentationWidget = function () {
var quickStartEl = $('[data-download-widget-controls]');
var mavenWidgetEl = $('.js-download-maven-widget');
var documentationEl = $('.js-documentation-widget');
var resourcesEl = $('.project-sidebar-resource--wrapper');
var projectUrl = apiBaseUrl + "/project_metadata/" + projectId;
var promise = Spring.loadProject(projectUrl);
var coursesPromise = Spring.loadCourses("https://pivotallms.biglms.com/api/courses");
promise.then(function (project) {
Spring.buildDocumentationWidget(documentationEl, project);
Spring.buildQuickStartWidget(quickStartEl, mavenWidgetEl, project);
});
coursesPromise.then(function(courseware) {
Spring.buildCoursesWidget(resourcesEl, courseware);
});
};
Spring.buildDocumentationWidget = function (documentationEl, project) {
@@ -29,6 +34,17 @@ Spring.buildDocumentationWidget = function (documentationEl, project) {
}).render();
}
Spring.buildCoursesWidget = function (resourcesEl, courseware) {
if(courseware.hasContent) {
var tpl = $("#project-courses-widget-template").text();
var view = new Spring.CoursesWidgetView({
el: resourcesEl,
model: courseware,
template: $("#project-courses-widget-template").text()
});
view.render();
}
}
Spring.buildQuickStartWidget = function (quickStartEl, mavenWidgetEl, project) {
new Spring.QuickStartSelectorView({
el: quickStartEl,
@@ -47,6 +63,13 @@ Spring.loadProject = function (url) {
});
}
Spring.loadCourses = function (url) {
return $.getJSON(url)
.then(function(data) {
return new Spring.Courseware(data);
});
}
Spring.Release = function (data) {
_.extend(this, data);
}
@@ -63,6 +86,15 @@ Spring.Release.prototype = {
}
}
Spring.Courseware = function (data) {
this.courses = data["edu1"];
this.talks = data["eng1"];
this.hasCourses = this.courses != null;
this.hasTalks = this.talks != null;
this.hasContent = this.hasTalks || this.hasCourses;
return this;
};
Spring.Project = function (data) {
_.extend(this, data);
var self = this;
@@ -87,6 +119,20 @@ Spring.DocumentationWidgetView = Backbone.View.extend({
}
});
Spring.CoursesWidgetView = Backbone.View.extend({
initialize: function () {
this.template = _.template(this.options.template);
_.bindAll(this, "render");
},
render: function () {
this.$el.append(
this.template(this.model)
);
return this;
}
});
Spring.SnippetView = Backbone.View.extend({
initialize: function () {
var snippetType = this.options.snippetType;