Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8830 - Allow two-pane to work on show #2048

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/two-pane.js
Expand Up @@ -7,7 +7,7 @@ $.fn.tab = function ( option ) {
}
}

$(document).on('click', ".table-two-pane td a[href$='edit']", function(e) {
$(document).on('click', ".table-two-pane td[class$='display-two-pane'] a", function(e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not ".table-two-pane .display-two-pane a"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftovers - at first it was called two-pane and other elements also had a class with the same name
I'll change it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use td.display-two-pane as well if you only want the tds with that class, [class$=...] lookups are much more expensive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a real pain, because this is an "on click" handler, therefore we are not filtering many elements. Just one or few per page.

if ($('.table-two-pane').length) {
e.preventDefault();
two_pane_open(this);
Expand Down
2 changes: 1 addition & 1 deletion app/views/architectures/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% for architecture in @architectures %>
<tr>
<td class='col-md-3'><%= link_to_if_authorized(trunc(architecture.name),
<td class='col-md-3 display-two-pane'><%= link_to_if_authorized(trunc(architecture.name),
hash_for_edit_architecture_path(:id => architecture).merge(:auth_object => architecture, :authorizer => authorizer)) %></td>
<td><%=h architecture.operatingsystems.map(&:to_label).to_sentence %></td>
<td><%= link_to architecture.hosts_count, hosts_path(:search => "architecture = #{architecture}") %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/auth_source_ldaps/index.html.erb
Expand Up @@ -17,7 +17,7 @@
<tbody>
<% for auth_source_ldap in @auth_source_ldaps %>
<tr>
<td><%=link_to_if_authorized trunc(auth_source_ldap.name), hash_for_edit_auth_source_ldap_path(:id => auth_source_ldap) %></td>
<td class="display-two-pane"><%=link_to_if_authorized trunc(auth_source_ldap.name), hash_for_edit_auth_source_ldap_path(:id => auth_source_ldap) %></td>
<td><%=h auth_source_ldap.host %></td>
<td><%=checked_icon auth_source_ldap.onthefly_register %></td>
<td><%=checked_icon auth_source_ldap.tls %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/bookmarks/index.html.erb
Expand Up @@ -14,7 +14,7 @@
<tbody>
<% for bookmark in @bookmarks %>
<tr>
<td><%= link_to_if_authorized(trunc(bookmark.name), hash_for_edit_bookmark_path(bookmark)) %></td>
<td class="display-two-pane"><%= link_to_if_authorized(trunc(bookmark.name), hash_for_edit_bookmark_path(bookmark)) %></td>
<td><%= bookmark.query %></td>
<td><%= bookmark.controller %></td>
<td><%= bookmark.public %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/common_parameters/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% for common_parameter in @common_parameters %>
<tr>
<td><%= link_to_if_authorized trunc(common_parameter), hash_for_edit_common_parameter_path(:id => common_parameter).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'edit_globals') %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(common_parameter), hash_for_edit_common_parameter_path(:id => common_parameter).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'edit_globals') %></td>
<td style='overflow-wrap: break-word;'><%= trunc(common_parameter.safe_value, 80) %></td>
<td class="ra">
<%= display_delete_if_authorized hash_for_common_parameter_path(:id => common_parameter).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'destroy_globals'),
Expand Down
2 changes: 1 addition & 1 deletion app/views/compute_profiles/show.html.erb
Expand Up @@ -24,7 +24,7 @@
new_compute_profile_compute_resource_compute_attribute_path(@compute_profile.to_param, compute_resource.to_param)
end %>
<tr>
<td><%= link_to(compute_resource.to_label, which_path, :class => compute_attribute.try(:id) ? '' : 'new_two_pane') %></td>
<td class="display-two-pane"><%= link_to(compute_resource.to_label, which_path, :class => compute_attribute.try(:id) ? '' : 'new_two_pane') %></td>
<td>
<% set = compute_resource.compute_attributes.where(:compute_profile_id => @compute_profile.id).first %>
<%= set ? set.name : content_tag(:span, _("unspecified"), :class => 'gray') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/config_groups/index.html.erb
Expand Up @@ -17,7 +17,7 @@
<tbody>
<% @config_groups.each do |config_group| %>
<tr>
<td><%= link_to_if_authorized trunc(config_group.name), hash_for_edit_config_group_path(config_group)%></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(config_group.name), hash_for_edit_config_group_path(config_group)%></td>
<td><%= link_to config_group.config_group_classes_count, puppetclasses_path(:search => %Q{config_group = "#{config_group}"}) %></td>
<td><%= link_to config_group.hosts_count, hosts_path(:search => %Q{config_group = "#{config_group}"}) %></td>
<td><%= link_to config_group.hostgroups_count, hostgroups_path(:search => %Q{config_group = "#{config_group}"}) %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/config_templates/index.html.erb
Expand Up @@ -22,7 +22,7 @@
<tbody>
<% for config_template in @config_templates %>
<tr>
<td>
<td class="display-two-pane">
<%= link_to_if_authorized trunc(config_template), hash_for_edit_config_template_path(:id => config_template.to_param).
merge(:auth_object => config_template, :authorizer => authorizer,
:permission => 'edit_templates') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/domains/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% for domain in @domains %>
<tr>
<td><%= link_to_if_authorized trunc(domain.fullname.empty? ? domain.name : domain.fullname), hash_for_edit_domain_path(:id => domain).merge(:auth_object => domain, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(domain.fullname.empty? ? domain.name : domain.fullname), hash_for_edit_domain_path(:id => domain).merge(:auth_object => domain, :authorizer => authorizer) %></td>
<td><%= link_to domain.hosts_count, hosts_path(:search => "domain = #{domain}") %>
<td><%= display_delete_if_authorized hash_for_domain_path(:id => domain).merge(:auth_object => domain, :authorizer => authorizer), :confirm => _("Delete %s?") % domain.name %></td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/environments/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% @environments.each do |environment| %>
<tr>
<td>
<td class="display-two-pane">
<%= link_to_if_authorized trunc(environment.name), hash_for_edit_environment_path(:id => environment).merge(:auth_object => environment, :authorizer => authorizer) %>
</td>
<td><%= link_to environment.hosts_count, hosts_path(:search => "environment = #{environment}") %></td>
Expand Down
4 changes: 2 additions & 2 deletions app/views/lookup_keys/index.html.erb
Expand Up @@ -12,9 +12,9 @@
<tbody>
<% @lookup_keys.each do |lookup_key| %>
<tr>
<td><%= link_to_if_authorized trunc(lookup_key.key), hash_for_edit_lookup_key_path(:id => lookup_key).merge(:auth_object => lookup_key, :permission => 'edit_external_variables', :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(lookup_key.key), hash_for_edit_lookup_key_path(:id => lookup_key).merge(:auth_object => lookup_key, :permission => 'edit_external_variables', :authorizer => authorizer) %></td>
<% puppet_class = lookup_key.param_class %>
<td><%= link_to_if_authorized trunc(puppet_class), hash_for_edit_puppetclass_path(:id => puppet_class).merge(:auth_object => puppet_class, :authorizer => @puppetclass_authorizer) if puppet_class %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(puppet_class), hash_for_edit_puppetclass_path(:id => puppet_class).merge(:auth_object => puppet_class, :authorizer => @puppetclass_authorizer) if puppet_class %></td>
<td><%=h lookup_key.lookup_values_count %></td>
<td><%= display_delete_if_authorized hash_for_lookup_key_path(:id => lookup_key).merge(:auth_object => lookup_key, :permission => 'destroy_external_variables', :authorizer => authorizer),
:confirm => _("Delete %s?") % lookup_key.key %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/media/index.html.erb
Expand Up @@ -16,7 +16,7 @@
<tbody>
<% for medium in @media %>
<tr>
<td><%= link_to_if_authorized trunc(medium), hash_for_edit_medium_path(:id => medium).merge(:auth_object => medium, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(medium), hash_for_edit_medium_path(:id => medium).merge(:auth_object => medium, :authorizer => authorizer) %></td>
<td><%= medium.path %></td>
<td><%= lookup_family(medium.os_family) %></td>
<td><%= medium.operatingsystems.map(&:to_label).to_sentence %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/models/index.html.erb
Expand Up @@ -15,7 +15,7 @@
<tbody>
<% for model in @models %>
<tr>
<td><%=link_to_if_authorized trunc(model.name), hash_for_edit_model_path(:id => model).merge(:auth_object => model, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%=link_to_if_authorized trunc(model.name), hash_for_edit_model_path(:id => model).merge(:auth_object => model, :authorizer => authorizer) %></td>
<td><%=h(model.vendor_class)%></td>
<td><%=h(model.hardware_model)%></td>
<td class="ra"><%= link_to model.hosts_count, hosts_path(:search => "model = \"#{model}\"") %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/operatingsystems/index.html.erb
Expand Up @@ -12,7 +12,7 @@
<tbody>
<% for operatingsystem in @operatingsystems %>
<tr>
<td><%= link_to_if_authorized(os_name(operatingsystem), hash_for_edit_operatingsystem_path(:id => operatingsystem).merge(:auth_object => operatingsystem, :authorizer => authorizer)) %></td>
<td class="display-two-pane"><%= link_to_if_authorized(os_name(operatingsystem), hash_for_edit_operatingsystem_path(:id => operatingsystem).merge(:auth_object => operatingsystem, :authorizer => authorizer)) %></td>
<td class="ra"><%= link_to operatingsystem.hosts_count, hosts_path(:search => "os_id = #{operatingsystem.id}") %></td>
<td class="ra">
<%= display_delete_if_authorized hash_for_operatingsystem_path(:id => operatingsystem).merge(:auth_object => operatingsystem, :authorizer => authorizer),
Expand Down
2 changes: 1 addition & 1 deletion app/views/ptables/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% for ptable in @ptables %>
<tr>
<td><%= link_to_if_authorized trunc(ptable), hash_for_edit_ptable_path(:id => ptable).merge(:auth_object => ptable, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(ptable), hash_for_edit_ptable_path(:id => ptable).merge(:auth_object => ptable, :authorizer => authorizer) %></td>
<td><%= lookup_family(ptable.os_family) %></td>
<td><%= ptable.operatingsystems.map(&:to_label).to_sentence %></td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/realms/index.html.erb
Expand Up @@ -13,7 +13,7 @@
<tbody>
<% for realm in @realms %>
<tr>
<td><%= link_to_if_authorized trunc(realm.name), hash_for_edit_realm_path(:id => realm)%></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(realm.name), hash_for_edit_realm_path(:id => realm)%></td>
<td><%= link_to realm.hosts_count, hosts_path(:search => "realm = #{realm}") %>
<td><%= display_delete_if_authorized hash_for_realm_path(:id => realm), :confirm => _("Delete %s?") % realm.name %></td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/roles/index.html.erb
Expand Up @@ -11,7 +11,7 @@
<tbody>
<% for role in @roles %>
<tr>
<td>
<td class="display-two-pane">
<%= content_tag(role.builtin? ? 'em' : 'span', role.builtin? ? role.name : link_to_if_authorized(trunc(role.name), hash_for_edit_role_path(:id => role))) %>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/smart_proxies/index.html.erb
Expand Up @@ -14,7 +14,7 @@
<tbody>
<% for proxy in @smart_proxies %>
<tr>
<td><%= link_to_if_authorized trunc(proxy.name), hash_for_edit_smart_proxy_path(:id => proxy).merge(:auth_object => proxy, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(proxy.name), hash_for_edit_smart_proxy_path(:id => proxy).merge(:auth_object => proxy, :authorizer => authorizer) %></td>
<td><%=h proxy.url %></td>
<td><%=h proxy.features.to_sentence %></td>
<td><%= action_buttons(*proxy_actions(proxy, authorizer)) %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/subnets/index.html.erb
Expand Up @@ -17,7 +17,7 @@
<tbody>
<% for subnet in @subnets %>
<tr>
<td><%=link_to_if_authorized trunc(subnet.name), hash_for_edit_subnet_path(:id => subnet).merge(:auth_object => subnet, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%=link_to_if_authorized trunc(subnet.name), hash_for_edit_subnet_path(:id => subnet).merge(:auth_object => subnet, :authorizer => authorizer) %></td>
<td><%=subnet.network_address %></td>
<td><%=subnet.domains.to_sentence %></td>
<td><%=subnet.vlanid %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/usergroups/index.html.erb
Expand Up @@ -15,7 +15,7 @@
<tbody>
<% for usergroup in @usergroups %>
<tr>
<td><%= link_to_if_authorized trunc(usergroup.name), hash_for_edit_usergroup_path(:id => usergroup.id).merge(:auth_object => usergroup, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= link_to_if_authorized trunc(usergroup.name), hash_for_edit_usergroup_path(:id => usergroup.id).merge(:auth_object => usergroup, :authorizer => authorizer) %></td>
<td><%= h usergroup.users.except_hidden.map(&:login).to_sentence %></td>
<td><%= h usergroup.usergroups.map(&:name).to_sentence %></td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/index.html.erb
Expand Up @@ -19,7 +19,7 @@
<tbody>
<% for user in @users %>
<tr>
<td><%= avatar_image_tag user, :class => "avatar" %> <%=link_to_if_authorized trunc(user.login), hash_for_edit_user_path(:id => user).merge(:auth_object => user, :authorizer => authorizer) %></td>
<td class="display-two-pane"><%= avatar_image_tag user, :class => "avatar" %> <%=link_to_if_authorized trunc(user.login), hash_for_edit_user_path(:id => user).merge(:auth_object => user, :authorizer => authorizer) %></td>
<td><%=h user.firstname %></td>
<td><%=h user.lastname %></td>
<td><%=h user.mail %></td>
Expand Down