Project

General

Profile

Defect #41952 » 0001-WIP.patch

Marius BĂLTEANU, 2024-12-09 02:27

View differences:

app/assets/stylesheets/application.css
text-align: left;
}
div.flash.error, #errorExplanation, div.flash.notice, div.flash.warning, .conflict {
&:has(svg){
background-image: none;
padding-left: 4px;
}
&.errorMessages svg {
position: absolute;
margin-top: 1em;
}
.conflict-details {
padding-left: 18px;
}
}
div.flash.notice:has(svg) svg {
stroke: #005f00;
stroke-width: 2px;
margin-right: 4px;
}
div.flash.warning:has(svg) svg, .conflict:has(svg) svg {
stroke: #A6750C;
}
div.flash.error:has(svg) svg, #errorExplanation:has(svg) svg {
stroke: #880000;
}
.nodata, .warning {
text-align: center;
background-color: #F3EDD1;
......
.conflict-details {font-size:93%;}
/***** Ajax indicator ******/
#ajax-indicator {
position: absolute; /* fixed not supported by IE */
app/helpers/application_helper.rb
def render_flash_messages
s = +''
flash.each do |k, v|
s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
end
s.html_safe
end
......
def render_error_messages(errors)
html = +""
if errors.present?
html << "<div id='errorExplanation'><ul>\n"
html << "<div id='errorExplanation' class='errorMessages'>#{notice_icon('error')}<ul>\n"
errors.each do |error|
html << "<li>#{h error}</li>\n"
end
app/helpers/icons_helper.rb
sprite_icon(icon_name, **options)
end
def notice_icon(type, **options)
icon_name = case type
when 'notice'
'checked'
when 'warning'
'warning'
when 'error'
'warning'
end
sprite_icon(icon_name, **options)
end
private
def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil)
app/views/common/error.html.erb
<h2><%= @status %></h2>
<% if @message.present? %>
%<= notice_icon('error') %>
<p id="errorExplanation"><%= @message %></p>
<% end %>
app/views/issues/_conflict.html.erb
<div class="conflict">
<%= l(:notice_issue_update_conflict) %>
<%= notice_icon('warning') + l(:notice_issue_update_conflict) %>
<% if @conflict_journals.present? %>
<div class="conflict-details">
<% @conflict_journals.sort_by(&:id).each do |journal| %>
(2-2/2)