├── src ├── fonts │ ├── ls-icons.eot │ ├── ls-icons.ttf │ ├── ls-icons.woff │ └── ls-icons.svg ├── img │ ├── F7F7F7-0.9.png │ └── licenses │ │ ├── bsd.png │ │ ├── by.png │ │ ├── cc.png │ │ ├── gpl.png │ │ ├── mit.png │ │ ├── nc.png │ │ ├── nd.png │ │ ├── osi.png │ │ ├── pd.png │ │ ├── sa.png │ │ ├── agpl3.png │ │ ├── apache.png │ │ ├── gpl3.png │ │ ├── lgpl.png │ │ ├── lgpl3.png │ │ ├── perl.png │ │ ├── zero.png │ │ ├── copyleft.png │ │ ├── eclipse.png │ │ ├── mozilla.png │ │ ├── opendata.png │ │ ├── copyright.png │ │ ├── copyright.svg │ │ ├── osi.svg │ │ ├── by.svg │ │ ├── sa.svg │ │ ├── pd.svg │ │ ├── nc.svg │ │ ├── copyleft.svg │ │ ├── zero.svg │ │ ├── gpl.svg │ │ ├── cc.svg │ │ ├── lgpl.svg │ │ ├── perl.svg │ │ ├── mit.svg │ │ ├── nd.svg │ │ ├── gpl3.svg │ │ ├── lgpl3.svg │ │ ├── agpl3.svg │ │ ├── eclipse.svg │ │ └── mozilla.svg ├── index.coffee ├── core │ ├── search.coffee │ ├── modal.coffee │ ├── question.coffee │ ├── tooltip.coffee │ ├── license-selector.coffee │ ├── history.coffee │ └── license-list.coffee ├── plugins │ └── jquery.coffee ├── data │ ├── labels.coffee │ ├── compatibility.coffee │ └── questions.coffee ├── tooltip.less ├── mixins.less ├── helpers │ └── explanations.coffee ├── modal.less ├── license-selector.less └── variables.less ├── babel.config.json ├── .mversionrc ├── .gitignore ├── .npmignore ├── Makefile ├── .editorconfig ├── Acknowledgment-ReadMe.md ├── cypress.config.js ├── cypress ├── support │ ├── e2e.js │ └── commands.js └── e2e │ └── license-selector.cy.js ├── bower.json ├── index.d.ts ├── LICENSE.md ├── webpack.config-old.js ├── webpack.config.js ├── index.html ├── package.json ├── docs └── extending.md └── .github └── workflows └── deploy.yml /src/fonts/ls-icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/fonts/ls-icons.eot -------------------------------------------------------------------------------- /src/fonts/ls-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/fonts/ls-icons.ttf -------------------------------------------------------------------------------- /src/img/F7F7F7-0.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/F7F7F7-0.9.png -------------------------------------------------------------------------------- /src/fonts/ls-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/fonts/ls-icons.woff -------------------------------------------------------------------------------- /src/img/licenses/bsd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/bsd.png -------------------------------------------------------------------------------- /src/img/licenses/by.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/by.png -------------------------------------------------------------------------------- /src/img/licenses/cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/cc.png -------------------------------------------------------------------------------- /src/img/licenses/gpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/gpl.png -------------------------------------------------------------------------------- /src/img/licenses/mit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/mit.png -------------------------------------------------------------------------------- /src/img/licenses/nc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/nc.png -------------------------------------------------------------------------------- /src/img/licenses/nd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/nd.png -------------------------------------------------------------------------------- /src/img/licenses/osi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/osi.png -------------------------------------------------------------------------------- /src/img/licenses/pd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/pd.png -------------------------------------------------------------------------------- /src/img/licenses/sa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/sa.png -------------------------------------------------------------------------------- /src/img/licenses/agpl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/agpl3.png -------------------------------------------------------------------------------- /src/img/licenses/apache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/apache.png -------------------------------------------------------------------------------- /src/img/licenses/gpl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/gpl3.png -------------------------------------------------------------------------------- /src/img/licenses/lgpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/lgpl.png -------------------------------------------------------------------------------- /src/img/licenses/lgpl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/lgpl3.png -------------------------------------------------------------------------------- /src/img/licenses/perl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/perl.png -------------------------------------------------------------------------------- /src/img/licenses/zero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/zero.png -------------------------------------------------------------------------------- /src/img/licenses/copyleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/copyleft.png -------------------------------------------------------------------------------- /src/img/licenses/eclipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/eclipse.png -------------------------------------------------------------------------------- /src/img/licenses/mozilla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/mozilla.png -------------------------------------------------------------------------------- /src/img/licenses/opendata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/opendata.png -------------------------------------------------------------------------------- /src/img/licenses/copyright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufal/public-license-selector/HEAD/src/img/licenses/copyright.png -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env", 5 | { 6 | "targets": { 7 | "browsers": [">0.2%", "not dead", "not op_mini all"] 8 | } 9 | } 10 | ] 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.mversionrc: -------------------------------------------------------------------------------- 1 | { 2 | "commitMessage": "Releasing %s", 3 | "tagName": "v%s", 4 | "scripts": { 5 | "preupdate": "echo 'Releasing new version...'", 6 | "postcommit": "git push origin master --follow-tags", 7 | "postupdate": "echo 'Updated to version %s'" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | # Commenting this out is preferred by some people, see 3 | # https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 4 | node_modules 5 | 6 | # No bower components 7 | bower_components 8 | 9 | # Ignore build directories 10 | dist 11 | 12 | # Users Environment Variables 13 | .lock-wscript 14 | .idea 15 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Development files 2 | src/ 3 | ci/ 4 | docs/ 5 | .github/ 6 | node_modules/ 7 | 8 | # Build configs 9 | webpack.config.js 10 | webpack.config-old.js 11 | babel.config.json 12 | .mversionrc 13 | .editorconfig 14 | Makefile 15 | 16 | # CI/CD 17 | .travis.yml 18 | 19 | # Documentation (already in README) 20 | testing-plan.md 21 | 22 | # Demo files 23 | index.html 24 | 25 | # Obsolete 26 | bower.json 27 | 28 | # Source maps (optional - remove if you want to include them) 29 | *.map 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build 2 | 3 | build: 4 | @npm run build 5 | 6 | install: 7 | @npm install 8 | 9 | run: 10 | @echo "**************************************************" 11 | @echo "* open http://localhost:8080/webpack-dev-server/ *" 12 | @echo "**************************************************" 13 | @npm start 14 | 15 | release: 16 | @./node_modules/.bin/mversion patch 17 | 18 | release-minor: 19 | @./node_modules/.bin/mversion minor 20 | 21 | release-major: 22 | @./node_modules/.bin/mversion major 23 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | 23 | # Tab indentation (no size specified) 24 | [Makefile] 25 | indent_style = tab 26 | -------------------------------------------------------------------------------- /src/index.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | # Module: index.coffee 3 | # Summary: Entry point that re-exports the selector and bundled data helpers. 4 | ### 5 | LicenseSelector = require './core/license-selector' 6 | LicenseDefinitions = require './data/licenses' 7 | LicenseCompatibility = require './data/compatibility' 8 | QuestionDefinitions = require './data/questions' 9 | LabelsDefinitions = require './data/labels' 10 | 11 | require './plugins/jquery' 12 | 13 | module.exports = 14 | LicenseSelector: LicenseSelector 15 | LicenseDefinitions: LicenseDefinitions 16 | LicenseCompatibility: LicenseCompatibility 17 | QuestionDefinitions: QuestionDefinitions 18 | LabelsDefinitions: LabelsDefinitions 19 | -------------------------------------------------------------------------------- /Acknowledgment-ReadMe.md: -------------------------------------------------------------------------------- 1 |

2 | EOSC CZ Logo 3 |

4 | 5 | --- 6 | 7 | This project output was developed with financial contributions from the [EOSC CZ](https://www.eosc.cz/projekty/narodni-podpora-pro-eosc) initiative through the project **National Repository Platform for Research Data** (CZ.02.01.01/00/23_014/0008787), funded by the Programme Johannes Amos Comenius (P JAC) of the Ministry of Education, Youth and Sports of the Czech Republic (MEYS). 8 | 9 | --- 10 | 11 |

12 | EU and MŠMT Logos 13 |

14 | -------------------------------------------------------------------------------- /cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("cypress"); 2 | 3 | module.exports = defineConfig({ 4 | e2e: { 5 | baseUrl: process.env.CYPRESS_BASE_URL || "https://ufal.github.io/public-license-selector", 6 | viewportWidth: 1280, 7 | viewportHeight: 720, 8 | 9 | // Enable video and screenshots in CI for debugging; disable locally to save resources 10 | video: !!process.env.CI, 11 | screenshotOnRunFailure: !!process.env.CI, 12 | 13 | defaultCommandTimeout: 10000, 14 | pageLoadTimeout: 30000, 15 | 16 | retries: { 17 | runMode: 2, 18 | openMode: 0, 19 | }, 20 | 21 | 22 | setupNodeEvents(on, config) { 23 | // implement node event listeners here 24 | }, 25 | }, 26 | }); 27 | -------------------------------------------------------------------------------- /cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "public-license-selector", 3 | "description": "JQuery plugin with UI for picking a license for software or data", 4 | "version": "0.1.4", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/ufal/public-license-selector" 8 | }, 9 | "authors": [ 10 | "Pawel Kamocki", 11 | "Pavel Straňák", 12 | "Michal Sedlák" 13 | ], 14 | "dependencies": { 15 | "jquery": "~2.1.1", 16 | "lodash": "~2.4.1" 17 | }, 18 | "main": [ 19 | "license-selector.js", 20 | "license-selector.css" 21 | ], 22 | "moduleType": [ 23 | "globals" 24 | ], 25 | "keywords": [ 26 | "license", 27 | "selector" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | "**/.*", 32 | "node_modules", 33 | "bower_components", 34 | "test", 35 | "tests" 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /src/core/search.coffee: -------------------------------------------------------------------------------- 1 | $ = require 'jquery' 2 | 3 | ### 4 | # Class: Search 5 | # Summary: Provides the header search input and forwards queries to `LicenseList.filter`. 6 | # Responsibilities: 7 | # - Owns a text box bound to `input` events and forwards values to the list. 8 | # - Toggles visibility alongside the license list as questions demand. 9 | ### 10 | class Search 11 | constructor: (@parent, @licenseList) -> 12 | @textbox = $('') 13 | .attr( 14 | type: 'text', 15 | placeholder: 'Search for a license...' 16 | ) 17 | .on 'input', => @licenseList.filter(@textbox.val()) 18 | 19 | @container = $('
') 20 | .addClass('ls-search') 21 | .append(@textbox) 22 | .appendTo(@parent) 23 | 24 | hide: -> @container.hide() 25 | 26 | show: -> @container.show() 27 | 28 | module.exports = Search 29 | -------------------------------------------------------------------------------- /src/fonts/ls-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright (C) 2014 by original authors @ fontello.com 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import type { JQuery } from 'jquery'; 2 | 3 | export interface LicenseDefinition { 4 | name: string; 5 | priority: number; 6 | available: boolean; 7 | url?: string; 8 | description?: string; 9 | categories: string[]; 10 | labels?: string[]; 11 | cssClass?: string; 12 | template?: (el: JQuery, license: LicenseDefinition, select: () => void) => void; 13 | } 14 | 15 | export interface LicenseSelectorOptions { 16 | appendTo?: string | HTMLElement | JQuery; 17 | start?: string; 18 | showLabels?: boolean; 19 | licenseItemTemplate?: (el: JQuery, license: LicenseDefinition, select: () => void) => void; 20 | licenses?: Record>; 21 | questions?: Record; 22 | onLicenseSelected?: (license: LicenseDefinition) => void; 23 | } 24 | 25 | declare global { 26 | interface JQuery { 27 | licenseSelector(options?: LicenseSelectorOptions): JQuery; 28 | } 29 | } 30 | 31 | export default function createLicenseSelector(container: JQuery, options?: LicenseSelectorOptions): void; 32 | -------------------------------------------------------------------------------- /src/plugins/jquery.coffee: -------------------------------------------------------------------------------- 1 | $ = require 'jquery' 2 | _ = require 'lodash' 3 | LicenseSelector = require '../core/license-selector' 4 | LicenseDefinitions = require '../data/licenses' 5 | QuestionDefinitions = require '../data/questions' 6 | 7 | ### 8 | # Module: plugins/jquery.coffee 9 | # Summary: jQuery integration that initiates or dispatches methods on `LicenseSelector` instances. 10 | ### 11 | $.fn.licenseSelector = (options, args...) -> 12 | return @each -> 13 | if args.length > 0 14 | throw new Error('Method has to be a string') unless _.isString(options) 15 | ls = $(this).data('license-selector') 16 | method = ls[options] 17 | throw new Error("Method #{options} does't exists") unless method? 18 | return method.apply(ls, args) 19 | 20 | licenses = _.merge(_.cloneDeep(LicenseDefinitions), options.licenses) 21 | questions = _.merge(_.cloneDeep(QuestionDefinitions), options.questions) 22 | delete options.questions 23 | delete options.licenses 24 | ls = new LicenseSelector(licenses, questions, options) 25 | $(this).data('license-selector', ls) 26 | $(this).click (e) -> 27 | ls.modal.show() 28 | e.preventDefault() 29 | 30 | module.exports = $.fn.licenseSelector 31 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # License 5 | 6 | Copyright © 2015 Institute of Formal and Applied Linguistics (http://ufal.mff.cuni.cz) 7 | 8 | ## The MIT License 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /webpack.config-old.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | 3 | var path = require('path'); 4 | var webpack = require('webpack'); 5 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 6 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 7 | 8 | var pgk = require('./package.json'); 9 | 10 | var defines = new webpack.DefinePlugin({ 11 | VERSION: JSON.stringify(pgk.version) 12 | }); 13 | 14 | module.exports = { 15 | devtool: 'source-map', 16 | entry: ['./src/license-selector.coffee', './src/license-selector.less'], 17 | output: { 18 | path: path.join(__dirname, 'dist'), 19 | filename: 'license-selector.js' 20 | }, 21 | externals: { 22 | lodash: '_', 23 | jquery: 'jQuery' 24 | }, 25 | module: { 26 | loaders: [ 27 | {test: /\.less$/, loader: ExtractTextPlugin.extract('css!autoprefixer!less')}, 28 | {test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'}, // inline base64 URLs for <=8k images, direct URLs for the rest 29 | {test: /\.coffee$/, loader: 'coffee'}, 30 | {test: /\.(woff|woff2)$/, loader: 'url?limit=10000&mimetype=application/font-woff&prefix=fonts'}, 31 | {test: /\.ttf$/, loader: 'url?limit=10000&mimetype=application/octet-stream&prefix=fonts'}, 32 | {test: /\.eot$/, loader: 'url?limit=10000&mimetype=application/vnd.ms-fontobject&prefix=fonts'}, 33 | {test: /\.svg$/, loader: 'url?limit=10000&mimetype=image/svg+xml&prefix=fonts'} 34 | ] 35 | }, 36 | plugins: [ 37 | new webpack.optimize.DedupePlugin(), 38 | new HtmlWebpackPlugin({ 39 | template: path.join(__dirname, 'index.html') 40 | }), 41 | new ExtractTextPlugin('license-selector.css', { 42 | allChunks: true 43 | }), 44 | defines 45 | ] 46 | }; 47 | -------------------------------------------------------------------------------- /src/img/licenses/copyright.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Source: Wikimedia Commons, Source: Wikimedia Commons, Source: Wikimedia Commons 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | image/svg+xml 31 | 32 | 33 | en 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // Custom Cypress commands for License Selector testing 3 | // *********************************************** 4 | 5 | /** 6 | * Custom command to check if modal is visible 7 | * The modal auto-opens on page load, so this verifies it's active 8 | */ 9 | Cypress.Commands.add('modalShouldBeVisible', () => { 10 | cy.get('.license-selector.is-active', { timeout: 10000 }).should('be.visible') 11 | cy.get('.ls-modal').should('be.visible') 12 | }) 13 | 14 | /** 15 | * Custom command to close modal 16 | */ 17 | Cypress.Commands.add('closeModal', () => { 18 | cy.get('.ls-modal-close').first().click() 19 | cy.get('.license-selector').should('not.have.class', 'is-active') 20 | }) 21 | 22 | /** 23 | * Custom command to reopen the license selector by clicking the link 24 | */ 25 | Cypress.Commands.add('reopenLicenseSelector', () => { 26 | cy.contains('a', 'Click to open selector').first().click() 27 | cy.get('.license-selector.is-active', { timeout: 5000 }).should('be.visible') 28 | }) 29 | 30 | /** 31 | * Custom command to click an answer button in the questionnaire 32 | * @param {string} answerText - The text of the answer button to click 33 | */ 34 | Cypress.Commands.add('clickAnswer', (answerText) => { 35 | cy.get('.ls-question-answers button').contains(answerText).click() 36 | }) 37 | 38 | /** 39 | * Custom command to verify a question is displayed 40 | * @param {string} questionText - Part of the question text to check for 41 | */ 42 | Cypress.Commands.add('questionShouldContain', (questionText) => { 43 | cy.get('.ls-question-text').should('contain', questionText) 44 | }) 45 | 46 | /** 47 | * Custom command to verify licenses are visible 48 | */ 49 | Cypress.Commands.add('licensesShouldBeVisible', () => { 50 | cy.get('.ls-license-list').should('be.visible') 51 | cy.get('.ls-license-list ul li').should('have.length.gt', 0) 52 | }) 53 | 54 | /** 55 | * Custom command to select a license from the list 56 | * @param {number} index - Index of the license to select (0-based) 57 | */ 58 | Cypress.Commands.add('selectLicense', (index = 0) => { 59 | cy.get('.ls-license-list ul li').eq(index).click() 60 | }) 61 | -------------------------------------------------------------------------------- /src/img/licenses/osi.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 28 | 31 | 35 | 39 | 42 | 47 | R 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/data/labels.coffee: -------------------------------------------------------------------------------- 1 | ### 2 | # Module: data/labels.coffee 3 | # Summary: Label metadata powering badge styling in the license list. 4 | ### 5 | LabelsDefinitions = 6 | public: 7 | text: 'Publicly Available' 8 | title: 'Under this license your resource will be publicly available' 9 | itemClass: 'ls-label-public' 10 | aca: 11 | text: 'Academic Use' 12 | title: 'License restricts the use only for research and educational purposes' 13 | itemClass: 'ls-label-aca' 14 | res: 15 | text: 'Restricted Use' 16 | title: 'License further restricts the use' 17 | itemClass: 'ls-label-res' 18 | pd: 19 | title: 'Public Domain Mark' 20 | itemClass: 'ls-icon-pd' 21 | cc: 22 | title: 'Creative Commons' 23 | itemClass: 'ls-icon-cc' 24 | zero: 25 | title: 'Creative Commons Zero' 26 | itemClass: 'ls-icon-zero' 27 | by: 28 | title: 'Attribution Required' 29 | itemClass: 'ls-icon-by' 30 | sa: 31 | title: 'Share-alike' 32 | itemClass: 'ls-icon-sa' 33 | nd: 34 | title: 'No Derivative Works' 35 | itemClass: 'ls-icon-nd' 36 | nc: 37 | title: 'Noncommercial' 38 | itemClass: 'ls-icon-nc' 39 | perl: 40 | title: 'Recommended for Perl software' 41 | itemClass: 'ls-icon-perl' 42 | osi: 43 | title: 'Approved by Open Source Initiative' 44 | itemClass: 'ls-icon-osi' 45 | gpl: 46 | title: 'General Public License' 47 | itemClass: 'ls-icon-gpl' 48 | gpl3: 49 | title: 'Latest General Public License version 3.0' 50 | itemClass: 'ls-icon-gpl3' 51 | agpl3: 52 | title: 'Latest Affero General Public License version 3.0' 53 | itemClass: 'ls-icon-agpl3' 54 | lgpl: 55 | title: 'Library General Public License' 56 | itemClass: 'ls-icon-lgpl' 57 | lgpl3: 58 | title: 'Latest Library General Public License version 3.0' 59 | itemClass: 'ls-icon-lgpl3' 60 | copyleft: 61 | title: 'Copyleft' 62 | itemClass: 'ls-icon-copyleft' 63 | mozilla: 64 | title: 'License endorsed by Mozilla Foundation' 65 | itemClass: 'ls-icon-mozilla' 66 | mit: 67 | title: 'MIT License' 68 | itemClass: 'ls-icon-mit' 69 | bsd: 70 | title: 'BSD License' 71 | itemClass: 'ls-icon-bsd' 72 | apache: 73 | title: 'License endorsed by Apache Foundation' 74 | itemClass: 'ls-icon-apache' 75 | eclipse: 76 | title: 'License endorsed by Eclipse Foundation' 77 | itemClass: 'ls-icon-eclipse' 78 | opendata: 79 | title: 'Open Data' 80 | itemClass: 'ls-icon-opendata' 81 | 82 | module.exports = LabelsDefinitions 83 | -------------------------------------------------------------------------------- /src/img/licenses/by.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Source: Creative Commons, Source: Creative Commons, Source: Creative Commons 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | image/svg+xml 30 | 31 | 32 | en 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/tooltip.less: -------------------------------------------------------------------------------- 1 | .ls-tooltip { 2 | font-size: @fontSizeSmall; 3 | font-family: @baseFontFamily; 4 | margin: 5px; 5 | padding: 3px 8px; 6 | color: #fff; 7 | background: #333; 8 | border-radius: 3px; 9 | max-width: 350px; 10 | .ls-license-name { 11 | display: block; 12 | } 13 | p { 14 | margin: 0 0 10px 15 | } 16 | p:last-child { 17 | margin-bottom: 0; 18 | } 19 | ul { 20 | padding-left: 20px; 21 | list-style: square; 22 | margin: 0; 23 | } 24 | li { 25 | padding-left: 0; 26 | list-style: square; 27 | } 28 | } 29 | .ls-term-tooltip { 30 | .ls-tooltip(); 31 | color: @textColor; 32 | //font-size: @baseFontSize; 33 | padding: 5px; 34 | text-align: left; 35 | white-space: normal; 36 | background-color: #fff; 37 | -webkit-background-clip: padding-box; 38 | background-clip: padding-box; 39 | border: 1px solid #ccc; 40 | border: 1px solid rgba(0,0,0,.2); 41 | border-radius: 6px; 42 | -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); 43 | box-shadow: 0 5px 10px rgba(0,0,0,.2); 44 | 45 | max-width: 550px; 46 | ul { 47 | margin-bottom: 10px; 48 | list-style: disc; 49 | padding-left: 20px; 50 | } 51 | ul:last-child { 52 | margin-bottom: 0; 53 | } 54 | li { 55 | list-style: disc; 56 | } 57 | } 58 | .ls-tooltip-wrapper { 59 | display: inline-block; 60 | position: absolute; 61 | z-index: @modal-layer+100; 62 | } 63 | .ls-tooltip-wrapper > * { 64 | position: relative; 65 | } 66 | 67 | .ls-tooltip-wrapper.ls-tooltip-left > * { 68 | right: 0; 69 | } 70 | 71 | .ls-tooltip-wrapper.ls-tooltip-right > * { 72 | left: 0; 73 | } 74 | 75 | .ls-tooltip-wrapper.ls-tooltip-top > * { 76 | bottom: 0; 77 | } 78 | 79 | .ls-tooltip-wrapper.ls-tooltip-bottom > * { 80 | top: 0; 81 | } 82 | .ls-tooltip-wrapper:before { 83 | display: block; 84 | position: absolute; 85 | width: 0; 86 | height: 0; 87 | content: ''; 88 | border: 5px solid transparent; 89 | } 90 | .ls-tooltip-wrapper.ls-tooltip-left:before { 91 | top: 50%; 92 | margin-top: -5px; 93 | right: 0; 94 | border-right-width: 0; 95 | border-left-color: #333; 96 | } 97 | .ls-tooltip-wrapper.ls-tooltip-right:before { 98 | top: 50%; 99 | margin-top: -5px; 100 | left: 0; 101 | border-left-width: 0; 102 | border-right-color: #333; 103 | } 104 | .ls-tooltip-wrapper.ls-tooltip-top:before { 105 | left: 50%; 106 | margin-left: -5px; 107 | bottom: 0; 108 | border-bottom-width: 0; 109 | border-top-color: #333; 110 | } 111 | .ls-tooltip-wrapper.ls-tooltip-bottom:before { 112 | // TODO: this is hack for now for terms tooltips 113 | // left: 50%; 114 | // margin-left: -5px; 115 | // top: 0; 116 | // border-top-width: 0; 117 | // border-bottom-color: #333; 118 | } 119 | -------------------------------------------------------------------------------- /src/core/modal.coffee: -------------------------------------------------------------------------------- 1 | $ = require 'jquery' 2 | 3 | ### 4 | # Class: Modal 5 | # Summary: Builds and manages the overlay container for the selector. 6 | # Responsibilities: 7 | # - Creates structural DOM (header, content area, close button) and attaches to the append target. 8 | # - Handles responsive scaling by updating injected `').appendTo('head') unless stylesheet 19 | width = $(window).width() 20 | margin = 10 21 | 22 | if width < MODAL_MAX_WIDTH 23 | currentMaxWidth = width - (margin * 2) 24 | leftMargin = currentMaxWidth / 2 25 | closeButtonMarginRight = '-' + Math.floor(currentMaxWidth / 2) 26 | stylesheet.html(""" 27 | .license-selector .ls-modal { max-width: #{currentMaxWidth}px !important; margin-left: -#{leftMargin}px !important;} 28 | .license-selector .ls-modal-close:after { margin-right: #{closeButtonMarginRight}px !important; } 29 | """) 30 | else 31 | currentMaxWidth = MODAL_MAX_WIDTH - (margin * 2) 32 | leftMargin = currentMaxWidth / 2 33 | stylesheet.html(""" 34 | .license-selector .ls-modal { max-width: #{currentMaxWidth}px; margin-left: -#{leftMargin}px;} 35 | .license-selector .ls-modal-close:after { margin-right: -#{leftMargin}px !important; } 36 | """) 37 | 38 | $(window).on 'resize', scale 39 | 40 | # create jquery && DOM 41 | constructor: (@parent) -> 42 | @element = $('
') 43 | .addClass('license-selector') 44 | .attr( 45 | tabindex: '-1' 46 | 'aria-hidden': 'true' 47 | role: 'dialog' 48 | ).on 'show.lsmodal', scale 49 | inner = $('
').addClass('ls-modal') 50 | @header = $('
') 51 | .append($('

').text('Choose a License')) 52 | .append($('

').text('Answer the questions or use the search to find the license you want')) 53 | .appendTo(inner) 54 | 55 | @content = $('

').addClass('ls-modal-content').appendTo(inner) 56 | 57 | closeButton = $('') 58 | .addClass('ls-modal-close') 59 | .attr( 60 | 'title': 'Close License Selector' 61 | 'data-dismiss': 'modal' 62 | 'data-close': 'Close' 63 | ) 64 | .click(=> @hide()) 65 | 66 | @element.append(inner) 67 | .append(closeButton) 68 | .appendTo(@parent) 69 | 70 | hide: -> 71 | @element.removeClass('is-active') 72 | .trigger('hide.lsmodal') 73 | .attr('aria-hidden', 'true') 74 | 75 | show: -> 76 | @element.addClass('is-active') 77 | .trigger('show.lsmodal') 78 | .attr('aria-hidden', 'false') 79 | 80 | module.exports = Modal 81 | -------------------------------------------------------------------------------- /src/img/licenses/sa.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Source: Creative Commons, Source: Creative Commons, Source: Creative Commons 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | image/svg+xml 30 | 31 | 32 | en 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/img/licenses/pd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Source: Creative Commons, Source: Creative Commons, Source: Creative Commons 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | image/svg+xml 30 | 31 | 32 | en 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/core/question.coffee: -------------------------------------------------------------------------------- 1 | $ = require 'jquery' 2 | _ = require 'lodash' 3 | {addExplanations, explanationTooltips} = require '../helpers/explanations.coffee' 4 | 5 | ### 6 | # Class: Question 7 | # Summary: Controls the prompt, answer buttons, checkbox options, and error display in the modal header. 8 | # Responsibilities: 9 | # - Resets content on new questions and injects explanation tooltips for marked terms. 10 | # - Wires checkbox options to update both selector state and history snapshots. 11 | # - Hides or show the license list depending on whether options are active. 12 | ### 13 | class Question 14 | 15 | constructor: (@parent, @licenseSelector) -> 16 | @element = $('
').addClass('ls-question') 17 | @errorContainer = $('
').addClass('ls-question-error').append($('

').text("Can't choose a license")).appendTo(@element) 18 | @errorContainer.hide() 19 | @error = $('').appendTo(@errorContainer) 20 | @text = $('

').addClass('ls-question-text').appendTo(@element) 21 | @options = $('