Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Completing some project management

  • Loading branch information...
commit eb1ff503083c62a33fa820299dc148064a76316f 1 parent baea71c
@iain authored
View
1  Gemfile
@@ -9,6 +9,7 @@ gem 'haml'
gem 'friendly_id'
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
gem 'pjax_rails'
+gem 'inherited_resources'
group :assets do
gem 'compass', '~> 0.12.alpha.4'
View
6 Gemfile.lock
@@ -62,8 +62,12 @@ GEM
friendly_id (4.0.0)
fssm (0.2.8.1)
haml (3.1.4)
+ has_scope (0.5.1)
hike (1.2.1)
i18n (0.6.0)
+ inherited_resources (1.3.0)
+ has_scope (~> 0.5.0)
+ responders (~> 0.6.0)
journey (1.0.0)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
@@ -103,6 +107,7 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
+ responders (0.6.4)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
@@ -146,6 +151,7 @@ DEPENDENCIES
factory_girl_rails
friendly_id
haml
+ inherited_resources
jquery-rails
pjax_rails
rails (= 3.2.0.rc2)
View
BIN  app/assets/images/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  app/assets/stylesheets/_layout.sass
@@ -7,3 +7,6 @@ table.projects
iframe
width: 100%
height: 800px
+
+.simple_form input.string
+ @extend .span7
View
30 app/controllers/projects_controller.rb
@@ -3,6 +3,10 @@ class ProjectsController < ApplicationController
def index
end
+ def new
+ @project = Project.new
+ end
+
def show
@project = Project.find(params[:id])
respond_to do |format|
@@ -11,11 +15,33 @@ def show
end
end
+ def create
+ @project = Project.new(params[:project])
+ if @project.save
+ redirect_to @project, :notice => "Project was created"
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @project = Project.find(params[:id])
+ end
+
def update
@project = Project.find(params[:id])
- @project.update_attributes(params[:project])
- redirect_to :back
+ if @project.update_attributes(params[:project])
+ redirect_to :back, :notice => "Project updated"
+ else
+ flash.now[:alert] = "Project could not be updated"
+ render :edit
+ end
end
+ def destroy
+ @project = Project.find(params[:id])
+ @project.destroy
+ redirect_to root_url
+ end
end
View
1  app/models/project.rb
@@ -4,5 +4,6 @@ class Project < ActiveRecord::Base
friendly_id :name, :use => :slugged
validates_presence_of :name
+ validates_uniqueness_of :name
end
View
6 app/views/cucumber/show.html.haml
@@ -9,7 +9,5 @@
%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
+ = f.input :cucumber_url, :required => true
+ = render "shared/actions", :f => f
View
5 app/views/layouts/application.html.haml
@@ -2,6 +2,8 @@
%html
%head
%title Stots
+ %meta{:charset => "UTF-8"}
+ = favicon_link_tag "favicon.png"
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
@@ -12,5 +14,6 @@
= link_to "Stots", root_path, :class => "brand"
= render "shared/navigation"
#main.container
- %div{:data => { "pjax-container" => "true" } }
+ = render "shared/messages"
+ %div{data("pjax-container")}
= yield
View
1  app/views/projects/_header.html.haml
@@ -15,3 +15,4 @@
%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
+ %li{active_when(tab == "edit")}= link_to "Edit", edit_project_path(project)
View
15 app/views/projects/edit.html.haml
@@ -0,0 +1,15 @@
+= render "header", :project => @project, :tab => "edit"
+
+= simple_form_for @project, :wrapper => :inline do |f|
+ %fieldset
+ %legend Basic
+ = f.input :name
+
+ %fieldset
+ %legend Integrations
+ = f.input :rspec_url
+ = f.input :cucumber_url
+
+ = render "shared/actions", :f => f
+
+.well= link_to "Delete Project", project_path(@project), :method => :delete, :class => "btn danger", :confirm => "Damn, girl! Are you sure?"
View
10 app/views/projects/new.html.haml
@@ -0,0 +1,10 @@
+:javascript
+ activateNavigation("new");
+
+%h1.well New Project
+
+= simple_form_for @project, :wrapper => :inline do |f|
+
+ = f.input :name, :autofocus => true
+
+ = render "shared/actions", :f => f
View
9 app/views/rspec/show.html.haml
@@ -4,13 +4,10 @@
%iframe#rspec-frame{:src => @project.rspec_url}
- else
- .alert-message.warning.fade.in{:data => { :alert => "alert" } }
+ .alert-message.warning.fade.in{data("alert")}
= link_to "×", "#", :class => "close"
%p You haven't specified an RSpec URL yet
= simple_form_for @project, :wrapper => :inline do |f|
- = f.input :rspec_url, :type => :url, :required => true, :placeholder => "https://...", :hint => "Probably: https://www.intranet.finalist.com/hudson/job/JOB_NAME/ws/rspec.html", :input_html => { :class => "span12" }
- .actions
- = f.submit :class => "btn primary"
- %button.btn{:type => "reset"} Cancel
-
+ = f.input :rspec_url, :required => true
+ = render "shared/actions", :f => f
View
3  app/views/shared/_actions.html.haml
@@ -0,0 +1,3 @@
+.actions
+ = f.submit :class => "btn primary"
+ %button.btn{:type => "reset"} Cancel
View
9 app/views/shared/_messages.html.haml
@@ -0,0 +1,9 @@
+- if flash[:notice]
+ .alert-message.success.fade.in{data("alert")}
+ = link_to "×", "#", :class => "close"
+ %p= flash[:notice]
+
+- if flash[:alert]
+ .alert-message.error.fade.in{data("alert")}
+ = link_to "×", "#", :class => "close"
+ %p= flash[:alert]
View
2  app/views/shared/_navigation.html.haml
@@ -13,4 +13,4 @@
= link_to project.name, project
%li.divider
- %li= link_to "New project", new_project_path
+ %li#project_nav_new.project_nav= link_to "New project", new_project_path
View
11 config/locales/cucumber.yml
@@ -0,0 +1,11 @@
+en:
+ simple_form:
+ labels:
+ project:
+ cucumber_url: Cucumber URL
+ placeholders:
+ project:
+ cucumber_url: "https://..."
+ hints:
+ project:
+ cucumber_url: "Probably: https://www.intranet.finalist.com/hudson/job/JOB_NAME/ws/cucumber.html"
View
11 config/locales/rspec.yml
@@ -0,0 +1,11 @@
+en:
+ simple_form:
+ labels:
+ project:
+ rspec_url: RSpec URL
+ placeholders:
+ project:
+ rspec_url: "https://..."
+ hints:
+ project:
+ rspec_url: "Probably: https://www.intranet.finalist.com/hudson/job/JOB_NAME/ws/rspec.html"
View
0  public/favicon.ico
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.