Permalink
Browse files

Add Cucumber

  • Loading branch information...
1 parent de4db9f commit baea71c3ca8aeb7f316b81577d6204b1f85b37a0 @iain committed Jan 15, 2012
View
3 app/assets/javascripts/activate_navigation.js.coffee
@@ -0,0 +1,3 @@
+window.activateNavigation = (project) ->
+ $(".project_nav").removeClass("active")
+ $("#project_nav_#{project}").addClass("active")
View
1 app/assets/javascripts/application.js.coffee
@@ -15,3 +15,4 @@
# Custom:
#
#= require renders_charts
+#= require activate_navigation
View
2 app/assets/stylesheets/_layout.sass
@@ -4,6 +4,6 @@
table.projects
@extend .zebra-striped
-#rspec-frame
+iframe
width: 100%
height: 800px
View
7 app/controllers/cucumber_controller.rb
@@ -0,0 +1,7 @@
+class CucumberController < ApplicationController
+
+ def show
+ @project = Project.find(params[:project_id])
+ end
+
+end
View
13 app/helpers/application_helper.rb
@@ -1,2 +1,15 @@
module ApplicationHelper
+
+ def data(type, value=nil)
+ { :data => { type => (value || type) } }
+ end
+
+ def active_when(logic, extra_class="")
+ if logic
+ { :class => "active #{extra_class}" }
+ else
+ { :class => extra_class }
+ end
+ end
+
end
View
15 app/views/cucumber/show.html.haml
@@ -0,0 +1,15 @@
+= render "projects/header", :project => @project, :tab => "cucumber"
+
+- if @project.cucumber_url?
+ %iframe#cucumber-frame{:src => @project.cucumber_url}
+- else
+
+ .alert-message.warning.fade.in{:data => { :alert => "alert" } }
+ = link_to "×", "#", :class => "close"
+ %p You haven't specified a Cucumber URL yet
+
+ = simple_form_for @project, :wrapper => :inline do |f|
+ = f.input :cucumber_url, :type => :url, :required => true, :placeholder => "https://...", :hint => "Probably: https://www.intranet.finalist.com/hudson/job/JOB_NAME/ws/cucumber.html", :input_html => { :class => "span12" }
+ .actions
+ = f.submit :class => "btn primary"
+ %button.btn{:type => "reset"} Cancel
View
9 app/views/layouts/application.html.haml
@@ -10,14 +10,7 @@
.topbar-inner
.container
= link_to "Stots", root_path, :class => "brand"
- %ul.nav.secondary-nav{:data => { :dropdown => "dropdown" } }
- %li.dropdown
- = link_to "Projects", projects_path, :class => "dropdown-toggle"
- %ul.dropdown-menu
- - projects.each do |project|
- %li{content_for(:project) == project.to_param ? { :class => "active" } : {} }= link_to project.name, project
- %li.divider
- %li= link_to "New project", new_project_path
+ = render "shared/navigation"
#main.container
%div{:data => { "pjax-container" => "true" } }
= yield
View
21 app/views/projects/_header.html.haml
@@ -1,16 +1,17 @@
-- provide :project, project.to_param
+:javascript
+ activateNavigation(#{project.to_param.inspect});
%h1.well
= project.name
%small= project.slug
%ul.tabs
- %li{tab == "overview" ? { :class => "active" } : {} }= link_to "Overview", project
- %li= link_to "Coverage"
- %li= link_to "Commits"
- %li= link_to "Errors"
- %li= link_to "Builds"
- %li= link_to "Stats"
- %li= link_to "Tracker"
- %li{tab == "rspec" ? { :class => "active" } : {} }= link_to "RSpec", project_rspec_path(project)
- %li= link_to "Cucumber"
+ %li{active_when(tab == "overview")}= link_to "Overview", project
+ %li{active_when(tab == "rspec")}= link_to "RSpec", project_rspec_path(project)
+ %li{active_when(tab == "cucumber")}= link_to "Cucumber", project_cucumber_path(project)
+ %li{active_when(tab == "coverage")}= link_to "Coverage", project
+ %li{active_when(tab == "commits")}= link_to "Commits", project
+ %li{active_when(tab == "errors")}= link_to "Errors", project
+ %li{active_when(tab == "builds")}= link_to "Builds", project
+ %li{active_when(tab == "stats")}= link_to "Builds", project
+ %li{active_when(tab == "tracker")}= link_to "Tracker", project
View
16 app/views/shared/_navigation.html.haml
@@ -0,0 +1,16 @@
+%ul.nav.secondary-nav{data("dropdown")}
+
+ %li.dropdown
+
+ = link_to "Projects", projects_path, :class => "dropdown-toggle"
+
+ %ul.dropdown-menu
+
+ - projects.each do |project|
+
+ %li.project_nav{:id => "project_nav_#{project.to_param}"}
+
+ = link_to project.name, project
+
+ %li.divider
+ %li= link_to "New project", new_project_path
View
1 config/routes.rb
@@ -5,6 +5,7 @@
resources :projects do
get "rspec" => "rspec#show"
+ get "cucumber" => "cucumber#show"
end
View
6 lib/charts/overview.rb
@@ -6,7 +6,7 @@ def self.[](project)
series = [ "Coverage", "Errors", "Builds" ].map { |t|
data = (1..28).map { |day|
if rand < 0.5
- [ Time.utc(2012, 1, day).to_i * 1000, rand(80) + 20.0 ]
+ [ day.days.ago.to_i * 1000, rand(80) + 20.0 ]
end
}.compact
{ :name => t, :data => data }
@@ -17,6 +17,10 @@ def self.[](project)
:type => 'spline',
:zoomType => 'x'
},
+ :credits => {
+ :enabled => false
+ },
+ :plotOptions => { :series => { :animation => { :duration => 100, :easing => :linear } } },
:title => {
:text => "Overview"
},
View
5 spec/controllers/cucumber_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe CucumberController do
+
+end

0 comments on commit baea71c

Please sign in to comment.