Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cibernox/pinkmine
base: b7adf71fdd
...
head fork: cibernox/pinkmine
compare: e5d988496a
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 08, 2012
miguel.camba More changes while in the train 4c3f0f9
miguel.camba Merge branch 'master' of github.com:cibernox/pinkmine
Conflicts:
	app/views/projects/index.html.haml
	app/views/projects/show.html.haml
e5d9884
View
1  Gemfile
@@ -38,6 +38,7 @@ group :development do
gem 'guard-spork'
gem 'guard-rspec'
gem 'quiet_assets'
+ gem 'guard-livereload'
end
group :test do
View
9 Gemfile.lock
@@ -37,6 +37,7 @@ GEM
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
+ addressable (2.2.8)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.0)
@@ -61,6 +62,9 @@ GEM
debugger-ruby_core_source (1.1.2)
decent_exposure (1.0.2)
diff-lcs (1.1.3)
+ em-websocket (0.3.6)
+ addressable (>= 2.1.1)
+ eventmachine (>= 0.12.9)
email_validator (1.3.0)
activemodel
erubis (2.7.0)
@@ -80,6 +84,10 @@ GEM
guard (1.0.1)
ffi (>= 0.5.0)
thor (~> 0.14.6)
+ guard-livereload (0.4.2)
+ em-websocket (>= 0.2.0)
+ guard (>= 0.10.0)
+ multi_json (~> 1.0)
guard-rspec (0.7.0)
guard (>= 0.10.0)
guard-spork (0.7.1)
@@ -230,6 +238,7 @@ DEPENDENCIES
email_validator
factory_girl_rails
foreigner
+ guard-livereload
guard-rspec
guard-spork
haml-rails
View
8 Guardfile
@@ -1,6 +1,14 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
+
+guard 'livereload' do
+ watch(%r{app/.+\.(erb|haml)})
+ watch(%r{app/helpers/.+\.rb})
+ watch(%r{public/.+\.(css|js|html)})
+ watch(%r{config/locales/.+\.yml})
+end
+
guard 'spork', cucumber_env: { 'RAILS_ENV' => 'test' }, rspec_env: { 'RAILS_ENV' => 'test' }, test_unit: false do
watch('config/application.rb')
watch('config/environment.rb')
View
BIN  app/assets/images/t.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
13 app/helpers/application_helper.rb
@@ -28,6 +28,19 @@ def default_text_for_bootstrap_alert(level)
text.html_safe
end
+ # Returns a class to style with twitter bootstrap the color of a progress bar
+ # Colors changes this way: red (low), orange(medium), green(high) and blue(complete)
+ def issue_progress_bar_class(issue)
+ color = case issue.percentage
+ when 0..33 then 'progress-danger'
+ when 34..66 then 'progress-warning'
+ when 67..99 then 'progress-success'
+ else 'progress-info'
+ end
+ striped = 'progress-striped active' if issue.in_progress?
+ "#{striped} #{color}"
+ end
+
# Renderiza un alert estilado para bootstrap, con boton de cerrar.
def bootstrap_alert(text = nil, level = nil)
text ||= default_text_for_bootstrap_alert(level)
View
6 app/models/issue.rb
@@ -40,6 +40,12 @@ class Issue < ActiveRecord::Base
#
# Instance metods
#
+ VALID_STATUS.each do |status|
+ define_method("#{status}?") do
+ self.status == status
+ end
+ end
+
def opened?
%w( unstarted in_progress resolved feedback ).include?(status)
end
View
2  app/views/projects/index.html.haml
@@ -16,7 +16,7 @@
.span10
%ul.thumbnails
%li.span2= link_to image_tag('la_o.png'), projects.first, class: 'thumbnail'
- %li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
+ %li.span2= link_to image_tag('t.png'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
%li.span2= link_to image_tag('256x256.gif'), '#', class: 'thumbnail'
View
10 app/views/projects/show.html.haml
@@ -24,7 +24,8 @@
%th Status
%th Title
%th Description
- %th Responsable
+ %th Assigned
+ %th Progress
%th Updated at
%tbody
- project.issues.each do |issue|
@@ -40,6 +41,9 @@
= link_to 'Done', '#'
= link_to 'Feedback', '#'
%td= link_to issue.title, [project, issue]
- %td= truncate(issue.description, length: 60)
+ %td= truncate(issue.description, length: 50)
%td= link_to issue.responsable, issue.responsable if issue.responsable
- %td.no_br= issue.updated_at.strftime '%d/%m/%y %H:%M'
+ %td
+ .progress{ style: "width: 150px", class: issue_progress_bar_class(issue) }
+ .bar{ style: "width: #{issue.percentage}%"} #{issue.percentage}%
+ %td= issue.updated_at.strftime '%d/%m/%y %H:%M'
View
20 spec/helpers/application_helper_spec.rb
@@ -35,6 +35,26 @@
end
end
+ describe '#progress_bar_class' do
+ it "return an class for a progress bar based on a percentage of progress" do
+ issue_progress_bar_class(Issue.new(percentage: 0)).should =~ /progress-danger/
+ issue_progress_bar_class(Issue.new(percentage: 33)).should =~ /progress-danger/
+ issue_progress_bar_class(Issue.new(percentage: 34)).should =~ /progress-warning/
+ issue_progress_bar_class(Issue.new(percentage: 66)).should =~ /progress-warning/
+ issue_progress_bar_class(Issue.new(percentage: 67)).should =~ /progress-success/
+ issue_progress_bar_class(Issue.new(percentage: 99)).should =~ /progress-success/
+ issue_progress_bar_class(Issue.new(percentage: 100)).should =~ /progress-info/
+ end
+ it "should return a class for a active and striped bar if the issue is in progress" do
+ html_class = issue_progress_bar_class(Issue.new(percentage: 50, status: 'in_progress'))
+ html_class.should =~ /active/
+ html_class.should =~ /progress-striped/
+ html_class = issue_progress_bar_class(Issue.new(percentage: 50, status: 'done'))
+ html_class.should_not =~ /active/
+html_class.should_not =~ /progress-striped/
+ end
+ end
+
describe '#bootstrap_flashes' do
let(:flashes){ helper.bootstrap_flashes }
it "should display an alert for each kind of flash entry" do

No commit comments for this range

Something went wrong with that request. Please try again.