Skip to content

Commit

Permalink
Merge pull request consuldemocracy#3819 from consul/remove_csv
Browse files Browse the repository at this point in the history
Remove new CSV report generation
  • Loading branch information
javierm committed Nov 5, 2019
2 parents ca66054 + 84ace7b commit 8b6fa65
Show file tree
Hide file tree
Showing 55 changed files with 98 additions and 1,273 deletions.
2 changes: 0 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
//= require i18n
//= require globalize
//= require send_admin_notification_alert
//= require modal_download
//= require settings
//= require cookies
//= require columns_selector
Expand Down Expand Up @@ -137,7 +136,6 @@ var initialize_modules = function() {
App.Managers.initialize();
App.Globalize.initialize();
App.SendAdminNotificationAlert.initialize();
App.ModalDownload.initialize();
App.Settings.initialize();
if ($("#js-columns-selector").length) {
App.ColumnsSelector.initialize();
Expand Down
14 changes: 0 additions & 14 deletions app/assets/javascripts/modal_download.js

This file was deleted.

5 changes: 1 addition & 4 deletions app/controllers/admin/budget_investments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Admin::BudgetInvestmentsController < Admin::BaseController
include FeatureFlags
include CommentableActions
include DownloadSettingsHelper
include Translatable

feature_flag :budgets
Expand All @@ -21,9 +20,7 @@ def index
format.html
format.js
format.csv do
send_data to_csv(@investments, Budget::Investment),
type: "text/csv",
disposition: "attachment",
send_data Budget::Investment::Exporter.new(@investments).to_csv,
filename: "budget_investments.csv"
end
end
Expand Down
13 changes: 0 additions & 13 deletions app/controllers/admin/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
class Admin::CommentsController < Admin::BaseController
include DownloadSettingsHelper

def index
@comments = Comment.sort_by_newest.page(params[:page])

respond_to do |format|
format.html

format.csv do
send_data to_csv(Comment.sort_by_newest, Comment),
type: "text/csv",
disposition: "attachment",
filename: "comments.csv"
end
end
end
end
43 changes: 0 additions & 43 deletions app/controllers/admin/download_settings_controller.rb

This file was deleted.

14 changes: 0 additions & 14 deletions app/controllers/admin/legislation/processes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Admin::Legislation::ProcessesController < Admin::Legislation::BaseController
include Translatable
include ImageAttributes
include DownloadSettingsHelper

has_filters %w[active all], only: :index

Expand All @@ -10,15 +9,6 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
def index
@processes = ::Legislation::Process.send(@current_filter).order(start_date: :desc)
.page(params[:page])
respond_to do |format|
format.html
format.csv do
send_data to_csv(process_for_download, Legislation::Process),
type: "text/csv",
disposition: "attachment",
filename: "legislation_processes.csv"
end
end
end

def create
Expand Down Expand Up @@ -53,10 +43,6 @@ def destroy

private

def process_for_download
::Legislation::Process.send(@current_filter).order(start_date: :desc)
end

def process_params
params.require(:legislation_process).permit(allowed_params)
end
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class Admin::ProposalsController < Admin::BaseController
include CommentableActions
include FeatureFlags
feature_flag :proposals
helper DownloadSettingsHelper

has_orders %w[created_at]

Expand Down
14 changes: 0 additions & 14 deletions app/controllers/budgets/executions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Budgets
class ExecutionsController < ApplicationController
include DownloadSettingsHelper
before_action :load_budget

load_and_authorize_resource :budget
Expand All @@ -9,19 +8,6 @@ def show
authorize! :read_executions, @budget
@statuses = Milestone::Status.all
@investments_by_heading = investments_by_heading_ordered_alphabetically.to_h
downloadables = []
investments_by_heading_ordered_alphabetically
.map { |heading| downloadables.concat heading[1] }

respond_to do |format|
format.html
format.csv do
send_data to_csv(downloadables, Budget::Investment, 1),
type: "text/csv",
disposition: "attachment",
filename: "budget_investment_milestones.csv"
end
end
end

private
Expand Down
11 changes: 0 additions & 11 deletions app/controllers/budgets/results_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,13 @@ module Budgets
class ResultsController < ApplicationController
before_action :load_budget
before_action :load_heading
include DownloadSettingsHelper

load_and_authorize_resource :budget

def show
authorize! :read_results, @budget
@investments = Budget::Result.new(@budget, @heading).investments
@headings = @budget.headings.sort_by_name

respond_to do |format|
format.html
format.csv do
send_data to_csv(@investments.compatible, Budget::Investment),
type: "text/csv",
disposition: "attachment",
filename: "budget_investment_results.csv"
end
end
end

private
Expand Down
12 changes: 0 additions & 12 deletions app/controllers/concerns/commentable_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module CommentableActions
extend ActiveSupport::Concern
include Polymorphic
include Search
include DownloadSettingsHelper
include RemotelyTranslatable

def index
Expand All @@ -12,7 +11,6 @@ def index
@resources = @resources.search(@search_terms) if @search_terms.present?
@resources = @advanced_search_terms.present? ? @resources.filter(@advanced_search_terms) : @resources
@resources = @resources.tagged_with(@tag_filter) if @tag_filter
resources_csv = @resources

@resources = @resources.page(params[:page]).send("sort_by_#{@current_order}")

Expand All @@ -25,16 +23,6 @@ def index

set_resources_instance
@remote_translations = detect_remote_translations(@resources, featured_proposals)

respond_to do |format|
format.html
format.csv do
send_data to_csv(resources_csv, resource_model),
type: "text/csv",
disposition: "attachment",
filename: "#{get_resource(resource_model)}.csv"
end
end
end

def show
Expand Down
15 changes: 0 additions & 15 deletions app/controllers/legislation/processes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class Legislation::ProcessesController < Legislation::BaseController
include RandomSeed
include DownloadSettingsHelper

has_filters %w[open past], only: :index
has_filters %w[random winners], only: :proposals
Expand All @@ -14,16 +13,6 @@ def index
@current_filter ||= "open"
@processes = ::Legislation::Process.send(@current_filter).published
.not_in_draft.order(start_date: :desc).page(params[:page])

respond_to do |format|
format.html
format.csv do
send_data to_csv(process_for_download, Legislation::Process),
type: "text/csv",
disposition: "attachment",
filename: "legislation_processes.csv"
end
end
end

def show
Expand Down Expand Up @@ -149,10 +138,6 @@ def proposals

private

def process_for_download
Legislation::Process.send(@current_filter).order(start_date: :desc)
end

def member_method?
params[:id].present?
end
Expand Down
44 changes: 0 additions & 44 deletions app/helpers/download_settings_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/models/abilities/administrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def initialize(user)
can [:deliver], Newsletter, hidden_at: nil
can [:manage], Dashboard::AdministratorTask

can [:edit, :update], DownloadSetting

can :manage, LocalCensusRecord
can [:create, :read], LocalCensusRecords::Import
end
Expand Down
5 changes: 0 additions & 5 deletions app/models/budget/investment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Budget
require "csv"
class Investment < ApplicationRecord
SORTING_OPTIONS = { id: "id", supports: "cached_votes_up" }.freeze

Expand All @@ -26,8 +25,6 @@ class Investment < ApplicationRecord
include Milestoneable
include Randomizable

extend DownloadSettings::BudgetInvestmentCsv

translates :title, touch: true
translates :description, touch: true
include Globalizable
Expand Down Expand Up @@ -57,8 +54,6 @@ class Investment < ApplicationRecord
inverse_of: :commentable,
class_name: "Comment"

delegate :name, :email, to: :author, prefix: true

validates_translation :title, presence: true, length: { in: 4..Budget::Investment.title_max_length }
validates_translation :description, presence: true, length: { maximum: Budget::Investment.description_max_length }

Expand Down
3 changes: 0 additions & 3 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
require "csv"

class Comment < ApplicationRecord
include Flaggable
include HasPublicAuthor
include Graphqlable
include Notifiable
extend DownloadSettings::CommentCsv

COMMENTABLE_TYPES = %w[Debate Proposal Budget::Investment Poll Topic
Legislation::Question Legislation::Annotation
Expand Down
26 changes: 0 additions & 26 deletions app/models/concerns/download_settings/budget_investment_csv.rb

This file was deleted.

Loading

0 comments on commit 8b6fa65

Please sign in to comment.