diff --git a/app/controllers/annotations_controller.rb b/app/controllers/annotations_controller.rb deleted file mode 100644 index 8b004076c..000000000 --- a/app/controllers/annotations_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -class AnnotationsController < ApplicationController - skip_before_action :verify_authenticity_token - load_and_authorize_resource - - def create - @annotation = Annotation.new(annotation_params) - @annotation.user = current_user - if @annotation.save - render json: @annotation.to_json(methods: :permissions) - end - end - - def update - @annotation = Annotation.find(params[:id]) - if @annotation.update_attributes(annotation_params) - render json: @annotation.to_json(methods: :permissions) - end - end - - def destroy - @annotation = Annotation.find(params[:id]) - @annotation.destroy - render json: { status: :ok } - end - - def search - @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 - - private - - def annotation_params - params - .require(:annotation) - .permit(:quote, :text, ranges: [:start, :startOffset, :end, :endOffset]) - .merge(legacy_legislation_id: params[:legacy_legislation_id]) - end -end diff --git a/app/controllers/legacy_legislations_controller.rb b/app/controllers/legacy_legislations_controller.rb deleted file mode 100644 index 103c81cea..000000000 --- a/app/controllers/legacy_legislations_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class LegacyLegislationsController < ApplicationController - load_and_authorize_resource - - def show - @legacy_legislation = LegacyLegislation.find(params[:id]) - end - -end diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index 847f1effc..6e879a6a9 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -57,8 +57,6 @@ module Abilities can [:search, :create, :index, :destroy], ::Manager can [:search, :index], ::User - can :manage, Annotation - can [:read, :update, :valuate, :destroy, :summary], SpendingProposal can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget can [:read, :create, :update, :destroy], Budget::Group diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index 7c84089b4..2305a0176 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -92,9 +92,6 @@ module Abilities can [:create, :show], ProposalNotification, proposal: { author_id: user.id } - can :create, Annotation - can [:update, :destroy], Annotation, user_id: user.id - can [:create], Topic can [:update, :destroy], Topic, author_id: user.id diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index ab5a095e0..a20a119fe 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -16,9 +16,7 @@ module Abilities can :read, Poll::Question can [:read, :welcome], Budget can :read, SpendingProposal - can :read, LegacyLegislation can :read, User - can [:search, :read], Annotation can [:read], Budget can [:read], Budget::Group can [:read, :print, :json_data], Budget::Investment diff --git a/app/models/annotation.rb b/app/models/annotation.rb deleted file mode 100644 index 295badd92..000000000 --- a/app/models/annotation.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Annotation < ActiveRecord::Base - serialize :ranges, Array - - belongs_to :legacy_legislation - belongs_to :user - - def permissions - { update: [user_id], delete: [user_id], admin: [] } - end -end diff --git a/app/models/legacy_legislation.rb b/app/models/legacy_legislation.rb deleted file mode 100644 index ddc267e3a..000000000 --- a/app/models/legacy_legislation.rb +++ /dev/null @@ -1,3 +0,0 @@ -class LegacyLegislation < ActiveRecord::Base - has_many :annotations -end diff --git a/app/views/legacy_legislations/show.html.erb b/app/views/legacy_legislations/show.html.erb deleted file mode 100644 index ab65649bb..000000000 --- a/app/views/legacy_legislations/show.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -
-
-
- -   - <%= t("legacy_legislation.help.title") %> - - - -
-
-
- -
-
-
-

<%= @legacy_legislation.title %>

-
<%= @legacy_legislation.body %>
-
-
-
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 20f843999..ae76c3626 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -242,13 +242,6 @@ en: no_notifications: "You don't have new notifications" admin: watch_form_message: 'You have unsaved changes. Do you confirm to leave the page?' - legacy_legislation: - help: - alt: Select the text you want to comment and press the button with the pencil. - text: To comment this document you must %{sign_in} or %{sign_up}. Then select the text you want to comment and press the button with the pencil. - text_sign_in: login - text_sign_up: sign up - title: How I can comment this document? notifications: index: empty_notifications: You don't have new notifications. diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index e1a2aa3e2..c87175398 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -242,13 +242,6 @@ es: no_notifications: "No tienes notificaciones nuevas" admin: watch_form_message: 'Has realizado cambios que no han sido guardados. ¿Seguro que quieres abandonar la página?' - legacy_legislation: - help: - alt: Selecciona el texto que quieres comentar y pulsa en el botón con el lápiz. - text: Para comentar este documento debes %{sign_in} o %{sign_up}. Después selecciona el texto que quieres comentar y pulsa en el botón con el lápiz. - text_sign_in: iniciar sesión - text_sign_up: registrarte - title: '¿Cómo puedo comentar este documento?' notifications: index: empty_notifications: No tienes notificaciones nuevas. diff --git a/db/migrate/20190124084612_drop_annotations_table.rb b/db/migrate/20190124084612_drop_annotations_table.rb new file mode 100644 index 000000000..eaf86595a --- /dev/null +++ b/db/migrate/20190124084612_drop_annotations_table.rb @@ -0,0 +1,5 @@ +class DropAnnotationsTable < ActiveRecord::Migration + def change + drop_table :annotations + end +end diff --git a/db/migrate/20190124085815_drop_legacy_legislations_table.rb b/db/migrate/20190124085815_drop_legacy_legislations_table.rb new file mode 100644 index 000000000..28381e1c2 --- /dev/null +++ b/db/migrate/20190124085815_drop_legacy_legislations_table.rb @@ -0,0 +1,5 @@ +class DropLegacyLegislationsTable < ActiveRecord::Migration + def change + drop_table :legacy_legislations + end +end diff --git a/db/schema.rb b/db/schema.rb index 333cdc28f..5a1e4cc20 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -73,19 +73,6 @@ ActiveRecord::Schema.define(version: 20190205131722) do add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree - create_table "annotations", force: :cascade do |t| - t.string "quote" - t.text "ranges" - t.text "text" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "user_id" - t.integer "legacy_legislation_id" - end - - add_index "annotations", ["legacy_legislation_id"], name: "index_annotations_on_legacy_legislation_id", using: :btree - add_index "annotations", ["user_id"], name: "index_annotations_on_user_id", using: :btree - create_table "banner_sections", force: :cascade do |t| t.integer "banner_id" t.integer "web_section_id" @@ -545,13 +532,6 @@ ActiveRecord::Schema.define(version: 20190205131722) do add_index "images", ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id", using: :btree add_index "images", ["user_id"], name: "index_images_on_user_id", using: :btree - create_table "legacy_legislations", force: :cascade do |t| - t.string "title" - t.text "body" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "legislation_annotations", force: :cascade do |t| t.string "quote" t.text "ranges" @@ -1539,8 +1519,6 @@ ActiveRecord::Schema.define(version: 20190205131722) do end add_foreign_key "administrators", "users" - add_foreign_key "annotations", "legacy_legislations" - add_foreign_key "annotations", "users" add_foreign_key "budget_investments", "communities" add_foreign_key "documents", "users" add_foreign_key "failed_census_calls", "poll_officers" diff --git a/spec/factories/legislations.rb b/spec/factories/legislations.rb index e911f574e..92a731736 100644 --- a/spec/factories/legislations.rb +++ b/spec/factories/legislations.rb @@ -1,17 +1,4 @@ FactoryBot.define do - factory :legacy_legislation do - sequence(:title) { |n| "Legacy Legislation #{n}" } - body "In order to achieve this..." - end - - factory :annotation do - quote "ipsum" - text "Loremp ipsum dolor" - ranges [{"start" => "/div[1]", "startOffset" => 5, "end" => "/div[1]", "endOffset" => 10}] - legacy_legislation - user - end - factory :legislation_process, class: 'Legislation::Process' do title "A collaborative legislation process" description "Description of the process" diff --git a/spec/models/abilities/administrator_spec.rb b/spec/models/abilities/administrator_spec.rb index fc50bc987..2a7efc28b 100644 --- a/spec/models/abilities/administrator_spec.rb +++ b/spec/models/abilities/administrator_spec.rb @@ -64,8 +64,6 @@ describe Abilities::Administrator do it { should be_able_to(:comment_as_administrator, legislation_question) } it { should_not be_able_to(:comment_as_moderator, legislation_question) } - it { should be_able_to(:manage, Annotation) } - it { should be_able_to(:read, SpendingProposal) } it { should be_able_to(:update, SpendingProposal) } it { should be_able_to(:valuate, SpendingProposal) }