Merge pull request #4577 from consul/admin_polls_sdg
Hide SDG columns on admin polls if SDG feature is disabled
This commit is contained in:
@@ -20,8 +20,10 @@
|
|||||||
<th class="text-center"><%= t("admin.legislation.processes.process.start_date") %></th>
|
<th class="text-center"><%= t("admin.legislation.processes.process.start_date") %></th>
|
||||||
<th class="text-center"><%= t("admin.legislation.processes.process.end_date") %></th>
|
<th class="text-center"><%= t("admin.legislation.processes.process.end_date") %></th>
|
||||||
<th class="text-center"><%= t("admin.legislation.processes.process.comments") %></th>
|
<th class="text-center"><%= t("admin.legislation.processes.process.comments") %></th>
|
||||||
<th class="text-center"><%= SDG::Goal.model_name.human(count: :other).upcase_first %></th>
|
<% if feature?(:sdg) %>
|
||||||
<th class="text-center"><%= SDG::Target.model_name.human(count: :other).upcase_first %></th>
|
<th class="text-center"><%= SDG::Goal.model_name.human(count: :other).upcase_first %></th>
|
||||||
|
<th class="text-center"><%= SDG::Target.model_name.human(count: :other).upcase_first %></th>
|
||||||
|
<% end %>
|
||||||
<th><%= t("admin.actions.actions") %></th>
|
<th><%= t("admin.actions.actions") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -34,8 +36,10 @@
|
|||||||
<td class="text-center"><%= I18n.l process.start_date %></td>
|
<td class="text-center"><%= I18n.l process.start_date %></td>
|
||||||
<td class="text-center"><%= I18n.l process.end_date %></td>
|
<td class="text-center"><%= I18n.l process.end_date %></td>
|
||||||
<td class="text-center"><%= process.total_comments %></td>
|
<td class="text-center"><%= process.total_comments %></td>
|
||||||
<td class="text-center"><%= process.sdg_goal_list %></td>
|
<% if feature?(:sdg) %>
|
||||||
<td class="text-center"><%= process.sdg_target_list %></td>
|
<td class="text-center"><%= process.sdg_goal_list %></td>
|
||||||
|
<td class="text-center"><%= process.sdg_target_list %></td>
|
||||||
|
<% end %>
|
||||||
<td><%= render Admin::TableActionsComponent.new(process) %></td>
|
<td><%= render Admin::TableActionsComponent.new(process) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
<td><strong><%= poll.name %></strong></td>
|
<td><strong><%= poll.name %></strong></td>
|
||||||
<td class="text-center"><%= l poll.starts_at.to_date %></td>
|
<td class="text-center"><%= l poll.starts_at.to_date %></td>
|
||||||
<td class="text-center"><%= l poll.ends_at.to_date %></td>
|
<td class="text-center"><%= l poll.ends_at.to_date %></td>
|
||||||
<td class="text-center"><%= poll.sdg_goal_list %></td>
|
<% if feature?(:sdg) %>
|
||||||
<td class="text-center"><%= poll.sdg_target_list %></td>
|
<td class="text-center"><%= poll.sdg_goal_list %></td>
|
||||||
|
<td class="text-center"><%= poll.sdg_target_list %></td>
|
||||||
|
<% end %>
|
||||||
<td>
|
<td>
|
||||||
<%= render Admin::TableActionsComponent.new(poll,
|
<%= render Admin::TableActionsComponent.new(poll,
|
||||||
destroy_confirmation: t("admin.polls.destroy.alert")
|
destroy_confirmation: t("admin.polls.destroy.alert")
|
||||||
|
|||||||
@@ -14,8 +14,10 @@
|
|||||||
<th class="small-5"><%= t("admin.polls.index.name") %></th>
|
<th class="small-5"><%= t("admin.polls.index.name") %></th>
|
||||||
<th class="text-center"><%= t("admin.polls.index.start_date") %></th>
|
<th class="text-center"><%= t("admin.polls.index.start_date") %></th>
|
||||||
<th class="text-center"><%= t("admin.polls.index.closing_date") %></th>
|
<th class="text-center"><%= t("admin.polls.index.closing_date") %></th>
|
||||||
<th class="text-center"><%= SDG::Goal.model_name.human(count: :other).upcase_first %></th>
|
<% if feature?(:sdg) %>
|
||||||
<th class="text-center"><%= SDG::Target.model_name.human(count: :other).upcase_first %></th>
|
<th class="text-center"><%= SDG::Goal.model_name.human(count: :other).upcase_first %></th>
|
||||||
|
<th class="text-center"><%= SDG::Target.model_name.human(count: :other).upcase_first %></th>
|
||||||
|
<% end %>
|
||||||
<th><%= t("admin.actions.actions") %></th>
|
<th><%= t("admin.actions.actions") %></th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -371,6 +371,22 @@ describe "Admin collaborative legislation", :admin do
|
|||||||
Setting["sdg.process.legislation"] = true
|
Setting["sdg.process.legislation"] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "do not show SDG columns if disabled" do
|
||||||
|
process = create(:legislation_process, title: "Legislation process with SDG related content")
|
||||||
|
process.sdg_goals = [SDG::Goal[1], SDG::Goal[17]]
|
||||||
|
|
||||||
|
Setting["feature.sdg"] = false
|
||||||
|
|
||||||
|
visit admin_legislation_processes_path
|
||||||
|
|
||||||
|
expect(page).not_to have_content "Goals"
|
||||||
|
expect(page).not_to have_content "Targets"
|
||||||
|
|
||||||
|
within "tr", text: "Legislation process with SDG related content" do
|
||||||
|
expect(page).not_to have_content "1, 17"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scenario "create Collaborative Legislation with sdg related list" do
|
scenario "create Collaborative Legislation with sdg related list" do
|
||||||
visit new_admin_legislation_process_path
|
visit new_admin_legislation_process_path
|
||||||
fill_in "Process Title", with: "Legislation process with SDG related content"
|
fill_in "Process Title", with: "Legislation process with SDG related content"
|
||||||
|
|||||||
@@ -526,6 +526,22 @@ describe "Admin polls", :admin do
|
|||||||
Setting["sdg.process.polls"] = true
|
Setting["sdg.process.polls"] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "do not show SDG columns if disabled" do
|
||||||
|
poll = create(:poll, name: "Poll with SDG related content")
|
||||||
|
poll.sdg_goals = [SDG::Goal[1], SDG::Goal[17]]
|
||||||
|
|
||||||
|
Setting["feature.sdg"] = false
|
||||||
|
|
||||||
|
visit admin_polls_path
|
||||||
|
|
||||||
|
expect(page).not_to have_content "Goals"
|
||||||
|
expect(page).not_to have_content "Targets"
|
||||||
|
|
||||||
|
within "tr", text: "Poll with SDG related content" do
|
||||||
|
expect(page).not_to have_content "1, 17"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scenario "create poll with sdg related list" do
|
scenario "create poll with sdg related list" do
|
||||||
visit new_admin_poll_path
|
visit new_admin_poll_path
|
||||||
fill_in "Name", with: "Upcoming poll with SDG related content"
|
fill_in "Name", with: "Upcoming poll with SDG related content"
|
||||||
|
|||||||
Reference in New Issue
Block a user