Merge pull request #3257 from Platoniq/dashboard-actions-attachments

Dashboard actions attachments
This commit is contained in:
Raimond Garcia
2019-02-28 13:33:38 +01:00
committed by GitHub
6 changed files with 46 additions and 13 deletions

View File

@@ -319,7 +319,8 @@
.legislation-process-edit,
.milestone-new,
.milestone-edit,
.image-form {
.image-form,
.dashboard-action-form {
@include direct-uploads;
}

View File

@@ -2,7 +2,11 @@ class Dashboard::Action < ActiveRecord::Base
include Documentable
documentable max_documents_allowed: 3,
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
@@ -14,7 +18,7 @@ class Dashboard::Action < ActiveRecord::Base
enum action_type: [:proposed_action, :resource]
validates :title,
validates :title,
presence: true,
allow_blank: false,
length: { in: 4..80 }
@@ -40,7 +44,7 @@ class Dashboard::Action < ActiveRecord::Base
scope :resources, -> { where(action_type: 1) }
scope :proposed_actions, -> { where(action_type: 0) }
def self.active_for(proposal)
def self.active_for(proposal)
published_at = proposal.published_at&.to_date || Date.today
active

View File

@@ -3,6 +3,8 @@
<h2><%= t("admin.dashboard.actions.edit.editing") %></h2>
</div>
<%= form_for dashboard_action, url: { action: 'update' } do |f| %>
<%= render 'form', f: f %>
<% end %>
<div class="dashboard-action-form ">
<%= form_for dashboard_action, url: { action: 'update' } do |f| %>
<%= render 'form', f: f %>
<% end %>
</div>

View File

@@ -3,6 +3,8 @@
<h2><%= t("admin.dashboard.actions.new.creating") %></h2>
</div>
<%= form_for dashboard_action, url: { action: 'create' } do |f| %>
<%= render 'form', f: f %>
<% end %>
<div class="dashboard-action-form ">
<%= form_for dashboard_action, url: { action: 'create' } do |f| %>
<%= render 'form', f: f %>
<% end %>
</div>