From 7be2901535662f86a14e9d4c359191664d06de69 Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Mon, 16 Jan 2017 22:23:30 +0100 Subject: [PATCH 1/3] Only highlight text and send request if phase is open --- .../legislation_annotatable.js.coffee | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/legislation_annotatable.js.coffee b/app/assets/javascripts/legislation_annotatable.js.coffee index cc238835e..5a9481e64 100644 --- a/app/assets/javascripts/legislation_annotatable.js.coffee +++ b/app/assets/javascripts/legislation_annotatable.js.coffee @@ -75,22 +75,23 @@ App.LegislationAnnotatable = $('#new_legislation_annotation #legislation_annotation_ranges').val(JSON.stringify(@annotation.ranges)) $('#comments-box').css({top: position.top - $('.calc-comments').offset().top}) - App.LegislationAnnotatable.highlight('#7fff9a') - $('#comments-box textarea').focus() + unless $('[data-legislation-open-phase]').data('legislation-open-phase') == false + App.LegislationAnnotatable.highlight('#7fff9a') + $('#comments-box textarea').focus() - $("#new_legislation_annotation").on("ajax:complete", (e, data, status, xhr) -> - if data.status == 200 - App.LegislationAnnotatable.remove_highlight() - $("#comments-box").html("").hide() - $.ajax - method: "GET" - url: annotation_url + "/annotations/" + data.responseJSON.id + "/comments" - dataType: 'script' - else - $(e.target).find('label').addClass('error') - $('' + data.responseJSON[0] + '').insertAfter($(e.target).find('textarea')) - return true - ) + $("#new_legislation_annotation").on("ajax:complete", (e, data, status, xhr) -> + if data.status == 200 + App.LegislationAnnotatable.remove_highlight() + $("#comments-box").html("").hide() + $.ajax + method: "GET" + url: annotation_url + "/annotations/" + data.responseJSON.id + "/comments" + dataType: 'script' + else + $(e.target).find('label').addClass('error') + $('' + data.responseJSON[0] + '').insertAfter($(e.target).find('textarea')) + return true + ) return ).bind(this) From 30cb7fe7b40467282fc50323795ec09539740844 Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Mon, 16 Jan 2017 22:53:27 +0100 Subject: [PATCH 2/3] Fix link --- app/views/legislation/annotations/_version_chooser.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/legislation/annotations/_version_chooser.html.erb b/app/views/legislation/annotations/_version_chooser.html.erb index 8cf4f5fc4..2b98cd90a 100644 --- a/app/views/legislation/annotations/_version_chooser.html.erb +++ b/app/views/legislation/annotations/_version_chooser.html.erb @@ -11,6 +11,6 @@ <%= t('legislation.draft_versions.show.updated_at', date: format_date(@draft_version.updated_at)) %>
- <%= link_to t('.see_text'), legislation_process_draft_version_annotations_path(process, draft_version), title: t('.see_text'), class: "button strong" %> + <%= link_to t('.see_text'), legislation_process_draft_version_path(process, draft_version), title: t('.see_text'), class: "button strong" %>
From 327fa6bce59d7b3ef8c1d921e1482356c826a51f Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Mon, 16 Jan 2017 23:34:41 +0100 Subject: [PATCH 3/3] Remove link to non existing comments --- app/views/legislation/annotations/_form.html.erb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/views/legislation/annotations/_form.html.erb b/app/views/legislation/annotations/_form.html.erb index a757b4612..f0a64e7ac 100644 --- a/app/views/legislation/annotations/_form.html.erb +++ b/app/views/legislation/annotations/_form.html.erb @@ -1,9 +1,6 @@
<%= t('legislation.annotations.comments.comments_count', count: 0) %>
- <%= link_to '#' do %> - - <% end %>