Cleanup - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 4ec2811346db3eb0dfc986bb0186f7e4f853ba25
DIR parent 998186ba0c645f43c40f405c476b0747bba24f3f
HTML Author: HD Moore <hd_moore@rapid7.com>
Date: Mon, 7 Jan 2013 12:24:40 -0600
Cleanup
Diffstat:
M app/helpers/application_helper.rb | 52 -------------------------------
M app/models/job.rb | 2 +-
M app/views/projects/index.html.erb | 6 +++---
M app/views/shared/_call_type.html.e… | 2 +-
4 files changed, 5 insertions(+), 57 deletions(-)
---
DIR diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
@@ -109,62 +109,10 @@ module ApplicationHelper
end
end
-
def escape_javascript_dq(str)
escape_javascript(str.strip).gsub("\\'", "'").gsub("\t", " ")
end
- #
- # Generate pagination links
- #
- # Parameters:
- # :name:: the kind of the items we're paginating
- # :items:: the collection of items currently on the page
- # :count:: total count of items to paginate
- # :offset:: offset from the beginning where +items+ starts within the total
- # :page:: current page
- # :num_pages:: total number of pages
- #
- def page_links(opts={})
- link_method = opts[:link_method]
- if not link_method or not respond_to? link_method
- raise RuntimeError.new("Need a method for generating links")
- end
- name = opts[:name] || ""
- items = opts[:items] || []
- count = opts[:count] || 0
- offset = opts[:offset] || 0
- page = opts[:page] || 1
- num_pages = opts[:num_pages] || 1
-
- page_list = ""
- 1.upto(num_pages) do |p|
- if p == page
- page_list << content_tag(:span, :class=>"current") { h page }
- else
- page_list << self.send(link_method, p, { :page => p })
- end
- end
- content_tag(:div, :id => "page_links") do
- content_tag(:span, :class => "index") do
- if items.size > 0
- "#{offset + 1}-#{offset + items.size} of #{h pluralize(count, name)}" + " "*3
- else
- h(name.pluralize)
- end.html_safe
- end +
- if num_pages > 1
- self.send(link_method, '', { :page => 0 }, { :class => 'start' }) +
- self.send(link_method, '', { :page => page-1 }, {:class => 'prev' }) +
- page_list +
- self.send(link_method, '', { :page => [page+1,num_pages].min }, { :class => 'next' }) +
- self.send(link_method, '', { :page => num_pages }, { :class => 'end' })
- else
- ""
- end
- end
- end
-
def submit_checkboxes_to(name, path, html={})
if html[:confirm]
confirm = html.delete(:confirm)
DIR diff --git a/app/models/job.rb b/app/models/job.rb
@@ -107,7 +107,7 @@ class Job < ActiveRecord::Base
:scope => self.scope, # job / project/ global
:force => !!(self.force), # true / false
:target_id => self.target_id.to_i, # job_id or project_id or nil
- :target_ids => self.target_ids.map{|x| x.to_i }
+ :target_ids => (self.target_ids || []).map{|x| x.to_i }
})
return self.save
else
DIR diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
@@ -20,9 +20,9 @@
<tr>
<td><%= link_to( h(project.name), project_path(project)) %></td>
<td><%=truncate(project.description, :length => 40, :separator => '') %></td>
- <td><%= project.jobs.count %></td>
- <td><%= project.calls.count %></td>
- <td><%= project.calls.where('analysis_completed_at IS NOT NULL').count %></td>
+ <td><%= number_with_delimiter(project.jobs.count) %></td>
+ <td><%= number_with_delimiter(project.calls.count) %></td>
+ <td><%= number_with_delimiter(project.calls.where('analysis_completed_at IS NOT NULL').count) %></td>
<td><%= project.updated_at.localtime.strftime("%Y-%m-%d %H:%M:%S") %></td>
<td>
<a class="btn" href="<%= edit_project_path(project) %>"rel="tooltip" title="Update Project Information"><i class="icon-pencil"></i></a>
DIR diff --git a/app/views/shared/_call_type.html.erb b/app/views/shared/_call_type.html.erb
@@ -11,4 +11,4 @@ ttip << raw("<div class='task_args_val'>") + h(call.audio_length.to_s) + raw("&n
ttip << raw("<div class='task_args_var'>Ring:</div> ")
ttip << raw("<div class='task_args_val'>") + h(call.ring_length.to_s) + raw(" </div>")
ttip << raw("</div>\n")
-%><%= raw("<span class='xpopover' rel='popover' data-title=\"#{h call.number.to_s }\" data-content=\"#{ttip}\"><strong>#{h call.line_type.upcase }</strong></span>") -%>
+%><%= raw("<span class='xpopover' rel='popover' data-title=\"#{h call.number.to_s }\" data-content=\"#{ttip}\"><strong>#{h call.line_type.to_s.upcase }</strong></span>") -%>