feedbacks 0.0.2

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.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +45 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/feedbacks/application.js +16 -0
  6. data/app/assets/stylesheets/feedbacks/application.css +16 -0
  7. data/app/controllers/feedbacks/application_controller.rb +5 -0
  8. data/app/controllers/feedbacks/feedback_sender_controller.rb +17 -0
  9. data/app/mailers/feedbacks/feedback_mailer.rb +12 -0
  10. data/app/models/feedbacks/feedback.rb +20 -0
  11. data/app/views/feedbacks/feedback_mailer/feedback_email.html.erb +27 -0
  12. data/app/views/feedbacks/feedback_sender/_feedback_form.html.erb +19 -0
  13. data/app/views/feedbacks/feedback_sender/create.js.erb +5 -0
  14. data/app/views/feedbacks/feedback_sender/new.js.erb +14 -0
  15. data/app/views/layouts/feedbacks/application.html.erb +14 -0
  16. data/app/views/shared/_error_messages.html.erb +9 -0
  17. data/config/locales/en.yml +12 -0
  18. data/config/routes.rb +7 -0
  19. data/db/migrate/20121108115745_create_feedbacks_feedbacks.rb +12 -0
  20. data/lib/feedbacks.rb +12 -0
  21. data/lib/feedbacks/engine.rb +8 -0
  22. data/lib/feedbacks/version.rb +3 -0
  23. data/lib/generators/feedbacks/initializer_generator.rb +14 -0
  24. data/test/dummy/Gemfile +14 -0
  25. data/test/dummy/Gemfile.lock +127 -0
  26. data/test/dummy/README.rdoc +1 -0
  27. data/test/dummy/Rakefile +7 -0
  28. data/test/dummy/app/assets/javascripts/application.js +16 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  30. data/test/dummy/app/controllers/application_controller.rb +7 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/views/application/index.html.erb +3 -0
  33. data/test/dummy/app/views/layouts/application.html.erb +18 -0
  34. data/test/dummy/config.ru +4 -0
  35. data/test/dummy/config/application.rb +59 -0
  36. data/test/dummy/config/boot.rb +10 -0
  37. data/test/dummy/config/database.yml +7 -0
  38. data/test/dummy/config/environment.rb +5 -0
  39. data/test/dummy/config/environments/development.rb +37 -0
  40. data/test/dummy/config/environments/production.rb +67 -0
  41. data/test/dummy/config/environments/test.rb +37 -0
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/test/dummy/config/initializers/feedbacks.rb +4 -0
  44. data/test/dummy/config/initializers/inflections.rb +15 -0
  45. data/test/dummy/config/initializers/mime_types.rb +5 -0
  46. data/test/dummy/config/initializers/secret_token.rb +7 -0
  47. data/test/dummy/config/initializers/session_store.rb +8 -0
  48. data/test/dummy/config/initializers/setup_mail.rb +9 -0
  49. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/test/dummy/config/locales/en.yml +5 -0
  51. data/test/dummy/config/locales/ru.yml +12 -0
  52. data/test/dummy/config/routes.rb +6 -0
  53. data/test/dummy/db/development.db +0 -0
  54. data/test/dummy/db/migrate/20140724190358_create_feedbacks_feedbacks.feedbacks.rb +13 -0
  55. data/test/dummy/db/schema.rb +25 -0
  56. data/test/dummy/db/test.db +0 -0
  57. data/test/dummy/log/development.log +5626 -0
  58. data/test/dummy/log/test.log +116 -0
  59. data/test/dummy/public/404.html +26 -0
  60. data/test/dummy/public/422.html +26 -0
  61. data/test/dummy/public/500.html +25 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/script/rails +6 -0
  64. data/test/dummy/spec/models/feedbacks/feedback_spec.rb +20 -0
  65. data/test/dummy/spec/rails_helper.rb +39 -0
  66. data/test/dummy/spec/spec_helper.rb +78 -0
  67. data/test/dummy/spec/support/factories.rb +8 -0
  68. data/test/dummy/tmp/cache/assets/C5B/270/sprockets%2F950f6c7b0d55e6d54701881553961a84 +0 -0
  69. data/test/dummy/tmp/cache/assets/C74/510/sprockets%2F8acc2baf76422417520890d418081b36 +0 -0
  70. data/test/dummy/tmp/cache/assets/C7D/550/sprockets%2Ff0d125345784030dd2723963561d9ced +0 -0
  71. data/test/dummy/tmp/cache/assets/C90/3F0/sprockets%2Fa5813adecb7637a6f843207987779224 +0 -0
  72. data/test/dummy/tmp/cache/assets/C9A/6A0/sprockets%2Fe3cba04112c13a41772566462891db4b +0 -0
  73. data/test/dummy/tmp/cache/assets/C9E/9F0/sprockets%2Fc2676e7c1304641a44a46195af1ae043 +0 -0
  74. data/test/dummy/tmp/cache/assets/CA3/610/sprockets%2F3dc616236a84970dcc5148a40d01d455 +0 -0
  75. data/test/dummy/tmp/cache/assets/CB8/F70/sprockets%2Fd04288328b6ecfb4705a47995e04b933 +0 -0
  76. data/test/dummy/tmp/cache/assets/CC0/DB0/sprockets%2Fa324c7f9c89af36907e19a95993503b0 +0 -0
  77. data/test/dummy/tmp/cache/assets/CD3/360/sprockets%2F4a6135703e15071f8ef187aa8c4b900a +0 -0
  78. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  79. data/test/dummy/tmp/cache/assets/CDA/0F0/sprockets%2F2104b964fbd412280234675bb9ce78bd +0 -0
  80. data/test/dummy/tmp/cache/assets/CDD/D70/sprockets%2Faed27105c7535267be0fb7f6327d2518 +0 -0
  81. data/test/dummy/tmp/cache/assets/CE5/DC0/sprockets%2F0a0559ec9c71e611ab5e82469ca58395 +0 -0
  82. data/test/dummy/tmp/cache/assets/CE6/3B0/sprockets%2F3942708d185a0dc1b828a573c895bbd9 +0 -0
  83. data/test/dummy/tmp/cache/assets/CEE/010/sprockets%2Fbd5411388cbf7f2079d86f32d3812c99 +0 -0
  84. data/test/dummy/tmp/cache/assets/CF2/010/sprockets%2F08124041b51a96b0a65b451feb5cda51 +0 -0
  85. data/test/dummy/tmp/cache/assets/CF3/270/sprockets%2Fa5c3f871cbeb977a8e256778206078c7 +0 -0
  86. data/test/dummy/tmp/cache/assets/D09/BC0/sprockets%2F5071923fa310681dcd59bfe1c636ef04 +0 -0
  87. data/test/dummy/tmp/cache/assets/D0C/C20/sprockets%2F084ea871a9fe801a622d6aa56e524d82 +0 -0
  88. data/test/dummy/tmp/cache/assets/D0E/080/sprockets%2F4e15101b58f5f7c8de1f2c157772d5a3 +0 -0
  89. data/test/dummy/tmp/cache/assets/D0E/410/sprockets%2F93e31c8b862ddc545eb7a6120e04856c +0 -0
  90. data/test/dummy/tmp/cache/assets/D11/BD0/sprockets%2F8d212a373571d358ee8076ce1f7dfa14 +0 -0
  91. data/test/dummy/tmp/cache/assets/D13/700/sprockets%2Fe9d0283f43f07370ac7730e767de0f1f +0 -0
  92. data/test/dummy/tmp/cache/assets/D16/9B0/sprockets%2F6a5a9878f43b1f8506ac26508efbb462 +0 -0
  93. data/test/dummy/tmp/cache/assets/D1A/4A0/sprockets%2F3f5c88687329ab7096ed3b1be33fe703 +0 -0
  94. data/test/dummy/tmp/cache/assets/D24/F30/sprockets%2F6f0338ea5a13d0b8127a12169ae6aa0d +0 -0
  95. data/test/dummy/tmp/cache/assets/D2B/290/sprockets%2F8856e4e9e49f5190c2f5b98d3b361ee6 +0 -0
  96. data/test/dummy/tmp/cache/assets/D2C/610/sprockets%2F35c17f36c20b2ace032f6e8e323a275b +0 -0
  97. data/test/dummy/tmp/cache/assets/D2E/6E0/sprockets%2F27ba090a0a80d29ff6d2f5990fa1011e +0 -0
  98. data/test/dummy/tmp/cache/assets/D2F/1F0/sprockets%2Ff8fe87c412fd60f985cd8c359b461885 +0 -0
  99. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  100. data/test/dummy/tmp/cache/assets/D39/D80/sprockets%2F1d743809d0765df235d5350fbaa51fdd +0 -0
  101. data/test/dummy/tmp/cache/assets/D39/DB0/sprockets%2F066fe3d19a94a3f691a2f24c40d63fc1 +0 -0
  102. data/test/dummy/tmp/cache/assets/D3A/F20/sprockets%2F68fdb071e5d26c08bb601fb176093a7f +0 -0
  103. data/test/dummy/tmp/cache/assets/D3C/AB0/sprockets%2Fbc3e82e31c4e209447bb731f0cb6c968 +0 -0
  104. data/test/dummy/tmp/cache/assets/D3F/0A0/sprockets%2F2476bea53b26aeef74f6372031b98be4 +0 -0
  105. data/test/dummy/tmp/cache/assets/D40/0A0/sprockets%2F47ade66ee19b934c023c92e1c9bb3329 +0 -0
  106. data/test/dummy/tmp/cache/assets/D40/710/sprockets%2F2a8caa9c60b397919124fd754bf1da74 +0 -0
  107. data/test/dummy/tmp/cache/assets/D48/DF0/sprockets%2Ff394d7dd0a927ed10dd559de12a29487 +0 -0
  108. data/test/dummy/tmp/cache/assets/D49/0D0/sprockets%2F6595720a01f047ffd8af0e599981dcac +0 -0
  109. data/test/dummy/tmp/cache/assets/D4D/0C0/sprockets%2F5f65b3ad601ab8928bd846d8986ad36c +0 -0
  110. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  111. data/test/dummy/tmp/cache/assets/D58/580/sprockets%2F8dda8d81bc94987d6273fa3d0a2798d9 +0 -0
  112. data/test/dummy/tmp/cache/assets/D5A/4A0/sprockets%2F332daad32aaac7d7915aea076c547153 +0 -0
  113. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  114. data/test/dummy/tmp/cache/assets/D5D/000/sprockets%2F2c8ed151db6f49eb0c014c7a2c7f4113 +0 -0
  115. data/test/dummy/tmp/cache/assets/D63/BF0/sprockets%2F5d9c07db11d9b2f3014c785c1ae550fc +0 -0
  116. data/test/dummy/tmp/cache/assets/D64/E70/sprockets%2Fba3f9cb7b80e5693e2abe21d274075b0 +0 -0
  117. data/test/dummy/tmp/cache/assets/D64/F80/sprockets%2Fb80a9ddb464f606b24e0ef82b6e620b1 +0 -0
  118. data/test/dummy/tmp/cache/assets/D68/5B0/sprockets%2F280b48ab2a891052f753cce1bfe771ce +0 -0
  119. data/test/dummy/tmp/cache/assets/D6D/830/sprockets%2F9ed7d74cd533e08604d355cafce2c350 +0 -0
  120. data/test/dummy/tmp/cache/assets/D6F/730/sprockets%2F72b6b16d8e3840753f1bede920f3cdb6 +0 -0
  121. data/test/dummy/tmp/cache/assets/D73/4E0/sprockets%2F817b581b44ccee3e09fa4870828f0bbf +0 -0
  122. data/test/dummy/tmp/cache/assets/D74/C70/sprockets%2F8f419eb322d9ddb4b8b93f24356f1c1f +0 -0
  123. data/test/dummy/tmp/cache/assets/D79/910/sprockets%2Fe8a935a8a09c5654af299acb4c36b66e +0 -0
  124. data/test/dummy/tmp/cache/assets/D7D/530/sprockets%2F17b08da019a6f1302cc12dbb13f8ebb1 +0 -0
  125. data/test/dummy/tmp/cache/assets/D82/AA0/sprockets%2F719d877e8dcf6c74bfcb857c344205be +0 -0
  126. data/test/dummy/tmp/cache/assets/D82/E20/sprockets%2F2cba4d7d2ef769667c27c10d78ee78f3 +0 -0
  127. data/test/dummy/tmp/cache/assets/D8A/D20/sprockets%2Fec3c9c64f5b7f9758d306f544b8ff6f1 +0 -0
  128. data/test/dummy/tmp/cache/assets/D8B/5B0/sprockets%2Fbe44597ce79b9e6f76dfd2d40747a5e5 +0 -0
  129. data/test/dummy/tmp/cache/assets/D9B/910/sprockets%2Fa7c3bca72ce605f517a62d5e1f891ae6 +0 -0
  130. data/test/dummy/tmp/cache/assets/D9C/F20/sprockets%2Fe48a1a537978aa70ffb1bdc2e5b0b794 +0 -0
  131. data/test/dummy/tmp/cache/assets/DA2/E50/sprockets%2Fbcf509306cd7d6cb2e13734f2fb99cf3 +0 -0
  132. data/test/dummy/tmp/cache/assets/DA3/690/sprockets%2F6eda83e8f2280c46b37fb063ee2a48ee +0 -0
  133. data/test/dummy/tmp/cache/assets/DB0/2E0/sprockets%2Fac76eb1bf53ab5c85f9562dd5b7f7299 +0 -0
  134. data/test/dummy/tmp/cache/assets/DBC/FB0/sprockets%2Fefd1a390c1dff024705c9b7c4acf400c +0 -0
  135. data/test/dummy/tmp/cache/assets/DD0/0D0/sprockets%2Fb96e72a1dcc836f7ba5b6d3bb56e3e80 +0 -0
  136. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  137. data/test/dummy/tmp/cache/assets/DDF/830/sprockets%2F0e16a9c63ef868f6cf1a97856bb3deae +0 -0
  138. data/test/dummy/tmp/cache/assets/DF7/0B0/sprockets%2Fca550ebb82aa49b5dc8b724680fbcee3 +0 -0
  139. data/test/dummy/tmp/cache/assets/DF7/180/sprockets%2Fa3dad96955fb1fcef24c03f1dd47ea21 +0 -0
  140. data/test/dummy/tmp/cache/assets/DF8/1C0/sprockets%2F0a8ed6be63cfc047322fcdfe27de092a +0 -0
  141. data/test/dummy/tmp/cache/assets/DFD/EB0/sprockets%2F61e6d55aee569fd4cb060d0f3a9cb6dc +0 -0
  142. data/test/dummy/tmp/cache/assets/DFF/5A0/sprockets%2F46db6dadd193e65b14604d9e6cd6feaa +0 -0
  143. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  144. data/test/dummy/tmp/cache/assets/E08/F50/sprockets%2Ffdf590370af77b8fddf45491afa3ece2 +0 -0
  145. metadata +379 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83311b670590d68b9b02afd541759c4620464fc4
4
+ data.tar.gz: 93ba1260e27bbf8eb9a48e5717d16fc77a59c939
5
+ SHA512:
6
+ metadata.gz: 60481b30b7bbb2cbd8822eda30d89a733cda5311af2c8effe024f7eb0371dd24108db68531d3ba0b3bd06f240f0d7f0536d6c3a12fa84712b483b29d9bd282e1
7
+ data.tar.gz: 36097f6dfd416d8de2157481d270a1f94bacc37d63d372e8cda9e8405466dec0cd4a2a07c29a748b7f640a768a4bc32b23d62159af79008e7597e7e45d343fc4
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ = Feedbacks
2
+
3
+ Gem adds the contact us dialog window to your Rails application.
4
+ Gem uses jquery-ui/dialog to work.
5
+
6
+ Engine tested on rails 3.2.
7
+
8
+ How to use it:
9
+
10
+ 1. Add to Gemfile:
11
+
12
+ gem 'feedbacks'
13
+
14
+ 2. Setup ActionMailer::Base.smtp_settings
15
+ 3. Run and change in generated initializers/feedbacks.rb :from and :to emails:
16
+
17
+ rails generate feedbacks:initializer
18
+
19
+ 4. Run:
20
+
21
+ rake feedbacks:install:migrations && rake db:migrate
22
+
23
+ 5. Add to config/routes.rb:
24
+
25
+ mount Feedbacks::Engine => "/feedbacks"
26
+
27
+ 6. Add to view where you need feedback form:
28
+
29
+ <div id='feedback-form' title='Feedback form title' >
30
+ <%= link_to "Contact us", feedbacks.new_feedback_sender_path, :remote => true, :class => 'feedback' %>
31
+ </div>
32
+
33
+ 7. Add to application.js and application.css:
34
+
35
+ require feedbacks/application
36
+
37
+ 8. Thats all. Feedback saves in feedbacks_feedbacks table in database and then sends to your :to email.
38
+
39
+ Tests are placed in test/dummy.
40
+
41
+ To try this engine goto test/dummy and enjoy it in the localhost by running rails server.
42
+
43
+ Using at http://www.rbcitynews.ru/
44
+
45
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Feedbacks'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery-ui/dialog
16
+ //= require_tree .
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require jquery-ui/dialog
13
+ *= require_tree .
14
+ */
15
+
16
+ label.required:after{content:"*"}
@@ -0,0 +1,5 @@
1
+ module Feedbacks
2
+ class ApplicationController < ::ApplicationController
3
+
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ module Feedbacks
2
+ class FeedbackSenderController < ApplicationController
3
+ def new
4
+ @feedback = Feedback.new(:topic => params[:topic])
5
+ respond_to do |format|
6
+ format.js
7
+ end
8
+ end
9
+
10
+ def create
11
+ @feedback = Feedback.create(params[:feedback])
12
+ respond_to do |format|
13
+ format.js
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module Feedbacks
2
+ class FeedbackMailer < ActionMailer::Base
3
+ default :from => Feedbacks.from_email,
4
+ :to => Feedbacks.to_email
5
+
6
+
7
+ def feedback_email(feedback)
8
+ @feedback = feedback
9
+ mail :subject => feedback.topic
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ module Feedbacks
2
+ class Feedback < ActiveRecord::Base
3
+ attr_accessible :email, :text, :topic, :url
4
+
5
+ validates :text, :presence => true
6
+ validates :email, :presence => true, :format => {
7
+ :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
8
+ }
9
+
10
+ after_create :send_email
11
+
12
+
13
+ private
14
+
15
+
16
+ def send_email
17
+ FeedbackMailer.feedback_email(self).deliver
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ <% if @feedback.email %>
2
+ <p>
3
+ <strong><%= I18n.t('activerecord.attributes.feedbacks/feedback.email') %></strong>
4
+ <%= @feedback.email %>
5
+ </p>
6
+ <% end %>
7
+
8
+ <p>
9
+ <strong> <%= I18n.t('activerecord.attributes.feedbacks/feedback.created_at') %> </strong>
10
+ <%= @feedback.created_at.strftime "%d %B %Y, %A %H:%M" %>
11
+ </p>
12
+
13
+ <p>
14
+ <b> <%= I18n.t('activerecord.attributes.feedbacks/feedback.url') %></b>
15
+ <%= link_to @feedback.url, @feedback.url %>
16
+ </p>
17
+
18
+ <p>
19
+ <b> <%= I18n.t('activerecord.attributes.feedbacks/feedback.topic') %></b>
20
+ <%= @feedback.topic %>
21
+ </p>
22
+
23
+ <p>
24
+ <b><%= I18n.t('activerecord.attributes.feedbacks/feedback.text') %></b>
25
+ <br />
26
+ <%= @feedback.text %>
27
+ </p>
@@ -0,0 +1,19 @@
1
+ <%= form_for feedback_form, :url => feedback_sender_index_path, :remote => true do |f| %>
2
+ <%= f.label :topic %>
3
+ <%= f.text_field :topic, :class => "text ui-widget-content ui-corner-all" %>
4
+ <br />
5
+ <%= f.label :text, :class => 'required' %>
6
+ <%= f.text_area :text, :size => '20x10', :class => "text ui-widget-content ui-corner-all" %>
7
+ <br />
8
+ <%= f.label :email, :class => 'required' %>
9
+ <%= f.text_field :email, :class => "text ui-widget-content ui-corner-all" %>
10
+ <%= f.hidden_field :url, :class => "text ui-widget-content ui-corner-all" %>
11
+ <% end %>
12
+
13
+ <% # Set document.url in the form's url because request.url returns feedback_send_path %>
14
+ <% # but we need the url which placed in a address bar %>
15
+ <script>
16
+ $(function() {
17
+ $("#feedback_url").val(document.URL);
18
+ });
19
+ </script>
@@ -0,0 +1,5 @@
1
+ <% if @feedback.errors.any? %>
2
+ $("#feedback-form").prepend("<%=escape_javascript( render :partial => 'shared/error_messages', :locals => {:target => @feedback} ) %>")
3
+ <% else %>
4
+ $("#feedback-form").dialog("close");
5
+ <% end %>
@@ -0,0 +1,14 @@
1
+ $("#feedback-form").html("<%= escape_javascript(render :partial => 'feedback_form', :object => @feedback) %>");
2
+
3
+ $("#feedback-form").dialog({
4
+ modal: true,
5
+ width: 300,
6
+ height: 550,
7
+ buttons: {
8
+ "<%= escape_javascript(I18n.t('feedbacks.submit'))%>": function(){
9
+ $("#feedback-form").children().submit();
10
+ },
11
+ "<%= escape_javascript(I18n.t('feedbacks.cancel'))%>": function() { $( this ).dialog( "close" ); }
12
+ },
13
+ close: function() { }
14
+ });
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Feedbacks</title>
5
+ <%= stylesheet_link_tag "feedbacks/application", :media => "all" %>
6
+ <%= javascript_include_tag "feedbacks/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,9 @@
1
+ <% if target.errors.any? %>
2
+ <div id='errorExplanation' class='errorExplanation' >
3
+ <ul>
4
+ <% target.errors.full_messages.each do |msg| %>
5
+ <li> <%= msg %> </li>
6
+ <% end %>
7
+ </ul>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,12 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ feedbacks/feedback:
5
+ topic: 'Topic'
6
+ text: 'Text'
7
+ created_at: 'Created at'
8
+ url: 'Url'
9
+ email: 'Email'
10
+ feedbacks:
11
+ submit: 'Submit'
12
+ cancel: 'Cancel'
@@ -0,0 +1,7 @@
1
+ Feedbacks::Engine.routes.draw do
2
+ # Old api support
3
+ get "feedback" => "feedback_sender#new"
4
+ post "feedback_send" => "feedback_sender#create"
5
+
6
+ resources :feedback_sender, :only => [:new, :create]
7
+ end
@@ -0,0 +1,12 @@
1
+ class CreateFeedbacksFeedbacks < ActiveRecord::Migration
2
+ def change
3
+ create_table :feedbacks_feedbacks do |t|
4
+ t.string :topic
5
+ t.text :text
6
+ t.string :email
7
+ t.string :url
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require "feedbacks/engine"
2
+
3
+ module Feedbacks
4
+ mattr_accessor :from_email, :to_email
5
+ @@from_email = "thisis@example.email"
6
+ @@to_email = "thisis@example.email"
7
+
8
+
9
+ def self.setup
10
+ yield self
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'jquery-ui-rails'
3
+
4
+ module Feedbacks
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Feedbacks
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Feedbacks
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,14 @@
1
+ module Feedbacks
2
+ module Generators
3
+ class InitializerGenerator < Rails::Generators::Base
4
+ desc "This generator creates Feedbacks initializer with default :from and :to emails"
5
+ def create_initializer_file
6
+ create_file "config/initializers/feedbacks.rb",
7
+ 'Feedbacks.setup do |config|
8
+ config.from_email = "example_from@example.example"
9
+ config.to_email = "example_to@example.example"
10
+ end'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'feedbacks', path: '../../'
4
+ gem 'rails', '~> 3.2.0'
5
+ gem 'sqlite3'
6
+
7
+ gem "jquery-rails"
8
+ gem "jquery-ui-rails", :group => :assets
9
+
10
+
11
+ group :development, :test do
12
+ gem 'rspec-rails'
13
+ gem 'factory_girl_rails'
14
+ end
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ feedbacks (0.0.2)
5
+ jquery-rails
6
+ jquery-ui-rails
7
+ rails
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.19)
13
+ actionpack (= 3.2.19)
14
+ mail (~> 2.5.4)
15
+ actionpack (3.2.19)
16
+ activemodel (= 3.2.19)
17
+ activesupport (= 3.2.19)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.4)
21
+ rack (~> 1.4.5)
22
+ rack-cache (~> 1.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.19)
26
+ activesupport (= 3.2.19)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.19)
29
+ activemodel (= 3.2.19)
30
+ activesupport (= 3.2.19)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.2.19)
34
+ activemodel (= 3.2.19)
35
+ activesupport (= 3.2.19)
36
+ activesupport (3.2.19)
37
+ i18n (~> 0.6, >= 0.6.4)
38
+ multi_json (~> 1.0)
39
+ arel (3.0.3)
40
+ builder (3.0.4)
41
+ diff-lcs (1.2.5)
42
+ erubis (2.7.0)
43
+ factory_girl (4.2.0)
44
+ activesupport (>= 3.0.0)
45
+ factory_girl_rails (4.2.1)
46
+ factory_girl (~> 4.2.0)
47
+ railties (>= 3.0.0)
48
+ hike (1.2.3)
49
+ i18n (0.6.11)
50
+ journey (1.0.4)
51
+ jquery-rails (3.1.1)
52
+ railties (>= 3.0, < 5.0)
53
+ thor (>= 0.14, < 2.0)
54
+ jquery-ui-rails (5.0.0)
55
+ railties (>= 3.2.16)
56
+ json (1.8.1)
57
+ mail (2.5.4)
58
+ mime-types (~> 1.16)
59
+ treetop (~> 1.4.8)
60
+ mime-types (1.25.1)
61
+ multi_json (1.10.1)
62
+ polyglot (0.3.5)
63
+ rack (1.4.5)
64
+ rack-cache (1.2)
65
+ rack (>= 0.4)
66
+ rack-ssl (1.3.4)
67
+ rack
68
+ rack-test (0.6.2)
69
+ rack (>= 1.0)
70
+ rails (3.2.19)
71
+ actionmailer (= 3.2.19)
72
+ actionpack (= 3.2.19)
73
+ activerecord (= 3.2.19)
74
+ activeresource (= 3.2.19)
75
+ activesupport (= 3.2.19)
76
+ bundler (~> 1.0)
77
+ railties (= 3.2.19)
78
+ railties (3.2.19)
79
+ actionpack (= 3.2.19)
80
+ activesupport (= 3.2.19)
81
+ rack-ssl (~> 1.3.2)
82
+ rake (>= 0.8.7)
83
+ rdoc (~> 3.4)
84
+ thor (>= 0.14.6, < 2.0)
85
+ rake (10.3.2)
86
+ rdoc (3.12.2)
87
+ json (~> 1.4)
88
+ rspec-core (3.0.2)
89
+ rspec-support (~> 3.0.0)
90
+ rspec-expectations (3.0.2)
91
+ diff-lcs (>= 1.2.0, < 2.0)
92
+ rspec-support (~> 3.0.0)
93
+ rspec-mocks (3.0.2)
94
+ rspec-support (~> 3.0.0)
95
+ rspec-rails (3.0.1)
96
+ actionpack (>= 3.0)
97
+ activesupport (>= 3.0)
98
+ railties (>= 3.0)
99
+ rspec-core (~> 3.0.0)
100
+ rspec-expectations (~> 3.0.0)
101
+ rspec-mocks (~> 3.0.0)
102
+ rspec-support (~> 3.0.0)
103
+ rspec-support (3.0.2)
104
+ sprockets (2.2.2)
105
+ hike (~> 1.2)
106
+ multi_json (~> 1.0)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ sqlite3 (1.3.8)
110
+ thor (0.19.1)
111
+ tilt (1.4.1)
112
+ treetop (1.4.15)
113
+ polyglot
114
+ polyglot (>= 0.3.1)
115
+ tzinfo (0.3.40)
116
+
117
+ PLATFORMS
118
+ ruby
119
+
120
+ DEPENDENCIES
121
+ factory_girl_rails
122
+ feedbacks!
123
+ jquery-rails
124
+ jquery-ui-rails
125
+ rails (~> 3.2.0)
126
+ rspec-rails
127
+ sqlite3