foreman_hosts 2.0.4.6 → 2.0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,6 @@ module ForemanHosts
4
4
  # change layout if needed
5
5
  #layout 'foreman_hosts/layouts/new_layout'
6
6
 
7
-
8
7
  def report_index
9
8
  @fact_values = FactValue.all
10
9
  @fact_names = FactName.all
@@ -1,30 +1,33 @@
1
1
  <div class="four wide right column">
2
2
  <button class='btn btn-info' type='button'><a href="javascript:void(0);" class="ui green button icon mini" id="btnExport" onclick="export_excel();">Export</a></button>
3
-
3
+
4
4
  </div>
5
5
  <%= javascript "jquery.cookie", "host_checkbox" %>
6
6
  <% title header ||= "" %>
7
+
7
8
  <table class="table table-bordered table-striped table-condensed" id="tblExport">
8
9
  <thead>
9
10
  <tr>
10
- <th class="ca"><%= check_box_tag "check_all", "", false, { :onclick => "toggleCheck()", :'check-title' => _("Select all items in this page"), :'uncheck-title'=> _("items selected. Uncheck to Clear") } %></th>
11
11
  <th class=''><%= sort :name, :as => _('Name') %></th>
12
+ <% fact_name_no1 = 1 %>
12
13
  <% @fact_names.each do |fact_name| %>
13
- <th><%= fact_name.name %></th>
14
- <% end %>
15
14
 
15
+ <th id="td<%= fact_name_no1 %>"><%= fact_name.name %>
16
+ <br />
17
+ <button type='button'><a href="javascript:void(0);" onclick="DeleteSignColumn(<%= fact_name_no1 %>);"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></button></th>
18
+ <% fact_name_no1 += 1 %>
19
+ <% end %>
16
20
  </tr>
17
21
  </thead>
18
22
  <tbody>
19
23
  <% @hosts.each do |host| %>
20
24
  <tr>
21
- <td class="ca">
22
- <%= check_box_tag "host_ids[]", nil, false, :id => "host_ids_#{host.id}", :disabled => !authorized?, :class => 'host_select_boxes', :onclick => 'hostChecked(this)' %>
23
- </td>
24
25
  <td class='ellipsis'><%= name_column(host) %></td>
25
- <% @fact_names.each do |fact_name| %>
26
+
27
+ <% @fact_names.each do |fact_name| %>
26
28
  <td><%= get_fact_value(host, fact_name) %> </td>
27
- <% end %>
29
+ <% end %>
30
+
28
31
  </tr>
29
32
  <% end %>
30
33
  </tbody>
@@ -42,6 +45,28 @@
42
45
  datatype: 'table',
43
46
  returnUri: true
44
47
  });
45
- $("#btnExport").attr('download', '项目工时.xlsx').attr('href', uri).attr('target', '_blank');
48
+ $("#btnExport").attr('download', 'hosts.xlsx').attr('href', uri).attr('target', '_blank');
46
49
  }
50
+
51
+ function DeleteSignColumn(tid) {
52
+ var tab = document.getElementById("tblExport");
53
+ var columnLength = tab.rows[0].cells.length;
54
+ var tr1 = tab.rows[0];
55
+ var columnId = 0;
56
+ tid= "td" + tid
57
+ for(var j=0;j<tr1.cells.length;j++)//取得第几行下面的td个数,再次循环遍历该行下面的td元素
58
+ {
59
+ var cell = tr1.cells[j];//获取某行下面的某个td元素
60
+ if (cell.id == tid) {
61
+ columnId = columnId + j;
62
+ }
63
+ }
64
+ //删除指定单元格
65
+ if (columnId > 0){
66
+ for (var i = 0; i < tab.rows.length; i++) {
67
+ tab.rows[i].deleteCell(columnId);
68
+ }
69
+ }
70
+
71
+ }
47
72
  </script>
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- match 'new_action', to: 'foreman_hosts/hosts#new_action'
3
- match 'export', to: 'foreman_hosts/hosts#export'
2
+ # match 'new_action', to: 'foreman_hosts/hosts#new_action'
3
+ # match 'export', to: 'foreman_hosts/hosts#export'
4
4
  match 'report_index', to: 'foreman_hosts/hosts#report_index'
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanHosts
2
- VERSION = '2.0.4.6'
2
+ VERSION = '2.0.4.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_hosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4.6
4
+ version: 2.0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,7 +56,6 @@ files:
56
56
  - app/views/foreman_hosts/hosts/export.xlsx.axlsx
57
57
  - app/views/foreman_hosts/hosts/report_index.html.erb
58
58
  - app/views/foreman_hosts/hosts/hosts/new_action.html.erb
59
- - app/views/foreman_hosts/hosts/new_action.html.erb
60
59
  - app/overrides/dashboard/index/sample_override.html.erb.deface
61
60
  - app/controllers/foreman_hosts/hosts_controller.rb
62
61
  - app/helpers/concerns/foreman_hosts/hosts_helper_extensions.rb
@@ -1 +0,0 @@
1
- Welcome to <b>ForemanHosts</b>