diff --git a/Gemfile b/Gemfile index 05d1379c5..52c854618 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,7 @@ gem 'tolk', '~> 2.0.0' # Web interface for translations gem 'browser' gem 'turnout', '~> 2.4.0' gem 'redcarpet', '~> 3.4.0' +gem 'rubyzip', '~> 1.2.0' gem 'paperclip' diff --git a/Gemfile.lock b/Gemfile.lock index 0989276ef..9c05a53e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,8 +35,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts-as-taggable-on (4.0.0) - activerecord (>= 4.0) + acts-as-taggable-on (5.0.0) + activerecord (>= 4.2.8) acts_as_votable (0.10.0) addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) @@ -65,7 +65,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) bcrypt (3.1.11) - browser (2.3.0) + browser (2.4.0) builder (3.2.3) bullet (5.5.1) activesupport (>= 3.0.0) @@ -97,7 +97,7 @@ GEM ckeditor (4.2.3) cocaine orm_adapter (~> 0.5.0) - climate_control (0.1.0) + climate_control (0.2.0) cliver (0.3.2) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) @@ -117,8 +117,8 @@ GEM tins (~> 1.6) daemons (1.2.4) dalli (2.7.6) - database_cleaner (1.5.3) - debug_inspector (0.0.2) + database_cleaner (1.6.1) + debug_inspector (0.0.3) delayed_job (4.1.2) activesupport (>= 3.0, < 5.1) delayed_job_active_record (4.1.1) @@ -142,10 +142,10 @@ GEM json thread thread_safe - email_spec (2.1.0) + email_spec (2.1.1) htmlentities (~> 4.3.3) launchy (~> 2.1) - mail (~> 2.6.3) + mail (~> 2.6) errbase (0.0.3) erubis (2.7.0) execjs (2.7.0) @@ -171,9 +171,9 @@ GEM fuubar (2.2.0) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) - geocoder (1.4.3) - globalid (0.3.7) - activesupport (>= 4.1.0) + geocoder (1.4.4) + globalid (0.4.0) + activesupport (>= 4.2.0) groupdate (3.2.0) activesupport (>= 3) gyoku (1.3.1) @@ -181,8 +181,9 @@ GEM hashie (3.5.5) highline (1.7.8) htmlentities (4.3.4) - httpi (2.4.1) + httpi (2.4.2) rack + socksify i18n (0.8.1) i18n-tasks (0.9.15) activesupport (>= 4.0.2) @@ -239,7 +240,7 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.2) mini_portile2 (2.1.0) - minitest (5.10.1) + minitest (5.10.2) multi_json (1.12.1) multi_xml (0.6.0) multipart-post (2.0.0) @@ -250,7 +251,7 @@ GEM nokogiri (1.7.2) mini_portile2 (~> 2.1.0) nori (2.6.0) - oauth (0.5.1) + oauth (0.5.2) oauth2 (1.3.1) faraday (>= 0.8, < 0.12) jwt (~> 1.0) @@ -300,7 +301,7 @@ GEM public_suffix (2.0.5) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.6.5) + rack (1.6.8) rack-accept (0.4.5) rack (>= 0.4) rack-attack (5.0.1) @@ -368,13 +369,14 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.8.1) + rubyzip (1.2.1) rvm1-capistrano3 (1.4.0) capistrano (~> 3.0) sshkit (>= 1.2) safe_yaml (1.0.4) safely_block (0.2.0) errbase - sass (3.4.23) + sass (3.4.24) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) @@ -393,12 +395,13 @@ GEM docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) + simplecov-html (0.10.1) sitemap_generator (5.3.1) builder (~> 3.0) social-share-button (0.10.0) coffee-rails - spring (2.0.1) + socksify (1.7.1) + spring (2.0.2) activesupport (>= 4.2) spring-commands-rspec (1.0.4) spring (>= 0.9.1) @@ -418,19 +421,20 @@ GEM net-ssh (>= 2.8.0) term-ansicolor (1.6.0) tins (~> 1.0) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) thor (0.19.4) thread (0.2.2) thread_safe (0.3.6) tilt (2.0.7) timecop (0.8.1) - tins (1.13.2) + tins (1.14.0) tolk (2.0.0) rails (>= 4.0) safe_yaml (>= 0.8.6) - turbolinks (2.5.3) - coffee-rails + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.3) turnout (2.4.0) i18n (~> 0.7) rack (>= 1.3, < 3) @@ -440,14 +444,14 @@ GEM thread_safe (~> 0.1) uglifier (3.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.1.3) + unicode-display_width (1.2.1) unicorn (5.3.0) kgio (~> 2.6) raindrops (~> 0.7) uniform_notifier (1.10.0) - user_agent_parser (2.3.0) + user_agent_parser (2.3.1) uuidtools (2.1.5) - warden (1.2.6) + warden (1.2.7) rack (>= 1.0) wasabi (3.5.0) httpi (~> 2.0) @@ -525,6 +529,7 @@ DEPENDENCIES rollbar (~> 2.14.1) rspec-rails (~> 3.6) rubocop (~> 0.48.1) + rubyzip (~> 1.2.0) rvm1-capistrano3 sass-rails (~> 5.0, >= 5.0.4) savon @@ -542,4 +547,4 @@ DEPENDENCIES whenever BUNDLED WITH - 1.14.6 + 1.15.0 diff --git a/app/controllers/admin/newsletters_controller.rb b/app/controllers/admin/newsletters_controller.rb new file mode 100644 index 000000000..f09a92e0c --- /dev/null +++ b/app/controllers/admin/newsletters_controller.rb @@ -0,0 +1,17 @@ +require 'zip' +class Admin::NewslettersController < Admin::BaseController + + def index + end + + def users + folder = Rails.root + "/tmp/" + zipfile_name = folder + "emails.zip" + + Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| + zipfile.get_output_stream("emails.txt") { |os| os.write 'peter@example.com' } + end + send_file(File.join(folder + "emails.zip"), :type => 'application/zip') + end + +end \ No newline at end of file diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 0b9929f46..c02ad4ede 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -162,5 +162,12 @@ <% end %> <% end %> + +
  • > + <%= link_to admin_newsletters_path do %> + + Newsletter + <% end %> +
  • diff --git a/app/views/admin/newsletters/index.html.erb b/app/views/admin/newsletters/index.html.erb new file mode 100644 index 000000000..d851f5fc2 --- /dev/null +++ b/app/views/admin/newsletters/index.html.erb @@ -0,0 +1 @@ +<%= link_to 'users', users_admin_newsletters_path %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4007595db..c016cce56 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -239,6 +239,9 @@ Rails.application.routes.draw do end resource :activity, controller: :activity, only: :show + resources :newsletters, only: :index do + get :users, on: :collection + end resource :stats, only: :show do get :proposal_notifications, on: :collection get :direct_messages, on: :collection