# HG changeset patch # User ymh # Date 1479132135 -3600 # Node ID 0046797e04114385dd0704b9d8fb65789f1f6b37 # Parent 5c6c526a7fc1466bb671ca29939c3d8cdc29ba76 add share buttons diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/components/playlist-component.js --- a/cms/app-client/app/components/playlist-component.js Sat Nov 12 17:21:25 2016 +0100 +++ b/cms/app-client/app/components/playlist-component.js Mon Nov 14 15:02:15 2016 +0100 @@ -1,4 +1,6 @@ import Ember from 'ember'; +import ENV from '../config/environment'; +import SocialShareKit from 'socialsharekit'; export default Ember.Component.extend({ @@ -9,6 +11,8 @@ isLoading: false, + rootURL: ENV.rootURL, + model: [], documents: Ember.computed('model', 'filter.location', 'filter.language', 'filter.discourse', 'filter.date', 'filter.theme', function() { return this.get('model'); @@ -79,8 +83,32 @@ } else { this.get('player').displayMetadata(false); } + }, + + 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) + Ember.$("#corpus-app").click(); + }); + return true; + }, + + shareLinkShow: (elemId) => { + let input = Ember.$("#"+elemId+" input"); + input.get(0).setSelectionRange(0, input.val().length); + input.get(0).select(0, input.val().length); + return true; + }, + + shareLinkClose: function() { + console.log("CLOSE"); + //console.log("CLOSE", popover); + // popover.hide(); + // return false; } - } }); diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/controllers/application.js --- a/cms/app-client/app/controllers/application.js Sat Nov 12 17:21:25 2016 +0100 +++ b/cms/app-client/app/controllers/application.js Mon Nov 14 15:02:15 2016 +0100 @@ -8,6 +8,7 @@ constants: Ember.inject.service(), isLoading: false, + currentUrl: '', page: 1, limit: Ember.computed(function() { @@ -76,6 +77,12 @@ } }), + targetUrlChanged: Ember.observer('target.url', function() { + Ember.run.next(this, function() { + this.set('currentUrl', window.location.href); + }); + }), + init: function() { this._super(...arguments); this.get('player'); diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/helpers/url-encode.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/helpers/url-encode.js Mon Nov 14 15:02:15 2016 +0100 @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export function urlEncode(params) { + return encodeURIComponent(params[0]); +} + +export default Ember.Helper.helper(urlEncode); diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/styles/components/playlist-component.scss --- a/cms/app-client/app/styles/components/playlist-component.scss Sat Nov 12 17:21:25 2016 +0100 +++ b/cms/app-client/app/styles/components/playlist-component.scss Mon Nov 14 15:02:15 2016 +0100 @@ -240,7 +240,26 @@ margin-left: 1em; } -.playlist-component .playlist-share-button { - visibility: hidden; +.playlist-share-button-close { + cursor: pointer; + text-align: right; + margin-top: 10px; +} + +.playlist-share-button-link { + width: 100%; } +.playlist-share-button-list { + margin-top: 5px; +} + +.playlist-share-button-popover { + background-color: #2f3337; + color: $corpus-white; +} + +.playlist-share-button-popover p { + margin-top: 10px; + margin-bottom: 10px; +} diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/templates/application.hbs --- a/cms/app-client/app/templates/application.hbs Sat Nov 12 17:21:25 2016 +0100 +++ b/cms/app-client/app/templates/application.hbs Mon Nov 14 15:02:15 2016 +0100 @@ -19,7 +19,7 @@
{{ filter-component }} - {{ playlist-component model=model page=page limit=limit pageAction='setPageQueryparams' isLoading=isLoading }} + {{ playlist-component model=model page=page limit=limit pageAction='setPageQueryparams' isLoading=isLoading currentUrl=currentUrl }}
\ No newline at end of file diff -r 5c6c526a7fc1 -r 0046797e0411 cms/app-client/app/templates/components/playlist-component.hbs --- a/cms/app-client/app/templates/components/playlist-component.hbs Sat Nov 12 17:21:25 2016 +0100 +++ b/cms/app-client/app/templates/components/playlist-component.hbs Mon Nov 14 15:02:15 2016 +0100 @@ -7,7 +7,7 @@