# HG changeset patch # User ymh # Date 1486563924 -3600 # Node ID 74fba571487e428df6061b813ddc698c41dccc3e # Parent 7b2dcd2b31c1860c6f6c603d98fd0f24f84883f2 Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746 diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/components/doc-rights.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/components/doc-rights.js Wed Feb 08 15:25:24 2017 +0100 @@ -0,0 +1,37 @@ +import Ember from 'ember'; + +const CC_LICENCE_URL_REGEXP = /http:\/\/creativecommons\.org\/licenses\/([byndsac-]+)\/([\d\.]+)\//; +const CC_LICENCE_TEXT = { + 'by': 'Attribution', + 'by-nd': 'Attribution - Pas de Modification', + 'by-sa': 'Attribution - Partage dans les Mêmes Conditions', + 'by-nc': 'Attribution - Pas d’Utilisation Commerciale', + 'by-nc-nd': 'Attribution - Pas d\'Utilisation Commerciale - Pas de Modification', + 'by-nc-sa': 'Attribution - Pas d\'Utilisation Commerciale - Partage dans les Mêmes Conditions' +}; + +export default Ember.Component.extend({ + tagName: 'span', + code: Ember.computed('matches', function() { + return this.get('matches')[1]; + }), + version: Ember.computed('matches', function() { + return this.get('matches')[2]; + }), + matches: Ember.computed('url', function() { + const url = this.get('url'); + if(!url) { + return [url,'by', '4.0']; + } + let m = url.match(CC_LICENCE_URL_REGEXP); + if(m === null || m.length !== 3) { + return [url,'by', '4.0']; + } + return m; + }), + text: Ember.computed('code', function() { + const code = this.get('code'); + return CC_LICENCE_TEXT[code]; + }) + +}); diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/components/notice-component.js --- a/cms/app-client/app/components/notice-component.js Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/components/notice-component.js Wed Feb 08 15:25:24 2017 +0100 @@ -4,6 +4,7 @@ player: Ember.inject.service(), filter: Ember.inject.service(), + constants: Ember.inject.service(), classNames: ['notice-component'], @@ -38,6 +39,11 @@ return location; }), + noticeCocoonPurlUrl: Ember.computed('item', function() { + const item = this.get('item'); + return this.get('constants').COCOON_PURL_BASE_URL + item.get('cocoonId'); + }), + actions: { addThemeFilter: function(id) { @@ -46,8 +52,11 @@ addLanguageFilter: function(id) { this.get('filter').setFilter('language', id); + }, + + addTypeFilter: function(id) { + this.get('filter').setFilter('theme', id); } - } }); diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/components/notice-location-component.js --- a/cms/app-client/app/components/notice-location-component.js Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/components/notice-location-component.js Wed Feb 08 15:25:24 2017 +0100 @@ -1,16 +1,22 @@ import Ember from 'ember'; import * as commonUtils from 'corpus-common-addon/utils/utils'; +import * as commonConstants from 'corpus-common-addon/utils/constants'; export default Ember.Component.extend({ classNames: ['notice-location-component'], + filter: Ember.inject.service(), + zoom: 6, tilesUrl: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + location: Ember.computed('geoInfo', function() { return [this.get('geoInfo.latitude'), this.get('geoInfo.longitude')]; }), + hasCoordinates: Ember.computed('geoInfo', function() { return Boolean(this.get('geoInfo.longitude')) && Boolean(this.get('geoInfo.latitude')); }), + geonamesLink: Ember.computed('geoInfo.ref-locs', function() { let link = null; this.get('geoInfo.ref-locs').forEach(l => { @@ -20,6 +26,13 @@ }); return link; }), - otherRefLinks: Ember.computed.filter('geoInfo.ref-locs', l => { return !commonUtils.isGeonamesLink(l); }) + + otherRefLinks: Ember.computed.filter('geoInfo.ref-locs', l => { return !commonUtils.isGeonamesLink(l); }), + + actions: { + addLocationFilter: function(id) { + this.get('filter').setFilter('location', commonConstants.GEONAMES_BASE_URL + id); + } + } }); diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/helpers/newlines-br.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/helpers/newlines-br.js Wed Feb 08 15:25:24 2017 +0100 @@ -0,0 +1,10 @@ +import Ember from 'ember'; + +export function newlinesBr(params) { + const param = params[0]; + let text = Ember.Handlebars.Utils.escapeExpression(param); + text = text.replace(/(\r\n|\n|\r)/gm, '
'); + return Ember.String.htmlSafe(text); +} + +export default Ember.Helper.helper(newlinesBr); diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/models/document.js --- a/cms/app-client/app/models/document.js Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/models/document.js Wed Feb 08 15:25:24 2017 +0100 @@ -5,10 +5,14 @@ export default DS.Model.extend({ constants: Ember.inject.service(), + cocoonId: DS.attr('string'), uri: DS.attr('string'), issued: DS.attr('date'), created: DS.attr('string'), title: DS.attr('string'), + rights: DS.attr('string'), + countryCode: DS.attr('string'), + alternativeTitle: DS.attr('string'), languages: DS.attr({ defaultValue: function() { return []; } }), publisher: DS.attr('string'), transcript_url: DS.attr('string'), @@ -19,6 +23,8 @@ geoInfo: DS.attr({ defaultValue: function() { return {}; } }), mediaArray: DS.attr({ defaultValue: function() { return []; } }), subjects: DS.attr({ defaultValue: function() { return []; } }), + types: DS.attr({ defaultValue: function() { return []; } }), + descriptions: DS.attr({ defaultValue: function() { return []; } }), duration_ms: DS.attr('number', { defaultValue: () => { diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/services/constants.js --- a/cms/app-client/app/services/constants.js Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/services/constants.js Wed Feb 08 15:25:24 2017 +0100 @@ -323,6 +323,8 @@ "video/mpeg": 15 }; +const COCOON_PURL_BASE_URL = 'http://purl.org/poi/crdo.vjf.cnrs.fr/'; + export default Ember.Service.extend({ OLAC_ROLES: OLAC_ROLES, DISCOURSE_CATEGORY_KEYS: DISCOURSE_CATEGORY_KEYS, @@ -334,5 +336,6 @@ LANGUAGES_TREEMAP: LANGUAGES_TREEMAP, DOCUMENTS_PAGINATION_PERPAGE : DOCUMENTS_PAGINATION_PERPAGE, AUTOSCROLL_RATE: AUTOSCROLL_RATE, - MEDIA_TYPE_WEIGHT: MEDIA_TYPE_WEIGHT + MEDIA_TYPE_WEIGHT: MEDIA_TYPE_WEIGHT, + COCOON_PURL_BASE_URL: COCOON_PURL_BASE_URL }); diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/styles/components/notice-component.scss --- a/cms/app-client/app/styles/components/notice-component.scss Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/styles/components/notice-component.scss Wed Feb 08 15:25:24 2017 +0100 @@ -59,7 +59,8 @@ .doc-link-bnf, .doc-link-lexvo, .doc-link-viaf, - .doc-link-geonames { + .doc-link-geonames, + .doc-link-dcmi { cursor: pointer; color: $corpus-black; text-decoration: none; @@ -92,6 +93,13 @@ padding: 0px; } +.notice-component h3 { + color: $corpus-blue; + margin-bottom: 12px; + font-size: 16px; + font-style: italic; +} + .notice-component.overlay h2, .notice-component.overlay h3 { color: $dark-grey; @@ -125,6 +133,34 @@ padding: 0; } -.notice-component .doc-link-lexvo { +.notice-component table tr td p { + margin: 0 0 6px 0; +} + +.notice-component { + + .doc-link-lexvo { text-transform: capitalize; + } + + // a.doc-link-dcmi { + // @extend .fa; + // } + + .doc-link-dcmi:after { + content: "\f045"; + font-family: FontAwesome; + font-style: normal; + font-weight: normal; + text-decoration: inherit; + + padding-right: 0.5em; + padding-left: 0.5em; + } + + .notice-links h5 { + display: inline-block; + } + } + diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/templates/components/doc-literal.hbs --- a/cms/app-client/app/templates/components/doc-literal.hbs Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/templates/components/doc-literal.hbs Wed Feb 08 15:25:24 2017 +0100 @@ -1,1 +1,1 @@ -{{#if value}}{{value}}{{/if}}{{#if datatype}} {{/if}} \ No newline at end of file +{{#if value}}{{newlines-br value}}{{/if}}{{#if datatype}} {{/if}} \ No newline at end of file diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/templates/components/doc-rights.hbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/templates/components/doc-rights.hbs Wed Feb 08 15:25:24 2017 +0100 @@ -0,0 +1,2 @@ +Licence Creative Commons
+Cette notice est mise à disposition selon les termes de la Licence Creative Commons {{ text }} {{ version }} International. diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/templates/components/notice-component.hbs --- a/cms/app-client/app/templates/components/notice-component.hbs Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/templates/components/notice-component.hbs Wed Feb 08 15:25:24 2017 +0100 @@ -1,5 +1,11 @@

{{ item.title }}

-
{{#if item.id }}permalien{{/if}}
+{{#if item.alternativeTitle }} +

{{ item.alternativeTitle }}

+{{/if}} + @@ -16,7 +22,7 @@ - + + + + + + + + + @@ -43,10 +69,14 @@ - + + + + +
Editeur{{#if (if-operator item.publishers.length '>' 1)}}s{{/if}}{{#each item.languages as |lang index|}}{{if index ", "}}{{ component (getLinkType lang) url=lang class="language" onClick=(action 'addLanguageFilter' lang) displayUrlLink=true}}{{/each}}
Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}}Sujet{{#if (if-operator item.subjects.length '>' 1)}}s{{/if}}
    {{#each item.subjects as |subject|}} @@ -28,6 +34,26 @@
Type{{#if (if-operator item.types.length '>' 1)}}s{{/if}} +
    + {{#each item.types as |type|}} +
  • + {{component (getLinkType type) url=type onClick=(action "addThemeFilter" type) displayUrlLink=true}} +
  • + {{/each}} +
+
Description + {{#each item.descriptions as |description|}} +

{{ doc-literal url=description }}

+ {{/each}} +
Enregistré en {{ doc-created value=item.created }}
Lieu{{ notice-location-component geoInfo=item.geoInfo }}{{ notice-location-component geoInfo=item.geoInfo countryCode=item.countryCode }}
Durée {{to-minutes item.duration}}
Droits{{ doc-rights url=item.rights }}
\ No newline at end of file diff -r 7b2dcd2b31c1 -r 74fba571487e cms/app-client/app/templates/components/notice-location-component.hbs --- a/cms/app-client/app/templates/components/notice-location-component.hbs Mon Feb 06 16:05:02 2017 +0100 +++ b/cms/app-client/app/templates/components/notice-location-component.hbs Wed Feb 08 15:25:24 2017 +0100 @@ -2,7 +2,7 @@ {{#if geoInfo.ref-locs }}