diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb index 6bccb176a..5e53033c5 100644 --- a/app/controllers/admin/tags_controller.rb +++ b/app/controllers/admin/tags_controller.rb @@ -4,12 +4,12 @@ class Admin::TagsController < Admin::BaseController respond_to :html, :js def index - @tags = ActsAsTaggableOn::Tag.category.page(params[:page]) - @tag = ActsAsTaggableOn::Tag.category.new + @tags = Tag.category.page(params[:page]) + @tag = Tag.category.new end def create - ActsAsTaggableOn::Tag.category.create(tag_params) + Tag.category.create(tag_params) redirect_to admin_tags_path end @@ -25,7 +25,7 @@ class Admin::TagsController < Admin::BaseController end def find_tag - @tag = ActsAsTaggableOn::Tag.category.find(params[:id]) + @tag = Tag.category.find(params[:id]) end end diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb index 5d882c51b..4d255e2bd 100644 --- a/app/controllers/budgets/ballot/lines_controller.rb +++ b/app/controllers/budgets/ballot/lines_controller.rb @@ -64,7 +64,7 @@ module Budgets end def load_categories - @categories = ActsAsTaggableOn::Tag.category.order(:name) + @categories = Tag.category.order(:name) end def load_ballot_referer diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 6b1c07832..7e0107845 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -17,7 +17,6 @@ module Budgets load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment", except: :json_data - before_action -> { flash.now[:notice] = flash[:notice].html_safe if flash[:html_safe] && flash[:notice] } before_action :load_ballot, only: [:index, :show] before_action :load_heading, only: [:index, :show] before_action :set_random_seed, only: :index @@ -147,7 +146,7 @@ module Budgets end def load_categories - @categories = ActsAsTaggableOn::Tag.category.order(:name) + @categories = Tag.category.order(:name) end def load_content_blocks diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index ffebce26d..e8e462839 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -110,12 +110,12 @@ module CommentableActions end def load_categories - @categories = ActsAsTaggableOn::Tag.category.order(:name) + @categories = Tag.category.order(:name) end def parse_tag_filter if params[:tag].present? - @tag_filter = params[:tag] if ActsAsTaggableOn::Tag.named(params[:tag]).exists? + @tag_filter = params[:tag] if Tag.named(params[:tag]).exists? end end diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb index da7bb117e..393e4e888 100644 --- a/app/controllers/management/budgets/investments_controller.rb +++ b/app/controllers/management/budgets/investments_controller.rb @@ -67,7 +67,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController end def load_categories - @categories = ActsAsTaggableOn::Tag.category.order(:name) + @categories = Tag.category.order(:name) end end diff --git a/app/controllers/sandbox_controller.rb b/app/controllers/sandbox_controller.rb deleted file mode 100644 index ca18b4588..000000000 --- a/app/controllers/sandbox_controller.rb +++ /dev/null @@ -1,45 +0,0 @@ -class SandboxController < ApplicationController - skip_authorization_check - - layout :set_layout - - helper_method(:namespace) - - def index - @templates = Dir.glob(Rails.root.join("app", "views", "sandbox", "*.html.erb").to_s).map do |filename| - filename = File.basename(filename, File.extname(filename)) - filename unless filename.starts_with?("_") || filename == "index.html" - end.compact - end - - def show - if params[:template].index(".") # CVE-2014-0130 - render action: "index" - elsif lookup_context.exists?("sandbox/#{params[:template]}") - if params[:template] == "index" - render action: "index" - else - render "sandbox/#{params[:template]}" - end - - elsif lookup_context.exists?("sandbox/#{params[:template]}/index") - render "sandbox/#{params[:template]}/index" - else - render action: "index" - end - end - - private - - def set_layout - if params[:template] && params[:template].split("_").first == "admin" - "admin" - else - "application" - end - end - - def namespace - "admin" - end -end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index c58067048..fc9ac5797 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,10 +1,10 @@ class TagsController < ApplicationController - load_and_authorize_resource class: ActsAsTaggableOn::Tag + load_and_authorize_resource respond_to :json def suggest - @tags = ActsAsTaggableOn::Tag.search(params[:search]).map(&:name) + @tags = Tag.search(params[:search]).map(&:name) respond_with @tags end diff --git a/app/helpers/valuation_helper.rb b/app/helpers/valuation_helper.rb index a0ba66e3a..8767ebb96 100644 --- a/app/helpers/valuation_helper.rb +++ b/app/helpers/valuation_helper.rb @@ -13,21 +13,6 @@ module ValuationHelper ValuatorGroup.order("name ASC").collect { |g| [g.name, "group_#{g.id}"] } end - def assigned_valuators_info(valuators) - case valuators.size - when 0 - t("valuation.budget_investments.index.no_valuators_assigned") - when 1 - "".html_safe + - valuators.first.name + - "".html_safe - else - "".html_safe + - t("valuation.budget_investments.index.valuators_assigned", count: valuators.size) + - "".html_safe - end - end - def explanation_field(field) simple_format_no_tags_no_sanitize(safe_html_with_links(field.html_safe)) if field.present? end diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index 8087e4dba..e670f86ca 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -52,7 +52,7 @@ module Abilities can :suggest, Debate can :suggest, Proposal can :suggest, Legislation::Proposal - can :suggest, ActsAsTaggableOn::Tag + can :suggest, Tag can [:flag, :unflag], Comment cannot [:flag, :unflag], Comment, user_id: user.id diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 9733a542f..724b7de2e 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -156,7 +156,7 @@ class Proposal < ApplicationRecord def self.for_summary summary = {} - categories = ActsAsTaggableOn::Tag.category_names.sort + categories = Tag.category_names.sort geozones = Geozone.names.sort groups = categories + geozones diff --git a/app/models/tag_cloud.rb b/app/models/tag_cloud.rb index 27b6c2d11..ee3184b51 100644 --- a/app/models/tag_cloud.rb +++ b/app/models/tag_cloud.rb @@ -16,7 +16,7 @@ class TagCloud end def category_names - ActsAsTaggableOn::Tag.category_names.map(&:downcase) + Tag.category_names.map(&:downcase) end def geozone_names diff --git a/app/views/admin/admin_notifications/index.html.erb b/app/views/admin/admin_notifications/index.html.erb index 986f1c077..c4d8b9c43 100644 --- a/app/views/admin/admin_notifications/index.html.erb +++ b/app/views/admin/admin_notifications/index.html.erb @@ -33,7 +33,7 @@
<%= link_to t("admin.admin_notifications.index.edit"), edit_admin_admin_notification_path(admin_notification), - method: :get, class: "button expanded hollow" %> + class: "button expanded hollow" %>
<%= link_to t("admin.admin_notifications.index.delete"), diff --git a/app/views/admin/budgets/_form.html.erb b/app/views/admin/budgets/_form.html.erb index e8337e551..a9e1805a5 100644 --- a/app/views/admin/budgets/_form.html.erb +++ b/app/views/admin/budgets/_form.html.erb @@ -95,7 +95,7 @@ <%= link_to t("admin.budgets.edit.edit_phase"), edit_admin_budget_budget_phase_path(@budget, phase), - method: :get, class: "button hollow expanded" %> + class: "button hollow expanded" %> <% end %> diff --git a/app/views/admin/milestone_statuses/index.html.erb b/app/views/admin/milestone_statuses/index.html.erb index 45c1e96a9..bf1940a64 100644 --- a/app/views/admin/milestone_statuses/index.html.erb +++ b/app/views/admin/milestone_statuses/index.html.erb @@ -25,7 +25,7 @@ <%= link_to t("admin.statuses.index.edit"), edit_admin_milestone_status_path(status), - method: :get, class: "button hollow" %> + class: "button hollow" %> <%= link_to t("admin.statuses.index.delete"), admin_milestone_status_path(status), method: :delete, class: "button hollow alert" %> diff --git a/app/views/admin/newsletters/index.html.erb b/app/views/admin/newsletters/index.html.erb index 3a2f6fb9d..7bbabde90 100644 --- a/app/views/admin/newsletters/index.html.erb +++ b/app/views/admin/newsletters/index.html.erb @@ -31,7 +31,7 @@
<%= link_to t("admin.newsletters.index.edit"), edit_admin_newsletter_path(newsletter), - method: :get, class: "button hollow expanded" %> + class: "button hollow expanded" %>
<%= link_to t("admin.newsletters.index.delete"), admin_newsletter_path(newsletter), diff --git a/config/api.yml b/config/api.yml index 0814d5552..6e47c090d 100644 --- a/config/api.yml +++ b/config/api.yml @@ -20,7 +20,7 @@ Debate: comments: [Comment] public_author: User votes_for: [Vote] - tags: ["ActsAsTaggableOn::Tag"] + tags: [Tag] Proposal: fields: id: integer @@ -42,7 +42,7 @@ Proposal: proposal_notifications: [ProposalNotification] public_author: User votes_for: [Vote] - tags: ["ActsAsTaggableOn::Tag"] + tags: [Tag] Comment: fields: id: integer @@ -68,7 +68,7 @@ ProposalNotification: proposal_id: integer public_created_at: string proposal: Proposal -ActsAsTaggableOn::Tag: +Tag: fields: id: integer name: string diff --git a/config/locales/en/valuation.yml b/config/locales/en/valuation.yml index 452c0b1e6..2c8c6d7c2 100644 --- a/config/locales/en/valuation.yml +++ b/config/locales/en/valuation.yml @@ -27,10 +27,6 @@ en: assigned_to: "Assigned to %{valuator}" title: Investment projects edit: Edit dossier - valuators_assigned: - one: Assigned valuator - other: "%{count} valuators assigned" - no_valuators_assigned: No valuators assigned table_id: ID table_title: Title table_heading_name: Heading name diff --git a/config/locales/es/valuation.yml b/config/locales/es/valuation.yml index 08b9ac9b0..15d6b7c31 100644 --- a/config/locales/es/valuation.yml +++ b/config/locales/es/valuation.yml @@ -27,10 +27,6 @@ es: assigned_to: "Asignadas a %{valuator}" title: Proyectos de gasto edit: Editar informe - valuators_assigned: - one: Evaluador asignado - other: "%{count} evaluadores asignados" - no_valuators_assigned: Sin evaluador table_id: ID table_title: Título table_heading_name: Nombre de la partida diff --git a/config/routes.rb b/config/routes.rb index 4a380a23c..1b30f8e2c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,12 +1,6 @@ Rails.application.routes.draw do mount Ckeditor::Engine => "/ckeditor" - - if Rails.env.development? || Rails.env.staging? - get "/sandbox" => "sandbox#index" - get "/sandbox/*template" => "sandbox#show" - end - mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? draw :account diff --git a/db/dev_seeds/debates.rb b/db/dev_seeds/debates.rb index 9422f0985..8e5de0c3d 100644 --- a/db/dev_seeds/debates.rb +++ b/db/dev_seeds/debates.rb @@ -19,7 +19,7 @@ section "Creating Debates" do end end - tags = ActsAsTaggableOn::Tag.where(kind: "category") + tags = Tag.where(kind: "category") 30.times do author = User.all.sample description = "

#{Faker::Lorem.paragraphs.join("

")}

" diff --git a/db/dev_seeds/notifications.rb b/db/dev_seeds/notifications.rb index 475927339..5452c7f79 100644 --- a/db/dev_seeds/notifications.rb +++ b/db/dev_seeds/notifications.rb @@ -3,7 +3,7 @@ section "Creating comment notifications" do debate = Debate.create!(author: user, title: Faker::Lorem.sentence(3).truncate(60), description: "

#{Faker::Lorem.paragraphs.join("

")}

", - tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(","), + tag_list: Tag.all.sample(3).join(","), geozone: Geozone.reorder("RANDOM()").first, terms_of_service: "1") diff --git a/db/dev_seeds/proposals.rb b/db/dev_seeds/proposals.rb index 308eefd98..216adf056 100644 --- a/db/dev_seeds/proposals.rb +++ b/db/dev_seeds/proposals.rb @@ -109,7 +109,7 @@ section "Creating Successful Proposals" do add_image_to proposal end - tags = ActsAsTaggableOn::Tag.where(kind: "category") + tags = Tag.where(kind: "category") 30.times do author = User.all.sample description = "

#{Faker::Lorem.paragraphs.join("

")}

" diff --git a/db/dev_seeds/tags_categories.rb b/db/dev_seeds/tags_categories.rb index 3ee08a1cb..b1ef647d5 100644 --- a/db/dev_seeds/tags_categories.rb +++ b/db/dev_seeds/tags_categories.rb @@ -1,17 +1,17 @@ section "Creating Tags Categories" do - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.associations")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.culture")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sports")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.social_rights")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.economy")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.employment")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.equity")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sustainability")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.participation")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.mobility")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.media")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.health")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.transparency")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.security_emergencies")) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.environment")) + Tag.category.create!(name: I18n.t("seeds.categories.associations")) + Tag.category.create!(name: I18n.t("seeds.categories.culture")) + Tag.category.create!(name: I18n.t("seeds.categories.sports")) + Tag.category.create!(name: I18n.t("seeds.categories.social_rights")) + Tag.category.create!(name: I18n.t("seeds.categories.economy")) + Tag.category.create!(name: I18n.t("seeds.categories.employment")) + Tag.category.create!(name: I18n.t("seeds.categories.equity")) + Tag.category.create!(name: I18n.t("seeds.categories.sustainability")) + Tag.category.create!(name: I18n.t("seeds.categories.participation")) + Tag.category.create!(name: I18n.t("seeds.categories.mobility")) + Tag.category.create!(name: I18n.t("seeds.categories.media")) + Tag.category.create!(name: I18n.t("seeds.categories.health")) + Tag.category.create!(name: I18n.t("seeds.categories.transparency")) + Tag.category.create!(name: I18n.t("seeds.categories.security_emergencies")) + Tag.category.create!(name: I18n.t("seeds.categories.environment")) end diff --git a/doc/api/api_en.md b/doc/api/api_en.md index f7fb1a52e..8848be487 100644 --- a/doc/api/api_en.md +++ b/doc/api/api_en.md @@ -134,7 +134,7 @@ The models are the following: | `Comment` | Comments on debates, proposals and other comments | | `Geozone` | Geozones (districts) | | `ProposalNotification` | Notifications related to proposals | -| `ActsAsTaggableOn::Tag` | Tags on debates and proposals | +| `Tag` | Tags on debates and proposals | | `Vote` | Information related to votes | ## Examples of queries diff --git a/doc/api/api_es.md b/doc/api/api_es.md index 3292809c4..a33c2bd33 100644 --- a/doc/api/api_es.md +++ b/doc/api/api_es.md @@ -134,7 +134,7 @@ La lista de modelos es la siguiente: | `Comment` | Comentarios en debates, propuestas y otros comentarios | | `Geozone` | Geozonas (distritos) | | `ProposalNotification` | Notificaciones asociadas a propuestas | -| `ActsAsTaggableOn::Tag` | Tags en debates y propuestas | +| `Tag` | Tags en debates y propuestas | | `Vote` | Información sobre votos | ## Ejemplos de consultas diff --git a/spec/factories/classifications.rb b/spec/factories/classifications.rb index df2ba4456..d2fde4b9e 100644 --- a/spec/factories/classifications.rb +++ b/spec/factories/classifications.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :tag, class: "ActsAsTaggableOn::Tag" do + factory :tag do sequence(:name) { |n| "Tag #{n} name" } trait :category do diff --git a/spec/features/admin/tags_spec.rb b/spec/features/admin/tags_spec.rb index 713c583ce..1bad1ccf6 100644 --- a/spec/features/admin/tags_spec.rb +++ b/spec/features/admin/tags_spec.rb @@ -86,7 +86,7 @@ describe "Admin tags" do click_button "Create topic" end - expect(ActsAsTaggableOn::Tag.category.where(name: "wow_category")).to exist + expect(Tag.category.where(name: "wow_category")).to exist end end diff --git a/spec/lib/acts_as_taggable_on_spec.rb b/spec/lib/acts_as_taggable_on_spec.rb index 4e496ed10..12521d67e 100644 --- a/spec/lib/acts_as_taggable_on_spec.rb +++ b/spec/lib/acts_as_taggable_on_spec.rb @@ -8,7 +8,7 @@ describe ActsAsTaggableOn do let(:debate) { create(:debate) } it "increases and decreases the tag's custom counters" do - tag = ActsAsTaggableOn::Tag.create(name: "foo") + tag = Tag.create(name: "foo") expect(tag.debates_count).to eq(0) expect(tag.proposals_count).to eq(0) @@ -47,7 +47,7 @@ describe ActsAsTaggableOn do describe "Tag" do describe "#recalculate_custom_counter_for" do it "updates the counters of proposals and debates, taking into account hidden ones" do - tag = ActsAsTaggableOn::Tag.create(name: "foo") + tag = Tag.create(name: "foo") create(:proposal, tag_list: "foo") create(:proposal, :hidden, tag_list: "foo") @@ -73,7 +73,7 @@ describe ActsAsTaggableOn do proposal.tag_list.add(tag) proposal.save - expect(ActsAsTaggableOn::Tag.public_for_api).to eq [tag] + expect(Tag.public_for_api).to eq [tag] end it "returns tags whose kind is 'category' and have at least one tagging whose taggable is not hidden" do @@ -82,7 +82,7 @@ describe ActsAsTaggableOn do proposal.tag_list.add(tag) proposal.save - expect(ActsAsTaggableOn::Tag.public_for_api).to eq [tag] + expect(Tag.public_for_api).to eq [tag] end it "blocks other kinds of tags" do @@ -91,13 +91,13 @@ describe ActsAsTaggableOn do proposal.tag_list.add(tag) proposal.save - expect(ActsAsTaggableOn::Tag.public_for_api).to be_empty + expect(Tag.public_for_api).to be_empty end it "blocks tags that don't have at least one tagged element" do create(:tag) - expect(ActsAsTaggableOn::Tag.public_for_api).to be_empty + expect(Tag.public_for_api).to be_empty end it "only permits tags on proposals or debates" do @@ -117,7 +117,7 @@ describe ActsAsTaggableOn do budget_investment.save debate.save - expect(ActsAsTaggableOn::Tag.public_for_api).to match_array([tag_1, tag_3]) + expect(Tag.public_for_api).to match_array([tag_1, tag_3]) end it "blocks tags after its taggings became hidden" do @@ -126,11 +126,11 @@ describe ActsAsTaggableOn do proposal.tag_list.add(tag) proposal.save - expect(ActsAsTaggableOn::Tag.public_for_api).to eq [tag] + expect(Tag.public_for_api).to eq [tag] proposal.delete - expect(ActsAsTaggableOn::Tag.public_for_api).to be_empty + expect(Tag.public_for_api).to be_empty end end @@ -141,10 +141,10 @@ describe ActsAsTaggableOn do create(:tag, name: "Salud") create(:tag, name: "Famosos") - expect(ActsAsTaggableOn::Tag.pg_search("f").length).to eq(2) - expect(ActsAsTaggableOn::Tag.search("cultura").first.name).to eq("Cultura") - expect(ActsAsTaggableOn::Tag.search("sal").first.name).to eq("Salud") - expect(ActsAsTaggableOn::Tag.search("fami").first.name).to eq("Familia") + expect(Tag.pg_search("f").length).to eq(2) + expect(Tag.search("cultura").first.name).to eq("Cultura") + expect(Tag.search("sal").first.name).to eq("Salud") + expect(Tag.search("fami").first.name).to eq("Familia") end end diff --git a/spec/lib/cache_spec.rb b/spec/lib/cache_spec.rb index 5d5ddb0fe..4289f938f 100644 --- a/spec/lib/cache_spec.rb +++ b/spec/lib/cache_spec.rb @@ -5,7 +5,7 @@ describe "Cache flow" do describe "Tag destroy" do it "invalidates Debate cache keys" do debate = create(:debate, tag_list: "Good, Bad") - tag = ActsAsTaggableOn::Tag.find_by(name: "Bad") + tag = Tag.find_by(name: "Bad") expect { tag.destroy }.to change { debate.reload.cache_key } end diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb index 66dec9825..e579ce22e 100644 --- a/spec/lib/graphql_spec.rb +++ b/spec/lib/graphql_spec.rb @@ -521,7 +521,7 @@ describe "Consul Schema" do it "does not display tags for taggings that are not public" do create(:proposal, tag_list: "Health") - allow(ActsAsTaggableOn::Tag).to receive(:public_for_api).and_return([]) + allow(Tag).to receive(:public_for_api).and_return([]) response = execute("{ tags { edges { node { name } } } }") received_tags = extract_fields(response, "tags", "name") diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 0b4f43256..99fefc037 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -403,7 +403,7 @@ describe Debate do describe "custom tag counters when hiding/restoring" do it "decreases the tag counter when hiden, and increases it when restored" do debate = create(:debate, tag_list: "foo") - tag = ActsAsTaggableOn::Tag.where(name: "foo").first + tag = Tag.where(name: "foo").first expect(tag.debates_count).to eq(1) debate.hide diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 6df2ea848..08032f4a1 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -346,7 +346,7 @@ describe Proposal do describe "custom tag counters when hiding/restoring" do it "decreases the tag counter when hiden, and increases it when restored" do proposal = create(:proposal, tag_list: "foo") - tag = ActsAsTaggableOn::Tag.where(name: "foo").first + tag = Tag.where(name: "foo").first expect(tag.proposals_count).to eq(1) proposal.hide