Uses icon font instead of expand/collapse image

pull/819/head
Hagen Schink 11 years ago
parent e75fce7c0a
commit f68ff89652
  1. 34
      app/assets/javascripts/application.js.erb
  2. 6
      app/assets/stylesheets/default/main.css.erb
  3. 5
      app/views/work_packages/_list.html.erb

@ -162,42 +162,42 @@ function showAndScrollTo(id, focus) {
} }
function setGroupRowStatus(el) { function setGroupRowStatus(el) {
var tr = jQuery(el).closest("tr"); var collapseExpandButton = jQuery(el);
var isOpen = tr.hasClass("open") var row = jQuery(el).closest("tr");
var toggleButton = tr.find("img").first(); var isOpen = row.hasClass("open")
var toggleButtonAltText = isOpen ? I18n.t('js.label_collapse') : I18n.t('js.label_expand'); var toggleAllLink = row.find(".toggle-all")
var toggleButtonImage = isOpen ? "<%= asset_path 'bullet_toggle_minus.png' %>" : "<%= asset_path 'bullet_toggle_plus.png' %>";
var toggleAllLink = tr.find(".toggle-all")
var toggleAllLinkText = isOpen ? I18n.t('js.label_collapse_all') : I18n.t('js.label_expand_all'); var toggleAllLinkText = isOpen ? I18n.t('js.label_collapse_all') : I18n.t('js.label_expand_all');
toggleButton.attr("alt", toggleButtonAltText); collapseExpandButton.toggleClass("icon-minus")
toggleButton.attr("src", toggleButtonImage); collapseExpandButton.toggleClass("icon-plus")
toggleAllLink.text(toggleAllLinkText); toggleAllLink.text(toggleAllLinkText);
} }
function toggleRowGroup(el) { function toggleRowGroup(el) {
var tr = jQuery(el).closest("tr"); var row = jQuery(el).closest("tr");
tr.toggleClass("open"); row.toggleClass("open closed");
setGroupRowStatus(el); setGroupRowStatus(el);
tr.nextUntil("tr.group").each(function(index) { row.nextUntil("tr.group").each(function(index) {
jQuery(this).toggle(); jQuery(this).toggle();
}); });
} }
function toggleAllRowGroups(el) { function toggleAllRowGroups(el) {
var tr = jQuery(el).closest("tr"); var row = jQuery(el).closest("tr");
var isOpen = tr.hasClass("open"); var collapseExpandButton = jQuery(row).find(".expander");
var isOpen = row.hasClass("open");
toggleRowGroup(el); toggleRowGroup(collapseExpandButton);
tr.siblings("tr.group").each(function(index) { row.siblings("tr.group").each(function(index) {
var currentGroupOpen = jQuery(this).hasClass("open"); var currentGroupOpen = jQuery(this).hasClass("open");
var collapseExpandButton = jQuery(this).find(".expander");
if (isOpen == currentGroupOpen) { if (isOpen == currentGroupOpen) {
toggleRowGroup(this); toggleRowGroup(collapseExpandButton);
} }
}); });
} }

@ -99,9 +99,9 @@ tr.entry td.revision, tr.entry td.author { text-align: center; }
tr.entry td.age { text-align: right; } tr.entry td.age { text-align: right; }
tr.entry.file td.filename a { margin-left: 16px; } tr.entry.file td.filename a { margin-left: 16px; }
tr span.expander {padding-left: 2px; cursor: pointer;} tr span.expander {cursor: pointer;}
tr span.expander img {vertical-align:middle;} tr.open span .expand { display:none; }
tr.open span.expander {} tr.closed span .collapse { display:none; }
tr.changeset td.author { text-align: center; width: 15%; } tr.changeset td.author { text-align: center; width: 15%; }
tr.changeset td.committed_on { text-align: center; width: 15%; } tr.changeset td.committed_on { text-align: center; width: 15%; }

@ -59,8 +59,9 @@ See doc/COPYRIGHT.rdoc for more details.
<% reset_cycle %> <% reset_cycle %>
<tr class="group open"> <tr class="group open">
<td colspan="<%= query.columns.size + 2 %>"> <td colspan="<%= query.columns.size + 2 %>">
<span class="expander" onclick="toggleRowGroup(this); return false;"> <span class="expander icon-context icon-minus" onclick="toggleRowGroup(this); return false;">
<img src="<%= asset_path 'bullet_toggle_minus.png' %>" alt="<%= I18n.t('label_collapse') %>" /> <span class="hidden-for-sighted expand"><%= I18n.t('label_expand') %></span>
<span class="hidden-for-sighted collapse"><%= I18n.t('label_collapse') %></span>
</span> </span>
<span> <span>

Loading…
Cancel
Save