diff --git a/app/assets/javascripts/markdown_editor.js.coffee b/app/assets/javascripts/markdown_editor.js.coffee index 1874da5aa..9065717fc 100644 --- a/app/assets/javascripts/markdown_editor.js.coffee +++ b/app/assets/javascripts/markdown_editor.js.coffee @@ -18,6 +18,7 @@ App.MarkdownEditor = $(this).on 'change input paste keyup', -> App.MarkdownEditor.refresh_preview($(this), md) + $('.legislation-draft-versions-edit .warning').show() return $(this).find('.fullscreen-toggle').on 'click', -> diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index c34eb3a10..486b93bc8 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -428,6 +428,13 @@ table.investment-projects-summary { // 06. Legislation // -------------- + +.legislation-admin { + .menu .active > a { + background: none; + } +} + .legislation-process-save { @include breakpoint(medium) { float: right; @@ -450,11 +457,7 @@ table.investment-projects-summary { } .legislation-process-edit { - - .menu .active > a { - background: none; - } - + .edit_legislation_process { small { @@ -480,11 +483,7 @@ table.investment-projects-summary { } .legislation-draft-versions-index { - - .menu .active > a { - background: none; - } - + .legislation-process-question { @include breakpoint(medium) { text-align: right; @@ -496,12 +495,8 @@ table.investment-projects-summary { } } -.legislation-questions-index { - - .menu .active > a { - background: none; - } - +.legislation-questions-form { + input[type]:not([type="submit"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]) { background: $white; margin-bottom: 0; @@ -561,8 +556,8 @@ table.investment-projects-summary { } } -.legislation-draft-versions-index { - +.legislation-draft-versions-form { + .legislation-process-version { @include breakpoint(medium) { text-align: right; diff --git a/app/assets/stylesheets/legislation.scss b/app/assets/stylesheets/legislation.scss index bacfb1aac..c53216dd9 100644 --- a/app/assets/stylesheets/legislation.scss +++ b/app/assets/stylesheets/legislation.scss @@ -9,6 +9,7 @@ // ----------------- .brand-heading { background: $brand; + margin-bottom: 2rem; .column { padding-top: 10rem; @@ -25,35 +26,31 @@ // 02. Sidebar menu // ----------------- .legislation-categories { - ul { + + .menu.simple { + border-bottom: none; list-style: none; padding-left: 0; margin-left: 0; + margin-top: 0; + + @include breakpoint(medium) { + margin: 1.5rem 0; + } li { + display: block; cursor: pointer; + margin-bottom: 1rem; @include breakpoint(medium) { + margin-bottom: 2rem; max-width: 80%; } - - h4 { - font-weight: 400; - color: $text-medium; - margin-bottom: 3rem; - transition: color 0.25s ease-out, color 0.25s ease-out; - } - - &:hover h4, &:active h4 { - color: $brand; - } } - - .active h4 { + + li.active { font-weight: 700; - color: $brand; - padding-bottom: 0.5rem; - border-bottom: 2px solid $brand; } } } @@ -62,9 +59,6 @@ // ----------------- .legislation { margin: 0 0 4rem 0; -} - -.legislation { background: white; border: 1px solid; border-color: #e5e6e9 #dfe0e4 #d0d1d5; @@ -117,11 +111,21 @@ padding-top: 1rem; h5 { + margin-left: 0.25rem; margin-bottom: 0; color: #61686E; + + @include breakpoint(medium) { + margin-left: 0; + } } p { + margin-left: 0.25rem; font-size: $small-font-size; + + @include breakpoint(medium) { + margin-left: 0; + } } } diff --git a/app/controllers/admin/legislation/questions_controller.rb b/app/controllers/admin/legislation/questions_controller.rb index 9a1c3eb5b..e27e75ce7 100644 --- a/app/controllers/admin/legislation/questions_controller.rb +++ b/app/controllers/admin/legislation/questions_controller.rb @@ -6,6 +6,10 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll @questions = @process.questions end + def new + @question.question_options.build + end + def create @question.author = current_user if @question.save diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index 59a13f9a8..1692cf326 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -3,6 +3,10 @@ module LegislationHelper l(date, format: "%d %b %Y") if date end + def format_date_for_calendar_form(date) + l(date, format: "%d/%m/%Y") if date + end + def legislation_question_path(question) legislation_process_question_path(question.process, question) end diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 2ab349623..995aedb9e 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -53,4 +53,8 @@ class Legislation::Process < ActiveRecord::Base today >= final_publication_date end end + + def total_comments + questions.map(&:comments_count).sum + end end diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb index a55bddc66..a217580d6 100644 --- a/app/views/admin/legislation/draft_versions/_form.html.erb +++ b/app/views/admin/legislation/draft_versions/_form.html.erb @@ -27,6 +27,7 @@
| <%= t("admin.legislation.draft_versions.table.title") %> | -<%= t("admin.legislation.draft_versions.table.created_at") %> | -<%= t("admin.legislation.draft_versions.table.status") %> | -<%= t("admin.legislation.draft_versions.table.comments") %> | -<%= t("admin.legislation.draft_versions.table.final_version") %> | -
|---|
| <%= t("admin.legislation.draft_versions.table.title") %> | +<%= t("admin.legislation.draft_versions.table.created_at") %> | +<%= t("admin.legislation.draft_versions.table.status") %> | +<%= t("admin.legislation.draft_versions.table.comments") %> | +<%= t("admin.legislation.draft_versions.table.final_version") %> | +
|---|---|---|---|---|
| @@ -33,6 +45,7 @@ | <%= draft_version.final_version %> |
| <%= t("admin.legislation.processes.process.title") %> | -- | ||||||
|---|---|---|---|---|---|---|---|
| - <%= link_to process.title, edit_admin_legislation_process_path(process) %> - | +
| <%= t("admin.legislation.processes.process.title") %> | +<%= t("admin.legislation.processes.process.comments") %> | ++ |
|---|---|---|
| + <%= link_to process.title, edit_admin_legislation_process_path(process) %> + | +<%= process.total_comments %> | ++ <%= link_to t("admin.legislation.processes.index.delete"), admin_legislation_process_path(process), + method: :delete, + class: 'button hollow alert' %> + | +
| <%= t("admin.legislation.questions.table.title") %> | -<%= t("admin.legislation.questions.table.question_options") %> | -<%= t("admin.legislation.questions.table.answers_count") %> | -<%= t("admin.legislation.questions.table.comments_count") %> | -
|---|
| <%= t("admin.legislation.questions.table.title") %> | +<%= t("admin.legislation.questions.table.question_options") %> | +<%= t("admin.legislation.questions.table.answers_count") %> | +<%= t("admin.legislation.questions.table.comments_count") %> | +
|---|---|---|---|
| @@ -36,9 +48,10 @@ <% end %> | <%= question.answers_count %> | -<%= question.comments.count %> | +<%= link_to question.comments.count, legislation_process_question_path(@process, question, anchor: 'comments') %> |