Skip to content

Commit 97292f7

Browse files
committed
fixing all view
1 parent a15ce91 commit 97292f7

File tree

3 files changed

+33
-51
lines changed

3 files changed

+33
-51
lines changed

app/views/keys/all.html.erb

+22-38
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<% html_title(t('label_module')) %>
2+
13
<% content_for :header_tags do %>
24
<%= stylesheet_link_tag "font-awesome.css", :plugin => "vault" %>
35
<%= stylesheet_link_tag "font-awesome.min.css", :plugin => "vault" %>
@@ -12,63 +14,43 @@
1214
<%= t('key.title.list') %>
1315
<%= form_tag({ controller: :keys, action: :all }, method: 'get', class: 'keys-search-form') do %>
1416
<%= text_field_tag(:query, @query, class: 'autocomplete') %>
15-
<%= select_tag "project_id", options_from_collection_for_select(@projects, 'id', 'name', params[:project_id]), :prompt => "Please select" %>
17+
1618
<%= submit_tag(t('key.btn.find')) %>
1719
<% end %>
1820
<%= button_to(t('button_clear'), {query: ''}, method: 'get') %>
1921
</h2>
2022

21-
<%= form_tag({}, :data => {:cm_url => keys_all_path}) do %>
23+
<%= form_tag({}, :data => {:cm_url => @project }) do %>
2224
<table class='list' id='keys_table'>
2325
<thead>
2426
<tr>
25-
<th><%= t('field_project') %></th>
26-
<th><%= t('key.attr.name') %></th>
27+
<th class="checkbox hide-when-print">
28+
<%= check_box_tag 'check_all', '', false, :class => 'toggle-selection',
29+
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
30+
</th>
31+
<th><%= t('key.attr.type') %></th>
32+
<%= sort_header_tag('name', caption: t('key.attr.name')) %>
2733
<th><%= t('key.attr.url') %></th>
2834
<th><%= t('key.attr.login') %></th>
2935
<th><%= t('key.attr.body') %> </th>
36+
<th><%= t('key.btn.actions') %></th>
3037
</tr>
3138
</thead>
3239
<tbody>
3340
<% @keys.each do |key| %>
34-
<% parity = cycle('odd', 'even') %>
35-
<tr class='hascontextmenu key <%= defined?(parity) ? parity : '' %>'>
36-
<td><%= key.project.name %></td>
37-
<td><%= key.name %></td>
38-
<td>
39-
<% unless key.url.blank? %>
40-
<% if /:\/\//.match(key.url) %>
41-
<%= link_to "#{key.url}", key.url, id: "url_#{key.id}" %>
42-
<% else %>
43-
<a align="left" class='keys-links' data-clipboard-target='url_<%=key.id%>' id='d_clip_url_<%=key.id%>'>
44-
<%= label_tag key.url, key.url, id: "url_#{key.id}" %>
45-
</a>
46-
<% end %>
47-
<% end %>
48-
</td>
49-
<td>
50-
<% unless key.login.blank? %>
51-
<a align="left" class='keys-links' data-clipboard-target='login_<%=key.id%>' id='d_clip_login_<%=key.id%>'>
52-
<label id="login_<%=key.id%>"><%= key.login %></label>
53-
</a>
54-
<% end %>
55-
</td>
56-
<td class='key-password-column'>
57-
<% unless key.body.blank? %>
58-
<label>*********</label>
59-
<label id='plain_pass_<%=key.id%>' style='display:none;'><%= key.body.force_encoding('UTF-8') %></label>
60-
<a align="left" class='keys-actions copy-key' data-clipboard-target='plain_pass_<%=key.id%>' title='<%=t('key.btn.clipboard')%>'>
61-
<i class="fa fa-clipboard fa-fw"></i>
62-
</a>
63-
<% end %>
64-
</td>
65-
</tr>
41+
<%= render partial: key, locals: {parity: cycle('odd', 'even')} %>
6642
<% end %>
6743
</tbody>
6844
</table>
6945
<% end %>
7046

71-
<span class='pagination'><%= pagination_links_full @key_pages, @key_count %></span>
47+
<span class='pagination'>
48+
<%= pagination_links_full @key_pages, @key_count %>
49+
</span>
50+
51+
<% other_formats_links do |f| %>
52+
<%= f.link_to_with_query_parameters t('export.title.pdf') if User.current.allowed_to?(:view_keys, @project) if User.current.allowed_to?(:export_keys, @project)%>
53+
<% end %>
7254

7355
<% content_for :sidebar do %>
7456
<h3><%= t('tag.title.popular') %></h3>
@@ -83,7 +65,9 @@
8365
</div>
8466
<% end %>
8567

68+
<%= context_menu %>
69+
8670
<script type="text/javascript">
8771
$('a[href^="http://"]').attr('target','_blank');
8872
$('a[href^="https://"]').attr('target','_blank');
89-
</script>
73+
</script>
+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<% if User.current.allowed_to?(:edit_keys, @project) %>
2-
<%= link_to edit_project_key_path(@project,key), class: 'keys-actions' do %>
1+
<% if User.current.allowed_to?(:edit_keys, key.project) %>
2+
<%= link_to edit_project_key_path(key.project,key), class: 'keys-actions' do %>
33
<i class='fa fa-pencil fa-fw'></i>
44
<% end %>
55
<% else %>
6-
<%= link_to edit_project_key_path(@project,key), class: 'keys-actions' do %>
6+
<%= link_to edit_project_key_path(key.project,key), class: 'keys-actions' do %>
77
<i class='fa fa-eye fa-fw'></i>
88
<% end %>
99
<% end %>
1010

11-
<%= link_to project_copy_key_path(@project,key), class: 'keys-actions' do %>
11+
<%= link_to project_copy_key_path(key.project,key), class: 'keys-actions' do %>
1212
<i class='fa fa-files-o fa-fw'></i>
13-
<% end if User.current.allowed_to?(:edit_keys, @project) %>
13+
<% end if User.current.allowed_to?(:edit_keys, key.project) %>
1414

15-
<%= link_to project_key_path(@project,key), class: 'keys-actions', data: {confirm: t('confirm.key.delete')}, method: :delete do %>
15+
<%= link_to project_key_path(key.project,key), class: 'keys-actions', data: {confirm: t('confirm.key.delete')}, method: :delete do %>
1616
<i class='fa fa-trash fa-fw'></i>
17-
<% end if User.current.allowed_to?(:edit_keys, @project) %>
17+
<% end if User.current.allowed_to?(:edit_keys, key.project) %>

app/views/shared/_key_fields.html.erb

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<td>
22
<label id="type_<%=key.id%>" class='keys-links'>
33
<% if key.type == 'Vault::Password' %>
4-
<%= link_to project_key_path(@project, key), class: 'keys-links' do %>
4+
<%= link_to project_key_path(key.project, key), class: 'keys-links' do %>
55
<%= t('activerecord.models.password') %>
66
<% end %>
77
<% elsif key.type == 'Vault::Sftp' %>
8-
<%= link_to project_key_path(@project, key), class: 'keys-links' do %>
8+
<%= link_to project_key_path(key.project, key), class: 'keys-links' do %>
99
<%= t('activerecord.models.sftp') %>
1010
<% end %>
1111
<% elsif key.type == 'Vault::KeyFile' %>
12-
<%= link_to project_key_path(@project, key), class: 'keys-links' do %>
12+
<%= link_to project_key_path(key.project, key), class: 'keys-links' do %>
1313
<%= t('activerecord.models.key_file') %>
1414
<% end %>
1515
<% else %>
@@ -18,9 +18,7 @@
1818
</label>
1919
</td>
2020
<td>
21-
<% if @project.present? %>
22-
<%= link_to key.name, edit_project_key_path(@project, key), class: 'keys-links' %>
23-
<% end %>
21+
<%= link_to key.name, edit_project_key_path(key.project, key), class: 'keys-links' %>
2422
</td>
2523
<td>
2624
<% unless key.url.blank? %>

0 commit comments

Comments
 (0)