diff --git a/Gemfile b/Gemfile index 6eb34093c..9ac7e06a9 100644 --- a/Gemfile +++ b/Gemfile @@ -67,6 +67,8 @@ gem 'redcarpet' gem 'rails-assets-markdown-it', source: 'https://rails-assets.org' +gem 'cocoon' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' diff --git a/Gemfile.lock b/Gemfile.lock index fb6eeb62f..28f67e75d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -104,6 +104,7 @@ GEM cliver (0.3.2) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) + cocoon (1.2.9) coffee-rails (4.2.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.2.x) @@ -467,6 +468,7 @@ DEPENDENCIES capistrano3-delayed-job (~> 1.0) capybara ckeditor (~> 4.2.0) + cocoon coffee-rails (~> 4.2.1) coveralls daemons diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 7188acecf..e81e74f34 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -48,6 +48,7 @@ //= require social_share //= require markdown-it //= require markdown_editor +//= require cocoon //= require allegations //= require custom diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 403d5566d..cd33ac92d 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -34,3 +34,4 @@ @include foundation-thumbnail; @include foundation-title-bar; @include foundation-top-bar; +@include foundation-menu-icon; diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 8c4549ffd..e5e6562d3 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -246,7 +246,7 @@ a { } } - h2 { + h2, h3 { font-size: $base-font-size; } } diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb index c96c7c72b..b919e0861 100644 --- a/app/controllers/admin/banners_controller.rb +++ b/app/controllers/admin/banners_controller.rb @@ -2,7 +2,6 @@ class Admin::BannersController < Admin::BaseController has_filters %w{all with_active with_inactive}, only: :index - before_action :find_banner, only: [:edit, :update, :destroy] before_action :banner_styles, only: [:edit, :new, :create, :update] before_action :banner_imgs, only: [:edit, :new, :create, :update] @@ -24,7 +23,6 @@ class Admin::BannersController < Admin::BaseController end def update - @banner.assign_attributes(banner_params) if @banner.update(banner_params) redirect_to admin_banners_path else @@ -43,10 +41,6 @@ class Admin::BannersController < Admin::BaseController params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at) end - def find_banner - @banner = Banner.find(params[:id]) - end - def banner_styles @banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] } end diff --git a/app/controllers/admin/legislation/draft_versions_controller.rb b/app/controllers/admin/legislation/draft_versions_controller.rb index 8c20374d9..f47dde361 100644 --- a/app/controllers/admin/legislation/draft_versions_controller.rb +++ b/app/controllers/admin/legislation/draft_versions_controller.rb @@ -31,7 +31,6 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont def draft_version_params params.require(:legislation_draft_version).permit( - :legislation_process_id, :title, :changelog, :status, diff --git a/app/controllers/admin/legislation/questions_controller.rb b/app/controllers/admin/legislation/questions_controller.rb new file mode 100644 index 000000000..9a1c3eb5b --- /dev/null +++ b/app/controllers/admin/legislation/questions_controller.rb @@ -0,0 +1,39 @@ +class Admin::Legislation::QuestionsController < Admin::Legislation::BaseController + load_and_authorize_resource :process, class: "Legislation::Process" + load_and_authorize_resource :question, class: "Legislation::Question", through: :process + + def index + @questions = @process.questions + end + + def create + @question.author = current_user + if @question.save + redirect_to admin_legislation_process_questions_path + else + render :new + end + end + + def update + if @question.update(question_params) + redirect_to admin_legislation_process_questions_path + else + render :edit + end + end + + def destroy + @question.destroy + redirect_to admin_legislation_process_questions_path + end + + private + + def question_params + params.require(:legislation_question).permit( + :title, + question_options_attributes: [:id, :value, :_destroy] + ) + end +end diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb index a444f151e..05b7fbeae 100644 --- a/app/controllers/legislation/processes_controller.rb +++ b/app/controllers/legislation/processes_controller.rb @@ -1,9 +1,32 @@ class Legislation::ProcessesController < Legislation::BaseController + has_filters %w{open next past}, only: :index load_and_authorize_resource def index + @current_filter ||= 'open' + @processes = ::Legislation::Process.send(@current_filter).page(params[:page]) end def show end + + def draft_publication + phase :draft_publication + end + + def allegations + phase :allegations + end + + def final_version_publication + phase :final_version_publication + end + + private + + def phase(phase) + @process = ::Legislation::Process.find(params[:process_id]) + @phase = phase + render :phase + end end diff --git a/app/controllers/legislation/questions_controller.rb b/app/controllers/legislation/questions_controller.rb new file mode 100644 index 000000000..7114c98cb --- /dev/null +++ b/app/controllers/legislation/questions_controller.rb @@ -0,0 +1,12 @@ +class Legislation::QuestionsController < Legislation::BaseController + load_and_authorize_resource :process + load_and_authorize_resource :question, through: :process + + has_orders %w{most_voted newest oldest}, only: :show + + def show + @commentable = @question + @comment_tree = CommentTree.new(@commentable, params[:page], @current_order) + set_comment_flags(@comment_tree.comments) + end +end diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb new file mode 100644 index 000000000..c92f57898 --- /dev/null +++ b/app/helpers/layouts_helper.rb @@ -0,0 +1,12 @@ +module LayoutsHelper + + def layout_menu_link_to(text, path, is_active, options) + if is_active + content_tag(:span, t('shared.you_are_in'), class: 'sr-only') + ' ' + + link_to(text, path, options.merge(class: "active")) + else + link_to(text, path, options) + end + end + +end diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb new file mode 100644 index 000000000..59a13f9a8 --- /dev/null +++ b/app/helpers/legislation_helper.rb @@ -0,0 +1,9 @@ +module LegislationHelper + def format_date(date) + l(date, format: "%d %b %Y") if date + end + + def legislation_question_path(question) + legislation_process_question_path(question.process, question) + end +end diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index 82035042b..f8362f87b 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -33,7 +33,7 @@ module Abilities can :mark_featured, Debate can :unmark_featured, Debate - can :comment_as_administrator, [Debate, Comment, Proposal] + can :comment_as_administrator, [Debate, Comment, Proposal, Legislation::Question] can [:search, :create, :index, :destroy], ::Moderator can [:search, :create, :index, :summary], ::Valuator @@ -48,6 +48,8 @@ module Abilities can [:manage], ::Legislation::Process can [:manage], ::Legislation::DraftVersion + can [:manage], ::Legislation::Question + cannot :comment_as_moderator, ::Legislation::Question end end end diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 88eccd00a..e22bcb7e0 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -11,8 +11,9 @@ module Abilities can :read, User can [:search, :read], Annotation can :new, DirectMessage - can [:read], Legislation::Process + can [:read, :draft_publication, :allegations, :final_version_publication], Legislation::Process can [:read], Legislation::DraftVersion + can [:read], Legislation::Question end end end diff --git a/app/models/abilities/moderator.rb b/app/models/abilities/moderator.rb index f6c5c5004..c8aed38fe 100644 --- a/app/models/abilities/moderator.rb +++ b/app/models/abilities/moderator.rb @@ -5,7 +5,7 @@ module Abilities def initialize(user) self.merge Abilities::Moderation.new(user) - can :comment_as_moderator, [Debate, Comment, Proposal] + can :comment_as_moderator, [Debate, Comment, Proposal, Legislation::Question] end end end diff --git a/app/models/comment.rb b/app/models/comment.rb index 0bfb6a320..025f50e71 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -10,7 +10,7 @@ class Comment < ActiveRecord::Base validates :body, presence: true validates :user, presence: true - validates_inclusion_of :commentable_type, in: ["Debate", "Proposal"] + validates_inclusion_of :commentable_type, in: ["Debate", "Proposal", "Legislation::Question"] validate :validate_body_length diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 43cca02f6..dbc31c7b3 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -3,6 +3,8 @@ class Legislation::Process < ActiveRecord::Base include ActsAsParanoidAliases has_many :draft_versions, class_name: 'Legislation::DraftVersion', foreign_key: 'legislation_process_id' + has_one :final_draft_version, -> { where final_version: true }, class_name: 'Legislation::DraftVersion', foreign_key: 'legislation_process_id' + has_many :questions, class_name: 'Legislation::Question', foreign_key: 'legislation_process_id' validates :title, presence: true validates :description, presence: true @@ -17,7 +19,38 @@ class Legislation::Process < ActiveRecord::Base validates :allegations_end_date, presence: true validates :final_publication_date, presence: true - scope :open, -> {where("start_date <= ? and end_date >= ?", Time.current, Time.current) } - scope :next, -> {where("start_date > ?", Time.current) } - scope :past, -> {where("end_date < ?", Time.current) } + scope :open, -> {where("start_date <= ? and end_date >= ?", Date.current, Date.current) } + scope :next, -> {where("start_date > ?", Date.current) } + scope :past, -> {where("end_date < ?", Date.current) } + + def open_phase?(phase) + today = Date.current + + case phase + when :debate + today >= debate_start_date && today <= debate_end_date + when :draft_publication + today >= draft_publication_date + when :allegations + today >= allegations_start_date && today <= allegations_end_date + when :final_version_publication + today >= final_publication_date + end + end + + def show_phase?(phase) + # show past phases even if they're finished + today = Date.current + + case phase + when :debate + today >= debate_start_date + when :draft_publication + today >= draft_publication_date + when :allegations + today >= allegations_start_date + when :final_version_publication + today >= final_publication_date + end + end end diff --git a/app/models/legislation/question.rb b/app/models/legislation/question.rb new file mode 100644 index 000000000..2b779d1f8 --- /dev/null +++ b/app/models/legislation/question.rb @@ -0,0 +1,19 @@ +class Legislation::Question < ActiveRecord::Base + acts_as_paranoid column: :hidden_at + include ActsAsParanoidAliases + + belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' + belongs_to :process, class_name: 'Legislation::Process', foreign_key: 'legislation_process_id' + + has_many :question_options, class_name: 'Legislation::QuestionOption', foreign_key: 'legislation_question_id', dependent: :destroy, inverse_of: :question + has_many :comments, as: :commentable + + accepts_nested_attributes_for :question_options, :reject_if => proc { |attributes| attributes[:value].blank? }, allow_destroy: true + + validates :process, presence: true + validates :title, presence: true + + def next_question_id + @next_question_id ||= process.questions.where("id > ?", id).order('id ASC').limit(1).pluck(:id).first + end +end diff --git a/app/models/legislation/question_option.rb b/app/models/legislation/question_option.rb new file mode 100644 index 000000000..93bc20320 --- /dev/null +++ b/app/models/legislation/question_option.rb @@ -0,0 +1,9 @@ +class Legislation::QuestionOption < ActiveRecord::Base + acts_as_paranoid column: :hidden_at + include ActsAsParanoidAliases + + belongs_to :question, class_name: 'Legislation::Question', foreign_key: 'legislation_question_id', inverse_of: :question_options + + validates :question, presence: true + validates :value, presence: true, uniqueness: { scope: :legislation_question_id } +end diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb index fb61ca3d1..a55bddc66 100644 --- a/app/views/admin/legislation/draft_versions/_form.html.erb +++ b/app/views/admin/legislation/draft_versions/_form.html.erb @@ -9,7 +9,7 @@ <%= @draft_version.errors.count %> - <%= t("admin.legislation.draft_versions.errors.form.error", count: @process.errors.count) %> + <%= t("admin.legislation.draft_versions.errors.form.error", count: @draft_version.errors.count) %> diff --git a/app/views/admin/legislation/draft_versions/edit.html.erb b/app/views/admin/legislation/draft_versions/edit.html.erb index b48c6409b..f347101cf 100644 --- a/app/views/admin/legislation/draft_versions/edit.html.erb +++ b/app/views/admin/legislation/draft_versions/edit.html.erb @@ -1,6 +1,6 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> + <%= link_to admin_legislation_process_path(@process), class: "back" do %> <%= t("admin.legislation.draft_versions.edit.back") %> <% end %> diff --git a/app/views/admin/legislation/draft_versions/new.html.erb b/app/views/admin/legislation/draft_versions/new.html.erb index c1ee1be90..7f7562339 100644 --- a/app/views/admin/legislation/draft_versions/new.html.erb +++ b/app/views/admin/legislation/draft_versions/new.html.erb @@ -1,6 +1,6 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> + <%= link_to admin_legislation_process_path(@process), class: "back" do %> <%= t("admin.legislation.draft_versions.new.back") %> <% end %> @@ -12,6 +12,5 @@

<%= t("admin.legislation.draft_versions.new.title") %>

<%= render 'form', url: admin_legislation_process_draft_versions_path(@process) %> -
diff --git a/app/views/admin/legislation/processes/_subnav.html.erb b/app/views/admin/legislation/processes/_subnav.html.erb index a645faef4..97640c4f4 100644 --- a/app/views/admin/legislation/processes/_subnav.html.erb +++ b/app/views/admin/legislation/processes/_subnav.html.erb @@ -1,6 +1,9 @@ +
<% end %> diff --git a/app/views/debates/_comments.html.erb b/app/views/debates/_comments.html.erb index cc96ab4ba..e7475662d 100644 --- a/app/views/debates/_comments.html.erb +++ b/app/views/debates/_comments.html.erb @@ -1,31 +1,29 @@ <% cache [locale_and_user_status, @current_order, commentable_cache_key(@debate), @comment_tree.comments, @comment_tree.comment_authors, @debate.comments_count, @comment_flags] do %> -
-
-
-

- <%= t("debates.show.comments_title") %> - (<%= @debate.comments_count %>) -

+
+
+

+ <%= t("debates.show.comments_title") %> + (<%= @debate.comments_count %>) +

- <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> - <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @debate, parent_id: nil, toggeable: false} %> - <% else %> -
+ <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @debate, parent_id: nil, toggeable: false} %> + <% else %> +
-
- <%= t("debates.show.login_to_comment", - signin: link_to(t("votes.signin"), new_user_session_path), - signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> -
- <% end %> +
+ <%= t("debates.show.login_to_comment", + signin: link_to(t("votes.signin"), new_user_session_path), + signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> +
+ <% end %> - <% @comment_tree.root_comments.each do |comment| %> - <%= render 'comments/comment', comment: comment %> - <% end %> - <%= paginate @comment_tree.root_comments %> -
+ <% @comment_tree.root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @comment_tree.root_comments %>
-
+
<% end %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 7a528ffa7..e2e2c84c9 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -1,6 +1,6 @@ <% provide :title do %><%= @debate.title %><% end %> <% cache [locale_and_user_status(@debate), @debate, @debate.author, Flag.flagged?(current_user, @debate), @debate_votes] do %> -
+
<%= render "shared/back_link" %> @@ -59,7 +59,7 @@ <% end %>
-
+ <% end %> <%= render "comments" %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2ad2303f8..6de8ed89e 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -16,12 +16,7 @@
<%= link_to root_path, class: "hide-for-small-only", accesskey: "/" do %> <%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %> - <% if opendata_page? %> - <%= t("layouts.header.open_gov", open: "#{t('layouts.header.open')}") %> | - <%= t("layouts.header.open_data") %> - <% else %> - <%= setting['org_name'] %> - <% end %> + <%= setting['org_name'] %> <% end %>
@@ -34,9 +29,6 @@
@@ -48,9 +40,9 @@
<%= render "shared/subnavigation" %> -
- <%= yield :header_addon %> -
+
+
+ <%= yield :header_addon %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 70ae90b11..34e7776fb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,7 +14,7 @@ <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "apple-touch-icon-200.png", - rel: "apple-touch-icon", + rel: "icon apple-touch-icon", sizes: "200x200", type: "image/png" %> <%= content_for :social_media_meta_tags %> diff --git a/app/views/legislation/draft_versions/changes.html.erb b/app/views/legislation/draft_versions/changes.html.erb index 80d902720..8b97de7f4 100644 --- a/app/views/legislation/draft_versions/changes.html.erb +++ b/app/views/legislation/draft_versions/changes.html.erb @@ -1,3 +1,5 @@ +<% provide :title do %><%= "#{@draft_version.title} - #{t('.title')} - #{@process.title}" %><% end %> +

<%= @process.title %>

<%= @draft_version.title %>

diff --git a/app/views/legislation/draft_versions/show.html.erb b/app/views/legislation/draft_versions/show.html.erb index 3a1ec15cf..0c220c03b 100644 --- a/app/views/legislation/draft_versions/show.html.erb +++ b/app/views/legislation/draft_versions/show.html.erb @@ -1,3 +1,5 @@ +<% provide :title do %><%= "#{@draft_version.title} - #{@process.title}" %><% end %> +

<%= link_to @process.title, @process %>

<%= @draft_version.title %>

diff --git a/app/views/legislation/processes/_debate.html.erb b/app/views/legislation/processes/_debate.html.erb new file mode 100644 index 000000000..6bdfc26a0 --- /dev/null +++ b/app/views/legislation/processes/_debate.html.erb @@ -0,0 +1,14 @@ +
+
+ <% if process.questions.empty? %> +

<%= t('.empty_questions') %>

+ <% else %> + <%= render process.questions %> + <% end %> +
+
+ +
+
<%= t('.participate') %>
+
+ diff --git a/app/views/legislation/processes/_header_full.html.erb b/app/views/legislation/processes/_header_full.html.erb new file mode 100644 index 000000000..4d365618e --- /dev/null +++ b/app/views/legislation/processes/_header_full.html.erb @@ -0,0 +1,37 @@ +
+
+
+

<%= t('.title') %>

+

+ <%= process.title %> +

+
+ +
+ +
+
+

<%= t('.description') %>

+ <%= markdown process.description %> +
+
+

<%= t('.target') %>

+ <%= markdown process.target %> +
+
+

<%= t('.how_to_participate') %>

+ <%= markdown process.how_to_participate %> +
+
+ + +
diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb new file mode 100644 index 000000000..a6d921c35 --- /dev/null +++ b/app/views/legislation/processes/_key_dates.html.erb @@ -0,0 +1,29 @@ + diff --git a/app/views/legislation/processes/_key_dates_svg.html.erb b/app/views/legislation/processes/_key_dates_svg.html.erb new file mode 100644 index 000000000..c9f2eca94 --- /dev/null +++ b/app/views/legislation/processes/_key_dates_svg.html.erb @@ -0,0 +1,5 @@ + + + + + diff --git a/app/views/legislation/processes/_phase_allegations.html.erb b/app/views/legislation/processes/_phase_allegations.html.erb new file mode 100644 index 000000000..be31ddf43 --- /dev/null +++ b/app/views/legislation/processes/_phase_allegations.html.erb @@ -0,0 +1,9 @@ +<% if process.draft_versions.any? %> + +<% else %> +

<%= t('.empty') %>

+<% end %> diff --git a/app/views/legislation/processes/_phase_draft_publication.html.erb b/app/views/legislation/processes/_phase_draft_publication.html.erb new file mode 100644 index 000000000..be31ddf43 --- /dev/null +++ b/app/views/legislation/processes/_phase_draft_publication.html.erb @@ -0,0 +1,9 @@ +<% if process.draft_versions.any? %> + +<% else %> +

<%= t('.empty') %>

+<% end %> diff --git a/app/views/legislation/processes/_phase_final_version_publication.html.erb b/app/views/legislation/processes/_phase_final_version_publication.html.erb new file mode 100644 index 000000000..52fba50d5 --- /dev/null +++ b/app/views/legislation/processes/_phase_final_version_publication.html.erb @@ -0,0 +1,5 @@ +<% if process.final_draft_version %> +

<%= legislation_process_draft_version_path(process.final_draft_version) %>

+<% else %> +

<%= t('.empty') %>

+<% end %> diff --git a/app/views/legislation/processes/_phase_not_open.html.erb b/app/views/legislation/processes/_phase_not_open.html.erb new file mode 100644 index 000000000..354ff5440 --- /dev/null +++ b/app/views/legislation/processes/_phase_not_open.html.erb @@ -0,0 +1,13 @@ +
+
+

<%= t('.not_open') %>

+

Suscríbete al proceso para recibir un aviso en el momento en que se abra.

+
+ +
+ +
+
diff --git a/app/views/legislation/processes/_process.html.erb b/app/views/legislation/processes/_process.html.erb new file mode 100644 index 000000000..9eac89a7b --- /dev/null +++ b/app/views/legislation/processes/_process.html.erb @@ -0,0 +1,41 @@ +
+
+
+
+

<%= link_to process.title, process %>

+

<%= process.description %>

+
+
+ +
+ <%= link_to process, class: "button button-legislation big expanded", title: t('.see_latest_comments_title') do %> +   <%= t('.see_latest_comments') %> + <% end %> +
+
+ +
+
+

<%= t('legislation.processes.shared.key_dates') %>

+
+
+ +
+
+
<%= t('legislation.processes.shared.debate_dates') %>
+

<%= format_date(process.debate_start_date) %> - <%= format_date(process.debate_end_date) %>

+
+
+
<%= t('legislation.processes.shared.draft_publication_date') %>
+

<%= format_date(process.draft_publication_date) %>

+
+
+
<%= t('legislation.processes.shared.allegations_dates') %>
+

<%= format_date(process.allegations_start_date) %> - <%= format_date(process.allegations_end_date) %>

+
+
+
<%= t('legislation.processes.shared.final_publication_date') %>
+

<%= format_date(process.final_publication_date) %>

+
+
+
diff --git a/app/views/legislation/processes/index.html.erb b/app/views/legislation/processes/index.html.erb index fd9517c12..e145896a7 100644 --- a/app/views/legislation/processes/index.html.erb +++ b/app/views/legislation/processes/index.html.erb @@ -1,5 +1,22 @@ -
- <% @processes.each do |process| %> - <%= link_to process.title, process %>
- <% end %> +
+
+
+

+ <%= t('.hightlighted_processes') %> +

+
+
+
+ +
+
+ <%= render 'shared/filter_subnav', i18n_namespace: "legislation.processes.index" %> +
+ +
+
+ <%= render @processes %> + <%= paginate @processes %> +
+
diff --git a/app/views/legislation/processes/phase.html.erb b/app/views/legislation/processes/phase.html.erb new file mode 100644 index 000000000..04ee25523 --- /dev/null +++ b/app/views/legislation/processes/phase.html.erb @@ -0,0 +1,17 @@ +<% provide :title do %><%= @process.title %><% end %> + +<%= render 'legislation/processes/header_full', process: @process %> + +
+ <%= render 'legislation/processes/key_dates', process: @process, phase: @phase %> + +
+
+ <% if @process.show_phase?(@phase) %> + <%= render "phase_#{@phase}", process: @process %> + <% else %> + <%= render 'legislation/processes/phase_not_open' %> + <% end %> +
+
+
diff --git a/app/views/legislation/processes/show.html.erb b/app/views/legislation/processes/show.html.erb index 7d11f6f25..471410b58 100644 --- a/app/views/legislation/processes/show.html.erb +++ b/app/views/legislation/processes/show.html.erb @@ -1,9 +1,17 @@ +<% provide :title do %><%= @process.title %><% end %> + +<%= render 'header_full', process: @process %> +
+ <%= render 'key_dates', process: @process, phase: :debate %> -

<%= @process.title %>

- -<% @process.draft_versions.each do |draft_version| %> - <%= link_to draft_version.title, legislation_process_draft_version_path(@process, draft_version) %> -<% end %> - +
+
+ <% if @process.show_phase?(:debate) %> + <%= render 'debate', process: @process %> + <% else %> + <%= render 'phase_not_open' %> + <% end %> +
+
diff --git a/app/views/legislation/questions/_comments.html.erb b/app/views/legislation/questions/_comments.html.erb new file mode 100644 index 000000000..c7b9591e8 --- /dev/null +++ b/app/views/legislation/questions/_comments.html.erb @@ -0,0 +1,29 @@ +<% cache [locale_and_user_status, @current_order, commentable_cache_key(@question), @comment_tree.comments, @comment_tree.comment_authors, @question.comments_count, @comment_flags] do %> +
+
+

+ <%= t("legislation.questions.show.comments") %> + (<%= @question.comments_count %>) +

+ + <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + + <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @question, parent_id: nil, toggeable: false} %> + <% else %> +
+ +
+ <%= t("debates.show.login_to_comment", + signin: link_to(t("votes.signin"), new_user_session_path), + signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> +
+ <% end %> + + <% @comment_tree.root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @comment_tree.root_comments %> +
+
+<% end %> diff --git a/app/views/legislation/questions/_question.html.erb b/app/views/legislation/questions/_question.html.erb new file mode 100644 index 000000000..750d248c1 --- /dev/null +++ b/app/views/legislation/questions/_question.html.erb @@ -0,0 +1,11 @@ +
+
+ <%= t('.debate') %> +
+
+

<%= link_to question.title, legislation_process_question_path(question.process, question) %>

+
+
+ <%= link_to t('.comments', count: question.comments.count), legislation_process_question_path(question.process, question) %> · <%= format_date question.created_at %> +
+
diff --git a/app/views/legislation/questions/show.html.erb b/app/views/legislation/questions/show.html.erb new file mode 100644 index 000000000..d22289d28 --- /dev/null +++ b/app/views/legislation/questions/show.html.erb @@ -0,0 +1,52 @@ +<% provide :title do %><%= @question.title %><% end %> + +
+
+
+
+

<%= t('.title') %>

+

<%= link_to @process.title, @process %>

+
+
+
+ <% if @question.next_question_id %> + <%= link_to legislation_process_question_path(@process, @question.next_question_id), class: "quiz-next-link" do %> + <%= content_tag :div, class: "quiz-next" do %> + <%= t('.next_question') %> +
+
+
+
+

<%= @question.title %>

+
+
+ <% @question.question_options.each do |question_option| %> + + <% end %> +
+
+
+ +
+
+ + +<%= render 'comments' %> diff --git a/app/views/proposals/_comments.html.erb b/app/views/proposals/_comments.html.erb index ed52b1b66..c304bc4dd 100644 --- a/app/views/proposals/_comments.html.erb +++ b/app/views/proposals/_comments.html.erb @@ -1,26 +1,24 @@ <% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %> -
-
-
- <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> +
+
+ <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> - <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @proposal, parent_id: nil, toggeable: false} %> - <% else %> -
+ <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @proposal, parent_id: nil, toggeable: false} %> + <% else %> +
-
- <%= t("proposals.show.login_to_comment", - signin: link_to(t("votes.signin"), new_user_session_path), - signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> -
- <% end %> +
+ <%= t("proposals.show.login_to_comment", + signin: link_to(t("votes.signin"), new_user_session_path), + signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> +
+ <% end %> - <% @comment_tree.root_comments.each do |comment| %> - <%= render 'comments/comment', comment: comment %> - <% end %> - <%= paginate @comment_tree.root_comments %> -
+ <% @comment_tree.root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @comment_tree.root_comments %>
-
+
<% end %> diff --git a/app/views/proposals/_filter_subnav.html.erb b/app/views/proposals/_filter_subnav.html.erb index b7bc85dd6..fe875c9a9 100644 --- a/app/views/proposals/_filter_subnav.html.erb +++ b/app/views/proposals/_filter_subnav.html.erb @@ -3,18 +3,18 @@ diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index ba6cb677f..6209805cf 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -6,8 +6,7 @@ social_description: @proposal.summary %> <% end %> <% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %> - -
+
<%= render "shared/back_link" %> @@ -134,7 +133,7 @@
-
+
<% end %>
diff --git a/app/views/shared/_advanced_search.html.erb b/app/views/shared/_advanced_search.html.erb index 00db85b9c..c27c8f8d6 100644 --- a/app/views/shared/_advanced_search.html.erb +++ b/app/views/shared/_advanced_search.html.erb @@ -15,14 +15,14 @@
- + <%= select_tag('advanced_search[official_level]', official_level_search_options, include_blank: t("shared.advanced_search.author_type_blank")) %>
- + <%= select_tag('advanced_search[date_min]', date_range_options, include_blank: t("shared.advanced_search.date_range_blank"), id: 'js-advanced-search-date-min') %> @@ -31,14 +31,18 @@