Class: Xport::DownloadPresenter
- Inherits:
-
Object
- Object
- Xport::DownloadPresenter
- Defined in:
- lib/xport/download_presenter.rb
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
Instance Method Summary collapse
-
#initialize(download, h) ⇒ DownloadPresenter
constructor
A new instance of DownloadPresenter.
- #progress_bar(job_id) ⇒ Object
- #progress_bar_pending ⇒ Object
Constructor Details
#initialize(download, h) ⇒ DownloadPresenter
Returns a new instance of DownloadPresenter.
7 8 9 10 |
# File 'lib/xport/download_presenter.rb', line 7 def initialize(download, h) @download = download @h = h end |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h.
5 6 7 |
# File 'lib/xport/download_presenter.rb', line 5 def h @h end |
Instance Method Details
#progress_bar(job_id) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/xport/download_presenter.rb', line 12 def (job_id) return unless job_id job = Resque::Plugins::Status::Hash.get(job_id) return unless job case job.status when Resque::Plugins::Status::STATUS_COMPLETED nil when Resque::Plugins::Status::STATUS_QUEUED else h.content_tag(:div, class: 'progress', data: { component: 'Future.ProgressBar' }) do h.content_tag(:div, class: 'progress-bar', style: "width: #{job.pct_complete}%") do "#{job.pct_complete}% #{job.}" end end end end |
#progress_bar_pending ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/xport/download_presenter.rb', line 31 def = I18n.translate( 'helpers.progress_bar.please_wait_pending', count: Resque.info[:pending] ) h.content_tag(:div, class: 'progress', data: { component: 'Future.ProgressBar' }) do h.content_tag(:div, class: 'progress-bar progress-bar-pending', style: 'width: 100%') do h.content_tag(:span, ) end end end |