Enh: Added Clipboard.js and Permalink "Copy to clipboard" link

This commit is contained in:
Lucas Bartholemy 2017-03-09 14:19:26 +01:00
parent 094405df2b
commit 20bc9e74dc
6 changed files with 70 additions and 31 deletions

View File

@ -45,7 +45,8 @@
"bower-asset/nprogress": "*",
"bower-asset/At.js": "^1.5.1",
"bower-asset/animate.css": "*",
"bower-asset/html5shiv": "^3.7"
"bower-asset/html5shiv": "^3.7",
"bower-asset/clipboard.js": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "~2.0.0",

View File

@ -92,6 +92,7 @@ class AppAsset extends AssetBundle
'humhub\assets\IE9FixesAsset',
'humhub\assets\IEFixesAsset',
'humhub\assets\PagedownConverterAsset',
'humhub\assets\ClipboardJsAsset',
];
/**

View File

@ -0,0 +1,36 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\assets;
use yii\web\AssetBundle;
/**
* Clipboard JS
*
* @author luke
*/
class ClipboardJsAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@bower/clipboard.js';
/**
* @inheritdoc
*/
public $js = ['clipboard.min.js'];
/**
* @inheritdoc
*/
public $css = [];
}

View File

@ -19,6 +19,7 @@ HumHub Change Log
- Fix: Show default error in status bar if invalid message object was provided
- Fix #2304: Users not loaded in user selection fields.
- Enh: Added User module 'displayNameCallback' attribute for custom display name formats
- Enh: Added Clipboard.js and Permalink "Copy to clipboard" link
1.2.0-beta.2 (February 24, 2017)
--------------------------------

View File

@ -135,7 +135,7 @@ humhub.module('content', function(module, require, $) {
};
var templates = {
permalinkBody : '<textarea rows="3" class="form-control permalink-txt" spellcheck="false" readonly>{permalink}</textarea><p class="help-block">{info}</p>',
permalinkBody: '<textarea rows="3" class="form-control permalink-txt" spellcheck="false" readonly>{permalink}</textarea><p class="help-block pull-right"><a href="#" onClick="clipboard.copy($(\'.permalink-txt\').text())"><i class="fa fa-clipboard" aria-hidden="true"></i> {info}</a></p>',
permalinkFooter: '<a href="#" data-modal-close class="btn btn-default">{buttonClose}</a><a href="{permalink}" class="btn btn-primary" data-ui-loader>{buttonOpen}</a>'
};

View File

@ -121,7 +121,7 @@ class CoreJsConfig extends Widget
'modal' => [
'permalink' => [
'head' => Yii::t('ContentModule.widgets_views_permaLink', '<strong>Permalink</strong> to this post'),
'info' => Yii::t('base', 'Copy to clipboard: Ctrl/Cmd+C'),
'info' => Yii::t('base', 'Copy to clipboard'),
'buttonOpen' => Yii::t('base', 'Open'),
'buttonClose' => Yii::t('base', 'Close'),
],