Merge pull request #3257 from Platoniq/dashboard-actions-attachments
Dashboard actions attachments
This commit is contained in:
@@ -319,7 +319,8 @@
|
|||||||
.legislation-process-edit,
|
.legislation-process-edit,
|
||||||
.milestone-new,
|
.milestone-new,
|
||||||
.milestone-edit,
|
.milestone-edit,
|
||||||
.image-form {
|
.image-form,
|
||||||
|
.dashboard-action-form {
|
||||||
@include direct-uploads;
|
@include direct-uploads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ class Dashboard::Action < ActiveRecord::Base
|
|||||||
include Documentable
|
include Documentable
|
||||||
documentable max_documents_allowed: 3,
|
documentable max_documents_allowed: 3,
|
||||||
max_file_size: 3.megabytes,
|
max_file_size: 3.megabytes,
|
||||||
accepted_content_types: [ 'application/pdf' ]
|
accepted_content_types: [ "application/pdf",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/png",
|
||||||
|
"application/zip" ]
|
||||||
|
|
||||||
include Linkable
|
include Linkable
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<h2><%= t("admin.dashboard.actions.edit.editing") %></h2>
|
<h2><%= t("admin.dashboard.actions.edit.editing") %></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= form_for dashboard_action, url: { action: 'update' } do |f| %>
|
<div class="dashboard-action-form ">
|
||||||
|
<%= form_for dashboard_action, url: { action: 'update' } do |f| %>
|
||||||
<%= render 'form', f: f %>
|
<%= render 'form', f: f %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<h2><%= t("admin.dashboard.actions.new.creating") %></h2>
|
<h2><%= t("admin.dashboard.actions.new.creating") %></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= form_for dashboard_action, url: { action: 'create' } do |f| %>
|
<div class="dashboard-action-form ">
|
||||||
|
<%= form_for dashboard_action, url: { action: 'create' } do |f| %>
|
||||||
<%= render 'form', f: f %>
|
<%= render 'form', f: f %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ feature 'Admin dashboard actions' do
|
|||||||
login_as(admin.user)
|
login_as(admin.user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "nested documentable",
|
||||||
|
"administrator",
|
||||||
|
"dashboard_action",
|
||||||
|
"new_admin_dashboard_action_path",
|
||||||
|
{ },
|
||||||
|
"documentable_fill_new_valid_dashboard_action",
|
||||||
|
"Save",
|
||||||
|
"Action created successfully"
|
||||||
|
|
||||||
context 'when visiting index' do
|
context 'when visiting index' do
|
||||||
context 'and no actions defined' do
|
context 'and no actions defined' do
|
||||||
before do
|
before do
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
let!(:administrator) { create(:user) }
|
let!(:administrator) { create(:user) }
|
||||||
let!(:user) { create(:user, :level_two) }
|
let!(:user) { create(:user, :level_two) }
|
||||||
let!(:arguments) { {} }
|
let!(:arguments) { {} }
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
let!(:documentable) { create(documentable_factory_name) }
|
||||||
|
else
|
||||||
let!(:documentable) { create(documentable_factory_name, author: user) }
|
let!(:documentable) { create(documentable_factory_name, author: user) }
|
||||||
|
end
|
||||||
let!(:user_to_login) { send(login_as_name)}
|
let!(:user_to_login) { send(login_as_name)}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@@ -133,7 +137,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
|
|
||||||
documentable_attach_new_file(
|
documentable_attach_new_file(
|
||||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
Rails.root.join("spec/fixtures/files/logo_header.gif"),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -154,7 +158,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
|
|
||||||
documentable_attach_new_file(
|
documentable_attach_new_file(
|
||||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
Rails.root.join("spec/fixtures/files/logo_header.gif"),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -208,6 +212,9 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should show new document after successful creation with one uploaded file", :js do
|
scenario "Should show new document after successful creation with one uploaded file", :js do
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
skip("Not render Documents count on dashboard_actions")
|
||||||
|
end
|
||||||
login_as user_to_login
|
login_as user_to_login
|
||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
send(fill_resource_method_name) if fill_resource_method_name
|
send(fill_resource_method_name) if fill_resource_method_name
|
||||||
@@ -227,6 +234,9 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
|
|
||||||
scenario "Should show resource with new document after successful creation with
|
scenario "Should show resource with new document after successful creation with
|
||||||
maximum allowed uploaded files", :js do
|
maximum allowed uploaded files", :js do
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
skip("Not render Documents count on dashboard_actions")
|
||||||
|
end
|
||||||
login_as user_to_login
|
login_as user_to_login
|
||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
FILENAMES ||= %w(clippy empty logo).freeze
|
FILENAMES ||= %w(clippy empty logo).freeze
|
||||||
@@ -359,6 +369,11 @@ def documentable_fill_new_valid_proposal
|
|||||||
check :proposal_terms_of_service
|
check :proposal_terms_of_service
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def documentable_fill_new_valid_dashboard_action
|
||||||
|
fill_in :dashboard_action_title, with: "Dashboard title"
|
||||||
|
fill_in :dashboard_action_short_description, with: "Dashboard description"
|
||||||
|
end
|
||||||
|
|
||||||
def documentable_fill_new_valid_budget_investment
|
def documentable_fill_new_valid_budget_investment
|
||||||
page.select documentable.heading.name_scoped_by_group, from: :budget_investment_heading_id
|
page.select documentable.heading.name_scoped_by_group, from: :budget_investment_heading_id
|
||||||
fill_in :budget_investment_title, with: "Budget investment title"
|
fill_in :budget_investment_title, with: "Budget investment title"
|
||||||
|
|||||||
Reference in New Issue
Block a user