Skip to content
Snippets Groups Projects
Select Git revision
  • ag-test
  • rs-test
  • master default protected
  • test-me-pa
  • mksionek-master-patch-52381
  • new-branch-10
  • test-conflicts
  • test-suggestions
  • alejandro-test
  • patch-25
  • winh-test-image-doscussion
  • stg-lfs-image-test-2
  • stg-lfs-image-test
  • test42016
  • issue_42016
  • issue-32709
  • add-codeowners
  • ClemMakesApps-master-patch-62759
  • bvl-staging-test
  • bvl-merge-base-api
  • v9.2.0-rc6 protected
  • v9.2.0-rc5 protected
  • v9.2.0-rc4 protected
  • v9.2.0-rc3 protected
  • v9.1.4 protected
  • v9.2.0-rc2 protected
  • v9.2.0-rc1 protected
  • v9.1.3 protected
  • v8.17.6 protected
  • v9.0.7 protected
  • v9.1.2 protected
  • v9.1.1 protected
  • v9.2.0.pre protected
  • v9.1.0 protected
  • v9.1.0-rc7 protected
  • v9.1.0-rc6 protected
  • v9.0.6 protected
  • v9.1.0-rc5 protected
  • v9.1.0-rc4 protected
  • v9.1.0-rc3 protected
40 results

user_tabs.js.coffee

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    user_tabs.js.coffee 4.33 KiB
    # UserTabs
    #
    # Handles persisting and restoring the current tab selection and lazily-loading
    # content on the Users#show page.
    #
    # ### Example Markup
    #
    #   <ul class="nav-links">
    #     <li class="activity-tab active">
    #       <a data-action="activity" data-target="#activity" data-toggle="tab" href="/u/username">
    #         Activity
    #       </a>
    #     </li>
    #     <li class="groups-tab">
    #       <a data-action="groups" data-target="#groups" data-toggle="tab" href="/u/username/groups">
    #         Groups
    #       </a>
    #     </li>
    #     <li class="contributed-tab">
    #       <a data-action="contributed" data-target="#contributed" data-toggle="tab" href="/u/username/contributed">
    #         Contributed projects
    #       </a>
    #     </li>
    #     <li class="projects-tab">
    #       <a data-action="projects" data-target="#projects" data-toggle="tab" href="/u/username/projects">
    #         Personal projects
    #       </a>
    #     </li>
    #    <li class="snippets-tab">
    #       <a data-action="snippets" data-target="#snippets" data-toggle="tab" href="/u/username/snippets">
    #       </a>
    #     </li>
    #   </ul>
    #
    #   <div class="tab-content">
    #     <div class="tab-pane" id="activity">
    #       Activity Content
    #     </div>
    #     <div class="tab-pane" id="groups">
    #       Groups Content
    #     </div>
    #     <div class="tab-pane" id="contributed">
    #       Contributed projects content
    #     </div>
    #     <div class="tab-pane" id="projects">
    #       Projects content
    #     </div>
    #     <div class="tab-pane" id="snippets">
    #       Snippets content
    #     </div>
    #   </div>
    #
    #   <div class="loading-status">
    #     <div class="loading">
    #       Loading Animation
    #     </div>
    #   </div>
    #
    class @UserTabs
      constructor: (opts) ->
        {
          @action = 'activity'
          @defaultAction = 'activity'
          @parentEl = $(document)
        } = opts
    
        # Make jQuery object if selector is provided
        @parentEl = $(@parentEl) if typeof @parentEl is 'string'
    
        # Store the `location` object, allowing for easier stubbing in tests