preston/bittorious

View on GitHub
app/views/welcome/torrents.html.slim

Summary

Maintainability
Test Coverage

.row ng-show="selectedFeed"
    .col-md-9
        h1 ng-bind="selectedFeed.name"
        p ng-bind="selectedFeed.description"
        pre
            h4
              i.icon.icon-rss
              |  Data RSS Feed
            a href="{{$location.host}}/feeds/{{selectedFeed.id}}.rss?authentication_token=#{current_user.authentication_token}"
                | {{urlRoot}}/feeds/{{selectedFeed.id}}.rss?authentication_token=#{current_user.authentication_token}

        p.help-block If you'd like to subscribe to this entire feed, jam this URL into your BitTorrent client! (Shhhh.. don't share it! This URL is specifically for YOU, and includes a secret token that should not be shared.)
        i
            span
                | Public volunteer archiving is 
                b
                    | {{selectedFeed.enable_public_archiving ? 'enabled' : 'disabled'}}.
            span ng-show="selectedFeed.enable_public_archiving"
                | , with a target replication percentage of  
                b ng-bind="selectedFeed.replication_percentage" 
                | % per peer per torrent.
            br
            span The feed ID is: 
              b ng-bind="selectedFeed.id"

    .col-md-3
        div ng-show="selectedFeed.can_update"
            h1  
            button.btn.btn-primary href="#create_torrent_dialog" role="button" ng-click="newTorrentDialog()"
                span.glyphicon.glyphicon-upload
                |  Register a torrent.

            p.help-block
                small To publish a new data .torrent to this feed, create the .torrent metadata file on your local machine, and then upload it via this dialog.
.row

    .col-md-12
        h1.lead ng-show="selectedFeed.torrents.length == 0" No torrents have been published to     {{selectedFeed.name}}!
        table.table.table-condensed#feed_torrents ng-show="selectedFeed.torrents.length > 0"
          thead
            tr
                th
                    a ng-click="reverse = !reverse; predicate = 'name'; " Name
                th
                    a ng-click="reverse = !reverse; predicate = 'user.name'; " Publisher
                th
                    a ng-click="reverse = !reverse; predicate = 'seed_count'; " Seeders
                th
                    a ng-click="reverse = !reverse; predicate = 'peer_count'; " Leechers
                th
                    a ng-click="reverse = !reverse; predicate = 'size'; " Size
                th Download
          tbody
            tr.torrent_link ng-repeat="torrent in selectedFeed.torrents | orderBy:predicate:reverse" ng-click="selectTorrent(torrent)" ng-class="{selected: torrent.id === selectedTorrent.id}"
              td
                b ng-bind="torrent.name"
                small ng-bind="torrent.description"
              td ng-bind="torrent.user.name"
              td ng-bind="torrent.seed_count"
              td ng-bind="torrent.peer_count"
              td ng-bind="torrent.size | humanizeBytes"
              td
                  a.btn.btn-primary href="/feeds/{{selectedFeed.id}}/torrents/{{torrent.id}}.torrent" = text_with_icon('Download', 'download')

    .col-md-6 ng-show="selectedTorrent.active_peers.length == 0"
        h1 No peers for this torrent.
        .lead Time to make some friends?

    .col-lg-6#active_peers ng-show="selectedTorrent.active_peers.length > 0"
        h3
            |  Authenticated Peers
            span.badge ng-bind="selectedTorrent.active_peer_count(true)"
        #table_container
            table.table.table-condensed
                thead
                  tr
                      th
                        a ng-click="reverse = !reverse; predicate = 'user.name'; " User
                    th
                        a ng-click="reverse = !reverse; predicate = 'ip'; " IP Address
                    th
                        a ng-click="reverse = !reverse; predicate = 'city_name'; " Location
                    th
                        a ng-click="reverse = !reverse; predicate = 'active_peers.length'; " Status
                    th
                        a ng-click="reverse = !reverse; predicate = 'left'; " Needs
                    th
                        a ng-click="reverse = !reverse; predicate = 'uploaded'; " Uploaded
                    / th
                        a ng-click="reverse = !reverse; predicate = 'updated_at'; " Last Registered
                tbody
                    tr ng-repeat="peer in selectedTorrent.active_peers" ng-show="!peer.volunteer_enabled"
                        td ng-bind="peer.user.name"
                        td
                            span ng-bind="peer.ip"
                            | :
                            span ng-bind="peer.port"
                            br
                            small#latitude ng-bind="peer.latitude" ng-show="peer.latitude"
                            small#longitude ng-bind="peer.longitude" ng-show="peer.longitude"
                        td
                            b#latitude ng-bind="peer.city_name" ng-show="peer.city_name"
                            br
                            small#longitude ng-bind="peer.country_name" ng-show="peer.country_name"
                        td
                            span ng-show="peer.left > 0" Leeching
                            span ng-show="peer.left == 0" Seeding
                        td ng-bind="peer.left | humanizeBytes"
                        td ng-bind="peer.uploaded | humanizeBytes"

        h3
            |  Volunteer Peers
            span.badge ng-bind="selectedTorrent.active_peer_count(false)"
        #table_container
            table.table.table-condensed
                thead
                  tr
                    th
                        a ng-click="reverse = !reverse; predicate = 'ip'; " IP Address
                    th
                        a ng-click="reverse = !reverse; predicate = 'city_name'; " Location
                    th
                        a ng-click="reverse = !reverse; predicate = 'active_peers.length'; " Status
                    th
                        a ng-click="reverse = !reverse; predicate = 'pieces'; " Affinity Offset
                    th
                        a ng-click="reverse = !reverse; predicate = 'volunteer_disk_used_bytes'; " Total Usage
                tbody
                    tr ng-repeat="peer in selectedTorrent.active_peers" ng-show="peer.volunteer_enabled"
                        td ng-bind="peer.user.name"
                        td
                            span ng-bind="peer.ip"
                            | :
                            span ng-bind="peer.port"
                            br
                            small#latitude ng-bind="peer.latitude" ng-show="peer.latitude"
                            small#longitude ng-bind="peer.longitude" ng-show="peer.longitude"
                        td
                            b#latitude ng-bind="peer.city_name" ng-show="peer.city_name"
                            br
                            small#longitude ng-bind="peer.country_name" ng-show="peer.country_name"
                        td
                            span ng-show="peer.left > 0" Leeching
                            span ng-show="peer.left == 0" Seeding
                        td
                            span ng-bind="peer.volunteer_disk_used_bytes | humanizeBytes"
                            | /
                            span ng-bind="peer.volunteer_disk_maximum_bytes | humanizeBytes"
                        td
                            span ng-bind="peer.volunteer_affinity_offset | humanizeBytes"
                            |  + 
                            span ng-bind="peer.volunteer_affinity_length | humanizeBytes"

    .col-lg-6#torrent_details ng-show="selectedTorrent"
        h3 ng-bind="selectedTorrent.name"
        a.btn.btn-primary ng-click="updateTorrent()" ng-show="selectedTorrent.can_update"
                    = text_with_icon('Save', 'floppy-disk')
        a.btn.btn-danger.pull-right ng-click="deleteTorrent(selectedTorrent)" ng-show="selectedFeed.can_update" ng-confirm-click="Are you sure?"
                    = text_with_icon('Delete', 'trash')
        form#edit_torrent_form role="form" ng-submit="updateTorrent()"
            .form-group
                label for="name" Name
                input#torrent_name.form-control type="text" ng-model="selectedTorrent.name" ng-show="selectedFeed.can_update"
        dl.dl-horizontal
            dt Created
            dd ng-bind="selectedTorrent.created_at | relativeDate"
            dt Updated
            dd ng-bind="selectedTorrent.updated_at | relativeDate"
            dt Publisher
            dd ng-bind="selectedTorrent.user.name"
            dt Created With
            dd ng-bind="selectedTorrent.file_created_by"
            dt Pieces
            dd ng-bind="selectedTorrent.pieces"
            dt Piece Size
            dd ng-bind="selectedTorrent.piece_length | humanizeBytes"
            dt Feed
            dd ng-bind="selectedFeed.name"
            dt Info Hash
            dd ng-bind="selectedTorrent.info_hash"


    .col-md-12 ng-show="selectedTorrent.active_peers.length > 0"
        h3 Peer Map
        #map_canvas