diff --git a/regulations/static/regulations/css/less/module/comment.less b/regulations/static/regulations/css/less/module/comment.less index 4991be8d1..9499d409e 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 { @@ -373,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 6fbfd6900..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 @@ -6,14 +6,16 @@ var _ = require('underscore'); var Backbone = require('backbone'); Backbone.$ = $; -var comments = require('../../collections/comment-collection'); - +var MainEvents = require('../../events/main-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', + 'change .agree': 'toggleSubmit', 'click .submit-button': 'submit' }, @@ -27,6 +29,8 @@ var CommentReviewView = Backbone.View.extend({ this.previewLoading = false; + this.listenTo(CommentEvents, 'read:proposal', this.handleRead); + this.render(); }, @@ -34,12 +38,32 @@ var CommentReviewView = Backbone.View.extend({ this.$status = this.$el.find('.status'); }, + handleRead: function() { + 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'); + }, + + 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'); + + MainEvents.trigger('section:open', section, options, 'preamble-section'); + CommentEvents.trigger('comment:writeTabOpen'); + }, + render: function() { var commentData = comments.toJSON({docId: this.docId}); var html = this.template({ comments: commentData, previewLoading: this.previewLoading }); + this.$content.html(html); this.findElms(); @@ -72,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({ 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/comment-review-chrome.html b/regulations/templates/regulations/comment-review-chrome.html index 03d9a4131..6c65c01d3 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 %} @@ -56,7 +58,7 @@
<% _.each(comments, function(comment, index) { %> --
+
-
<%= comment.comment %>
diff --git a/regulations/templates/regulations/preamble-chrome.html b/regulations/templates/regulations/preamble-chrome.html
index e04c6023b..290b5df78 100644
--- a/regulations/templates/regulations/preamble-chrome.html
+++ b/regulations/templates/regulations/preamble-chrome.html
@@ -14,11 +14,7 @@
{% endblock %}
-{% block wayfinding %}
-{{doc_number}}
-
-{% endblock %}
-
+{% block wayfinding %}{% endblock %}
{% block header-secondary %}
{% include "regulations/preamble-header.html" %}
<%= comment.label %>