RT26084: Hide Suspend button on suspended holds
[sitka/overdrive-evergreen-opac.git] / src / od_pages_myopac.coffee
index beea96a..40a27ec 100644 (file)
@@ -4,10 +4,11 @@
 define [
        'jquery'
        'lodash'
 define [
        'jquery'
        'lodash'
+       'od_config'
        'jquery-ui'
        'od_action'
        'od_pages_opac'
        'jquery-ui'
        'od_action'
        'od_pages_opac'
-], ($, _) ->
+], ($, _, config) ->
 
        $.fn.extend
 
 
        $.fn.extend
 
@@ -294,11 +295,13 @@ define [
 
                _holds_row: (hold) ->
 
 
                _holds_row: (hold) ->
 
+                       suspended = if hold.holdSuspension? then 1
+
                        @find 'td.availability'
                                ._holds_row_avail1 hold
                                .end()
                        .find 'td.actions'
                        @find 'td.availability'
                                ._holds_row_avail1 hold
                                .end()
                        .find 'td.actions'
-                               ._actions hold.actions, hold.reserveId
+                               ._actions hold.actions, hold.reserveId, suspended
                                .end()
 
                # Show a title, author, or format by using the given metadata object
                                .end()
 
                # Show a title, author, or format by using the given metadata object
@@ -310,13 +313,13 @@ define [
                        return @ unless meta
 
                        $title = $ """
                        return @ unless meta
 
                        $title = $ """
-                       <a href="/eg/opac/results?query=#{meta.title};locg=10;qtype=title">#{meta.title}</a>
+                       <a href="/eg/opac/results?query=#{meta.title};qtype=title">#{meta.title}</a>
                        """
                        $thumbnail = $ """
                        <img src="#{meta.images?.thumbnail?.href}" alt="#{meta.title}" />
                        """
                        $author = $ """
                        """
                        $thumbnail = $ """
                        <img src="#{meta.images?.thumbnail?.href}" alt="#{meta.title}" />
                        """
                        $author = $ """
-                       <a href="/eg/opac/results?query=#{meta.author};locg=10;qtype=author">#{meta.author}</a>
+                       <a href="/eg/opac/results?query=#{meta.author};qtype=author">#{meta.author}</a>
                        """
                        for n in classnames
                                $n = @find ".#{n}"
                        """
                        for n in classnames
                                $n = @find ".#{n}"
@@ -357,7 +360,7 @@ define [
                                <li>Hold will expire <%= expires %></li>
                                </ul>
                        </div>
                                <li>Hold will expire <%= expires %></li>
                                </ul>
                        </div>
-                       <a href="http://downloads.bclibrary.ca/ContentDetails.htm?ID=<%= id %>">Link to Overdrive Account to change preferences</a>
+                       <a href="<%= baseURL %>?ID=<%= id %>">Link to Overdrive Account to change preferences</a>
                        """
                        @empty().append tpl
                                position:  hold.holdListPosition
                        """
                        @empty().append tpl
                                position:  hold.holdListPosition
@@ -366,6 +369,7 @@ define [
                                expires:   hold.holdExpires.fromNow()
                                placed:    hold.holdPlacedDate.fromNow()
                                activates: hold.holdSuspension?.numberOfDays.calendar()
                                expires:   hold.holdExpires.fromNow()
                                placed:    hold.holdPlacedDate.fromNow()
                                activates: hold.holdSuspension?.numberOfDays.calendar()
+                               baseURL:   config.baseURL
                                id:        hold.reserveId
 
                        # Illuminate areas of this row according to the hold status
                                id:        hold.reserveId
 
                        # Illuminate areas of this row according to the hold status
@@ -470,11 +474,12 @@ define [
                        tpl = _.template """
                        <div>Expires <%= expires_relatively %></div>
                        <div><%= expires_exactly %></div>
                        tpl = _.template """
                        <div>Expires <%= expires_relatively %></div>
                        <div><%= expires_exactly %></div>
-                       <a href="http://downloads.bclibrary.ca/ContentDetails.htm?ID=<%= id %>">Click to access online (library card required)</a>
+                       <a href="<%= baseURL %>?ID=<%= id %>">Click to access online (library card required)</a>
                        """
                        @empty().append tpl
                                expires_relatively: circ.expires.fromNow()
                                expires_exactly:    circ.expires.format 'YYYY MMM D, h:mm:ss a'
                        """
                        @empty().append tpl
                                expires_relatively: circ.expires.fromNow()
                                expires_exactly:    circ.expires.format 'YYYY MMM D, h:mm:ss a'
+                               baseURL:            config.baseURL
                                id:                 circ.reserveId
 
                # Build a <tr> element to show the available actions of an item.
                                id:                 circ.reserveId
 
                # Build a <tr> element to show the available actions of an item.