add set_active_tab method in preparation for streaming
Change-Id: I0b80fc5632bc83dacff8a37a696f99ffd137eddb Reviewed-on: https://gerrit.instructure.com/202967 Tested-by: Jenkins Reviewed-by: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
6719ec01b5
commit
888b1c7d2a
|
@ -2117,6 +2117,17 @@ class ApplicationController < ActionController::Base
|
|||
def body_classes; @body_classes ||= []; end
|
||||
helper_method :body_classes
|
||||
|
||||
def set_active_tab(active_tab)
|
||||
raise "call set_active_tab for #{active_tab.inspect} in the controller when using streaming templates" if @streaming_template && @active_tab != active_tab
|
||||
@active_tab = active_tab
|
||||
end
|
||||
helper_method :set_active_tab
|
||||
|
||||
def get_active_tab
|
||||
@active_tab
|
||||
end
|
||||
helper_method :get_active_tab
|
||||
|
||||
def get_course_from_section
|
||||
if params[:section_id]
|
||||
@section = api_find(CourseSection, params.delete(:section_id))
|
||||
|
|
|
@ -1864,7 +1864,7 @@ class CoursesController < ApplicationController
|
|||
).to_a
|
||||
@syllabus_body = syllabus_user_content
|
||||
else
|
||||
@active_tab = "home"
|
||||
set_active_tab "home"
|
||||
if @context.grants_right?(@current_user, session, :manage_groups)
|
||||
@contexts += @context.groups
|
||||
else
|
||||
|
|
|
@ -80,7 +80,7 @@ class DeveloperKeysController < ApplicationController
|
|||
protected
|
||||
|
||||
def set_navigation
|
||||
@active_tab = 'developer_keys'
|
||||
set_active_tab 'developer_keys'
|
||||
add_crumb t('#crumbs.developer_keys', "Developer Keys")
|
||||
end
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ class DiscussionTopicsController < ApplicationController
|
|||
format.html do
|
||||
log_asset_access([ "topics", @context ], 'topics', 'other')
|
||||
|
||||
@active_tab = 'discussions'
|
||||
set_active_tab 'discussions'
|
||||
add_crumb(t('#crumbs.discussions', 'Discussions'),
|
||||
named_context_url(@context, :context_discussion_topics_url))
|
||||
|
||||
|
@ -1061,10 +1061,10 @@ class DiscussionTopicsController < ApplicationController
|
|||
|
||||
def add_discussion_or_announcement_crumb
|
||||
if @topic.is_a? Announcement
|
||||
@active_tab = "announcements"
|
||||
set_active_tab "announcements"
|
||||
add_crumb t('#crumbs.announcements', "Announcements"), named_context_url(@context, :context_announcements_url)
|
||||
else
|
||||
@active_tab = "discussions"
|
||||
set_active_tab "discussions"
|
||||
add_crumb t('#crumbs.discussions', "Discussions"), named_context_url(@context, :context_discussion_topics_url)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ class EportfoliosController < ApplicationController
|
|||
@context = @current_user.profile
|
||||
return unless tab_enabled?(UserProfile::TAB_EPORTFOLIOS)
|
||||
rce_js_env
|
||||
@active_tab = "eportfolios"
|
||||
set_active_tab "eportfolios"
|
||||
add_crumb(@current_user.short_name, user_profile_url(@current_user))
|
||||
add_crumb(t(:crumb, "ePortfolios"))
|
||||
@portfolios = @current_user.eportfolios.active.order(:updated_at).to_a
|
||||
|
|
|
@ -376,7 +376,7 @@ class ExternalToolsController < ApplicationController
|
|||
:redirect_return_cancel_url => cancel_url)
|
||||
js_env(:course_id => @context.id) if @context.is_a?(Course)
|
||||
|
||||
@active_tab = @tool.asset_string
|
||||
set_active_tab @tool.asset_string
|
||||
@show_embedded_chat = false if @tool.tool_id == 'chat'
|
||||
|
||||
@lti_launch = lti_launch(tool: @tool, selection_type: placement)
|
||||
|
|
|
@ -255,12 +255,12 @@ class GroupsController < ApplicationController
|
|||
unless api_request?
|
||||
if @context.is_a?(Account)
|
||||
user_crumb = t('#crumbs.users', "Users")
|
||||
@active_tab = "users"
|
||||
set_active_tab "users"
|
||||
@group_user_type = "user"
|
||||
@allow_self_signup = false
|
||||
else
|
||||
user_crumb = t('#crumbs.people', "People")
|
||||
@active_tab = "people"
|
||||
set_active_tab "people"
|
||||
@group_user_type = "student"
|
||||
@allow_self_signup = true
|
||||
if @context.grants_right? @current_user, session, :read_as_admin
|
||||
|
|
|
@ -108,7 +108,7 @@ class JobsController < ApplicationController
|
|||
end
|
||||
|
||||
def set_navigation
|
||||
@active_tab = 'jobs'
|
||||
set_active_tab 'jobs'
|
||||
add_crumb t('#crumbs.jobs', "Jobs")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -185,7 +185,7 @@ module Lti
|
|||
|
||||
message = IMS::LTI::Models::Messages::BasicLTILaunchRequest.new(launch_attrs)
|
||||
message.user_id = Lti::Asset.opaque_identifier_for(@current_user, context: @context)
|
||||
@active_tab = message_handler.asset_string
|
||||
set_active_tab message_handler.asset_string
|
||||
@lti_launch.resource_url = message.launch_url
|
||||
@lti_launch.link_text = resource_handler.name
|
||||
@lti_launch.launch_type = message.launch_presentation_document_target
|
||||
|
|
|
@ -78,6 +78,6 @@ class PluginsController < ApplicationController
|
|||
end
|
||||
|
||||
def set_navigation
|
||||
@active_tab = 'plugins'
|
||||
set_active_tab 'plugins'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -158,7 +158,7 @@ class ProfileController < ApplicationController
|
|||
end
|
||||
|
||||
@user ||= @current_user
|
||||
@active_tab = "profile"
|
||||
set_active_tab "profile"
|
||||
@context = @user.profile if @user == @current_user
|
||||
|
||||
@user_data = profile_data(
|
||||
|
@ -203,7 +203,7 @@ class ProfileController < ApplicationController
|
|||
@pseudonyms = @user.pseudonyms.active
|
||||
@password_pseudonyms = @pseudonyms.select{|p| !p.managed_password? }
|
||||
@context = @user.profile
|
||||
@active_tab = "profile_settings"
|
||||
set_active_tab "profile_settings"
|
||||
js_env :enable_gravatar => @domain_root_account&.enable_gravatar?
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
|
@ -223,7 +223,7 @@ class ProfileController < ApplicationController
|
|||
@user = @current_user
|
||||
@current_user.used_feature(:cc_prefs)
|
||||
@context = @user.profile
|
||||
@active_tab = 'notifications'
|
||||
set_active_tab 'notifications'
|
||||
|
||||
|
||||
# Get the list of Notification models (that are treated like categories) that make up the full list of Categories.
|
||||
|
@ -458,7 +458,7 @@ class ProfileController < ApplicationController
|
|||
js_env(AUTH_TYPE: @domain_root_account.parent_auth_type)
|
||||
end
|
||||
@user ||= @current_user
|
||||
@active_tab = 'observees'
|
||||
set_active_tab 'observees'
|
||||
@context = @user.profile if @user == @current_user
|
||||
|
||||
add_crumb(@user.short_name, profile_path)
|
||||
|
|
|
@ -170,7 +170,7 @@ class RoleOverridesController < ApplicationController
|
|||
|
||||
js_bundle :permissions_index
|
||||
css_bundle :permissions
|
||||
@active_tab = 'permissions'
|
||||
set_active_tab 'permissions'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1346,7 +1346,7 @@ class UsersController < ApplicationController
|
|||
@lti_launch.link_text = @tool.label_for(:user_navigation, I18n.locale)
|
||||
@lti_launch.analytics_id = @tool.tool_id
|
||||
|
||||
@active_tab = @tool.asset_string
|
||||
set_active_tab @tool.asset_string
|
||||
add_crumb(@current_user.short_name, user_profile_path(@current_user))
|
||||
render Lti::AppUtil.display_template
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ module SectionTabHelper
|
|||
}) do
|
||||
concat(content_tag(:ul, id: 'section-tabs') do
|
||||
available_section_tabs(@context).map do |tab|
|
||||
section_tab_tag(tab, @context, @active_tab)
|
||||
section_tab_tag(tab, @context, get_active_tab)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<%
|
||||
@active_tab = "admin_tools"
|
||||
set_active_tab "admin_tools"
|
||||
provide :page_title, t(:page_title, "Admin Tools for %{account}", :account => @context.name)
|
||||
add_crumb t(:admin_tools_cumb, "Admin tools")
|
||||
js_bundle :account_admin_tools
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<%
|
||||
@active_tab = "courses"
|
||||
set_active_tab "courses"
|
||||
add_crumb t(:courses_crumb, "Courses"), account_path(@account)
|
||||
add_crumb t(:search_results_crumb, "Search results for \"%{query}\"", :query => @query)
|
||||
%>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#
|
||||
# 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/>.
|
||||
@active_tab = "settings"
|
||||
set_active_tab "settings"
|
||||
add_crumb t(:settings_crumb, "Settings")
|
||||
js_bundle :account_settings
|
||||
css_bundle :account_settings, :reports, :tinymce
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<% provide :page_title do %><%= @account.name %><% end %>
|
||||
<%
|
||||
@active_tab = "courses"
|
||||
set_active_tab "courses"
|
||||
add_crumb t(:courses_crumb, "Courses"), account_path(@account)
|
||||
%>
|
||||
<% provide :right_side do %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<% add_crumb t(:sis_import_crumb, "SIS Import") %>
|
||||
<% @active_tab = "sis_import" %>
|
||||
<% set_active_tab "sis_import" %>
|
||||
<% provide :page_title do %><%= t(:page_title, "SIS Import") %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<%
|
||||
provide :page_title, t(:page_title, "Statistics for %{account}", :account => @account.name)
|
||||
@active_tab = "statistics"
|
||||
set_active_tab "statistics"
|
||||
css_bundle :statistics
|
||||
js_bundle :account_statistics
|
||||
%>
|
||||
|
@ -194,4 +194,4 @@
|
|||
</div>
|
||||
|
||||
<script type="text/javascript" src="//www.google.com/jsapi"></script>
|
||||
<script> google.load('visualization', '1', {'packages':['annotatedtimeline']}); </script>
|
||||
<script> google.load('visualization', '1', {'packages':['annotatedtimeline']}); </script>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<% js_env :CAN_READ => can_do(@context, @current_user, :read) %>
|
||||
<% js_env :SYLLABUS_BODY => user_content(@syllabus_body || '') %>
|
||||
<% @active_tab = "syllabus" %>
|
||||
<% set_active_tab "syllabus" %>
|
||||
<% course_home ||= false %>
|
||||
<div class="ic-Action-header">
|
||||
<div class="ic-Action-header__Primary">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<% add_crumb t(:page_title, "Authentication Settings") %>
|
||||
<% @active_tab = "authentication" %>
|
||||
<% set_active_tab "authentication" %>
|
||||
<%- css_bundle(:federated_attributes) %>
|
||||
<% provide :page_title do %>
|
||||
<%= t(:page_title, "Authentication Settings")%>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<%
|
||||
add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
|
||||
add_crumb(context_user_name(@context, @user), context_url(@context, :context_user_url, @user))
|
||||
@active_tab="people"
|
||||
set_active_tab "people"
|
||||
%>
|
||||
<% provide :page_title do %><%= join_title context_user_name(@context, @user), @context.name %><% end %>
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<%
|
||||
<%
|
||||
add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
|
||||
add_crumb(t('#crumbs.prior_users', "Prior Users"))
|
||||
@active_tab="people"
|
||||
set_active_tab "people"
|
||||
%>
|
||||
<% provide :page_title, t('titles.prior_users', "Prior Users") %>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<%
|
||||
@active_tab = 'people'
|
||||
set_active_tab 'people'
|
||||
add_crumb t('People'), context_url(@context, :context_users_url)
|
||||
|
||||
translated_title = @context.is_a?(Course) ? t('Course Roster') : t('Group Roster')
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<%
|
||||
add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
|
||||
add_crumb(context_user_name(@context, @user), context_url(@context, :context_user_url, @user))
|
||||
@active_tab="people"
|
||||
set_active_tab "people"
|
||||
%>
|
||||
<% provide :page_title do %><%= join_title context_user_name(@context, @user), @context.name %><% end %>
|
||||
<% provide :right_side do %>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<% provide :page_title, t('titles.registered_services', 'Registered Services') %>
|
||||
<% add_crumb(t('#crumbs.people', 'People'), context_url(@context, :context_users_url))
|
||||
@active_tab="people"
|
||||
set_active_tab "people"
|
||||
add_crumb(t('#crumbs.registered_services', 'Registered Services'), context_url(@context, :context_user_services_url)) %>
|
||||
<% provide :right_side do %>
|
||||
<div class="rs-margin-bottom">
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<% provide :page_title, t('titles.access_report', 'Access Report') %>
|
||||
<% add_crumb(t('#crumbs.people', 'People'), context_url(@context, :context_users_url))
|
||||
add_crumb(@user.name, context_url(@context, :context_user_url, @user))
|
||||
@active_tab="people"
|
||||
set_active_tab "people"
|
||||
add_crumb(t('#crumbs.access_report', "Access Report"))
|
||||
css_bundle :roster_user_usage
|
||||
%>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
provide :page_title, join_title(t(:page_title, "Course Details"), @context.name)
|
||||
css_bundle :course_settings
|
||||
js_bundle :course_settings
|
||||
@active_tab = "settings"
|
||||
set_active_tab "settings"
|
||||
|
||||
can_manage = can_do(@context, @current_user, :manage)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<% provide :page_title, @context.name %>
|
||||
<% @active_tab ||= "home" %>
|
||||
<% set_active_tab "home" unless get_active_tab %>
|
||||
<h1 class='screenreader-only'><%= @context.name %></h1>
|
||||
|
||||
<% provide :right_side do %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<%
|
||||
@active_tab = 'settings'
|
||||
set_active_tab 'settings'
|
||||
css_bundle :statistics
|
||||
add_crumb t('#crumbs.stats', "Statistics")
|
||||
%>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<% provide :page_title do %><%= join_title @group.name, @context.full_name %><% end %>
|
||||
<% css_bundle :dashboard %>
|
||||
<% js_bundle :dashboard %>
|
||||
<% @active_tab = "home" %>
|
||||
<% set_active_tab "home" %>
|
||||
|
||||
<% provide :right_side do %>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= InstFS.login_pixel(logged_in_user, session, request.host_with_port) if logged_in_user && !@files_domain %>
|
||||
<% js_env(active_context_tab: @active_tab) %>
|
||||
<% js_env(active_context_tab: get_active_tab) %>
|
||||
|
||||
<script>
|
||||
INST = <%= raw(inst_env.to_json) %>;
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
@body_classes << "with-embedded-chat" if @show_embedded_chat
|
||||
@body_classes << 'with-fixed-bottom' if @show_fixed_bottom
|
||||
@body_classes << 'pages' if controller.js_env[:WIKI_PAGE].present?
|
||||
@body_classes << @active_tab
|
||||
@body_classes << get_active_tab
|
||||
@body_classes << 'Underline-All-Links__enabled' if @current_user && @current_user.feature_enabled?(:underline_all_links)
|
||||
@body_classes << 'is-masquerading-or-student-view' if @real_current_user && @real_current_user != @current_user
|
||||
@body_classes << 'primary-nav-expanded' unless @collapse_global_nav
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<% @active_tab = "question_banks" %>
|
||||
<% set_active_tab "question_banks" %>
|
||||
<% provide :page_title, t(:page_title, "Question Banks") %>
|
||||
|
||||
<% css_bundle :quizzes %>
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_crumb t('titles.sub_accounts', "Sub-Accounts")
|
||||
@active_tab = "sub_accounts"
|
||||
set_active_tab "sub_accounts"
|
||||
provide :page_title, t('titles.sub_accounts', 'Sub-Accounts')
|
||||
css_bundle :sub_accounts
|
||||
js_bundle :sub_accounts
|
||||
js_bundle :sub_accounts
|
||||
%>
|
||||
|
||||
<h1 class="screenreader-only"><%= t :page_header_title, 'Sub Accounts' %></h1>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
add_crumb(t('crumbs.assignments', "Assignments"), context_url(@context, :context_assignments_url))
|
||||
add_crumb(@assignment.title, context_url(@context, :context_assignment_url, @assignment.id))
|
||||
add_crumb(user_crumb_name)
|
||||
@active_tab = "assignments"
|
||||
set_active_tab "assignments"
|
||||
%>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<% @active_tab = "terms" %>
|
||||
<% set_active_tab "terms" %>
|
||||
<% provide :page_title do %><%= t :page_title, "%{account} Terms", :account => @context.name %><% end %>
|
||||
|
||||
<% js_bundle 'legacy/terms_index' %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<% add_crumb t('crumbs.faculty_journal', "Faculty Journal") %>
|
||||
<% @active_tab = "faculty_journal" %>
|
||||
<% set_active_tab "faculty_journal" %>
|
||||
<% provide :page_title do %><%= t :page_title, "Faculty Journal" %><% end %>
|
||||
<h1 class="screenreader-only"><%= t :journal_header, "Faculty Journal" %></h1>
|
||||
<p><%= @is_course ? t(:details_this_course, "Last Faculty Journal entries for students currently enrolled in this course.") :
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%>
|
||||
|
||||
<% add_crumb t('crumbs.users', "Users") %>
|
||||
<% @active_tab = "users" %>
|
||||
<% set_active_tab "users" %>
|
||||
<% if @query %>
|
||||
<% js_env ga_page_title: "User Search Results" %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue