Base legislation processes and draft versions page structure for public site
This commit is contained in:
14
app/controllers/legislation/draft_versions_controller.rb
Normal file
14
app/controllers/legislation/draft_versions_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class Legislation::DraftVersionsController < Legislation::BaseController
|
||||
load_and_authorize_resource :process
|
||||
load_and_authorize_resource :draft_version, through: :process
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def changes
|
||||
@draft_version = @process.draft_versions.find(params[:draft_version_id])
|
||||
end
|
||||
end
|
||||
@@ -1,2 +1,9 @@
|
||||
class Legislation::ProcessesController < Legislation::BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,8 @@ module Abilities
|
||||
can :read, User
|
||||
can [:search, :read], Annotation
|
||||
can :new, DirectMessage
|
||||
can [:read], Legislation::Process
|
||||
can [:read], Legislation::DraftVersion
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,4 +9,8 @@ class Legislation::DraftVersion < ActiveRecord::Base
|
||||
validates :title, presence: true
|
||||
validates :body, presence: true
|
||||
validates :status, presence: true, inclusion: { in: VALID_STATUSES }
|
||||
|
||||
def body_in_html
|
||||
body_html || Redcarpet::Markdown.new(Redcarpet::Render::HTML.new).render(body)
|
||||
end
|
||||
end
|
||||
|
||||
12
app/views/legislation/draft_versions/changes.html.erb
Normal file
12
app/views/legislation/draft_versions/changes.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="row">
|
||||
<h2><%= @process.title %></h2>
|
||||
<h2><%= @draft_version.title %></h2>
|
||||
|
||||
<div>
|
||||
<%= link_to t('.see_text'), legislation_process_draft_version_path(@process, @draft_version) %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= markdown @draft_version.changelog %>
|
||||
</div>
|
||||
</div>
|
||||
12
app/views/legislation/draft_versions/show.html.erb
Normal file
12
app/views/legislation/draft_versions/show.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="row">
|
||||
<h2><%= link_to @process.title, @process %></h2>
|
||||
<h2><%= @draft_version.title %></h2>
|
||||
|
||||
<div>
|
||||
<%= link_to t('.see_changes'), legislation_process_draft_version_changes_path(@process, @draft_version) %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= @draft_version.body_in_html.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
5
app/views/legislation/processes/index.html.erb
Normal file
5
app/views/legislation/processes/index.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<div class="row">
|
||||
<% @processes.each do |process| %>
|
||||
<%= link_to process.title, process %><br/>
|
||||
<% end %>
|
||||
</div>
|
||||
9
app/views/legislation/processes/show.html.erb
Normal file
9
app/views/legislation/processes/show.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="row">
|
||||
|
||||
<h1><%= @process.title %></h1>
|
||||
|
||||
<% @process.draft_versions.each do |draft_version| %>
|
||||
<%= link_to draft_version.title, legislation_process_draft_version_path(@process, draft_version) %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
@@ -11,6 +11,11 @@
|
||||
<li>
|
||||
<%= link_to t("layouts.header.proposal_ballot"), proposal_ballots_path, class: ("active" if controller_name == "proposal_ballots"), accesskey: "v" %>
|
||||
</li>
|
||||
<% if feature?(:legislation) %>
|
||||
<li>
|
||||
<%= link_to t("layouts.header.collaborative_legislation"), legislation_processes_path, class: ("active" if controller.class.parent == Legislation ), accesskey: "l" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if feature?(:spending_proposals) %>
|
||||
<li>
|
||||
<%= link_to t("layouts.header.spending_proposals"), spending_proposals_path, class: ("active" if controller_name == "spending_proposals"), accesskey: "s" %>
|
||||
|
||||
@@ -186,6 +186,7 @@ en:
|
||||
header:
|
||||
administration: Administration
|
||||
available_locales: Available languages
|
||||
collaborative_legislation: Legislation processes
|
||||
debates: Debates
|
||||
external_link_blog: Blog
|
||||
external_link_opendata: Open data
|
||||
@@ -220,6 +221,12 @@ en:
|
||||
text_sign_in: login
|
||||
text_sign_up: sign up
|
||||
title: How I can comment this document?
|
||||
legislation:
|
||||
draft_versions:
|
||||
changes:
|
||||
see_text: See text
|
||||
show:
|
||||
see_changes: See changes
|
||||
locale: English
|
||||
notifications:
|
||||
index:
|
||||
|
||||
@@ -186,6 +186,7 @@ es:
|
||||
header:
|
||||
administration: Administrar
|
||||
available_locales: Idiomas disponibles
|
||||
collaborative_legislation: Procesos legislativos
|
||||
debates: Debates
|
||||
external_link_blog: Blog
|
||||
external_link_opendata: Datos abiertos
|
||||
@@ -220,6 +221,12 @@ es:
|
||||
text_sign_in: iniciar sesión
|
||||
text_sign_up: registrarte
|
||||
title: "¿Cómo puedo comentar este documento?"
|
||||
legislation:
|
||||
draft_versions:
|
||||
changes:
|
||||
see_text: Ver texto
|
||||
show:
|
||||
see_changes: Ver cambios
|
||||
locale: Español
|
||||
notifications:
|
||||
index:
|
||||
|
||||
@@ -85,6 +85,15 @@ Rails.application.routes.draw do
|
||||
get :search, on: :collection
|
||||
end
|
||||
|
||||
namespace :legislation do
|
||||
resources :processes, only: [:index, :show] do
|
||||
resources :draft_versions, only: [:show] do
|
||||
resources :annotations
|
||||
get :changes
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
resources :users, only: [:show] do
|
||||
resources :direct_messages, only: [:new, :create, :show]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user