Project

General

Profile

Patch #36182 » show-notifications-v2.patch

Mizuki ISHIKAWA, 2022-06-20 05:58

View differences:

app/helpers/application_helper.rb
1879 1879
      wiki_pages: auto_complete_wiki_pages_path(project_id: project, q: ''),
1880 1880
    }
1881 1881
  end
1882

  
1883
  def render_top_banner(id, wide)
1884
    return if Setting.login_required? && !User.current.logged?
1885

  
1886
    parsed_banner_text = textilizable(Setting.banner_text)
1887
    return if parsed_banner_text.blank?
1888

  
1889
    tag.div(id: id, class: "wiki top-banner #{wide ? 'mobile-hide' : 'mobile-show'}") do
1890
      parsed_banner_text
1891
    end
1892
  end
1882 1893
end
app/views/layouts/base.html.erb
67 67
    <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
68 68
</div>
69 69

  
70
<%= render_top_banner('top-banner', true) %>
71

  
70 72
<div id="header">
71 73

  
72 74
    <a href="#" class="mobile-toggle-button js-flyout-menu-toggle-button"></a>
......
108 110
    </div>
109 111

  
110 112
    <div id="content">
113
        <%= render_top_banner('top-banner-in-content', false) %>
111 114
        <%= render_flash_messages %>
112 115
        <%= yield %>
113 116
        <%= call_hook :view_layouts_base_content %>
app/views/settings/_general.html.erb
6 6
<p><%= setting_text_area :welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
7 7
<%= wikitoolbar_for 'settings_welcome_text' %>
8 8

  
9
<p><%= setting_text_area :banner_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
10
<%= wikitoolbar_for 'settings_banner_text' %>
9 11

  
10 12
<p><%= setting_text_field :per_page_options, :size => 20 %>
11 13
<em class="info"><%= l(:text_comma_separated) %></em></p>
config/locales/en.yml
417 417

  
418 418
  setting_app_title: Application title
419 419
  setting_welcome_text: Welcome text
420
  setting_banner_text: Banner text
420 421
  setting_default_language: Default language
421 422
  setting_login_required: Authentication required
422 423
  setting_self_registration: Self-registration
config/locales/ja.yml
346 346

  
347 347
  setting_app_title: アプリケーションのタイトル
348 348
  setting_welcome_text: ウェルカムメッセージ
349
  setting_banner_text: バナーメッセージ
349 350
  setting_default_language: デフォルトの言語
350 351
  setting_login_required: 認証が必要
351 352
  setting_self_registration: ユーザーによるアカウント登録
config/settings.yml
23 23
  default: Redmine
24 24
welcome_text:
25 25
  default:
26
banner_text:
27
  default:
26 28
login_required:
27 29
  default: 0
28 30
  security_notifications: 1
public/stylesheets/application.css
1151 1151
  margin-bottom: 15px;
1152 1152
}
1153 1153

  
1154
/***** Banner *****/
1155

  
1156
div.top-banner {
1157
  padding: 0px 20px;
1158
  margin: 0px;
1159
  background-color: #eee;
1160
  border: 1px solid #ddd;
1161
}
1162

  
1154 1163
/***** Progress bar *****/
1155 1164
table.progress {
1156 1165
  border-collapse: collapse;
public/stylesheets/responsive.css
584 584
  .mobile-hide {display:none;}
585 585
  .mobile-show {display:initial;}
586 586

  
587
  .top-banner.mobile-show { display: block; }
588

  
587 589
  /* Contextual Buttons */
588 590

  
589 591
  #content>.contextual {
test/functional/account_controller_test.rb
64 64
    assert_equal 2, @request.session[:user_id]
65 65
  end
66 66

  
67
  def test_login_should_not_view_banner_if_required_login
68
    with_settings :banner_text => 'h1. banner text' do
69
      with_settings :login_required => '0' do
70
        get :login
71
        assert_response :success
72
        assert_select '#top-banner h1', text: /banner text/
73
      end
74

  
75
      with_settings :login_required => '1' do
76
        get :login
77
        assert_response :success
78
        assert_select '#top-banner', count: 0
79
      end
80
    end
81
  end
82

  
67 83
  def test_login_should_redirect_to_back_url_param
68 84
    # request.uri is "test.host" in test environment
69 85
    back_urls = [
(4-4/8)