Project

General

Profile

Feature #5953 » fixed-5953.patch

Yuichi HARADA, 2019-07-17 10:47

View differences:

app/views/my/_sidebar.html.erb
22 22
<h4><%= l(:label_api_access_key) %></h4>
23 23
<div>
24 24
  <%= link_to l(:button_show), my_api_key_path, :remote => true %>
25
  <%= link_to_function l(:button_copy), "copyTextToClipboard('api-access-key')", :id => 'copy-api-access-key', :class => ['icon', 'icon-copy'] %>
25 26
  <pre id='api-access-key' class='autoscroll'></pre>
26 27
</div>
27
<%= javascript_tag("$('#api-access-key').hide();") %>
28
<%= javascript_tag("$('#api-access-key, #copy-api-access-key').hide();") %>
28 29
<p>
29 30
<% if @user.api_token %>
30 31
<%= l(:label_api_access_key_created_on, distance_of_time_in_words(Time.now, @user.api_token.created_on)) %>
app/views/my/show_api_key.js.erb
1 1
$('#api-access-key').html('<%= escape_javascript @user.api_key %>').toggle();
2
$('#copy-api-access-key').toggle();
public/javascripts/application.js
570 570
  return key;
571 571
}
572 572

  
573
function copyTextToClipboard(id) {
574
  var target = document.getElementById(id);
575
  if (target) {
576
    var temp = document.createElement('textarea');
577
    temp.value = target.innerText;
578
    document.body.appendChild(temp);
579
    temp.select();
580
    document.execCommand('copy');
581
    if (temp.parentNode) {
582
      temp.parentNode.removeChild(temp);
583
    }
584
  }
585
  return false;
586
}
587

  
573 588
function updateIssueFrom(url, el) {
574 589
  $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
575 590
    $(this).data('valuebeforeupdate', $(this).val());
public/stylesheets/application.css
91 91
#sidebar ul li, ul.flat li {list-style-type:none;margin: 0px 2px 0px 0px; padding: 0px 0px 0px 0px;}
92 92
#sidebar div.wiki ul {margin:inherit; padding-left:40px;}
93 93
#sidebar div.wiki ul li {list-style-type:inherit;}
94
#sidebar #copy-api-access-key {float:right;}
94 95

  
95 96
#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; overflow-x: auto;}
96 97
html>body #content { min-height: 600px; }
(2-2/3)