Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactored the helper methods a bit (and moved one helper method to t…

…he model where it belongs).
  • Loading branch information...
commit f243f9b9b1f1bd0bfec34e408f87a3d94eb1ab6c 1 parent 335cf2c
@srushti authored
View
4 app/helpers/application_helper.rb
@@ -14,4 +14,8 @@ def status(s)
def format_timestamp(timestamp)
timestamp.nil? ? '' : content_tag(:span, "#{time_ago_in_words(timestamp)} ago", :class => 'timestamp', :title => timestamp.strftime("%a, %Y/%m/%d %I:%M%p %Z"))
end
+
+ def force_build_text(project)
+ "force build#{project.build_queued? ? ' (build queued)' : ''}"
+ end
end
View
4 app/helpers/home_helper.rb
@@ -6,9 +6,5 @@ def project_status_image(status)
image_tag "#{status}.png", :alt => status, :title => status
end
end
-
- def build_queued?(project)
- project.build_requested? && project.latest_build_status != 'building'
- end
end
View
4 app/models/project.rb
@@ -145,6 +145,10 @@ def self.configure
(Project.temp_config ||= Configuration.new).tap{|config| yield config}
end
+ def build_queued?
+ build_requested? && latest_build_status != 'building'
+ end
+
def activity
{'passed' => 'Sleeping', 'timeout' => 'Sleeping', 'failed' => 'Sleeping', 'building' => 'Building'}[latest_build_status] || 'Unknown'
end
View
2  app/views/builds/show.html.haml
@@ -1,6 +1,6 @@
%div.project_heading{:class => "#{build_status(@build)}"}
%form.force_build{:method => 'post', :action => project_force_path(@project.name)}
- %input{:type => 'submit', :value => "force build#{build_queued?(@project) ? ' (build queued)' : ''}"}
+ %input{:type => 'submit', :value => force_build_text(@project), :class => 'force_build' }
%h2.project
= @project.name
%em.project_ruby (#{@project.ruby})
View
2  app/views/home/_projects.html.haml
@@ -6,7 +6,7 @@
= submit_tag 'cancel build'
- else
= form_tag project_force_path(project.name) do
- = submit_tag "force build#{build_queued?(project) ? ' (build queued)' : ''}"
+ = submit_tag force_build_text(project), :class => 'force_build'
%span.status-icon
 
%span.project-name{:class => status}
Please sign in to comment.
Something went wrong with that request. Please try again.