<noscript>
  <div role="alert" class="ic-flash-static ic-flash-error">
    <h1><%= t :javascript_required, "You need to have JavaScript enabled in order to access this site." %></h1>
  </div>
</noscript>

<% if session.has_key? :brand_config_md5 && !params[:previewing_from_themeeditor] %>
  <div role="alert" class="ic-flash-static ic-flash-info ic-flash--Theme-Editor">
    <% if params[:editing_brand_config] %>
      <%= t("You're editing your Canvas Theme! The changes have not been applied yet.") %>
    <% else %>
      <%= t do %>
        You're editing your Canvas Theme! Apply or cancel changes from within the.
        <%= link_to("Theme Editor", account_theme_editor_path(::Context.get_account(@context || @domain_root_account))) %>.
      <% end %>
      <br /> <%= t do %> Note: sub-account themes are not active during this preview. <% end %>
    <% end %>
  </div>
<% end %>

<% if @current_user.try(:show_bouncing_channel_message?) %>
  <div role="alert" class="ic-flash-static ic-flash-warning">
  <%= t(:bouncing_communication_channels, "There appears to be a problem with one of your contact methods. Please check your *Settings Page*.", wrapper: link_to('\1', settings_profile_path)) %>
  </div>
<% end %>

<noscript>
  <div role="alert" class="ic-flash-static ic-flash-error">
    <h1><%= t :javascript_required, "You need to have JavaScript enabled in order to access this site." %></h1>
  </div>
</noscript>

<% unless params[:previewing_from_themeeditor] || !session.has_key?(:brand_config_md5) %>
  <div role="alert" class="ic-flash-static ic-flash-info ic-flash--Theme-Editor">
    <% if params[:editing_brand_config] %>
      <%= t("You're editing your Canvas Theme! The changes have not been applied yet.") %>
    <% else %>
      <% current_account = ::Context.get_account(@context, @domain_root_account) %>
      <%= t do %>
        You're editing your Canvas Theme! Apply or cancel changes from within the
        <%= link_to "Theme Editor", account_theme_editor_path(current_account), target: "_top" %>.
      <% end %>
      <% if current_account.settings[:sub_account_includes] %>
        <br />
        <%= t "Note: sub-account themes are not active during this preview. " %>
      <% end %>
    <% end %>
  </div>
<% end %>

<% if @current_user.try(:show_bouncing_channel_message?) %>
  <div role="alert" class="ic-flash-static ic-flash-warning">
  <%= t(:bouncing_communication_channels, "There appears to be a problem with one of your contact methods. Please check your *Settings Page*.", wrapper: link_to('\1', settings_profile_path)) %>
  </div>
<% end %>

Fix theme editor preview and flash notices
Fix theme editor preview and flash notices

fixes CNVS-23167

Note: https://gerrit.instructure.com/#/c/61285 caused a bug where
navigating anywhere other than the main theme editor page during
preview results in a blank page
(ArgumentError Exception: wrong number of arguments (1 for 2).

Meanwhile, https://gerrit.instructure.com/#/c/61890/ made it so
that the offending code was never run, but also prevented the flash
notices from appearing in preview mode. This fixes both of these issues.

When navigating to any page (other than the theme editor page) while in theme
preview mode, you should see the following flash notice and the
'Theme Editor' link should take you to the theme editor view for the
current account:

* Within the theme editor: http://cl.ly/image/072l0M3z3R3g
* Outside the theme editor: http://cl.ly/image/1X281e2i3O2W

The theme editor page should display this notice in preview mode:
http://cl.ly/image/3Y3p0b0i091h

Change-Id: I124d722c2b4257c80cf08b20700147799c304f8e
Reviewed-on: https://gerrit.instructure.com/62982
Reviewed-by: Mike Nomitch <74443f6f110b6b7b934c89126258ed3d843d673f@instructure.com>
Reviewed-by: Ryan Shaw <ea3cd978650417470535f3a4725b6b5042a6ab59@instructure.com>
Tested-by: Jenkins
Product-Review: Colleen Palmer <387ba1943871e60965e6b44638a2f2e1ab9b8469@instructure.com>
QA-Review: Myller de Araujo <e5c7c5e1b7f2ce5e9870cc98ec52b20b3006cb48@instructure.com>
