add base trophy case page
refs VICE-574 flag=trophy_case test plan: ** WITHOUT enabling trophy_case flag ** - open the user profile tab - there should be no link to the trophy case page ** WITH enabling trophy_case flag ** - open the user profile tab - there should be a link to the trophy case page - clicking the link should take you to /trophy_case qa risk: low Change-Id: I3b3ade661b509a2fc42f6ccf532cd4dcff7ceb3d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/240870 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Matthew Lemon <mlemon@instructure.com> QA-Review: Matthew Lemon <mlemon@instructure.com> Product-Review: Davis Hyer <dhyer@instructure.com>
This commit is contained in:
parent
58f188a064
commit
1be8227b97
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# Copyright (C) 2020 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
class UserTrophiesController < ApplicationController
|
||||
before_action :require_user
|
||||
|
||||
def show
|
||||
add_crumb(@current_user.short_name, profile_path)
|
||||
add_crumb(t("Trophy Case"))
|
||||
@show_left_side = true
|
||||
@context = @current_user.profile
|
||||
set_active_tab('trophy_case')
|
||||
js_bundle :trophy_case
|
||||
render html: '', layout: true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2020 - present Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import renderTrophyCaseApp from '../trophy_case/index'
|
||||
import $ from 'jquery'
|
||||
|
||||
$(() => {
|
||||
renderTrophyCaseApp(ENV, $('#content')[0])
|
||||
})
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2020 - present Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
|
||||
export default function TrophyCase() {
|
||||
return <div>Trophy Case!!</div>
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2020 - present Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {render} from '@testing-library/react'
|
||||
import TrophyCase from '../TrophyCase'
|
||||
import React from 'react'
|
||||
|
||||
describe('TrophyCase', () => {
|
||||
it('renders', () => {
|
||||
const {getByText} = render(<TrophyCase />)
|
||||
expect(getByText('Trophy Case!!')).toBeVisible()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2020 - present Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import TrophyCase from './components/TrophyCase'
|
||||
|
||||
export default function renderTrophyCaseApp(env, elt) {
|
||||
ReactDOM.render(<TrophyCase />, elt)
|
||||
}
|
|
@ -37,6 +37,7 @@ class UserProfile < ActiveRecord::Base
|
|||
TAB_OBSERVEES,
|
||||
TAB_QR_MOBILE_LOGIN,
|
||||
TAB_PAST_GLOBAL_ANNOUNCEMENTS,
|
||||
TAB_TROPHY_CASE,
|
||||
TAB_CONTENT_SHARES =
|
||||
*0..10
|
||||
|
||||
|
@ -90,6 +91,7 @@ class UserProfile < ActiveRecord::Base
|
|||
insert_observer_tabs(tabs, user)
|
||||
insert_qr_mobile_login_tab(tabs, user, opts)
|
||||
insert_past_global_announcements(tabs, user, opts)
|
||||
insert_trophy_case(tabs, user, opts)
|
||||
tabs
|
||||
end
|
||||
end
|
||||
|
@ -187,6 +189,19 @@ class UserProfile < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
def insert_trophy_case(tabs, user, opts)
|
||||
if user && Account.site_admin.feature_enabled?(:trophy_case)
|
||||
tabs <<
|
||||
{
|
||||
id: TAB_TROPHY_CASE,
|
||||
label: I18n.t('#tabs.trophy_case', 'Trophy Case'),
|
||||
css_class: 'trophy_case',
|
||||
href: :trophy_case_path,
|
||||
no_args: true
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def instructure_misc_plugin_available?
|
||||
|
|
|
@ -861,6 +861,8 @@ CanvasRails::Application.routes.draw do
|
|||
|
||||
get 'account_notifications' => 'account_notifications#render_past_global_announcements'
|
||||
|
||||
resource :trophy_case, controller: :user_trophies, only: [:show]
|
||||
|
||||
scope '/profile' do
|
||||
post 'toggle_disable_inbox' => 'profile#toggle_disable_inbox'
|
||||
get 'profile_pictures' => 'profile#profile_pics', as: :profile_pics
|
||||
|
|
Loading…
Reference in New Issue