my_forum 0.0.1.beta17 → 0.0.1.beta18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d1e202c05804a742b9d512e36d3906628907539
4
- data.tar.gz: ad40174859af4747f265f7c59de9c2cf8bc3f393
3
+ metadata.gz: 5514c53da96410d98cfc5924939be182c7642fcf
4
+ data.tar.gz: cab1bed9170f717fe9362ba9a19191dffe0c1542
5
5
  SHA512:
6
- metadata.gz: ab4c08efa89eef98b122432e580ad7921238194f96831d57184a4be04e166b06132892002bb58dec2b462898606b3b056d188e7328efebd96f5632ac0058bdb8
7
- data.tar.gz: f3509ae79d7074d42cb966e92fabf099ea18c5d556d4a74c8927a47b172bd191b8baa99e066dd8bbb6183604961205f51b4ab62b2d08bc38a1fb149b23694ee9
6
+ metadata.gz: 2e48abf56b44da7dc752c0e41da1cfa2fd1cde60e3d0d5008fd71e74d747cdc5a6b7392dda56ac3646b2400a6fe40756f244396ff05ed2ff6ca0feed70c67a57
7
+ data.tar.gz: b10df2275cb6a7f470040ae32cd74f28f2dc6c864922ca0e3985e664b4d7c544d84ddfdb61faf96371158f99e8fe19b1c6d58739fc948855683800de5bfdf4bc
@@ -0,0 +1,26 @@
1
+ require_dependency "my_forum/application_controller"
2
+
3
+ module MyForum
4
+ class Admin::MailController < ApplicationController
5
+ before_filter :verify_admin
6
+
7
+ layout 'layouts/my_forum/admin_application'
8
+
9
+ def index
10
+ if request.post?
11
+ send_mails(params[:emails], params[:subject], params[:message]) unless params[:emails].blank?
12
+ redirect_to admin_mail_list_path
13
+ else
14
+ @users = User.all.map{ |u| [u.login, u.email]}
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def send_mails(email_list, subject, message)
21
+ email_list.each do |mail|
22
+ UserMailer.custom_email(email: mail, subject: subject, message: message).deliver_now
23
+ end
24
+ end
25
+ end
26
+ end
@@ -10,5 +10,10 @@ module MyForum
10
10
  @user.save
11
11
  mail(to: @user.email, subject: 'vaz.od.ua - New password')
12
12
  end
13
+
14
+ def custom_email(email:, subject:, message:)
15
+ @message = message
16
+ mail(to: email, subject: subject)
17
+ end
13
18
  end
14
19
  end
@@ -20,6 +20,7 @@
20
20
  %li= link_to t('.manage_forums'), admin_forums_path
21
21
  %li= link_to t('.manage_roles'), admin_roles_path
22
22
  %li= link_to t('.manage_users'), admin_users_path
23
+ %li= link_to t('.manage_mail'), admin_mail_list_path
23
24
 
24
25
  .col-sm-9.col-md-10
25
26
  = yield
@@ -0,0 +1,9 @@
1
+ %br
2
+ = form_tag admin_mail_list_path, remote: true do
3
+ = select_tag :emails, options_for_select(@users), multiple: true
4
+ %br
5
+ = text_field_tag :subject
6
+ %br
7
+ = text_area_tag :message
8
+ %br
9
+ = submit_tag
@@ -0,0 +1 @@
1
+ <%= @message %>
data/config/routes.rb CHANGED
@@ -30,6 +30,7 @@ MyForum::Engine.routes.draw do
30
30
  root 'dashboard#index'
31
31
 
32
32
  match 'forums', to: 'forums#index', via: [:get]
33
+ match 'mail_list', to: 'mail#index', via: [:get, :post]
33
34
 
34
35
  resources :users
35
36
  resources :roles
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta17"
2
+ VERSION = "0.0.1.beta18"
3
3
  end
@@ -0,0 +1,7 @@
1
+ require 'rails_helper'
2
+
3
+ module MyForum
4
+ RSpec.describe Admin::MailController, type: :controller do
5
+
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_forum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta17
4
+ version: 0.0.1.beta18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -185,6 +185,7 @@ files:
185
185
  - app/controllers/my_forum/admin/categories_controller.rb
186
186
  - app/controllers/my_forum/admin/dashboard_controller.rb
187
187
  - app/controllers/my_forum/admin/forums_controller.rb
188
+ - app/controllers/my_forum/admin/mail_controller.rb
188
189
  - app/controllers/my_forum/admin/roles_controller.rb
189
190
  - app/controllers/my_forum/admin/users_controller.rb
190
191
  - app/controllers/my_forum/application_controller.rb
@@ -235,6 +236,7 @@ files:
235
236
  - app/views/my_forum/admin/dashboard/index.haml
236
237
  - app/views/my_forum/admin/forums/index.haml
237
238
  - app/views/my_forum/admin/forums/new.haml
239
+ - app/views/my_forum/admin/mail/index.haml
238
240
  - app/views/my_forum/admin/roles/index.haml
239
241
  - app/views/my_forum/admin/roles/new.haml
240
242
  - app/views/my_forum/admin/users/index.haml
@@ -250,6 +252,7 @@ files:
250
252
  - app/views/my_forum/topics/_user_info.haml
251
253
  - app/views/my_forum/topics/new.haml
252
254
  - app/views/my_forum/topics/show.haml
255
+ - app/views/my_forum/user_mailer/custom_email.text.erb
253
256
  - app/views/my_forum/user_mailer/reset_password_email.haml
254
257
  - app/views/my_forum/user_mailer/reset_password_email.text.erb
255
258
  - app/views/my_forum/users/edit.haml
@@ -279,6 +282,7 @@ files:
279
282
  - lib/my_forum/engine.rb
280
283
  - lib/my_forum/version.rb
281
284
  - lib/tasks/my_forum_tasks.rake
285
+ - spec/controllers/my_forum/admin/mail_controller_spec.rb
282
286
  - spec/controllers/my_forum/private_messages_controller_spec.rb
283
287
  - spec/controllers/my_forum/users_controller_spec.rb
284
288
  - spec/dummy/README.rdoc
@@ -348,6 +352,7 @@ signing_key:
348
352
  specification_version: 4
349
353
  summary: Simple Forum
350
354
  test_files:
355
+ - spec/controllers/my_forum/admin/mail_controller_spec.rb
351
356
  - spec/controllers/my_forum/private_messages_controller_spec.rb
352
357
  - spec/controllers/my_forum/users_controller_spec.rb
353
358
  - spec/dummy/app/assets/javascripts/application.js