feedbacker 0.1.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.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .tmp*
2
+ .redcar
3
+ *.gem
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Worldwide IDEA, Inc http://www.wwidea.org
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.
data/README ADDED
@@ -0,0 +1,34 @@
1
+ Feedbacker
2
+ ==========
3
+
4
+ Feedbacker provides a tab for users to contact developers from within the application
5
+
6
+
7
+ Assumptions
8
+ ===========
9
+
10
+ Feedbacker assumes that you're using...
11
+ At least Rails 3.1.3
12
+ The Rails Asset Pipeline
13
+ Jquery
14
+
15
+ Installation
16
+ ============
17
+ 1. Add the following to your Gemfile
18
+ gem :feedbacker
19
+
20
+ 2. Run `bundle install`
21
+
22
+ 3. Add the following line to your application layout
23
+ <%= javascript_include_tag :feedbacker %>
24
+
25
+ 4. Add the following line to your application layout before you call application.css. Override default settings in application.css
26
+ <%= stylesheet_link_tag :feedbacker %>
27
+
28
+ 5. Add the following line right after the body tag in your application layout
29
+ <%= render(:partial => 'feedbacker/tab') unless current_user.is_guest? %>
30
+
31
+ 6. Add the folllowing line to config/application.rb
32
+ config.paths['db/migrate'] = Feedbacker::Engine.paths['db/migrate'].existent
33
+
34
+ Copyright (c) 2009 WWIDEA, Inc. released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the feedbacker plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the feedbacker plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'Feedbacker'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
Binary file
@@ -0,0 +1,12 @@
1
+ Feedback = {
2
+ show_form: function() {
3
+ $('#expanded_feedback_form').show();
4
+ $('#compressed_feedback_form_tab').hide();
5
+ },
6
+
7
+ hide_form: function() {
8
+ $('#compressed_feedback_form_tab').show();
9
+ $('#expanded_feedback_form').hide();
10
+ }
11
+
12
+ }
@@ -0,0 +1,102 @@
1
+ /********************
2
+
3
+ FEEDBACKER DEFAULT STYLES
4
+
5
+ OVERRIDE IN APPLICATION.CSS
6
+
7
+ ********************/
8
+
9
+ #feedback input[value="Submit Feedback"] {
10
+ margin-top: -0.75em;
11
+ }
12
+
13
+ .feedback, .feedback a, .feedback a:hover {
14
+ background: #FFAC48;
15
+ color: #fff;
16
+ font-weight:bold;
17
+ padding: 0 3px;
18
+ border-bottom: 0;
19
+ }
20
+
21
+ #feedback {
22
+ position: fixed;
23
+ top: 55px;
24
+ left:0;
25
+ z-index: 10;
26
+ /* width: 440px;*/
27
+ }
28
+
29
+ #feedback p {
30
+ margin:0;
31
+ padding:0;
32
+ color: #fff;
33
+ }
34
+
35
+ #feedback div {
36
+ margin-top: 0;
37
+ }
38
+
39
+ #compressed_feedback_form_tab {
40
+ float: left;
41
+ height: 155px;
42
+ }
43
+
44
+ #expanded_feedback_form_tab img {
45
+ position: absolute;
46
+ top: 0;
47
+ left: 430px;
48
+ }
49
+
50
+ :first-child+html #expanded_feedback_form_tab img {
51
+ position: absolute;
52
+ top: 0;
53
+ left: 436px;
54
+ }
55
+
56
+ #compressed_feedback_form_tab a {
57
+ border-bottom: 0;
58
+ }
59
+
60
+ #expanded_feedback_form_tab a {
61
+ border-bottom: 0;
62
+ }
63
+
64
+ #feedback label {
65
+ display:inline;
66
+ width: auto;
67
+ color: #fff;
68
+ margin-left: 1em;
69
+ }
70
+
71
+ #remark_content {
72
+ width: 400px;
73
+ height: 60px;
74
+ padding: 0.5em;
75
+ margin-left: 1em;
76
+ font: 12px "Trebuchet MS", Verdana, Arial, sans-serif;
77
+ overflow-y: auto;
78
+ }
79
+
80
+ #expanded_feedback_form {
81
+ background: url(<%= asset_data_uri 'feedback_tab_bottom.png' %>) top left repeat-x;
82
+ height: 155px;
83
+ padding: 0.25em;
84
+ }
85
+
86
+ .fb_cancel a {
87
+ margin-left: 0.5em;
88
+ color: #ffc;
89
+ border-bottom: 1px dotted #ffc;
90
+ font-weight:normal;
91
+ }
92
+
93
+ .fb_cancel a:hover {
94
+ border-bottom: 1px solid #ffc;
95
+ }
96
+
97
+ #feedback_thank_you_message {
98
+ font-size: 14px;
99
+ color: #D1FEA4;
100
+ margin-left: 1em;
101
+ font-weight:bold;
102
+ }
@@ -0,0 +1,3 @@
1
+ class RemarksController < ::ApplicationController
2
+ include Feedbacker::RemarksControllerMethods
3
+ end
@@ -0,0 +1,9 @@
1
+ module FeedbackerHelper
2
+ def show_feedback
3
+ "$('#expanded_feedback_form').show(); $('#compressed_feedback_form_tab').hide();"
4
+ end
5
+
6
+ def hide_feedback
7
+ "$('#compressed_feedback_form_tab').show(); $('#expanded_feedback_form').hide();"
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ class FeedbackMailer < ActionMailer::Base
2
+ def feedback(remark)
3
+ @remark = remark
4
+ mail(:to => "support@wwidea.org", :from => 'support@wwidea.org', :reply_to => remark.user.email, :subject => "#{(defined? FEEDBACKER_EMAIL_PREFIX) ? FEEDBACKER_EMAIL_PREFIX : '[FEEDBACKER]'} Feedback Notification")
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ class Remark < ActiveRecord::Base
2
+ include Feedbacker::RemarkMethods
3
+ end
@@ -0,0 +1,5 @@
1
+ class RemarkObserver < ActiveRecord::Observer
2
+ def after_create(remark)
3
+ FeedbackMailer.feedback(remark).deliver
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ <p>Feedback Received</p>
2
+
3
+ <p>From: <%= @remark.user_name %> [<%= @remark.user.email %>]</p>
4
+ <p>Page: <%= link_to(@remark.source_url, @remark.source_url) %></p>
5
+
6
+ <p>Comments:</p>
7
+ <p><%= @remark.content %></p>
@@ -0,0 +1,10 @@
1
+ <div id="feedback">
2
+ <div id="compressed_feedback_form_tab">
3
+ <%= link_to_function image_tag('feedback_tab.png'), show_feedback %>
4
+ </div>
5
+ <div id="expanded_feedback_form" style="display:none">
6
+ <div id="expanded_feedback_form_tab"><%= link_to_function image_tag('feedback_tab.png'), hide_feedback %></div>
7
+ <% @remark ||= Remark.new %>
8
+ <%= render :partial => 'remarks/form' %>
9
+ </div>
10
+ </div>
@@ -0,0 +1,6 @@
1
+ <%= form_for @remark, :remote => true do |f| %>
2
+ <p><label><%= render :partial => 'remarks/greeting' %></label></p>
3
+ <div><%= f.text_area :content %></div>
4
+ <div id='feedback_submit_button'><%= f.submit 'Submit Feedback' %> <span class="fb_cancel"><%= link_to_function 'Cancel', hide_feedback %></span></div>
5
+ <div id='feedback_thank_you_message' style='display:none'>Thank you for your feedback!</div>
6
+ <% end %>
@@ -0,0 +1 @@
1
+ Let us know what you think!
@@ -0,0 +1,7 @@
1
+ $('#feedback_submit_button').hide();
2
+ $('#feedback_thank_you_message').fadeIn('500')
3
+ setTimeout(function() {
4
+ Feedback.hide_form();
5
+ $('#feedback_thank_you_message').hide();
6
+ $('#feedback_submit_button').show();
7
+ }, 2000);
@@ -0,0 +1,2 @@
1
+ Feedbacker::RemarkMethods::USER_NAME_METHOD = :first_last
2
+ FEEDBACKER_EMAIL_PREFIX = '[FEEDBACKER]'
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :remarks, :only => [:create]
3
+ end
@@ -0,0 +1,14 @@
1
+ class CreateRemarksTable < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :remarks do |t|
4
+ t.integer :user_id
5
+ t.string :source_url
6
+ t.text :content
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :remarks
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path('../lib/feedbacker/version', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "feedbacker"
5
+ s.version = Feedbacker::VERSION
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Jonathan S. Garvin", 'Aaron Baldwin', 'WWIDEA, Inc']
8
+ s.email = ["developers@wwidea.org"]
9
+ s.homepage = "https://github.com/wwidea/feedbacker"
10
+ s.summary = %q{Sitewide Feedback form pinned to sidewall as verticle tab.}
11
+ s.description = %q{Feedbacker provides a pull out tab on the side of every page on a site for users to send feedback to the site.}
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- test/*`.split("\n")
14
+ s.require_paths = ["lib"]
15
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ # Include hook code here
data/install.rb ADDED
@@ -0,0 +1 @@
1
+ # Install hook code here
data/lib/feedbacker.rb ADDED
@@ -0,0 +1,10 @@
1
+ Dir[File.join(File.dirname(__FILE__), '/feedbacker/*.rb')].each {|file| require file }
2
+
3
+ module Feedbacker
4
+ class Engine < ::Rails::Engine
5
+ config.active_record.observers = :remark_observer
6
+ rake_tasks do
7
+ Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,28 @@
1
+ module Feedbacker #:nodoc:
2
+ module RemarkMethods
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ base.class_eval do
6
+ include InstanceMethods
7
+
8
+ belongs_to :user
9
+ end
10
+ end
11
+
12
+ module ClassMethods
13
+
14
+ end
15
+
16
+ module InstanceMethods
17
+
18
+ def user_name
19
+ if defined? Feedbacker::RemarkMethods::USER_NAME_METHOD
20
+ return user.send(Feedbacker::RemarkMethods::USER_NAME_METHOD)
21
+ else
22
+ user.name
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ module Feedbacker
2
+ module RemarksControllerMethods
3
+ def create
4
+ @remark = Remark.new(params[:remark].merge(:user_id => current_user.id))
5
+ @remark.source_url = request.env['HTTP_REFERER']
6
+ if @remark.save
7
+ respond_to do |format|
8
+ format.js
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Feedbacker
2
+ VERSION = '0.1.2'
3
+ end
@@ -0,0 +1,58 @@
1
+ # desc "Explaining what the task does"
2
+ # task :feedbacker do
3
+ # # Task goes here
4
+ # end
5
+
6
+ namespace :feedbacker do
7
+ desc "bootstrap feedbacker"
8
+ task :bootstrap => :environment do
9
+ require 'fileutils'
10
+ unless File.exist?("#{Rails.root}/config/initializers/feedbacker.rb")
11
+ FileUtils.copy(File.expand_path('../../../config/packaged_initializers/feedbacker.rb', __FILE__), "#{Rails.root}/config/initializers")
12
+ end
13
+ #unless File.exist?("#{RAILS_ROOT}/public/images/feedback_tab.png")
14
+ # FileUtils.copy("#{RAILS_ROOT}/vendor/plugins/feedbacker/public/images/feedback_tab.png","#{RAILS_ROOT}/public/images")
15
+ #end
16
+ #unless File.exist?("#{RAILS_ROOT}/public/images/feedback_tab_bottom.png")
17
+ # FileUtils.copy("#{RAILS_ROOT}/vendor/plugins/feedbacker/public/images/feedback_tab_bottom.png","#{RAILS_ROOT}/public/images")
18
+ #end
19
+ #unless File.exist?("#{RAILS_ROOT}/public/stylesheets/feedbacker.css")
20
+ # FileUtils.copy("#{RAILS_ROOT}/vendor/plugins/feedbacker/public/stylesheets/feedbacker.css","#{RAILS_ROOT}/public/stylesheets")
21
+ #end
22
+ #unless File.exist?("#{RAILS_ROOT}/public/javascripts/feedbacker.js")
23
+ # FileUtils.copy("#{RAILS_ROOT}/vendor/plugins/feedbacker/public/javascripts/feedbacker.js","#{RAILS_ROOT}/public/javascripts")
24
+ #end
25
+ #unless File.exist?("#{RAILS_ROOT}/db/migrate/20101230191157_create_remarks_table.rb")
26
+ # FileUtils.copy("#{RAILS_ROOT}/vendor/plugins/feedbacker/db/migrate/20101230191157_create_remarks_table.rb","#{RAILS_ROOT}/db/migrate")
27
+ # Rake::Task['db:migrate'].execute
28
+ #end
29
+ end
30
+
31
+ ########################################################################
32
+ ### Below task simply for use during initial building of Feedbacker, ###
33
+ ### not intended to be used once plugin is considered complete. ###
34
+ ########################################################################
35
+
36
+ task :debootstrap => :environment do
37
+ if File.exist?("#{RAILS_ROOT}/config/initializers/feedbacker.rb")
38
+ File.delete("#{RAILS_ROOT}/config/initializers/feedbacker.rb")
39
+ end
40
+ if File.exist?("#{RAILS_ROOT}/public/images/feedback_tab.png")
41
+ File.delete("#{RAILS_ROOT}/public/images/feedback_tab.png")
42
+ end
43
+ if File.exist?("#{RAILS_ROOT}/public/images/feedback_tab_bottom.png")
44
+ File.delete("#{RAILS_ROOT}/public/images/feedback_tab_bottom.png")
45
+ end
46
+ if File.exist?("#{RAILS_ROOT}/public/stylesheets/feedbacker.css")
47
+ File.delete("#{RAILS_ROOT}/public/stylesheets/feedbacker.css")
48
+ end
49
+ if File.exist?("#{RAILS_ROOT}/public/javascripts/feedbacker.js")
50
+ File.delete("#{RAILS_ROOT}/public/javascripts/feedbacker.js")
51
+ end
52
+ if File.exist?("#{RAILS_ROOT}/db/migrate/20101230191157_create_remarks_table.rb")
53
+ ENV['VERSION'] = '20101230191156'
54
+ Rake::Task['db:migrate'].execute
55
+ File.delete("#{RAILS_ROOT}/db/migrate/20101230191157_create_remarks_table.rb")
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class FeedbackerTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: feedbacker
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.2
6
+ platform: ruby
7
+ authors:
8
+ - Jonathan S. Garvin
9
+ - Aaron Baldwin
10
+ - WWIDEA, Inc
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2012-01-13 00:00:00 -07:00
16
+ default_executable:
17
+ dependencies: []
18
+
19
+ description: Feedbacker provides a pull out tab on the side of every page on a site for users to send feedback to the site.
20
+ email:
21
+ - developers@wwidea.org
22
+ executables: []
23
+
24
+ extensions: []
25
+
26
+ extra_rdoc_files: []
27
+
28
+ files:
29
+ - .gitignore
30
+ - MIT-LICENSE
31
+ - README
32
+ - Rakefile
33
+ - app/assets/images/feedback_tab.png
34
+ - app/assets/images/feedback_tab_bottom.png
35
+ - app/assets/javascripts/feedbacker.js
36
+ - app/assets/stylesheets/feedbacker.css.erb
37
+ - app/controllers/remarks_controller.rb
38
+ - app/helpers/feedbacker_helper.rb
39
+ - app/mailers/feedback_mailer.rb
40
+ - app/models/remark.rb
41
+ - app/observers/remark_observer.rb
42
+ - app/views/feedback_mailer/feedback.html.erb
43
+ - app/views/feedbacker/_tab.html.erb
44
+ - app/views/remarks/_form.html.erb
45
+ - app/views/remarks/_greeting.html.erb
46
+ - app/views/remarks/create.js.erb
47
+ - config/initializers/feedbacker.rb
48
+ - config/routes.rb
49
+ - db/migrate/20101230191157_create_remarks_table.rb
50
+ - feedbacker.gemspec
51
+ - init.rb
52
+ - install.rb
53
+ - lib/feedbacker.rb
54
+ - lib/feedbacker/remark_methods.rb
55
+ - lib/feedbacker/remarks_controller_methods.rb
56
+ - lib/feedbacker/version.rb
57
+ - lib/tasks/feedbacker_tasks.rake
58
+ - test/feedbacker_test.rb
59
+ - test/test_helper.rb
60
+ - uninstall.rb
61
+ has_rdoc: true
62
+ homepage: https://github.com/wwidea/feedbacker
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ requirements: []
83
+
84
+ rubyforge_project:
85
+ rubygems_version: 1.5.2
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Sitewide Feedback form pinned to sidewall as verticle tab.
89
+ test_files:
90
+ - test/feedbacker_test.rb
91
+ - test/test_helper.rb