<commit_before>﻿/**
Copyright 2010 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

**/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SpaceTraffic.GameUi.Models.Ui;
using SpaceTraffic.GameUi.Controllers;

namespace SpaceTraffic.GameUi.Areas.Game.Controllers
{
    /// <summary>
    /// Controller for page with tabs.
    /// </summary>
    public abstract class TabsControllerBase : AbstractController
    {
        /// <summary>
        /// Page which should be displayed for Index action.
        /// </summary>
        protected const string INDEX_VIEW = "~/Areas/Game/Views/Shared/_GameWindow.cshtml";

        /// <summary>
        /// Gets the tabs.
        /// </summary>
        protected Tabs Tabs { get; private set; }

        /// <summary>
        /// Builds the tabs.
        /// Use this method to add tabs to the collection.
        /// </summary>
        protected abstract void BuildTabs();

        /// <summary>
        /// Initializes data that might not be available when the constructor is called.
        /// Used for building tabs and putting them into ViewBag.
        /// </summary>
        /// <param name="requestContext">The HTTP context and route data.</param>
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            this.Tabs = new Tabs();
            this.BuildTabs();
            ViewBag.Tabs = this.Tabs;
        }

        /// <summary>
        /// Gets the view for given tab.
        /// </summary>
        /// <param name="tabName">Name of the tab.</param>
        /// <returns></returns>
        protected PartialViewResult GetTabView(string tabName)
        {
            this.Tabs.CurrentTab = this.Tabs.Items[tabName];
            return PartialView(this.Tabs.Items[tabName].PartialViewName);
        }
    }
}<commit_msg>Added overload to GetTabView method for model<commit_after>﻿/**
Copyright 2010 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

**/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SpaceTraffic.GameUi.Models.Ui;
using SpaceTraffic.GameUi.Controllers;

namespace SpaceTraffic.GameUi.Areas.Game.Controllers
{
    /// <summary>
    /// Controller for page with tabs.
    /// </summary>
    public abstract class TabsControllerBase : AbstractController
    {
        /// <summary>
        /// Page which should be displayed for Index action.
        /// </summary>
        protected const string INDEX_VIEW = "~/Areas/Game/Views/Shared/_GameWindow.cshtml";

        /// <summary>
        /// Gets the tabs.
        /// </summary>
        protected Tabs Tabs { get; private set; }

        /// <summary>
        /// Builds the tabs.
        /// Use this method to add tabs to the collection.
        /// </summary>
        protected abstract void BuildTabs();

        /// <summary>
        /// Initializes data that might not be available when the constructor is called.
        /// Used for building tabs and putting them into ViewBag.
        /// </summary>
        /// <param name="requestContext">The HTTP context and route data.</param>
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            this.Tabs = new Tabs();
            this.BuildTabs();
            ViewBag.Tabs = this.Tabs;
        }

        /// <summary>
        /// Gets the view for given tab.
        /// </summary>
        /// <param name="tabName">Name of the tab.</param>
        /// <returns></returns>
        protected PartialViewResult GetTabView(string tabName)
        {
            this.Tabs.CurrentTab = this.Tabs.Items[tabName];
            return PartialView(this.Tabs.Items[tabName].PartialViewName);
        }

        /// <summary>
        /// Gets the view for given tab.
        /// </summary>
        /// <param name="tabName">Name of the tab</param>
        /// <param name="model">Model</param>
        /// <returns></returns>
        protected PartialViewResult GetTabView(string tabName, object model)
        {
            this.Tabs.CurrentTab = this.Tabs.Items[tabName];
            return PartialView(this.Tabs.Items[tabName].PartialViewName, model);
        }
    }
}
{'fraction_non_alphanumeric': 0.10821455363840961, 'fraction_numerical': 0.003000750187546887, 'mean_word_length': 2.251829268292683, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3827979', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1380, 'n_words': 469}