Project

General

Profile

Patch #29185 » diff.patch

Mizuki ISHIKAWA, 2018-07-04 10:29

View differences:

app/controllers/my_controller.rb
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 17

  
18 18
class MyController < ApplicationController
19
  self.main_menu = false
19
  menu_item :my_page
20 20
  before_action :require_login
21 21
  # let user change user's password when user has to
22 22
  skip_before_action :check_password_change, :only => :password
lib/redmine.rb
201 201
end
202 202

  
203 203
Redmine::MenuManager.map :application_menu do |menu|
204
  menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
204 205
  menu.push :projects, {:controller => 'projects', :action => 'index'},
205 206
    :permission => nil,
206 207
    :caption => :label_project_plural
test/functional/my_controller_test.rb
35 35
    get :page
36 36
    assert_response :success
37 37
    assert_select 'h2', 'My page'
38
    assert_select '#main-menu' do
39
      assert_select 'a.my-page.selected', 1
40
    end
38 41
  end
39 42

  
40 43
  def test_page_with_timelog_block
(2-2/2)