hummingbird-me/hummingbird

View on GitHub
frontend/app/templates/kotodama.hbs

Summary

Maintainability
Test Coverage
<div class="container">
  <h1>Admin Panel</h1>
</div>

<div class="container">
  <div class="row">
    <div class="col-md-4 col-sm-4">
      <div class="panel panel-default">
        <div class="panel-body">
          <ul>
            <li><a class="btn" href="/kotodama/rails_admin">Biribiri Admin</a></li>
            <li><a class="btn" href="/kotodama/sidekiq">Sidekiq Dashboard</a></li>
            <li><a class="btn" href="/kotodama/pghero">PG Hero</a></li>
            <li><a class="btn" href="/kibana">Kibana</a></li>
            <li>
              {{#link-to 'edits' class="btn"}}
                {{pluralize model.pending_count "Pending Edit" "Pending Edits"}}
              {{/link-to}}
            </li>
          </ul>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">Registrations over the last week</div>
        <div class="panel-body">
          {{ember-chart type="Line" data=graphData options=graphOptions}}
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">Daily stats</div>
        <div class="panel-body no-padding no-vpadding">
          <table class="table table-striped small-content">
            <tbody>
              <tr><td>Registrations</td><td>{{accountsNew}}</td></tr>
              <tr><td>Confirmed Accounts</td><td>{{accountsCnf}}</td></tr>
              <tr><td>Active Accounts</td><td>{{model.activeaccs}}</td></tr>
              <tr><td>Pro Users</td><td>{{model.pro_users}}</td></tr>
              <tr><td>Feed posts</td><td>{{model.feedposts}}</td></tr>
              <tr><td>Feed updates</td><td>{{model.feedcomments}}</td></tr>
              <tr><td>Feed likes</td><td>{{model.feedlikes}}</td></tr>
              <tr><td>Group joins</td><td>{{model.groupjoins}}</td></tr>
              <tr><th colspan="2">Money Shit</th></tr>
              <tr><td>Gross Revenue</td><td>${{model.pro_gross_revenue}}</td></tr>
              <tr><td>Stripe Fees</td><td>&minus; {{model.pro_stripe_fees}}</td></tr>
              <tr><td>Net Revenue</td><td>= {{model.pro_net_revenue}}</td></tr>
            </tbody>
          </table>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">Deploy Hummingbird [Current: {{model.sha_hash}}]</div>
        <div class="panel-body">
          <button class="form-control btn status-button" {{action 'deploy'}}>Good Luck!</button>
          {{#if hasDeployed}}
            <button class="btn btn-success form-control" {{action 'reload'}}>Deployment successful!</button>
          {{/if}}
          <div class="row">
            <div class="col-md-6">
              <button class="form-control btn btn-danger" {{action 'publishUpdate'}}>Make 'em Reload!</button>
            </div>
            <div class="col-md-6">
              <button class="form-control btn btn-danger" {{action 'resetBreakCounter'}}>I broke it!</button>
            </div>
          </div>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">Users to follow</div>
        <div class="panel-body no-padding no-vpadding">
          <table class="table table-striped">
            <tbody>
              {{#each usersToFollow as |user|}}
                <tr><td>
                  {{#link-to 'user' user}}{{user.username}}{{/link-to}}
                </td></tr>
              {{/each}}
            </tbody>
          </table>
        </div>
      </div>
    </div>


    <div class="col-md-8 col-sm-8">
      <div class="panel panel-default">
        <div class="panel-heading">Set Hummingbird Blotter</div>
        <div class="panel-body">
          {{#if hasBlotter}}
            <div class="row">
              <div class="col-md-8 col-xs-8">
                <blockquote>
                  {{blotterMesgFix}}
                </blockquote>
              </div>
              <div class="col-md-4 col-xs-4">
                <button class="form-control btn status-button" {{action 'clearBlotter'}}>
                  <i class="fa fa-trash"></i> Clear
                </button>
              </div>
            </div>
          {{/if}}
          <div class="row">
            <div class="col-md-6 col-xs-6">
              {{input type="text" value=blotterMesg class="form-control" placeholder="Blotter Message"}}
            </div>
            <div class="col-md-3 col-xs-3">
              {{input type="url" value=blotterLink class="form-control" placeholder="Blotter Link"}}
            </div>
            <div class="col-md-3 col-xs-3">
              <button class="form-control btn status-button" {{action 'saveBlotter'}}>Save</button>
            </div>
          </div>
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">Import from MAL</div>
        <div class="panel-body">
          <form method="get" action="/kotodama/find_or_create_by_mal">
            <div class="row">
              <div class="col-md-3 col-xs-3">
                <select name="media" size="1" class="form-control">
                  <option value="anime">Anime</option>
                  <option value="manga">Manga</option>
                </select>
              </div>
              <div class="col-md-3 col-xs-3">
                <input type="number" name="mal_id" class="form-control" placeholder="MAL ID" />
              </div>
              <div class="col-md-3 col-xs-3">
                <input type="submit" value="Import" class="form-control btn status-button" />
              </div>
              <div class="col-md-3 col-xs-3">
                {{#if nonMalAnime}}
                  <button class="form-control btn btn-default" {{action 'toggleNonMal'}}>No MAL-ID Anime</button>
                {{/if}}
              </div>
            </div>
          </form>
          {{#if showNonMal}}
            <table class="table table-striped">
              <tbody>
                {{#each nonMalAnime as |anime|}}
                  <tr><td>{{#link-to 'anime' anime.slug}}{{anime.title}}{{/link-to}}</td></tr>
                {{/each}}
              </tbody>
            </table>
          {{/if}}
        </div>
      </div>

      <div class="panel panel-default">
        <div class="panel-heading">PRO Deals Needing Refill</div>
        <div class="panel-body">
          <table class="table">
            <thead>
              <th>Partner</th>
              <th>Deal</th>
              <th colspan="2">Codes Remaining</th>
            </thead>
            <tbody>
              {{#each partnerDeals itemController="kotodama.partner-deal" as |deal|}}
                <tr>
                  <td>{{deal.model.partner_name}}</td>
                  <td>{{deal.model.deal_title}}</td>
                  <td>{{deal.model.codes_remaining}}</td>
                  <td>
                    {{#if deal.isRefilling}}
                      Refilling...
                    {{else}}
                      {{#if deal.hasRefilled}}
                        Refilled!
                      {{else}}
                        <label>
                          {{view "file-upload" action="uploadCodesFile"}}
                          <i class="fa fa-upload"></i> Refill
                        </label>
                      {{/if}}
                    {{/if}}
                  </td>
                </tr>
              {{/each}}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>