GitHub PullRequestReviewCommentEvent at 2014-02-12 23:48:14
Repository: nucore-open
Actor: jhanggi
Payload: {"comment":{"url":"https://api.github.com/repos/tablexi/nucore-open/pulls/comments/9691940","id":9691940,"diff_hunk":"@@ -0,0 +1,73 @@\n+class ReservationUserActionPresenter\n+  attr_accessor :reservation, :controller\n+  delegate :order_detail, :order,\n+           :can_switch_instrument?, :can_switch_instrument_on?, :can_switch_instrument_off?,\n+           :can_cancel?, :can_move?, :can_customer_edit?, to: :reservation\n+  delegate :current_facility, to: :controller\n+\n+  delegate :link_to, to: 'ActionController::Base.helpers'\n+  include Rails.application.routes.url_helpers\n+  include ActionView::Helpers::NumberHelper\n+  include ReservationsHelper\n+\n+  def initialize(controller, reservation)\n+    @reservation = reservation\n+    @controller = controller\n+  end\n+\n+  def user_actions\n+    actions = []\n+    actions << switch_actions if can_switch_instrument?\n+    actions << cancel_link if can_cancel?\n+    actions << move_link if can_move?\n+    actions.compact.join('&nbsp;|&nbsp;').html_safe\n+  end\n+\n+  def view_edit_link\n+    if can_customer_edit?\n+      link_to reservation, edit_reservation_path\n+    else\n+      link_to reservation, view_reservation_path\n+    end\n+  end\n+\n+  private\n+\n+  def edit_reservation_path\n+    current_facility ? edit_facility_order_order_detail_reservation_path(current_facility, order, order_detail, reservation) : edit_order_order_detail_reservation_path(order, order_detail, reservation)\n+  end\n+\n+  def view_reservation_path\n+    current_facility ? facility_order_order_detail_reservation_path(current_facility, order, order_detail, reservation) : order_order_detail_reservation_path(order, order_detail, reservation)\n+  end\n+\n+  def switch_actions\n+    if can_switch_instrument_on?\n+      link_to I18n.t('reservations.switch.start'),\n+              order_order_detail_reservation_switch_instrument_path(order, order_detail, reservation, :switch => 'on')\n+    elsif can_switch_instrument_off?\n+      link_to I18n.t('reservations.switch.end'),\n+              order_order_detail_reservation_switch_instrument_path(order, order_detail, reservation, :switch => 'off'),\n+              :class => end_reservation_class(reservation),\n+              :data => { :refresh_on_cancel => true }\n+    end\n+  end\n+\n+  def cancel_link\n+    fee = order_detail.cancellation_fee\n+    if fee > 0\n+      link_to(\"Cancel\", order_order_detail_path(order, order_detail, :cancel => 'cancel'),\n+        :method => :put,\n+        :confirm => \"Canceling this reservation will incur a #{number_to_currency fee} fee.  Are you sure you wish to cancel this reservation?\")","path":"app/presenters/reservation_user_action_presenter.rb","position":61,"original_position":61,"commit_id":"acb963a9b388375ca1a9d49285984d9e827262f7","original_commit_id":"49144ddbaa02ab388ff0ba4ad2014303e6e13690","user":{"login":"jhanggi","id":1099111,"avatar_url":"https://gravatar.com/avatar/15ace0feb2dbc14991e3ed44443ba20a?d=https%3A%2F%2Fidenticons.github.com%2F6b82dcc7702de458615b3521f9baa837.png&r=x","gravatar_id":"15ace0feb2dbc14991e3ed44443ba20a","url":"https://api.github.com/users/jhanggi","html_url":"https://github.com/jhanggi","followers_url":"https://api.github.com/users/jhanggi/followers","following_url":"https://api.github.com/users/jhanggi/following{/other_user}","gists_url":"https://api.github.com/users/jhanggi/gists{/gist_id}","starred_url":"https://api.github.com/users/jhanggi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhanggi/subscriptions","organizations_url":"https://api.github.com/users/jhanggi/orgs","repos_url":"https://api.github.com/users/jhanggi/repos","events_url":"https://api.github.com/users/jhanggi/events{/privacy}","received_events_url":"https://api.github.com/users/jhanggi/received_events","type":"User","site_admin":false},"body":"Yeah, I realized that, too, and was going to fix it before you went to review this. But I got distracted when I discovered that this is never appearing. (http://pm.tablexi.com/issues/79509)","created_at":"2014-02-12T23:48:14Z","updated_at":"2014-02-12T23:48:14Z","html_url":"https://github.com/tablexi/nucore-open/pull/93#discussion_r9691940","pull_request_url":"https://api.github.com/repos/tablexi/nucore-open/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/tablexi/nucore-open/pulls/comments/9691940"},"html":{"href":"https://github.com/tablexi/nucore-open/pull/93#discussion_r9691940"},"pull_request":{"href":"https://api.github.com/repos/tablexi/nucore-open/pulls/93"}}}}