Project

General

Profile

Patch #18770 » Collapsable-history-divs.patch

Version to use - Olivier Houdas, 2015-01-07 15:14

View differences:

app/views/issues/_history.html.erb Fri Dec 12 09:20:05 2014 +0100 → app/views/issues/_history.html.erb Wed Jan 07 15:03:04 2015 +0100
<% reply_links = authorize_for('issues', 'edit') -%>
<div class="expander">
<% for journal in journals %>
<div id="change-<%= journal.id %>" class="<%= journal.css_classes %>">
<div id="change-<%= journal.id %>" class="<%= journal.css_classes %>">
<div id="note-<%= journal.indice %>">
<div class="expander-item group open">
<h4><%= link_to "##{journal.indice}", {:anchor => "note-#{journal.indice}"}, :class => "journal-link" %>
<%= avatar(journal.user, :size => "24") %>
<span class="expander" onclick="toggleExpanderDiv(this);">&nbsp;</span>
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %>
<%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
"toggleAllExpanderDivs(this)", :class => 'toggle-all') %>
<%= content_tag('span', l(:field_is_private), :class => 'private') if journal.private_notes? %></h4>
</div>
<div class="expander-item">
<% if journal.details.any? %>
<ul class="details">
<% details_to_strings(journal.visible_details).each do |string| %>
......
<% end %>
<%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
</div>
</div>
</div>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
<% end %>
</div>
<% heads_for_wiki_formatter if User.current.allowed_to?(:edit_issue_notes, issue.project) || User.current.allowed_to?(:edit_own_issue_notes, issue.project) %>
app/views/issues/show.html.erb Fri Dec 12 09:20:05 2014 +0100 → app/views/issues/show.html.erb Wed Jan 07 15:03:04 2015 +0100
<% if @issue.description? || @issue.attachments.any? -%>
<hr />
<% if @issue.description? %>
<div class="description">
<div class="contextual">
<%= link_to l(:button_quote), quoted_issue_path(@issue), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
<div class="expander">
<div class="description">
<div class="expander-item group open">
<div class="contextual">
<%= link_to l(:button_quote), quoted_issue_path(@issue), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
</div>
<p>
<span class="expander" onclick="toggleExpanderDiv(this);">&nbsp;</span>
<strong><%=l(:field_description)%></strong>
</p>
</div>
<p><strong><%=l(:field_description)%></strong></p>
<div class="wiki">
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
<div class="expander-item open">
<div class="wiki">
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
</div>
</div>
</div>
</div>
<% end %>
<%= link_to_attachments @issue, :thumbnails => true %>
<% end -%>
public/javascripts/application.js Fri Dec 12 09:20:05 2014 +0100 → public/javascripts/application.js Wed Jan 07 15:03:04 2015 +0100
}
}
function toggleExpanderDiv(el) {
var expItem = $(el).parents('div.expander-item').first();
var n = expItem.next();
expItem.toggleClass('open');
while (n.length && !n.hasClass('group')) {
n.toggle();
n = n.next('expItem');
}
}
function collapseAllExpanderDivs(el) {
var exp = $(el).parents('div.expander').first();
exp.find('div.expander-item').each(function(index) {
if ($(this).hasClass('group')) {
$(this).removeClass('open');
} else {
$(this).hide();
}
});
}
function expandAllExpanderDivs(el) {
var exp = $(el).parents('div.expander').first();
exp.find('div.expander-item').each(function(index) {
if ($(this).hasClass('group')) {
$(this).addClass('open');
} else {
$(this).show();
}
});
}
function toggleAllExpanderDivs(el) {
var expItem = $(el).parents('div.expander-item').first();
if (expItem.hasClass('open')) {
collapseAllExpanderDivs(el);
} else {
expandAllExpanderDivs(el);
}
}
function toggleFieldset(el) {
var fieldset = $(el).parents('fieldset').first();
fieldset.toggleClass('collapsed');
public/stylesheets/application.css Fri Dec 12 09:20:05 2014 +0100 → public/stylesheets/application.css Wed Jan 07 15:03:04 2015 +0100
tr.entry.file td.filename a { margin-left: 16px; }
tr.entry.file td.filename_no_report a { margin-left: 16px; }
tr span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}
tr span.expander, div span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
tr.open span.expander, div.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}
tr.changeset { height: 20px }
tr.changeset ul, ol { margin-top: 0px; margin-bottom: 0px; }
......
table.list tbody tr.group td { padding: 0.8em 0 0.5em 0.3em; font-weight: bold; border-bottom: 1px solid #ccc; text-align:left; }
table.list tbody tr.group span.count {position:relative; top:-1px; color:#fff; font-size:10px; background:#9DB9D5; padding:0px 6px 1px 6px; border-radius:3px; margin-left:4px;}
tr.group a.toggle-all { color: #aaa; font-size: 80%; font-weight: normal; display:none;}
tr.group:hover a.toggle-all { display:inline;}
tr.group a.toggle-all, div.group a.toggle-all { color: #aaa; font-size: 80%; font-weight: normal; display:none;}
tr.group:hover a.toggle-all, div.group:hover a.toggle-all { display:inline;}
a.toggle-all:hover {text-decoration:none;}
table.list tbody tr:hover { background-color:#ffffdd; }
(4-4/5)