Project

General

Profile

Defect #41952 » 0001-WIP.patch

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

View differences:

app/assets/stylesheets/application.css
1206 1206
  text-align: left;
1207 1207
}
1208 1208

  
1209
div.flash.error, #errorExplanation, div.flash.notice, div.flash.warning, .conflict {
1210
  &:has(svg){
1211
    background-image: none;
1212
    padding-left: 4px;
1213
  }
1214

  
1215
  &.errorMessages svg {
1216
    position: absolute;
1217
    margin-top: 1em;
1218
  }
1219

  
1220
  .conflict-details {
1221
    padding-left: 18px;
1222
  }
1223
}
1224

  
1225
div.flash.notice:has(svg) svg {
1226
  stroke: #005f00;
1227
  stroke-width: 2px;
1228
  margin-right: 4px;
1229
}
1230
div.flash.warning:has(svg) svg, .conflict:has(svg) svg {
1231
  stroke: #A6750C;
1232
}
1233
div.flash.error:has(svg) svg, #errorExplanation:has(svg) svg {
1234
  stroke: #880000;
1235
}
1236

  
1209 1237
.nodata, .warning {
1210 1238
  text-align: center;
1211 1239
  background-color: #F3EDD1;
......
1218 1246

  
1219 1247
.conflict-details {font-size:93%;}
1220 1248

  
1249

  
1221 1250
/***** Ajax indicator ******/
1222 1251
#ajax-indicator {
1223 1252
position: absolute; /* fixed not supported by IE */
app/helpers/application_helper.rb
510 510
  def render_flash_messages
511 511
    s = +''
512 512
    flash.each do |k, v|
513
      s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
513
      s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
514 514
    end
515 515
    s.html_safe
516 516
  end
......
1568 1568
  def render_error_messages(errors)
1569 1569
    html = +""
1570 1570
    if errors.present?
1571
      html << "<div id='errorExplanation'><ul>\n"
1571
      html << "<div id='errorExplanation' class='errorMessages'>#{notice_icon('error')}<ul>\n"
1572 1572
      errors.each do |error|
1573 1573
        html << "<li>#{h error}</li>\n"
1574 1574
      end
app/helpers/icons_helper.rb
67 67
    sprite_icon(icon_name, **options)
68 68
  end
69 69

  
70
  def notice_icon(type, **options)
71
    icon_name = case type
72
                when 'notice'
73
                  'checked'
74
                when 'warning'
75
                  'warning'
76
                when 'error'
77
                  'warning'
78
                end
79

  
80
    sprite_icon(icon_name, **options)
81
  end
82

  
70 83
  private
71 84

  
72 85
  def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil)
app/views/common/error.html.erb
1 1
<h2><%= @status %></h2>
2 2

  
3 3
<% if @message.present? %>
4
  %<= notice_icon('error') %>
4 5
  <p id="errorExplanation"><%= @message %></p>
5 6
<% end %>
6 7

  
app/views/issues/_conflict.html.erb
1 1
<div class="conflict">
2
  <%= l(:notice_issue_update_conflict) %> 
2
  <%= notice_icon('warning') + l(:notice_issue_update_conflict) %>
3 3
  <% if @conflict_journals.present? %>
4 4
    <div class="conflict-details">
5 5
    <% @conflict_journals.sort_by(&:id).each do |journal| %>
(2-2/2)