Remove featured attribute management on admin/tags
This commit is contained in:
@@ -4,7 +4,7 @@ class Admin::TagsController < Admin::BaseController
|
|||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@tags = ActsAsTaggableOn::Tag.category.order(featured: :desc).page(params[:page])
|
@tags = ActsAsTaggableOn::Tag.category.page(params[:page])
|
||||||
@tag = ActsAsTaggableOn::Tag.category.new
|
@tag = ActsAsTaggableOn::Tag.category.new
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -13,11 +13,6 @@ class Admin::TagsController < Admin::BaseController
|
|||||||
redirect_to admin_tags_path
|
redirect_to admin_tags_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
|
||||||
@tag.update(tag_params)
|
|
||||||
redirect_to admin_tags_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@tag.destroy
|
@tag.destroy
|
||||||
redirect_to admin_tags_path
|
redirect_to admin_tags_path
|
||||||
@@ -26,7 +21,7 @@ class Admin::TagsController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def tag_params
|
def tag_params
|
||||||
params.require(:tag).permit(:featured, :name)
|
params.require(:tag).permit(:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_tag
|
def find_tag
|
||||||
|
|||||||
@@ -8,12 +8,6 @@
|
|||||||
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
|
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="is-featured small-12 medium-6 column">
|
|
||||||
<%= f.label :featured do %>
|
|
||||||
<%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false %>
|
|
||||||
<span class="checkbox"><%= t("admin.tags.mark_as_featured") %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= f.submit(t("admin.tags.create"), class: "button success") %>
|
<%= f.submit(t("admin.tags.create"), class: "button success") %>
|
||||||
@@ -33,13 +27,8 @@
|
|||||||
|
|
||||||
<span class="float-left text-left">
|
<span class="float-left text-left">
|
||||||
<strong><%= tag.name %></strong>
|
<strong><%= tag.name %></strong>
|
||||||
<%= f.label "featured_#{tag.id}" do %>
|
|
||||||
<%= f.check_box :featured, title: t('admin.tags.mark_as_featured'), label: false, id: "tag_featured_#{tag.id}", class: "inline-block" %>
|
|
||||||
<span class="checkbox inline-block"><%= t("admin.tags.mark_as_featured") %></span>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<%= f.submit(t("admin.tags.update"), class: "button hollow on-hover") %>
|
|
||||||
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
|
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -812,10 +812,8 @@ en:
|
|||||||
index:
|
index:
|
||||||
add_tag: Add a new proposal topic
|
add_tag: Add a new proposal topic
|
||||||
title: Proposal topics
|
title: Proposal topics
|
||||||
mark_as_featured: Propose topic upon creating proposal
|
|
||||||
name:
|
name:
|
||||||
placeholder: Type the name of the topic
|
placeholder: Type the name of the topic
|
||||||
update: Update Topic
|
|
||||||
users:
|
users:
|
||||||
columns:
|
columns:
|
||||||
name: Name
|
name: Name
|
||||||
|
|||||||
@@ -812,10 +812,8 @@ es:
|
|||||||
index:
|
index:
|
||||||
add_tag: Añade un nuevo tema de propuesta
|
add_tag: Añade un nuevo tema de propuesta
|
||||||
title: Temas de propuesta
|
title: Temas de propuesta
|
||||||
mark_as_featured: Proponer tema al crear propuesta
|
|
||||||
name:
|
name:
|
||||||
placeholder: Escribe el nombre del tema
|
placeholder: Escribe el nombre del tema
|
||||||
update: Actualizar Tema
|
|
||||||
users:
|
users:
|
||||||
columns:
|
columns:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
|
|||||||
@@ -644,10 +644,8 @@ fr:
|
|||||||
index:
|
index:
|
||||||
add_tag: Ajouter un nouveau sujet de proposition
|
add_tag: Ajouter un nouveau sujet de proposition
|
||||||
title: Sujets de propositions
|
title: Sujets de propositions
|
||||||
mark_as_featured: Proposer le sujet lors de la création d'une proposition
|
|
||||||
name:
|
name:
|
||||||
placeholder: Saisir le nom du sujet
|
placeholder: Saisir le nom du sujet
|
||||||
update: Mettre-à-jour le sujet
|
|
||||||
users:
|
users:
|
||||||
index:
|
index:
|
||||||
filter: Filtrer
|
filter: Filtrer
|
||||||
|
|||||||
@@ -641,10 +641,8 @@ nl:
|
|||||||
index:
|
index:
|
||||||
add_tag: Add a new proposal topic
|
add_tag: Add a new proposal topic
|
||||||
title: Proposal topics
|
title: Proposal topics
|
||||||
mark_as_featured: Propose topic upon creating proposal
|
|
||||||
name:
|
name:
|
||||||
placeholder: Type the name of the topic
|
placeholder: Type the name of the topic
|
||||||
update: Update Topic
|
|
||||||
users:
|
users:
|
||||||
index:
|
index:
|
||||||
filter: Filter
|
filter: Filter
|
||||||
|
|||||||
@@ -31,21 +31,6 @@ feature 'Admin tags' do
|
|||||||
expect(page).to have_content 'important issues'
|
expect(page).to have_content 'important issues'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Update' do
|
|
||||||
visit admin_tags_path
|
|
||||||
featured_checkbox = find("#tag_featured_#{@tag1.id}")
|
|
||||||
expect(featured_checkbox.checked?).to be_blank
|
|
||||||
|
|
||||||
within("#edit_tag_#{@tag1.id}") do
|
|
||||||
check "tag_featured_#{@tag1.id}"
|
|
||||||
click_button 'Update Topic'
|
|
||||||
end
|
|
||||||
|
|
||||||
visit admin_tags_path
|
|
||||||
featured_checkbox = find("#tag_featured_#{@tag1.id}")
|
|
||||||
expect(featured_checkbox.checked?).to eq(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Delete' do
|
scenario 'Delete' do
|
||||||
tag2 = create(:tag, :category, name: "bad tag")
|
tag2 = create(:tag, :category, name: "bad tag")
|
||||||
create(:debate, tag_list: tag2.name)
|
create(:debate, tag_list: tag2.name)
|
||||||
@@ -101,17 +86,6 @@ feature 'Admin tags' do
|
|||||||
|
|
||||||
expect(ActsAsTaggableOn::Tag.category.where(name: "wow_category")).to exist
|
expect(ActsAsTaggableOn::Tag.category.where(name: "wow_category")).to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Update doesn't affect the category kind" do
|
|
||||||
visit admin_tags_path
|
|
||||||
|
|
||||||
within("#edit_tag_#{@tag1.id}") do
|
|
||||||
check "tag_featured_#{@tag1.id}"
|
|
||||||
click_button 'Update Topic'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(ActsAsTaggableOn::Tag.category.where(id: @tag1.id)).to exist
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user