Skip to content

Commit 4a5891c

Browse files
author
Ari
committed
Get basic license card working, currently only cc-by supported
1 parent 9f1f5a2 commit 4a5891c

File tree

5 files changed

+99
-10
lines changed

5 files changed

+99
-10
lines changed

src/index.html

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,34 @@ <h4 class="title is-4">
234234
</div>
235235
</div> <br><br>
236236
</div>-->
237+
<div class="column">
238+
<div class="card">
239+
<h3 class="title is-3 selected-license-card-title" align="center">Your License!</h3>
240+
<div class="columns">
241+
<div class="column is-one-quarter">
242+
243+
</div>
244+
<div class="column">
245+
<p v-bind:href="chooser.selected_license_link" class="selected-license-name">
246+
{{chooser.selected_license}} ({{chooser.selected_license_short}})
247+
</p>
248+
<p>
249+
{{chooser.selected_license_description}}
250+
</p> <br>
251+
<div>
252+
<p>{{chooser.selected_license_short}} attribution means you are free to</p>
253+
<div id="selected-license-permissions-share">
254+
<p><b>Share</b> the material in any medium or format, and</p>
255+
</div>
256+
<div id="selected-license-permissions-adapt">
257+
<p><b>Adapt</b> {{chooser.selected_license_share_allowance}}</p>
258+
</div>
259+
</div>
260+
</div>
261+
</div>
262+
</div>
263+
</div>
264+
<!--
237265
<div class="column" align="center">
238266
<h3 class="title is-3">Your License!</h3> <br><br>
239267
<a v-bind:href="chooser.selected_license_link" align="center">{{chooser.selected_license}}</a> <br>
@@ -244,7 +272,7 @@ <h3 class="title is-3">Your License!</h3> <br><br>
244272
<img src="assets/license-icons/cc-nc_icon.svg" class="chooser-license-icon" id="commercial-icon">
245273
<img v-bind:src="'assets/license-icons/' + chooser.icons.nd_sa_src" class="chooser-license-icon" id="adaptations-icon">
246274
</span>
247-
</div>
275+
</div>-->
248276
</div>
249277
</div>
250278
<hr>

src/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ var app_state = new Vue({ // eslint-disable-line
55
chooser: {
66
selected_license: "[License Name]",
77
selected_license_short: "[License Short]",
8+
selected_license_slugified: "",
9+
selected_license_short_noversion: "[License Short No Version]",
10+
selected_license_description: "[Selected Description]",
11+
selected_license_share_allowance: "[Share Allowance]",
812
selected_license_link: "",
913
icons: {
1014
nc_shown: false,
@@ -27,6 +31,40 @@ var app_state = new Vue({ // eslint-disable-line
2731
license_mark: "",
2832
normal_icon: true,
2933
metadata_text: ""
34+
},
35+
license_packs: {
36+
"by": {
37+
"description": "As the most accommodating of \
38+
the licenses offered, the CC BY license \
39+
allows others to distribute, remix, tweak, \
40+
and build upon your work, even commercially \
41+
, as long as they credit you for the \
42+
original creation.",
43+
"Adapt": "it for any purpose, even commercial."
44+
},
45+
"by-sa": {
46+
"description": "",
47+
"Adapt": "remix, transform, and build upon the \
48+
material for any purpose, even commercially."
49+
},
50+
"by-nd": {
51+
"description": "",
52+
"Adapt": false
53+
},
54+
"by-nc": {
55+
"description": "",
56+
"Adapt": "remix, transform, and build upon the material, \
57+
but not for commercial purposes."
58+
},
59+
"by-nc-sa": {
60+
"description": "",
61+
"Adapt": "remix, transform, and build upon the material, \
62+
but not for commercial purposes."
63+
},
64+
"by-nc-nd": {
65+
"description": "",
66+
"Adapt": false
67+
}
3068
}
3169
}
3270
}

src/scripts/choose-a-license.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
function set_license() {
22
set_license_text()
3-
set_license_icons()
3+
//set_license_icons()
4+
set_license_description()
5+
set_license_shareallowance()
46
}
57

68
function set_license_text() {
@@ -18,6 +20,21 @@ function set_license_text() {
1820
set_license_link()
1921
}
2022

23+
function set_license_description() {
24+
const description = app_state.chooser.license_packs[app_state.chooser.selected_license_slugified]["description"]
25+
app_state.chooser.selected_license_description = description
26+
}
27+
28+
function set_license_shareallowance() {
29+
const adapt = app_state.chooser.license_packs[app_state.chooser.selected_license_slugified]["Adapt"]
30+
if (!adapt) {
31+
document.getElementById("selected-license-permissions-adapt").style.display = "none"
32+
} else {
33+
app_state.chooser.selected_license_share_allowance = adapt
34+
document.getElementById("selected-license-permissions-adapt").style.display = "block"
35+
}
36+
}
37+
2138
function set_license_icons() {
2239
var state = app_state.chooser
2340
if (state.inputs.allow_adaptations) {
@@ -86,6 +103,7 @@ function gen_shortened_name(url_version = false) {
86103

87104
function set_license_link() {
88105
const short_license = gen_shortened_name(true)
106+
app_state.chooser.selected_license_slugified = short_license
89107
var url = "https://creativecommons.org/licenses/{0}/4.0".format(short_license)
90108
app_state.chooser.selected_license_link = url
91109
}

src/styles/sass/bulma-mods.scss

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ $default: $cc-orange;
1111

1212
// Import only what you need from Bulma
1313
@import "../../../node_modules/bulma/sass/utilities/_all.sass";
14+
@import "../../../node_modules/bulma/sass/elements/_all.sass";
1415
@import "../../../node_modules/bulma/sass/base/_all.sass";
15-
@import "../../../node_modules/bulma/sass/elements/button.sass";
16-
@import "../../../node_modules/bulma/sass/elements/container.sass";
17-
@import "../../../node_modules/bulma/sass/elements/title.sass";
1816
@import "../../../node_modules/bulma/sass/form/_all.sass";
19-
@import "../../../node_modules/bulma/sass/components/navbar.sass";
20-
@import "../../../node_modules/bulma/sass/layout/hero.sass";
21-
@import "../../../node_modules/bulma/sass/layout/section.sass";
22-
@import "../../../node_modules/bulma/sass/grid/all.sass";
23-
@import "../../../node_modules/bulma/sass/components/modal.sass";
17+
@import "../../../node_modules/bulma/sass/layout/_all.sass";
18+
@import "../../../node_modules/bulma/sass/grid/_all.sass";
19+
@import "../../../node_modules/bulma/sass/components/_all.sass";
2420
@import "../../../node_modules/bulma-switch/dist/css/bulma-switch.sass";
2521
@import "../../../node_modules/cool-checkboxes-for-bulma.io/dist/css/bulma-radio-checkbox.css";
2622
@import "../../../node_modules/@creativebulma/bulma-collapsible/dist/css/bulma-collapsible.min.css";

src/styles/styles.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ h3 {
5555
text-align: center;
5656
}
5757

58+
.selected-license-name {
59+
font-weight: bold;
60+
font-size: 1.2rem;
61+
}
62+
63+
.selected-license-card-title {
64+
padding-top: 2%;
65+
}
66+
5867
.generated-icons img {
5968
vertical-align: middle;
6069
width: 25px;

0 commit comments

Comments
 (0)