diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-22 19:13:41 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-22 19:13:41 +0200 |
| commit | 24d7f9e8255eccad9346215268e91d28c5909797 (patch) | |
| tree | 700a5d349cc94673df28ba7f7fa54982939bcb47 | |
| parent | f929caffdaeac836c32819e9d5fcf2433b4a797a (diff) | |
factor out flash rendering from layouts/admin
| -rw-r--r-- | app/views/layouts/_flash.html.erb | 24 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 17 |
2 files changed, 25 insertions, 16 deletions
diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb new file mode 100644 index 0000000..a67fc86 --- /dev/null +++ b/app/views/layouts/_flash.html.erb | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | <% if flash.any? %> | ||
| 2 | <div id="flash"> | ||
| 3 | <%= flash[:notice] %> | ||
| 4 | <% if flash[:status_path] %> | ||
| 5 | <%= link_to 'Go to Status', flash[:status_path] %> | ||
| 6 | <% end %> | ||
| 7 | <% if flash[:stale_locale_path] %> | ||
| 8 | The <%= flash[:stale_locale] %> translation may be out of date — | ||
| 9 | <%= link_to 'review it', flash[:stale_locale_path] %> too. | ||
| 10 | <% end %> | ||
| 11 | <% if flash[:locked_node_path] %> | ||
| 12 | <span class="warning">The page is locked by <%= flash[:locked_by] %> — | ||
| 13 | <%= link_to 'unlock it there', flash[:locked_node_path] %> first, | ||
| 14 | then attach from this asset's page.</span> | ||
| 15 | <% end %> | ||
| 16 | <% if flash[:headline_kept_path] %> | ||
| 17 | <span class="warning">The page's existing headline was kept — | ||
| 18 | <%= link_to 'change it there', flash[:headline_kept_path] %> if needed.</span> | ||
| 19 | <% end %> | ||
| 20 | <% if flash[:error] %> | ||
| 21 | <span id="flash_error"><%= flash[:error] %></span> | ||
| 22 | <% end %> | ||
| 23 | </div> | ||
| 24 | <% end %> | ||
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index e220beb..89c9b55 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -37,25 +37,10 @@ | |||
| 37 | </div> | 37 | </div> |
| 38 | </div> | 38 | </div> |
| 39 | <div class="admin_content_spacer"></div> | 39 | <div class="admin_content_spacer"></div> |
| 40 | <% if flash[:notice].present? || flash[:error].present? %> | 40 | <%= render "layouts/flash" %> |
| 41 | <div id="flash"> | ||
| 42 | <%= flash[:notice] %> | ||
| 43 | <% if flash[:status_path] %> | ||
| 44 | <%= link_to 'Go to Status', flash[:status_path] %> | ||
| 45 | <% end %> | ||
| 46 | <% if flash[:stale_locale_path] %> | ||
| 47 | The <%= flash[:stale_locale] %> translation may be out of date — | ||
| 48 | <%= link_to 'review it', flash[:stale_locale_path] %> too. | ||
| 49 | <% end %> | ||
| 50 | <% if flash[:error] %> | ||
| 51 | <span id="flash_error"><%= flash[:error] %></span> | ||
| 52 | <% end %> | ||
| 53 | </div> | ||
| 54 | <% end %> | ||
| 55 | <div id="content"> | 41 | <div id="content"> |
| 56 | <%= yield %> | 42 | <%= yield %> |
| 57 | </div> | 43 | </div> |
| 58 | |||
| 59 | <div id="results"></div> | 44 | <div id="results"></div> |
| 60 | </div> | 45 | </div> |
| 61 | </body> | 46 | </body> |
