copy url tooltip

This commit is contained in:
Zachary Chai 2016-11-17 12:17:58 -05:00
parent 459740cb36
commit fd044fc75d
4 changed files with 63 additions and 11 deletions

View File

@ -15,7 +15,7 @@
var init = function() { var init = function() {
Meeting.clear(); Meeting.clear();
// setup click handlers // setup event handlers
$('.center-panel-wrapper').on ('click', '.meeting-join', function (event) { $('.center-panel-wrapper').on ('click', '.meeting-join', function (event) {
var name = $('.meeting-user-name').val(); var name = $('.meeting-user-name').val();
Meeting.getInstance().setName(name); Meeting.getInstance().setName(name);
@ -54,11 +54,49 @@
$('.center-panel-wrapper').on ('click', '.meeting-url-copy', function (event) { $('.center-panel-wrapper').on ('click', '.meeting-url-copy', function (event) {
meetingURLInput = $('.meeting-url'); meetingURLInput = $('.meeting-url');
// copy URL
meetingURLInput.select(); meetingURLInput.select();
document.execCommand("copy"); try {
meetingURLInput.blur(); var success = document.execCommand("copy");
if (success) {
meetingURLInput.blur();
$(this).trigger('hint', [$(this).data('copied-hint')]);
} else {
$(this).trigger('hint', [$(this).data('copy-error')]);
}
} catch (err) {
$(this).trigger('hint', [$(this).data('copy-error')]);
}
}); });
$('.center-panel-wrapper').on('hint', '.meeting-url-copy', function (event, msg) {
$(this).focus();
$(this).attr('title', msg)
.tooltip('fixTitle')
.tooltip('show')
.attr('title', $(this).data('copy-hint'))
.tooltip('fixTitle');
});
$('.center-panel-wrapper').on('mouseleave', '.meeting-url-copy', function (event, msg) {
$(this).blur();
});
$('.center-panel-wrapper').on('focus', '.meeting-url', function (event, msg) {
$(this).select();
});
// only allow ctrl-c to work
$('.center-panel-wrapper').on('keydown', '.meeting-url', function (event, msg) {
if(!event.ctrlKey) {
event.preventDefault();
}
});
// enable tooltips
$('[data-toggle="tooltip"]').tooltip()
// enable popovers // enable popovers
var options = { var options = {
selector: '.has-popover', selector: '.has-popover',
@ -73,7 +111,7 @@
}; };
$('#recordings').popover(options); $('#recordings').popover(options);
// focus user // focus name input or join button
if ($('.meeting-user-name').is(':visible')) { if ($('.meeting-user-name').is(':visible')) {
$('.meeting-user-name').focus(); $('.meeting-user-name').focus();
} else { } else {

View File

@ -2,11 +2,20 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
.join-form { .center-panel-wrapper {
width: 100%; .join-form {
width: 100%;
}
.meeting-url-wrapper {
.meeting-url {
cursor: default;
}
}
} }
.rooms { .rooms {
.table-wrapper { .table-wrapper {
padding: 40px 50px 10px 50px; padding: 40px 50px 10px 50px;
@ -18,4 +27,5 @@
} }
} }
} }
} }

View File

@ -1,13 +1,15 @@
<div <%= "hidden" if hidden %> class="meeting-url-wrapper"> <div <%= "hidden" if hidden %> class="meeting-url-wrapper">
<div class="input-group"> <div class="input-group">
<input type="text" readonly="readonly" class="form-control meeting-url"/> <input type="text" class="form-control meeting-url"/>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" class="btn btn-default meeting-url-copy"> <button type="button" class="btn btn-default meeting-url-copy has-tooltip"
title="<%= t('url_copy_explanation') %>"
data-copied-hint="<%= t('copied') %>"
data-copy-error="<%= t('copy_error') %>"
data-copy-hint="<%= t('url_copy_explanation') %>"
>
<i class="fa fa-paperclip" aria-hidden="true"></i> <i class="fa fa-paperclip" aria-hidden="true"></i>
</button> </button>
</span> </span>
</div> </div>
<small>
<em><%= t('url_copy_explanation') %></em>
</small>
</div> </div>

View File

@ -29,6 +29,8 @@ en-US:
recording_deleted: Recording was deleted recording_deleted: Recording was deleted
recording_published: Recording was published recording_published: Recording was published
recording_unpublished: Recording was unpublished recording_unpublished: Recording was unpublished
copied: Copied
copy_error: Use Ctrl-c to copy
date_recorded: Date Recorded date_recorded: Date Recorded
duration: Duration duration: Duration
end: End end: End