Draft Version page
This commit is contained in:
@@ -50,8 +50,7 @@
|
|||||||
//= require markdown_editor
|
//= require markdown_editor
|
||||||
//= require cocoon
|
//= require cocoon
|
||||||
//= require allegations
|
//= require allegations
|
||||||
//= require legislation_debate
|
//= require legislation
|
||||||
//= require legislation_questions
|
|
||||||
//= require custom
|
//= require custom
|
||||||
|
|
||||||
var initialize_modules = function() {
|
var initialize_modules = function() {
|
||||||
@@ -76,8 +75,7 @@ var initialize_modules = function() {
|
|||||||
App.SocialShare.initialize();
|
App.SocialShare.initialize();
|
||||||
App.MarkdownEditor.initialize();
|
App.MarkdownEditor.initialize();
|
||||||
App.Allegations.initialize();
|
App.Allegations.initialize();
|
||||||
App.LegislationDebate.initialize();
|
App.Legislation.initialize();
|
||||||
App.LegislationQuestions.initialize();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|||||||
16
app/assets/javascripts/legislation.js.coffee
Normal file
16
app/assets/javascripts/legislation.js.coffee
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
App.Legislation =
|
||||||
|
|
||||||
|
initialize: ->
|
||||||
|
$('#js-toggle-debate').on
|
||||||
|
click: ->
|
||||||
|
$('#debate-info').toggle()
|
||||||
|
|
||||||
|
$('form#new_legislation_answer input.button').hide()
|
||||||
|
$('form#new_legislation_answer input[type=radio]').on
|
||||||
|
click: ->
|
||||||
|
$('form#new_legislation_answer').submit()
|
||||||
|
|
||||||
|
$('form#draft_version_go_to_version input.button').hide()
|
||||||
|
$('form#draft_version_go_to_version select').on
|
||||||
|
change: ->
|
||||||
|
$('form#draft_version_go_to_version').submit()
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
App.LegislationDebate =
|
|
||||||
|
|
||||||
initialize: ->
|
|
||||||
$('#js-toggle-debate').on
|
|
||||||
click: ->
|
|
||||||
$('#debate-info').toggle()
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
App.LegislationQuestions =
|
|
||||||
|
|
||||||
initialize: ->
|
|
||||||
$('form#new_legislation_answer input.button').hide()
|
|
||||||
$('form#new_legislation_answer input[type=radio]').on
|
|
||||||
click: ->
|
|
||||||
$('form#new_legislation_answer').submit()
|
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ App.MarkdownEditor =
|
|||||||
textarea_content = element.find('textarea').val()
|
textarea_content = element.find('textarea').val()
|
||||||
result = md.render(textarea_content)
|
result = md.render(textarea_content)
|
||||||
element.find('#markdown-preview').html(result)
|
element.find('#markdown-preview').html(result)
|
||||||
element.find('#markdown-result input').val(result)
|
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$('.markdown-editor').each ->
|
$('.markdown-editor').each ->
|
||||||
|
|||||||
@@ -11,4 +11,14 @@ class Legislation::DraftVersionsController < Legislation::BaseController
|
|||||||
def changes
|
def changes
|
||||||
@draft_version = @process.draft_versions.find(params[:draft_version_id])
|
@draft_version = @process.draft_versions.find(params[:draft_version_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def go_to_version
|
||||||
|
version = @process.draft_versions.find(params[:draft_version_id])
|
||||||
|
|
||||||
|
if params[:redirect_action] == 'changes'
|
||||||
|
redirect_to legislation_process_draft_version_changes_path(@process, version)
|
||||||
|
else
|
||||||
|
redirect_to legislation_process_draft_version_path(@process, version)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ class Legislation::DraftVersion < ActiveRecord::Base
|
|||||||
validates :body, presence: true
|
validates :body, presence: true
|
||||||
validates :status, presence: true, inclusion: { in: VALID_STATUSES }
|
validates :status, presence: true, inclusion: { in: VALID_STATUSES }
|
||||||
|
|
||||||
def body_in_html
|
before_save :render_html
|
||||||
|
|
||||||
|
def render_html
|
||||||
renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
|
renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
|
||||||
toc_renderer = Redcarpet::Render::HTML_TOC.new(with_toc_data: true)
|
toc_renderer = Redcarpet::Render::HTML_TOC.new(with_toc_data: true)
|
||||||
|
|
||||||
body_html = Redcarpet::Markdown.new(renderer).render(body)
|
self.body_html = Redcarpet::Markdown.new(renderer).render(body)
|
||||||
toc = Redcarpet::Markdown.new(toc_renderer).render(body)
|
self.toc_html = Redcarpet::Markdown.new(toc_renderer).render(body)
|
||||||
|
|
||||||
return toc, body_html
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -82,9 +82,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="markdown-preview" class="small-12 medium-6 column">
|
<div id="markdown-preview" class="small-12 medium-6 column">
|
||||||
</div>
|
</div>
|
||||||
<div id="markdown-result">
|
|
||||||
<%= f.hidden_field :body_html, label: false %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<div class="legislation-hero legislation-allegation no-margin-top grey-heading">
|
||||||
|
<div class="row headline">
|
||||||
|
<div class="small-12 medium-7 column">
|
||||||
|
<h3><%= process.title %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-4 column right">
|
||||||
|
<a class="button-subscribed expanded button strong" title="Suscríbete al proceso" data-remote="true" rel="nofollow" data-method="post" href="#">
|
||||||
|
<span class="icon-checkmark-circle" aria-hidden="true"></span>
|
||||||
|
<h3>Suscrito</h3>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="center half-gradient">
|
||||||
|
<a class="button big center button-circle" title="Ver info del proceso">
|
||||||
|
<span class="icon-angle-down" aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,14 +1,32 @@
|
|||||||
<% provide :title do %><%= "#{@draft_version.title} - #{t('.title')} - #{@process.title}" %><% end %>
|
<% provide :title do %><%= "#{@draft_version.title} - #{t('.title')} - #{@process.title}" %><% end %>
|
||||||
|
|
||||||
<div class="row">
|
<%= render 'process_header', process: @process %>
|
||||||
<h2><%= @process.title %></h2>
|
|
||||||
<h2><%= @draft_version.title %></h2>
|
|
||||||
|
|
||||||
<div>
|
<div class="column row">
|
||||||
<%= link_to t('.see_text'), legislation_process_draft_version_path(@process, @draft_version) %>
|
<%= render 'legislation/processes/key_dates', process: @process, phase: :allegations %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div class="draft-panels small-12 column row">
|
||||||
<%= markdown @draft_version.changelog %>
|
<div class="row draft-chooser">
|
||||||
|
<div class="small-12 medium-9 column">
|
||||||
|
<h3><%= t('.seeing_changelog_version') %></h3>
|
||||||
|
<div class="select-box">
|
||||||
|
<%= form_tag go_to_version_legislation_process_draft_versions_path(@process), method: :get, id: "draft_version_go_to_version" do %>
|
||||||
|
<%= select_tag "draft_version_id", options_from_collection_for_select(@process.draft_versions, 'id', 'title', @draft_version.id), "aria-label": t('legislation.draft_versions.show.select_draft_version') %>
|
||||||
|
<%= hidden_field_tag "redirect_action", "changes" %>
|
||||||
|
<%= submit_tag t('legislation.draft_versions.show.select_version_submit'), class: "button" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<span><%= t('legislation.draft_versions.show.updated_at', date: format_date(@draft_version.updated_at)) %></span>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= link_to t('.see_text'), legislation_process_draft_version_path(@process, @draft_version), title: t('.see_text'), class: "button strong" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 medium-8 column legislation-changes">
|
||||||
|
<%= markdown @draft_version.changelog %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,27 +1,69 @@
|
|||||||
<% provide :title do %><%= "#{@draft_version.title} - #{@process.title}" %><% end %>
|
<% provide :title do %><%= "#{@draft_version.title} - #{@process.title}" %><% end %>
|
||||||
|
|
||||||
<div class="row">
|
<%= render 'process_header', process: @process %>
|
||||||
<h2><%= link_to @process.title, @process %></h2>
|
|
||||||
<h2><%= @draft_version.title %></h2>
|
|
||||||
|
|
||||||
<div>
|
<div class="column row">
|
||||||
<%= link_to t('.see_changes'), legislation_process_draft_version_changes_path(@process, @draft_version) %>
|
<%= render 'legislation/processes/key_dates', process: @process, phase: :allegations %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<% toc, body = @draft_version.body_in_html %>
|
<div class="draft-panels small-12 column row">
|
||||||
|
<div class="row draft-chooser">
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-9 column">
|
||||||
<%= toc.html_safe %>
|
<h3><%= t('.seeing_version') %></h3>
|
||||||
</div>
|
<div class="select-box">
|
||||||
|
<%= form_tag go_to_version_legislation_process_draft_versions_path(@process), method: :get, id: "draft_version_go_to_version" do %>
|
||||||
<div class="small-12 medium-9 column">
|
<%= select_tag "draft_version_id", options_from_collection_for_select(@process.draft_versions, 'id', 'title', @draft_version.id), "aria-label": t('.select_draft_version') %>
|
||||||
<section data-annotatable-type="legislation_draft_version"
|
<%= submit_tag t('.select_version_submit'), class: "button" %>
|
||||||
data-annotatable-id="<%= @draft_version.id %>">
|
<% end %>
|
||||||
|
<span><%= link_to t('.see_changes'), legislation_process_draft_version_changes_path(@process, @draft_version) %></span>
|
||||||
<div id="legislation_draft_version_body">
|
</div>
|
||||||
<%= body.html_safe %>
|
<span><%= t('.updated_at', date: format_date(@draft_version.updated_at)) %></span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
<div class="small-12 medium-3 column">
|
||||||
|
<%= link_to t('.see_comments'), legislation_process_draft_version_annotations_path(@process, @draft_version), title: t('.see_comments'), class: "button strong" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row draft-allegation medium-collapse">
|
||||||
|
<div class="small-12 calc-index column border-right js-toggle-allegations">
|
||||||
|
<div class="draft-panel">
|
||||||
|
<div>
|
||||||
|
<span class="icon-banner" aria-hidden="true"></span> <span class="panel-title"><%= t('.text_index') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="draft-index-rotated center">
|
||||||
|
<span class="panel-title"><%= t('.text_index') %></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="draft-index">
|
||||||
|
<%= @draft_version.toc_html.html_safe %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 calc-text column border-right">
|
||||||
|
<div class="draft-panel">
|
||||||
|
<div><span class="panel-title"><%= t('.text_body') %></span></div>
|
||||||
|
</div>
|
||||||
|
<div class="draft-text">
|
||||||
|
<%= @draft_version.body_html.html_safe %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 calc-comments end column js-toggle-allegations">
|
||||||
|
<div class="draft-panel">
|
||||||
|
<div>
|
||||||
|
<span class="icon-comments" aria-hidden="true"></span> <span class="panel-title"><%= t('.text_comments') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="draft-comments-rotated center">
|
||||||
|
<span class="panel-title"><%= t('.text_comments') %></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -226,9 +226,18 @@ en:
|
|||||||
draft_versions:
|
draft_versions:
|
||||||
changes:
|
changes:
|
||||||
title: Changes
|
title: Changes
|
||||||
see_text: See text
|
seeing_changelog_version: Revision changes summary
|
||||||
|
see_text: See text draft
|
||||||
show:
|
show:
|
||||||
see_changes: See changes
|
seeing_version: You're seeing draft version
|
||||||
|
select_draft_version: Select draft
|
||||||
|
select_version_submit: see
|
||||||
|
updated_at: updated at %{date}
|
||||||
|
see_changes: see changes summary
|
||||||
|
see_comments: See all comments
|
||||||
|
text_index: Index
|
||||||
|
text_body: Text
|
||||||
|
text_comments: Comments
|
||||||
processes:
|
processes:
|
||||||
debate:
|
debate:
|
||||||
empty_questions: There aren't any questions
|
empty_questions: There aren't any questions
|
||||||
|
|||||||
@@ -226,9 +226,18 @@ es:
|
|||||||
draft_versions:
|
draft_versions:
|
||||||
changes:
|
changes:
|
||||||
title: Cambios
|
title: Cambios
|
||||||
see_text: Ver texto
|
seeing_changelog_version: Resumen de cambios de la revisión
|
||||||
|
see_text: Ver borrador del texto
|
||||||
show:
|
show:
|
||||||
see_changes: Ver cambios
|
seeing_version: Estás viendo la revisión
|
||||||
|
select_draft_version: Seleccionar borrador
|
||||||
|
select_version_submit: ver
|
||||||
|
updated_at: actualizada el %{date}
|
||||||
|
see_changes: ver resumen de cambios
|
||||||
|
see_comments: Ver todos los comentarios
|
||||||
|
text_index: Índice
|
||||||
|
text_body: Texto
|
||||||
|
text_comments: Comentarios
|
||||||
processes:
|
processes:
|
||||||
debate:
|
debate:
|
||||||
empty_questions: No hay preguntas
|
empty_questions: No hay preguntas
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ Rails.application.routes.draw do
|
|||||||
resources :answers, only: [:create]
|
resources :answers, only: [:create]
|
||||||
end
|
end
|
||||||
resources :draft_versions, only: [:show] do
|
resources :draft_versions, only: [:show] do
|
||||||
|
get :go_to_version, on: :collection
|
||||||
get :changes
|
get :changes
|
||||||
resources :annotations
|
resources :annotations
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddTocHtmlToDraftVersions < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :legislation_draft_versions, :toc_html, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20161229110336) do
|
ActiveRecord::Schema.define(version: 20161229213217) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -123,10 +123,10 @@ ActiveRecord::Schema.define(version: 20161229110336) do
|
|||||||
t.string "visit_id"
|
t.string "visit_id"
|
||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
t.integer "flags_count", default: 0
|
t.integer "flags_count", default: 0
|
||||||
t.datetime "ignored_flag_at"
|
|
||||||
t.integer "cached_votes_total", default: 0
|
t.integer "cached_votes_total", default: 0
|
||||||
t.integer "cached_votes_up", default: 0
|
t.integer "cached_votes_up", default: 0
|
||||||
t.integer "cached_votes_down", default: 0
|
t.integer "cached_votes_down", default: 0
|
||||||
|
t.datetime "ignored_flag_at"
|
||||||
t.integer "comments_count", default: 0
|
t.integer "comments_count", default: 0
|
||||||
t.datetime "confirmed_hide_at"
|
t.datetime "confirmed_hide_at"
|
||||||
t.integer "cached_anonymous_votes_total", default: 0
|
t.integer "cached_anonymous_votes_total", default: 0
|
||||||
@@ -145,6 +145,7 @@ ActiveRecord::Schema.define(version: 20161229110336) do
|
|||||||
add_index "debates", ["cached_votes_total"], name: "index_debates_on_cached_votes_total", using: :btree
|
add_index "debates", ["cached_votes_total"], name: "index_debates_on_cached_votes_total", using: :btree
|
||||||
add_index "debates", ["cached_votes_up"], name: "index_debates_on_cached_votes_up", using: :btree
|
add_index "debates", ["cached_votes_up"], name: "index_debates_on_cached_votes_up", using: :btree
|
||||||
add_index "debates", ["confidence_score"], name: "index_debates_on_confidence_score", using: :btree
|
add_index "debates", ["confidence_score"], name: "index_debates_on_confidence_score", using: :btree
|
||||||
|
add_index "debates", ["description"], name: "index_debates_on_description", using: :btree
|
||||||
add_index "debates", ["geozone_id"], name: "index_debates_on_geozone_id", using: :btree
|
add_index "debates", ["geozone_id"], name: "index_debates_on_geozone_id", using: :btree
|
||||||
add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree
|
add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree
|
||||||
add_index "debates", ["hot_score"], name: "index_debates_on_hot_score", using: :btree
|
add_index "debates", ["hot_score"], name: "index_debates_on_hot_score", using: :btree
|
||||||
@@ -252,6 +253,7 @@ ActiveRecord::Schema.define(version: 20161229110336) do
|
|||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.text "body_html"
|
t.text "body_html"
|
||||||
|
t.text "toc_html"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "legislation_draft_versions", ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at", using: :btree
|
add_index "legislation_draft_versions", ["hidden_at"], name: "index_legislation_draft_versions_on_hidden_at", using: :btree
|
||||||
@@ -394,6 +396,7 @@ ActiveRecord::Schema.define(version: 20161229110336) do
|
|||||||
add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree
|
add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree
|
||||||
add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree
|
add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree
|
||||||
add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree
|
add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree
|
||||||
|
add_index "proposals", ["description"], name: "index_proposals_on_description", using: :btree
|
||||||
add_index "proposals", ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree
|
add_index "proposals", ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree
|
||||||
add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree
|
add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree
|
||||||
add_index "proposals", ["hot_score"], name: "index_proposals_on_hot_score", using: :btree
|
add_index "proposals", ["hot_score"], name: "index_proposals_on_hot_score", using: :btree
|
||||||
@@ -566,7 +569,7 @@ ActiveRecord::Schema.define(version: 20161229110336) do
|
|||||||
t.boolean "email_digest", default: true
|
t.boolean "email_digest", default: true
|
||||||
t.boolean "email_on_direct_message", default: true
|
t.boolean "email_on_direct_message", default: true
|
||||||
t.boolean "official_position_badge", default: false
|
t.boolean "official_position_badge", default: false
|
||||||
t.datetime "password_changed_at", default: '2016-12-21 17:55:08', null: false
|
t.datetime "password_changed_at", default: '2016-11-02 13:51:14', null: false
|
||||||
t.boolean "created_from_signature", default: false
|
t.boolean "created_from_signature", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -87,12 +87,11 @@ feature 'Admin legislation draft versions' do
|
|||||||
click_link 'Version 1'
|
click_link 'Version 1'
|
||||||
|
|
||||||
fill_in 'legislation_draft_version_title', with: 'Version 1b'
|
fill_in 'legislation_draft_version_title', with: 'Version 1b'
|
||||||
fill_in 'legislation_draft_version_body', with: '# Version 1 body\r\nParagraph\r\n>Quote'
|
fill_in 'legislation_draft_version_body', with: '# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote'
|
||||||
|
|
||||||
click_button 'Save changes'
|
click_button 'Save changes'
|
||||||
|
|
||||||
expect(page).to have_content 'Version 1b'
|
expect(page).to have_content 'Version 1b'
|
||||||
expect(draft_version.reload.body_html).to eq("<h1>Version 1 body\\r\\nParagraph\\r\\n>Quote</h1>\r\n")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,4 +6,75 @@ RSpec.describe Legislation::DraftVersion, type: :model do
|
|||||||
it "should be valid" do
|
it "should be valid" do
|
||||||
expect(legislation_draft_version).to be_valid
|
expect(legislation_draft_version).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "renders and saves the html from the markdown body field" do
|
||||||
|
legislation_draft_version.body = body_markdown
|
||||||
|
|
||||||
|
legislation_draft_version.save!
|
||||||
|
|
||||||
|
expect(legislation_draft_version.body_html).to eq(body_html)
|
||||||
|
expect(legislation_draft_version.toc_html).to eq(toc_html)
|
||||||
|
end
|
||||||
|
|
||||||
|
def body_markdown
|
||||||
|
<<-BODY_MARKDOWN
|
||||||
|
# Title 1
|
||||||
|
|
||||||
|
Some paragraph.
|
||||||
|
|
||||||
|
A list:
|
||||||
|
|
||||||
|
- item 1
|
||||||
|
- item 2
|
||||||
|
|
||||||
|
## Subtitle
|
||||||
|
|
||||||
|
Another paragraph.
|
||||||
|
|
||||||
|
# Title 2
|
||||||
|
|
||||||
|
Something about this.
|
||||||
|
BODY_MARKDOWN
|
||||||
|
end
|
||||||
|
|
||||||
|
def body_html
|
||||||
|
<<-BODY_HTML
|
||||||
|
<h1 id="title-1">Title 1</h1>
|
||||||
|
|
||||||
|
<p>Some paragraph.</p>
|
||||||
|
|
||||||
|
<p>A list:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>item 1</li>
|
||||||
|
<li>item 2</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="subtitle">Subtitle</h2>
|
||||||
|
|
||||||
|
<p>Another paragraph.</p>
|
||||||
|
|
||||||
|
<h1 id="title-2">Title 2</h1>
|
||||||
|
|
||||||
|
<p>Something about this.</p>
|
||||||
|
BODY_HTML
|
||||||
|
end
|
||||||
|
|
||||||
|
def toc_html
|
||||||
|
<<-TOC_HTML
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#title-1">Title 1</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#subtitle">Subtitle</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#title-2">Title 2</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
TOC_HTML
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user