File tree Expand file tree Collapse file tree 4 files changed +12
-18
lines changed Expand file tree Collapse file tree 4 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 1818 {{$t(byString)}}
1919 </template >
2020 <template v-slot :licenseName >
21- <a v-if =" isWeb" :href =" licenseUrl" target =" _blank" rel =" license noopener noreferrer"
21+ <a v-if =" isWeb" :href =" licenseUrl('web') " target =" _blank" rel =" license noopener noreferrer"
2222 style =" display : inline-block ;" >{{shortName}}</a >
2323 <span v-else >{{shortName}}</span >
2424 <LicenseIcons
2828 </template >
2929 </i18n >
3030 <i18n path =" license-use.richtext.print-instructions" tag =" span" v-if =" !isWeb" >
31- <template v-slot :linkToLicenseDeed >{{licenseUrl}}</template >
31+ <template v-slot :linkToLicenseDeed >{{licenseUrl('print') }}</template >
3232 </i18n >
3333 </p >
3434</template >
Original file line number Diff line number Diff line change 22<div class =" selected-license-card" >
33 <h3 class =" vocab ha h3a" >{{$t('license-details-card.heading')}}</h3 >
44 <h4 class =" vocab h4b hb" >
5- <a :href =" licenseUrl" class =" license-name" >{{fullName}} ({{shortName}})
5+ <a :href =" licenseUrl('web') " class =" license-name" >{{fullName}} ({{shortName}})
66 <LicenseIcons
7- :url =" licenseUrl"
7+ :url =" licenseUrl('web') "
88 :iconsArr =" iconsList" />
99 </a >
1010 </h4 >
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ export default new Vuex.Store({
3030 fullName : state => {
3131 return attrToFull ( state . currentLicenseAttributes )
3232 } ,
33- licenseUrl : state => {
34- return licenseUrl ( state . currentLicenseAttributes )
33+ licenseUrl : state => ( mode ) => {
34+ return licenseUrl ( state . currentLicenseAttributes , mode )
3535 } ,
3636 iconsList : state => {
3737 return licenseIconsArr ( state . currentLicenseAttributes )
Original file line number Diff line number Diff line change @@ -63,23 +63,17 @@ function attrToFull(attr) {
6363 base += ' 4.0 International'
6464 return base
6565}
66- // function licenseUrl(shortLicenseName) {
67- // Returns url to license from short license name with version number (eg. 'CC BY 4.0')
68- // TODO: check how it works: it doesn't use '-' to join elements ?
69- // if (shortLicenseName.includes('CC0')) {
70- // return 'https://creativecommons.org/publicdomain/zero/1.0/?ref=ccchooser'
71- // }
72- // const short = shortLicenseName.toLowerCase().slice(3, shortLicenseName.length - 4)
73- // return 'https://creativecommons.org/licenses/' + short + '/4.0/?ref=ccchooser'
74- // }
75- function licenseUrl ( attr ) {
66+
67+ function licenseUrl ( attr , mode ) {
7668 // Returns url to license from short license name with version number (eg. 'CC BY 4.0')
69+ // mode: web/ print (?ref=ccchooser is added to the end of the link if mode is web)
70+ const linkRef = mode === 'web' ? '/?ref=ccchooser' : ''
7771 if ( attr . BY === false ) {
78- return ' https://creativecommons.org/publicdomain/zero/1.0/?ref=ccchooser'
72+ return ` https://creativecommons.org/publicdomain/zero/1.0${ linkRef } `
7973 }
8074 let short = attrToShort ( attr ) . toLowerCase ( ) . slice ( 3 )
8175 short = short . slice ( 0 , short . length - 4 )
82- return ' https://creativecommons.org/licenses/' + short + ' /4.0/?ref=ccchooser'
76+ return ` https://creativecommons.org/licenses/${ short } /4.0${ linkRef } `
8377}
8478
8579function licenseSlug ( shortLicenseName ) {
You can’t perform that action at this time.
0 commit comments