Remove open in new tab option for links

This commit is contained in:
decabeza
2019-04-11 11:03:48 +02:00
parent 050896d1d3
commit 2cff3767c1
8 changed files with 8 additions and 16 deletions

View File

@@ -57,7 +57,7 @@ class Admin::Dashboard::ActionsController < Admin::Dashboard::BaseController
:title, :description, :short_description, :request_to_administrators, :day_offset,
:required_supports, :order, :active, :action_type, :published_proposal,
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
links_attributes: [:id, :label, :url, :open_in_new_tab, :_destroy]
links_attributes: [:id, :label, :url, :_destroy]
)
end

View File

@@ -13,11 +13,7 @@
<div class="margin-top">
<h4><%= t("dashboard.new_request.links") %></h4>
<% dashboard_action.links.each do |link| %>
<% if link.open_in_new_tab %>
<p><%= link_to link.label, link.url, target: "_blank" %></p>
<% else %>
<p><%= link_to link.label, link.url %></p>
<% end %>
<% end %>
</div>
<% end %>

View File

@@ -354,7 +354,6 @@ en:
link:
label: Title
url: Link
open_in_new_tab: Open in new tab
errors:
models:
user:

View File

@@ -355,7 +355,6 @@ es:
link:
label: Título
url: Enlace
open_in_new_tab: Abrir en ventana nueva
errors:
models:
user:

View File

@@ -0,0 +1,5 @@
class RemoveOpenInNewTabFromLinks < ActiveRecord::Migration
def change
remove_column :links, :open_in_new_tab, :boolean
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190205131722) do
ActiveRecord::Schema.define(version: 20190411090023) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -804,7 +804,6 @@ ActiveRecord::Schema.define(version: 20190205131722) do
create_table "links", force: :cascade do |t|
t.string "label"
t.string "url"
t.boolean "open_in_new_tab"
t.string "linkable_type"
t.integer "linkable_id"
t.datetime "created_at", null: false

View File

@@ -7,7 +7,6 @@ namespace :proposal_actions do
Link.create!(
label: action.title,
url: action.link,
open_in_new_tab: true,
linkable: action
)
end

View File

@@ -174,10 +174,5 @@ FactoryBot.define do
linkable { |s| s.association(:action) }
label { Faker::Lorem.sentence }
url { Faker::Internet.url }
open_in_new_tab false
trait :open_in_new_tab do
open_in_new_tab true
end
end
end