Feature #5953 » fixed-5953-v2.patch
| app/views/my/_sidebar.html.erb | ||
|---|---|---|
|
<% if Setting.rest_api_enabled? %>
|
||
|
<h4><%= l(:label_api_access_key) %></h4>
|
||
|
<div>
|
||
|
<%= link_to l(:button_show), my_api_key_path, :remote => true %>
|
||
|
<pre id='api-access-key' class='autoscroll'></pre>
|
||
|
<%= link_to l(:button_show), my_api_key_path, :remote => true, :id => 'toggle-api-access-key' %>
|
||
|
<%= link_to_function l(:button_copy), "copyTextToClipboard(getElementById('api-access-key'))",
|
||
|
:id => 'copy-api-access-key',
|
||
|
:class => ['icon', 'icon-copy'],
|
||
|
:style => 'display:none;' %>
|
||
|
<pre id='api-access-key' class='autoscroll' style="display:none;"></pre>
|
||
|
</div>
|
||
|
<%= javascript_tag("$('#api-access-key').hide();") %>
|
||
|
<p>
|
||
|
<% if @user.api_token %>
|
||
|
<%= 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 | ||
|---|---|---|
|
$('#api-access-key').html('<%= escape_javascript @user.api_key %>').toggle();
|
||
|
var api_access_key = '<%= escape_javascript @user.api_key %>';
|
||
|
$('#api-access-key').html(api_access_key);
|
||
|
$('#api-access-key').attr('data-clipboard-text', api_access_key);
|
||
|
$('#api-access-key, #copy-api-access-key').toggle();
|
||
|
var label_show = '<%= escape_javascript l(:button_show) %>';
|
||
|
if($('#toggle-api-access-key').text() == label_show){
|
||
|
$('#toggle-api-access-key').text('<%= escape_javascript l(:button_hide) %>');
|
||
|
}
|
||
|
else{
|
||
|
$('#toggle-api-access-key').text(label_show);
|
||
|
}
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
#sidebar a.icon-only:hover {opacity: 1;}
|
||
|
#sidebar span.icon-warning {margin-left: 5px;}
|
||
|
#sidebar li input[type=checkbox] {height: 20px;}
|
||
|
#sidebar #copy-api-access-key {float:right;}
|
||
|
#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 10px 16px 10px 16px; overflow-x: auto;}
|
||
|
html>body #content { min-height: 600px; }
|
||