From f28894d90583e10695cf2262daed91a55aa0bd32 Mon Sep 17 00:00:00 2001 From: Jason Long Date: Wed, 6 Nov 2013 11:24:34 -0500 Subject: [PATCH] made partial for license overview sections --- _includes/license-overview.html | 49 ++++++++++++++++++++++++++++ css/application.css | 8 +++++ javascripts/app.coffee | 14 ++++++++ javascripts/app.js | 14 ++++++++ licenses.html | 58 ++------------------------------- licenses/gpl-v2.txt | 2 +- 6 files changed, 88 insertions(+), 57 deletions(-) create mode 100644 _includes/license-overview.html diff --git a/_includes/license-overview.html b/_includes/license-overview.html new file mode 100644 index 0000000..e2e19fc --- /dev/null +++ b/_includes/license-overview.html @@ -0,0 +1,49 @@ +
+ + +
+
+ + +
+
+ + + {% assign types = "required|permitted|forbidden" | split: "|" %} + {% for type in types %} + + {% endfor %} + + + {% for type in types %} + + {% endfor %} + +
{{ type | capitalize }}
+
    + {% for req in page[type] %} +
  • {{ site.rules[type][req].label }}
  • + {% endfor %} +
+
+

View full GPL v2 license »

+
+
+ GPL v3 table +

View full GPL v3 license »

+
+
+ Affero GPL table +

View full Affero GPL license »

+
+
+
+ diff --git a/css/application.css b/css/application.css index 6cd7abe..f6b191a 100644 --- a/css/application.css +++ b/css/application.css @@ -425,6 +425,14 @@ strong { color: #f7f4ef; } +.variation-tab { + display: none; +} + +.variation-tab.active { + display: block; +} + .small { font-size: 90%; } diff --git a/javascripts/app.coffee b/javascripts/app.coffee index 2bb3806..9e4cd81 100644 --- a/javascripts/app.coffee +++ b/javascripts/app.coffee @@ -36,6 +36,7 @@ class Choosealicense constructor: -> @initTooltips() @initClipboard() + @initLicenseVariationNav() # Init tooltip action initTooltips: -> @@ -92,5 +93,18 @@ class Choosealicense clipboardComplete: (client, args) -> @innerText = "Copied!" + # Initializes pill navigation for license variations + initLicenseVariationNav: -> + $(".js-nav-pills a").click (e) -> + selectedTab = $(this).data('selected-tab') + nav = $(this).closest('.js-nav-pills') + nav.find('li').removeClass('active') + nav.closest('.js-license-variations').siblings('.js-variation-tab').removeClass('active') + + $(this).parent('li').addClass('active') + $('.' + selectedTab).addClass('active') + + e.preventDefault() + $ -> new Choosealicense() diff --git a/javascripts/app.js b/javascripts/app.js index be3bca0..4837e7e 100644 --- a/javascripts/app.js +++ b/javascripts/app.js @@ -40,6 +40,7 @@ function Choosealicense() { this.initTooltips(); this.initClipboard(); + this.initLicenseVariationNav(); } Choosealicense.prototype.initTooltips = function() { @@ -106,6 +107,19 @@ return this.innerText = "Copied!"; }; + Choosealicense.prototype.initLicenseVariationNav = function() { + return $(".js-nav-pills a").click(function(e) { + var nav, selectedTab; + selectedTab = $(this).data('selected-tab'); + nav = $(this).closest('.js-nav-pills'); + nav.find('li').removeClass('active'); + nav.closest('.js-license-variations').siblings('.js-variation-tab').removeClass('active'); + $(this).parent('li').addClass('active'); + $('.' + selectedTab).addClass('active'); + return e.preventDefault(); + }); + }; + return Choosealicense; })(); diff --git a/licenses.html b/licenses.html index 553b715..630e9a6 100644 --- a/licenses.html +++ b/licenses.html @@ -11,45 +11,7 @@ class: license-types {% for page in site.pages %} {% if page.layout == "license" %} {% if page.featured %} -
- - -
-
- {% comment %} always show this div, even w/o variations, for proper spacing {% endcomment %} - -
- - - {% assign types = "required|permitted|forbidden" | split: "|" %} - {% for type in types %} - - {% endfor %} - - - {% for type in types %} - - {% endfor %} - -
{{ type | capitalize }}
-
    - {% for req in page[type] %} -
  • {{ site.rules[type][req].label }}
  • - {% endfor %} -
-
-

View full GPL v2 license »

-
-
- + {% include license-overview.html %} {% endif %} {% endif %} {% endfor %} @@ -63,23 +25,7 @@ class: license-types {% for page in site.pages %} {% if page.layout == "license" %} {% if page.featured != true and page.hide-from-license-list != true %} -

{% if page.family-title %}{{ page.family-title }}{% else %}{{ page.title }}{% endif %}

-

{{ page.description }} View full license »

- - {% assign types = "required|permitted|forbidden" | split: "|" %} - {% for type in types %} - - - - - {% endfor %} -
{{ type | capitalize }} -
    - {% for req in page[type] %} -
  • {{ site.rules[type][req].label }}
  • - {% endfor %} -
-
+ {% include license-overview.html %} {% endif %} {% endif %} {% endfor %} diff --git a/licenses/gpl-v2.txt b/licenses/gpl-v2.txt index c4903a5..1a433ae 100644 --- a/licenses/gpl-v2.txt +++ b/licenses/gpl-v2.txt @@ -6,7 +6,7 @@ layout: license permalink: /licenses/gpl-v2/ source: http://www.gnu.org/licenses/gpl-2.0.txt -description: GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license. There are multiple variants of the GPL each with different requirements, GPL v2, GPL v3, and Affero GPL. +description: GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license. There are multiple variants of the GPL each with different requirements. featured: true