diff --git a/app/assets/javascripts/legislation.js.coffee b/app/assets/javascripts/legislation.js.coffee
index cd4e90bc3..3eb53e6d2 100644
--- a/app/assets/javascripts/legislation.js.coffee
+++ b/app/assets/javascripts/legislation.js.coffee
@@ -4,7 +4,7 @@ App.Legislation =
$('#js-toggle-debate').on
click: ->
$('#debate-show').toggle()
-
+
$('#js-toggle-small-debate').on
click: ->
$('#debate-show').toggle()
diff --git a/app/assets/javascripts/markdown_editor.js.coffee b/app/assets/javascripts/markdown_editor.js.coffee
index 7617c5004..510bf83ec 100644
--- a/app/assets/javascripts/markdown_editor.js.coffee
+++ b/app/assets/javascripts/markdown_editor.js.coffee
@@ -25,9 +25,15 @@ App.MarkdownEditor =
$(this).find('.fullscreen-toggle').on 'click', ->
$('.markdown-editor').toggleClass('fullscreen')
+ $('.fullscreen-container').toggleClass('medium-8', 'medium-12')
+ span = $(this).find('span')
+ current_html = span.html()
+ if(current_html == span.data('open-text'))
+ span.html(span.data('closed-text'))
+ else
+ span.html(span.data('open-text'))
if $('.markdown-editor').hasClass('fullscreen')
$('.markdown-editor textarea').height($(window).height() - 100)
else
$('.markdown-editor textarea').height("10em")
-
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
index 807a202d5..979963d12 100644
--- a/app/assets/stylesheets/admin.scss
+++ b/app/assets/stylesheets/admin.scss
@@ -411,6 +411,11 @@ table.investment-projects-summary {
.markdown-editor {
background-color: white;
+
+ .markdown-area,
+ #markdown-preview {
+ display: none;
+ }
}
.markdown-editor #markdown-preview {
@@ -437,7 +442,9 @@ table.investment-projects-summary {
// 06. Legislation
// --------------
-
+.edit_legislation_draft_version .row {
+ margin-bottom: 2rem;
+}
.legislation-admin {
.menu .active > a {
background: none;
@@ -595,6 +602,8 @@ table.investment-projects-summary {
}
.fullscreen-container {
+ text-align: center;
+ background: #ccdbe6;
.markdown-editor-header,
.markdown-editor-buttons {
@@ -602,12 +611,7 @@ table.investment-projects-summary {
}
a {
-
- @include breakpoint(medium) {
- float: right;
- }
-
- line-height: 3rem;
+ line-height: 8rem;
span {
text-decoration: none;
@@ -660,13 +664,28 @@ table.investment-projects-summary {
.fullscreen {
+ .markdown-area,
+ #markdown-preview {
+ display: block;
+ }
+
.column {
padding: 0;
}
.fullscreen-container {
+ text-align: left;
background: $admin-color;
padding: 0.5rem 1rem;
+ margin-bottom: 0;
+
+ a {
+ line-height: 3rem;
+
+ @include breakpoint(medium) {
+ float: right;
+ }
+ }
.markdown-editor-header {
vertical-align: top;
diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss
index 5b23736d7..39a45da93 100644
--- a/app/assets/stylesheets/legislation_process.scss
+++ b/app/assets/stylesheets/legislation_process.scss
@@ -212,10 +212,18 @@ $epigraph-line-height: rem-calc(22);
cursor: pointer;
display: inline-block;
margin: 0 1rem 1rem 0;
+ transition: all 0.4s;
+ border-bottom: 2px solid transparent;
&:first-of-type {
margin-left: 0;
}
+
+ &:hover,
+ &:active,
+ &:focus {
+ border-bottom: 2px solid $brand;
+ }
@media (min-width: 950px) {
margin: 0 0 0 3rem;
@@ -223,6 +231,7 @@ $epigraph-line-height: rem-calc(22);
a,
h4 {
+ display: block;
color: #6D6D6D;
margin-bottom: 0;
}
diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb
index 6f5069763..c97165e2a 100644
--- a/app/controllers/legislation/annotations_controller.rb
+++ b/app/controllers/legislation/annotations_controller.rb
@@ -1,7 +1,7 @@
class Legislation::AnnotationsController < ApplicationController
skip_before_action :verify_authenticity_token
- before_action :authenticate_user!, only: [:create]
+ before_action :authenticate_user!, only: [:create, :new_comment]
before_action :convert_ranges_parameters, only: [:create]
load_and_authorize_resource :process
@@ -43,6 +43,7 @@ class Legislation::AnnotationsController < ApplicationController
def comments
@annotation = Legislation::Annotation.find(params[:annotation_id])
+ @comment = @annotation.comments.new
end
def new
@@ -51,6 +52,19 @@ class Legislation::AnnotationsController < ApplicationController
end
end
+ def new_comment
+ @draft_version = Legislation::DraftVersion.find(params[:draft_version_id])
+ @annotation = @draft_version.annotations.find(params[:annotation_id])
+ @comment = @annotation.comments.new(body: params[:comment][:body], user: current_user)
+ if @comment.save
+ @comment = @annotation.comments.new
+ end
+
+ respond_to do |format|
+ format.js { render :comments }
+ end
+ end
+
private
def annotation_params
diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb
index ab346e802..99f401f7b 100644
--- a/app/controllers/notifications_controller.rb
+++ b/app/controllers/notifications_controller.rb
@@ -1,4 +1,6 @@
class NotificationsController < ApplicationController
+ include CustomUrlsHelper
+
before_action :authenticate_user!
after_action :mark_as_read, only: :show
skip_authorization_check
diff --git a/app/helpers/custom_urls_helper.rb b/app/helpers/custom_urls_helper.rb
new file mode 100644
index 000000000..1519e771e
--- /dev/null
+++ b/app/helpers/custom_urls_helper.rb
@@ -0,0 +1,9 @@
+module CustomUrlsHelper
+ def legislation_question_url(question)
+ legislation_process_question_url(question.process, question)
+ end
+
+ def legislation_annotation_url(annotation)
+ legislation_process_question_url(annotation.draft_version.process, annotation.draft_version, annotation)
+ end
+end
diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb
index ae3dc432d..4d44f14eb 100644
--- a/app/models/abilities/everyone.rb
+++ b/app/models/abilities/everyone.rb
@@ -20,7 +20,7 @@ module Abilities
can [:read, :changes, :go_to_version], Legislation::DraftVersion
can [:read], Legislation::Question
can [:create], Legislation::Answer
- can [:search, :comments, :read, :create], Legislation::Annotation
+ can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation
end
end
end
diff --git a/app/models/comment_notifier.rb b/app/models/comment_notifier.rb
index 3cceb5c15..68b350e6b 100644
--- a/app/models/comment_notifier.rb
+++ b/app/models/comment_notifier.rb
@@ -12,7 +12,9 @@ class CommentNotifier
private
def send_comment_email
- Mailer.comment(@comment).deliver_later if email_on_comment?
+ unless @comment.commentable.is_a?(Legislation::Annotation)
+ Mailer.comment(@comment).deliver_later if email_on_comment?
+ end
end
def send_reply_email
diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb
index a29a93ea4..36a774f23 100644
--- a/app/views/admin/legislation/draft_versions/_form.html.erb
+++ b/app/views/admin/legislation/draft_versions/_form.html.erb
@@ -63,20 +63,22 @@
<%= f.label :body %>
<%= t('admin.legislation.draft_versions.form.use_markdown') %>
-
<%= truncate comment.body, length: 250 %>
@@ -36,11 +36,35 @@ <% end %>