Skip to content

NathanielWroblewski/pivotal_tracker_widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dashing Pivotal Tracker Widget

Description

A Dashing widget to display your unstarted, started, and finished stories on Pivotal Tracker using the Ruby Pivotal Tracker gem.

Preview

Screen Shot

Useage

To use this widget, copy pivotal.coffee, pivotal.html, and pivotal.scss into the /widgets/pivotal directory of your Dashing app. This directory does not exist in new Dashing apps, so you may have to create it. Copy the pivotal.rb file into your /jobs folder, and include the Pivotal Tracker gem in your Gemfile. Edit the pivotal.rb file to include your Pivotal Tracker username, password, and full name as it appears on Pivotal Tracker.

To include the widget in a dashboard, add the following to your dashboard layout file:

#####dashboards/sample.erb

...
  <li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
    <div data-id="pivotal" data-view="Pivotal" data-title="Pivotal Tracker"></div>
  </li>
...

Requirements

Code

#####widgets/pivotal/pivotal.coffee

class Dashing.Pivotal extends Dashing.Widget

  ready: ->

  onData: (data) ->

#####widgets/pivotal/pivotal.html

<h1 class="title" data-bind="title"></h1>
<table class="table">
  <th>Unstarted</th>
  <tr data-class="pivotal" data-foreach-story="unstarted">
    <td data-bind="story | raw"></td>
  </tr>
</table>

<table>
  <th>Started</th>
  <tr data-class="pivotal" data-foreach-story="started">
    <td data-bind="story | raw"></td>
  </tr>
</table>

<table>
  <th>Finished</th>
  <tr data-class="pivotal" data-foreach-story="finished">
    <td data-bind="story | raw"></td>
  </tr>
</table>

<p class="more-info">Powered by PivotalLabs</p>
<p class="updated-at" data-bind="updatedAtMessage"></p>

#####widgets/pivotal/pivotal.scss

$background-color:  #9c4274;
$full-color:  rgba(255, 255, 255, 1);
$light-color: rgba(255, 255, 255, 0.4);

.widget-pivotal {
  background-color: $background-color;
  .title {
    color: $light-color;
  }
  table {
    margin: 30px 0px;
    tr {
      &:nth-child(even) {
        background-color: $light-color;
      }
    }
  }
  .updated-at {
    color: rgba(0, 0, 0, 0.3);
  }
}

#####jobs/pivotal.rb

require 'pivotal-tracker'

SCHEDULER.every '30m', first_in: 0 do |job|
  username  = '' # <-- Your PivotalTracker username goes here
  password  = '' # <-- Your PivotalTracker password goes here
  full_name = '' # <-- Your name as it appears in PivotalTracker

  PivotalTracker::Client.token(username, password)

  statuses = [:unstarted, :started, :finished]
  stories  = Hash.new { |hash, key| hash[key] = [] }
  projects = PivotalTracker::Project.all

  projects.each do |project|
    statuses.each do |status|
      my_stories = project.stories.all(owner: full_name, state: status.to_s)
      stories[status] << my_stories.map{ |story| story.name[0..20] + '...' }
      stories[status].flatten!
    end
  end

  send_event('pivotal', stories )
end

About

A Dashing widget to display your unstarted, started, and finished Pivotal Tracker stories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published