# HG changeset patch # User ymh # Date 1479835987 -3600 # Node ID 65e357e5eecb02b7fec260cc581064e767d3982e # Parent 44569a7f8db017dc08c5f9f4942603b8e0861912 correct document permalinks in notice and share buttons diff -r 44569a7f8db0 -r 65e357e5eecb cms/app-client/app/components/playlist-component.js --- a/cms/app-client/app/components/playlist-component.js Tue Nov 22 16:55:56 2016 +0100 +++ b/cms/app-client/app/components/playlist-component.js Tue Nov 22 18:33:07 2016 +0100 @@ -86,8 +86,6 @@ }, shareLinkRender: (elemId) => { - //Ember.$("#"+elemId+" .playlist-share-button").click(function(e) { e.preventDefault(); return false;}); - //console.log("RENDER"); SocialShareKit.init({selector: "#"+elemId+" .ssk"}); Ember.$("#"+elemId+" .playlist-share-button-close").click(function() { // This is done like this because I was not able to register an action directly on the button like shgown on ember-tooltips documentaion (https://github.com/sir-dunxalot/ember-tooltips#popover-on-element) @@ -103,12 +101,6 @@ return true; }, - shareLinkClose: function() { - console.log("CLOSE"); - //console.log("CLOSE", popover); - // popover.hide(); - // return false; - } } }); diff -r 44569a7f8db0 -r 65e357e5eecb cms/app-client/app/helpers/abs-url-for.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/helpers/abs-url-for.js Tue Nov 22 18:33:07 2016 +0100 @@ -0,0 +1,20 @@ +// inspired by http://stackoverflow.com/a/36368522 + +import Ember from 'ember'; +import ENV from '../config/environment'; + +export default Ember.Helper.extend({ + router: Ember.computed(function() { + return Ember.getOwner(this).lookup('router:main'); + }), + + compute([routeName, ...routeParams]) { + let router = this.get('router'); + let rootUrl = ENV.rootURL; + + var resUrl = Ember.isEmpty(routeParams) ? + router.generate(routeName) : router.generate(routeName, routeParams[0]); + var location = window.location; + return location.protocol + "//" + location.host + rootUrl + resUrl; + } +}); diff -r 44569a7f8db0 -r 65e357e5eecb cms/app-client/app/templates/components/notice-component.hbs --- a/cms/app-client/app/templates/components/notice-component.hbs Tue Nov 22 16:55:56 2016 +0100 +++ b/cms/app-client/app/templates/components/notice-component.hbs Tue Nov 22 18:33:07 2016 +0100 @@ -1,61 +1,54 @@

{{ item.title }}

-
{{#link-to "document" item.id (query-params) class="notice-permalink" target="blank"}}permalien{{/link-to}}
+
permalien
- - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Editeur{{#if (if-operator item.publishers.length '>' 1)}}s{{/if}} -
    - {{#each item.publishers as |publisher|}} -
  • {{ publisher }}
  • - {{/each}} -
-
Langue{{#each item.languages as |lang index|}}{{if index ", "}}{{ doc-language url=lang class="language"}}Share{{/each}}
Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}} -
    - {{#each subjects as |subject|}} -
  • - {{#if subject.url}} - {{#if subject.name}} - {{subject.name}} - {{else}} - {{component (getLinkType subject.url) url=subject.url}} - {{/if}} - Share - {{else}} - {{subject.name}} - {{/if}} -
  • - {{/each}} -
-
Enregistré en{{ short-date item.issued }}
Participant{{#if (if-operator participants.length '>' 1)}}s{{/if}} -
    - {{#each participants as |participant|}} -
  • {{ participant.name }} ({{ participant.role }})
  • - {{/each}} -
-
Lieu{{ location }}
Durée{{to-minutes item.duration}}
Editeur{{#if (if-operator item.publishers.length '>' 1)}}s{{/if}} +
    + {{#each item.publishers as |publisher|}} +
  • {{ publisher }}
  • + {{/each}} +
+
Langue{{#each item.languages as |lang index|}}{{if index ", "}}{{ doc-language url=lang class="language"}}Share{{/each}}
Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}} +
    + {{#each subjects as |subject|}} +
  • + {{#if subject.url}} {{#if subject.name}} {{subject.name}} {{else}} + {{component (getLinkType subject.url) url=subject.url}} {{/if}} + Share {{else}} {{subject.name}} {{/if}} +
  • + {{/each}} +
+
Enregistré en{{ short-date item.issued }}
Participant{{#if (if-operator participants.length '>' 1)}}s{{/if}} +
    + {{#each participants as |participant|}} +
  • {{ participant.name }} ({{ participant.role }})
  • + {{/each}} +
+
Lieu{{ location }}
Durée{{to-minutes item.duration}}
\ No newline at end of file diff -r 44569a7f8db0 -r 65e357e5eecb cms/app-client/app/templates/components/playlist-component.hbs --- a/cms/app-client/app/templates/components/playlist-component.hbs Tue Nov 22 16:55:56 2016 +0100 +++ b/cms/app-client/app/templates/components/playlist-component.hbs Tue Nov 22 18:33:07 2016 +0100 @@ -36,9 +36,9 @@ as |popover| }}

Partager un lien vers cette notice

- {{input id=(concat "popup-playlist-share-button-text-" index) value=(concat currentUrl "#/doc/" (url-encode document.id)) readonly='readonly' class='playlist-share-button-link'}} + {{input id=(concat "popup-playlist-share-button-text-" index) value=(abs-url-for "document" document.id) readonly='readonly' class='playlist-share-button-link'}}
-
+