In mobile, don't load comments in the sidebar, but use the permalink page
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
App.LegislationAllegations =
|
||||
|
||||
toggle_comments: ->
|
||||
$('.draft-allegation').toggleClass('comments-on');
|
||||
$('#comments-box').html('').hide()
|
||||
if !App.LegislationAnnotatable.isMobile()
|
||||
$('.draft-allegation').toggleClass('comments-on')
|
||||
$('#comments-box').html('').hide()
|
||||
|
||||
show_comments: ->
|
||||
$('.draft-allegation').addClass('comments-on');
|
||||
if !App.LegislationAnnotatable.isMobile()
|
||||
$('.draft-allegation').addClass('comments-on')
|
||||
|
||||
initialize: ->
|
||||
$('.js-toggle-allegations .draft-panel').on
|
||||
click: (e) ->
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
App.LegislationAllegations.toggle_comments()
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if !App.LegislationAnnotatable.isMobile()
|
||||
App.LegislationAllegations.toggle_comments()
|
||||
|
||||
$('.js-toggle-allegations').on
|
||||
click: (e) ->
|
||||
# Toggle comments when the section title is visible
|
||||
if $(this).find('.draft-panel .panel-title:visible').length == 0
|
||||
App.LegislationAllegations.toggle_comments()
|
||||
if !App.LegislationAnnotatable.isMobile()
|
||||
if $(this).find('.draft-panel .panel-title:visible').length == 0
|
||||
App.LegislationAllegations.toggle_comments()
|
||||
|
||||
@@ -38,6 +38,9 @@ App.LegislationAnnotatable =
|
||||
|
||||
renderAnnotationComments: (event) ->
|
||||
$('#comments-box').css({top: event.offset - $('.calc-comments').offset().top})
|
||||
if App.LegislationAnnotatable.isMobile()
|
||||
return
|
||||
|
||||
$.ajax
|
||||
method: "GET"
|
||||
url: event.annotation_url + "/annotations/" + event.annotation_id + "/comments"
|
||||
@@ -47,6 +50,10 @@ App.LegislationAnnotatable =
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
if App.LegislationAnnotatable.isMobile()
|
||||
annotation_url = $(event.target).closest(".legislation-annotatable").data("legislation-annotatable-base-url")
|
||||
window.location.href = annotation_url + "/annotations/" + $(this).data('annotation-id')
|
||||
return
|
||||
|
||||
$('[data-annotation-id]').removeClass('current-annotation')
|
||||
$(this).addClass('current-annotation')
|
||||
@@ -59,6 +66,9 @@ App.LegislationAnnotatable =
|
||||
annotation_url: $(event.target).closest(".legislation-annotatable").data("legislation-annotatable-base-url")
|
||||
offset: $(event.target).offset()["top"]
|
||||
|
||||
isMobile: () ->
|
||||
return window.innerWidth <= 652
|
||||
|
||||
viewerExtension: (viewer) ->
|
||||
viewer._onHighlightMouseover = (event) ->
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user