Project

General

Profile

Feature #12388 » 0001-wip.patch

Marius BĂLTEANU, 2026-07-12 01:40

View differences:

app/assets/stylesheets/application.css
}
.journals h4.journal-header .update-info {
font-size: 0.9em;
}
.journals h4.journal-header span.update-info {
color: var(--oc-gray-6);
font-size: 0.9em;
}
app/controllers/journals_controller.rb
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalsController < ApplicationController
before_action :find_journal, :only => [:edit, :update, :diff]
before_action :find_journal, :only => [:edit, :update, :diff, :history]
before_action :find_issue, :only => [:new]
before_action :find_optional_project, :only => [:index]
before_action :authorize, :only => [:new, :edit, :update, :diff]
before_action :authorize, :only => [:new, :edit, :update, :diff, :history]
accept_atom_auth :index
accept_api_auth :update
menu_item :issues
......
@diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value)
end
def history
@issue = @journal.issue
@details = @journal.details.where(property: 'attr', prop_key: 'notes').reorder(id: :desc)
respond_to do |format|
format.js
end
end
def new
@journal = Journal.visible.find(params[:journal_id]) if params[:journal_id]
@content = if @journal
app/helpers/journals_helper.rb
def render_journal_update_info(journal)
return if journal.created_on == journal.updated_on
content_tag('span', "· #{l(:label_edited)}", :title => l(:label_time_by_author, :time => format_time(journal.updated_on), :author => journal.updated_by), :class => 'update-info')
notes_details = journal.details.select {|d| d.property == 'attr' && d.prop_key == 'notes'}
if notes_details.any?
link_to("· #{l(:label_edited)}",
history_journal_path(journal),
:remote => true,
:class => 'update-info',
:title => l(:label_time_by_author, :time => format_time(journal.updated_on), :author => journal.updated_by))
else
# Only show Edited label, no link since there is nothing to show in note history view
content_tag('span', "· #{l(:label_edited)}", :title => l(:label_time_by_author, :time => format_time(journal.updated_on), :author => journal.updated_by), :class => 'update-info')
end
end
end
app/models/journal.rb
detail.custom_field && detail.custom_field.visible_by?(project, user)
elsif detail.property == 'relation'
Issue.find_by_id(detail.value || detail.old_value).try(:visible?, user)
elsif detail.property == 'attr' && detail.prop_key == 'notes'
false
else
true
end
......
# Generates journal details for attribute and custom field changes
def journalize_changes
if !new_record? && notes_changed?
add_attribute_detail('notes', notes_was, notes)
end
# attributes changes
if @attributes_before_change
attrs = (journalized.journalized_attribute_names + @attributes_before_change.keys).uniq
app/views/issues/tabs/_history.html.erb
</span>
</h4>
<div class="journal-content">
<% if journal.details.any? %>
<% if journal.visible_details.any? %>
<ul class="journal-details">
<% details_to_strings(journal.visible_details).each do |string| %>
<li><%= string %></li>
app/views/journals/_history.html.erb
<h3 class="title"><%= l(:label_history) %></h3>
<div class="journal-history journals" style="max-height: 400px; overflow-y: auto;">
<% @details.each_with_index do |detail, index| %>
<div class="journal-history-version">
<h4 class="journal-header">
<span class="journal-info">
<%= avatar(@journal.user) %>
<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>
</span>
<span class="journal-meta">
#<%= @details.size - index %>
</span>
</h4>
<pre class="text-diff"><%= Redmine::Helpers::Diff.new(detail.value, detail.old_value).to_html %></pre>
</div>
<% end %>
</div>
<p class="buttons">
<%= link_to_function l(:button_close), "hideModal(this);" %>
</p>
app/views/journals/history.js.erb
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'history') %>');
showModal('ajax-modal', '650px');
app/views/journals/update.js.erb
$("#journal-<%= @journal.id %>-notes").show();
$("#journal-<%= @journal.id %>-form").remove();
var journal_header = $("#change-<%= @journal.id %>>div.note>h4.journal-header>.journal-info");
var journal_updated_info = journal_header.find("span.update-info");
var journal_updated_info = journal_header.find(".update-info");
if (journal_updated_info.length > 0) {
journal_updated_info.replaceWith('<%= escape_javascript(render_journal_update_info(@journal)) %>');
} else {
config/routes.rb
resources :journals, :only => [:edit, :update] do
member do
get 'diff'
get 'history'
end
end
lib/redmine/preparation.rb
:auto_complete => [:issues],
:context_menus => [:issues],
:versions => [:index, :show, :status_by],
:journals => [:index, :diff],
:journals => [:index, :diff, :history],
:queries => :index,
:reports => [:issue_report, :issue_report_details]},
:read => true
(1-1/3)