From d37f2228a169ad59aaf85d27add6f976964d1c90 Mon Sep 17 00:00:00 2001 From: xtine Date: Wed, 6 Apr 2016 17:04:13 -0600 Subject: [PATCH 1/5] janky way for read tab to work in review page --- .../static/regulations/css/less/module/comment.less | 5 +++++ .../js/source/views/comment/comment-review-view.js | 9 +++++++-- .../js/source/views/header/preamble-head-view.js | 3 ++- regulations/templates/regulations/preamble-chrome.html | 6 +----- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/regulations/static/regulations/css/less/module/comment.less b/regulations/static/regulations/css/less/module/comment.less index 4991be8d1..1f22f177f 100644 --- a/regulations/static/regulations/css/less/module/comment.less +++ b/regulations/static/regulations/css/less/module/comment.less @@ -310,6 +310,11 @@ a.comment-index-review { line-height: 18px; text-transform: inherit; width: 425px; + + &:hover { + cursor: pointer; + text-decoration: underline; + } } .details { diff --git a/regulations/static/regulations/js/source/views/comment/comment-review-view.js b/regulations/static/regulations/js/source/views/comment/comment-review-view.js index 6fbfd6900..469fe4c22 100644 --- a/regulations/static/regulations/js/source/views/comment/comment-review-view.js +++ b/regulations/static/regulations/js/source/views/comment/comment-review-view.js @@ -6,10 +6,9 @@ var _ = require('underscore'); var Backbone = require('backbone'); Backbone.$ = $; -var comments = require('../../collections/comment-collection'); - var PreambleHeadView = require('../header/preamble-head-view'); var CommentEvents = require('../../events/comment-events'); +var comments = require('../../collections/comment-collection'); var CommentReviewView = Backbone.View.extend({ events: { @@ -27,6 +26,8 @@ var CommentReviewView = Backbone.View.extend({ this.previewLoading = false; + this.listenTo(CommentEvents, 'read:proposal', this.handleRead); + this.render(); }, @@ -34,6 +35,10 @@ var CommentReviewView = Backbone.View.extend({ this.$status = this.$el.find('.status'); }, + handleRead: function() { + location.href = '../../preamble/' + this.docId + '/I'; + }, + render: function() { var commentData = comments.toJSON({docId: this.docId}); var html = this.template({ diff --git a/regulations/static/regulations/js/source/views/header/preamble-head-view.js b/regulations/static/regulations/js/source/views/header/preamble-head-view.js index 4000e30ff..ac907fe78 100644 --- a/regulations/static/regulations/js/source/views/header/preamble-head-view.js +++ b/regulations/static/regulations/js/source/views/header/preamble-head-view.js @@ -38,7 +38,8 @@ var PreambleHeadView = Backbone.View.extend({ }, readProposal: function() { - if ($('#preamble-write').is(':visible')) { + // yeah... need a better way to manage this. - xtine + if ($('#preamble-write').is(':visible') || $('#comment-review').length) { this.readTabOpen(); CommentEvents.trigger('read:proposal'); diff --git a/regulations/templates/regulations/preamble-chrome.html b/regulations/templates/regulations/preamble-chrome.html index 1ec25aeb3..6a1f998a5 100644 --- a/regulations/templates/regulations/preamble-chrome.html +++ b/regulations/templates/regulations/preamble-chrome.html @@ -13,11 +13,7 @@
  • CFR
  • {% endblock %} -{% block wayfinding %} -{{doc_number}} - -{% endblock %} - +{% block wayfinding %}{% endblock %} {% block header-secondary %} {% include "regulations/preamble-header.html" %} From a72b6660d735f7e41b09bcbfd9ba3fb0a2806eee Mon Sep 17 00:00:00 2001 From: xtine Date: Wed, 6 Apr 2016 20:54:33 -0600 Subject: [PATCH 2/5] review page: better way to go back to read preamble --- .../js/source/views/comment/comment-review-view.js | 12 +++++++++++- .../templates/regulations/comment-review-chrome.html | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/regulations/static/regulations/js/source/views/comment/comment-review-view.js b/regulations/static/regulations/js/source/views/comment/comment-review-view.js index 469fe4c22..6404c9d4a 100644 --- a/regulations/static/regulations/js/source/views/comment/comment-review-view.js +++ b/regulations/static/regulations/js/source/views/comment/comment-review-view.js @@ -6,6 +6,8 @@ var _ = require('underscore'); var Backbone = require('backbone'); Backbone.$ = $; +var MainEvents = require('../../events/main-events'); +var DrawerEvents = require('../../events/drawer-events'); var PreambleHeadView = require('../header/preamble-head-view'); var CommentEvents = require('../../events/comment-events'); var comments = require('../../collections/comment-collection'); @@ -36,7 +38,15 @@ var CommentReviewView = Backbone.View.extend({ }, handleRead: function() { - location.href = '../../preamble/' + this.docId + '/I'; + var section = this.docId + '-preamble-' + this.docId + '-I'; + var options = {id: section, section: section, mode: 'read'}; + + $('#content-body').removeClass('comment-review-wrapper').addClass('preamble-wrapper'); + + MainEvents.trigger('section:open', section, options, 'preamble-section'); + DrawerEvents.trigger('section:open', options.section); + DrawerEvents.trigger('pane:change', 'table-of-contents'); + }, render: function() { diff --git a/regulations/templates/regulations/comment-review-chrome.html b/regulations/templates/regulations/comment-review-chrome.html index 03d9a4131..0d04813bb 100644 --- a/regulations/templates/regulations/comment-review-chrome.html +++ b/regulations/templates/regulations/comment-review-chrome.html @@ -9,6 +9,8 @@ class="drawer-toggle-icon" alt="Table of Contents toggle" /> {% endblock %} +{% block wayfinding %}{% endblock %} + {% block header-secondary %} {% include "regulations/preamble-header.html" %} {% endblock %} From c7543f11cc2aed2368496d91374aaf320701797d Mon Sep 17 00:00:00 2001 From: xtine Date: Wed, 6 Apr 2016 21:13:18 -0600 Subject: [PATCH 3/5] review page: edit comment links --- .../js/source/views/comment/comment-review-view.js | 14 +++++++++++--- .../regulations/comment-review-chrome.html | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/regulations/static/regulations/js/source/views/comment/comment-review-view.js b/regulations/static/regulations/js/source/views/comment/comment-review-view.js index 6404c9d4a..4b9ffb351 100644 --- a/regulations/static/regulations/js/source/views/comment/comment-review-view.js +++ b/regulations/static/regulations/js/source/views/comment/comment-review-view.js @@ -7,13 +7,13 @@ var Backbone = require('backbone'); Backbone.$ = $; var MainEvents = require('../../events/main-events'); -var DrawerEvents = require('../../events/drawer-events'); var PreambleHeadView = require('../header/preamble-head-view'); var CommentEvents = require('../../events/comment-events'); var comments = require('../../collections/comment-collection'); var CommentReviewView = Backbone.View.extend({ events: { + 'click .edit-comment': 'editComment', 'click .preview-button': 'preview', 'click .submit-button': 'submit' }, @@ -44,9 +44,16 @@ var CommentReviewView = Backbone.View.extend({ $('#content-body').removeClass('comment-review-wrapper').addClass('preamble-wrapper'); MainEvents.trigger('section:open', section, options, 'preamble-section'); - DrawerEvents.trigger('section:open', options.section); - DrawerEvents.trigger('pane:change', 'table-of-contents'); + }, + + editComment: function(e) { + var section = $(e.target).closest('li').data('section'); + var options = {id: section, section: section, mode: 'write'}; + + $('#content-body').removeClass('comment-review-wrapper').addClass('preamble-wrapper'); + MainEvents.trigger('section:open', section, options, 'preamble-section'); + CommentEvents.trigger('comment:writeTabOpen'); }, render: function() { @@ -55,6 +62,7 @@ var CommentReviewView = Backbone.View.extend({ comments: commentData, previewLoading: this.previewLoading }); + this.$content.html(html); this.findElms(); diff --git a/regulations/templates/regulations/comment-review-chrome.html b/regulations/templates/regulations/comment-review-chrome.html index 0d04813bb..6c65c01d3 100644 --- a/regulations/templates/regulations/comment-review-chrome.html +++ b/regulations/templates/regulations/comment-review-chrome.html @@ -58,7 +58,7 @@

    You are submitting an official comment to Regulations.gov.

      <% _.each(comments, function(comment, index) { %> -
    • +
    • <%= comment.label %>

      <%= comment.comment %> From 02e0f4728f436a50ef19935944cbbfd3b0efb19f Mon Sep 17 00:00:00 2001 From: xtine Date: Wed, 6 Apr 2016 21:29:17 -0600 Subject: [PATCH 4/5] agree checkbox toggle submit button --- .../static/regulations/css/less/module/comment.less | 12 ++++++++++-- .../js/source/views/comment/comment-review-view.js | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/regulations/static/regulations/css/less/module/comment.less b/regulations/static/regulations/css/less/module/comment.less index 1f22f177f..9499d409e 100644 --- a/regulations/static/regulations/css/less/module/comment.less +++ b/regulations/static/regulations/css/less/module/comment.less @@ -378,13 +378,21 @@ a.comment-index-review { } .submit-button { - background: @grey; + background: @pacific; border-radius: 3px; - color: #000; + color: #FFF; font-size: 17px; font-weight: bold; height: auto; padding: 12px 30px; + + &:disabled, &:disabled:hover { + background: @grey; + color: #000; + } + &:hover { + background-color: @pacific_hover; + } } } diff --git a/regulations/static/regulations/js/source/views/comment/comment-review-view.js b/regulations/static/regulations/js/source/views/comment/comment-review-view.js index 4b9ffb351..d13f61ff4 100644 --- a/regulations/static/regulations/js/source/views/comment/comment-review-view.js +++ b/regulations/static/regulations/js/source/views/comment/comment-review-view.js @@ -15,6 +15,7 @@ var CommentReviewView = Backbone.View.extend({ events: { 'click .edit-comment': 'editComment', 'click .preview-button': 'preview', + 'change .agree': 'toggleSubmit', 'click .submit-button': 'submit' }, @@ -95,6 +96,10 @@ var CommentReviewView = Backbone.View.extend({ this.render(); }, + toggleSubmit: function() { + $('.submit-button').prop('disabled', function(i, v) { return !v; }); + }, + submit: function() { var prefix = window.APP_PREFIX || '/'; var $xhr = $.ajax({ From a392c9c7bb42e1e86d840b22dbb01430bca364a0 Mon Sep 17 00:00:00 2001 From: xtine Date: Thu, 7 Apr 2016 20:02:51 -0600 Subject: [PATCH 5/5] no need to add preamble-wrapper class --- .../regulations/js/source/views/comment/comment-review-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regulations/static/regulations/js/source/views/comment/comment-review-view.js b/regulations/static/regulations/js/source/views/comment/comment-review-view.js index d13f61ff4..6b62d5873 100644 --- a/regulations/static/regulations/js/source/views/comment/comment-review-view.js +++ b/regulations/static/regulations/js/source/views/comment/comment-review-view.js @@ -51,7 +51,7 @@ var CommentReviewView = Backbone.View.extend({ var section = $(e.target).closest('li').data('section'); var options = {id: section, section: section, mode: 'write'}; - $('#content-body').removeClass('comment-review-wrapper').addClass('preamble-wrapper'); + $('#content-body').removeClass('comment-review-wrapper'); MainEvents.trigger('section:open', section, options, 'preamble-section'); CommentEvents.trigger('comment:writeTabOpen');