Renames Legislation model to LegacyLegislation
Renames the model and related stuff from Legislation to LegacyLegislation to avoid name clashes with the future Legislation module.
This commit is contained in:
@@ -24,7 +24,7 @@ class AnnotationsController < ApplicationController
|
||||
end
|
||||
|
||||
def search
|
||||
@annotations = Annotation.where(legislation_id: params[:legislation_id])
|
||||
@annotations = Annotation.where(legacy_legislation_id: params[:legacy_legislation_id])
|
||||
annotations_hash = { total: @annotations.size, rows: @annotations }
|
||||
render json: annotations_hash.to_json(methods: :permissions)
|
||||
end
|
||||
@@ -35,6 +35,6 @@ class AnnotationsController < ApplicationController
|
||||
params
|
||||
.require(:annotation)
|
||||
.permit(:quote, :text, ranges: [:start, :startOffset, :end, :endOffset])
|
||||
.merge(legislation_id: params[:legislation_id])
|
||||
.merge(legacy_legislation_id: params[:legacy_legislation_id])
|
||||
end
|
||||
end
|
||||
|
||||
8
app/controllers/legacy_legislations_controller.rb
Normal file
8
app/controllers/legacy_legislations_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class LegacyLegislationsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
|
||||
def show
|
||||
@legacy_legislation = LegacyLegislation.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
class LegislationsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
|
||||
def show
|
||||
@legislation = Legislation.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -7,7 +7,7 @@ module Abilities
|
||||
can [:read, :map, :summary], Proposal
|
||||
can :read, Comment
|
||||
can :read, SpendingProposal
|
||||
can :read, Legislation
|
||||
can :read, LegacyLegislation
|
||||
can :read, User
|
||||
can [:search, :read], Annotation
|
||||
can :new, DirectMessage
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Annotation < ActiveRecord::Base
|
||||
serialize :ranges, Array
|
||||
|
||||
belongs_to :legislation
|
||||
belongs_to :legacy_legislation
|
||||
belongs_to :user
|
||||
|
||||
def permissions
|
||||
|
||||
3
app/models/legacy_legislation.rb
Normal file
3
app/models/legacy_legislation.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class LegacyLegislation < ActiveRecord::Base
|
||||
has_many :annotations
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
class Legislation < ActiveRecord::Base
|
||||
has_many :annotations
|
||||
end
|
||||
29
app/views/legacy_legislations/show.html.erb
Normal file
29
app/views/legacy_legislations/show.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 column">
|
||||
<div class="float-right">
|
||||
<a class="button warning" type="button" data-toggle="help-legacy-legislation">
|
||||
<sub><span class="icon-edit"></span></sub>
|
||||
<%= t("legacy_legislation.help.title") %>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-pane" id="help-legacy-legislation" data-dropdown data-auto-focus="true">
|
||||
<p>
|
||||
<%= t("legacy_legislation.help.text",
|
||||
sign_in: link_to(t("legacy_legislation.help.text_sign_in"), new_user_session_path),
|
||||
sign_up: link_to(t("legacy_legislation.help.text_sign_up"), new_user_registration_path)).html_safe %>
|
||||
<%= image_tag ("annotator_help.gif"), alt: t("legacy_legislation.help.alt") %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 small-centered column">
|
||||
<section data-annotatable-type="legacy_legislation"
|
||||
data-annotatable-id="<%= @legacy_legislation.id %>">
|
||||
<h1 class="text-center"><%= @legacy_legislation.title %></h1>
|
||||
<div id="legacy_legislation_body"><%= @legacy_legislation.body %></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,29 +0,0 @@
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 column">
|
||||
<div class="float-right">
|
||||
<a class="button warning" type="button" data-toggle="help-legislation">
|
||||
<sub><span class="icon-edit"></span></sub>
|
||||
<%= t("legislation.help.title") %>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-pane" id="help-legislation" data-dropdown data-auto-focus="true">
|
||||
<p>
|
||||
<%= t("legislation.help.text",
|
||||
sign_in: link_to(t("legislation.help.text_sign_in"), new_user_session_path),
|
||||
sign_up: link_to(t("legislation.help.text_sign_up"), new_user_registration_path)).html_safe %>
|
||||
<%= image_tag ("annotator_help.gif"), alt: t("legislation.help.alt") %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 small-centered column">
|
||||
<section data-annotatable-type="legislation"
|
||||
data-annotatable-id="<%= @legislation.id %>">
|
||||
<h1 class="text-center"><%= @legislation.title %></h1>
|
||||
<div id="legislation_body"><%= @legislation.body %></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user