feedy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c1cb097c269f0dde74b0b28e93b63cfb31f20628
4
+ data.tar.gz: ed27323c07e531394c75cf78a757b59e9c170e20
5
+ SHA512:
6
+ metadata.gz: ad9afe018d521cd478a63348f4ede2bf3fbcdb696afda08d0e3f2b0f7bb338a60294276a4bd9eb04a257bb3c65518fe0d7e9302fbfaced26087e6f0ef4974371
7
+ data.tar.gz: 94241b8bdafb15338d4fcb913e2cf90aa36052d63c10c6cbba76189c41f211f09f842966c05fb5d07ddda1373c896fb10a6f374ba6f348307bbb6ff756f44587
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Sung Won Cho
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,25 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Feedy'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/javascripts directory 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
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,16 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
3
+ ;$(function () {
4
+ // Hide the input when the page loads.
5
+ $('.feedback-input').hide();
6
+
7
+ $('.feedback-toggle').on('click', function () {
8
+ $('.feedback-input').toggle();
9
+ });
10
+
11
+
12
+ // When the form submission is successful
13
+ $('#feedback-form').on('ajax:success', function (e, data, status, xhr) {
14
+ $('.feedback-input').html('thanks');
15
+ });
16
+ });
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,17 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
5
+
6
+ .feedback {
7
+ position: absolute;
8
+ bottom: 0;
9
+ right: 0;
10
+ }
11
+
12
+ .feedback-toggle {
13
+ color: #FFF;
14
+ background-color: #567390;
15
+ cursor: pointer;
16
+ padding: 15px 35px;
17
+ }
@@ -0,0 +1,7 @@
1
+ module Feedy
2
+ class ApplicationController < ActionController::Base
3
+ def current_user
4
+ Feedy.current_user_helper
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,47 @@
1
+ require_dependency "feedy/application_controller"
2
+
3
+ module Feedy
4
+ class FeedbacksController < ApplicationController
5
+ before_action :set_feedbacks, only: :index
6
+ before_action :set_feedback, only: [:show, :destroy]
7
+
8
+ def index
9
+ end
10
+
11
+ def show
12
+ end
13
+
14
+ def create
15
+ if Feedy.anonymous_feedback
16
+ @feedback = Feedback.new(feedback_params)
17
+ else
18
+ @feedback = current_user.feedbacks.new(feedback_params)
19
+ end
20
+
21
+ if @feedback.save
22
+ respond_to do |format|
23
+ format.js { head :created }
24
+ end
25
+ end
26
+ end
27
+
28
+ def destroy
29
+ if @feedback.destroy
30
+ head 204
31
+ end
32
+ end
33
+
34
+ private
35
+ def set_feedbacks
36
+ @feedbacks = Feedback.all
37
+ end
38
+
39
+ def set_feedback
40
+ @feedback = Feedback.find(params[:id])
41
+ end
42
+
43
+ def feedback_params
44
+ params.require(:feedback).permit(:subject, :body)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,4 @@
1
+ module Feedy
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module Feedy
2
+ module FeedbackHelper
3
+ def feedback_input
4
+ render 'feedy/feedback/form'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Feedy
2
+ class Feedback < ActiveRecord::Base
3
+ belongs_to :author, class_name: Feedy.user_class
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ <tr>
2
+ <td><%= feedback.id %></td>
3
+ <td><%= feedback.created_at %></td>
4
+ <td><%= feedback.author.try :id %></td>
5
+ <td><%= feedback.subject %></td>
6
+ <td><%= feedback.body %></td>
7
+ <td>
8
+ <%= link_to 'view', feedback %>
9
+ </td>
10
+ </tr>
@@ -0,0 +1,17 @@
1
+ <div class="feedback">
2
+ <div class="feedback-toggle">
3
+ Feedback
4
+ </div>
5
+
6
+ <div class="feedback-input">
7
+ <%= form_for :feedback, url: feedy.feedback_index_path, html: { id: 'feedback-form' }, remote: true do |f| %>
8
+ <%= f.label :subject %>
9
+ <%= f.text_field :subject %>
10
+
11
+ <%= f.label :body %>
12
+ <%= f.text_field :body %>
13
+
14
+ <%= f.submit %>
15
+ <% end %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,16 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <td>ID</td>
5
+ <td>Date</td>
6
+ <td>User ID</td>
7
+ <td>Subject</td>
8
+ <td>Body</td>
9
+ <td>Action</td>
10
+ </tr>
11
+ </thead>
12
+
13
+ <tbody>
14
+ <%= render @feedbacks %>
15
+ </tbody>
16
+ </table>
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <%= @feedback.subject %>
3
+ </div>
4
+
5
+ <div>
6
+ <%= @feedback.body %>
7
+ </div>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Feedy</title>
5
+ <%= stylesheet_link_tag "feedy/application", media: "all" %>
6
+ <%= javascript_include_tag "feedy/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ Feedy::Engine.routes.draw do
2
+ resources :feedbacks, only: [:index, :show, :create, :destroy]
3
+ end
@@ -0,0 +1,11 @@
1
+ class CreateFeedyFeedbacks < ActiveRecord::Migration
2
+ def change
3
+ create_table :feedy_feedbacks do |t|
4
+ t.references :author, polymorphic: true, index: true
5
+ t.text :subject
6
+ t.text :body
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ require "feedy/engine"
2
+ require "active_support"
3
+
4
+ module Feedy
5
+
6
+ mattr_accessor :user_class, :current_user_helper, :anonymous_feedback
7
+
8
+ class << self
9
+
10
+ def extend_user_class!
11
+ Feedy.user_class.class_eval do
12
+ has_many :feedbacks, as: :author, class_name: "Feedy::Feedback", dependent: :destroy
13
+ end
14
+ end
15
+
16
+ def user_class
17
+ Object.const_get(@@user_class)
18
+ end
19
+
20
+ def current_user_helper
21
+ @@current_user_helper || :current_user
22
+ end
23
+
24
+ def anonymous_feedback
25
+ @@anonymous_feedback || false
26
+ end
27
+ end
28
+ end
29
+
30
+ ActiveSupport.on_load(:active_record) do
31
+ Feedy.extend_user_class!
32
+ end
@@ -0,0 +1,18 @@
1
+ module Feedy
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Feedy
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
8
+ end
9
+
10
+ # Expose the engine's helper methods in the parent app
11
+ config.before_initialize do
12
+ ActiveSupport.on_load :action_controller do
13
+ helper Feedy::Engine.helpers
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Feedy
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ Feedy.anonymous_feedback = false
2
+ Feedy.user_class = "User"
3
+ Feedy.current_user_helper = :current_user
@@ -0,0 +1,16 @@
1
+ class CreateFeedbacks < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :feedbacks do |t|
4
+ t.references :feedback_giver, polymorphic: true
5
+ t.text :subject
6
+ t.text :body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :feedbacks
14
+ end
15
+
16
+ end
@@ -0,0 +1,21 @@
1
+ require "rails/generators"
2
+
3
+ module Feedy
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path("../install/templates", __FILE__)
9
+ desc "Copies Feedy migrations"
10
+
11
+ def self.next_migration_number(path)
12
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
13
+ end
14
+
15
+ def copy_migration_file
16
+ migration_template "migration.rb", "db/migrate/create_feedbacks.rb"
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :feedy do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: feedy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sung Won Cho
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: jquery-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.10
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.10
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 4.5.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 4.5.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: generator_spec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.3
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.5.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.5.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: factory_girl_rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.5.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.5.0
125
+ description: Feedy lets you collect and analyze user feedback with ease.
126
+ email:
127
+ - mikeswcho@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - MIT-LICENSE
133
+ - Rakefile
134
+ - app/assets/javascripts/feedy/application.js
135
+ - app/assets/javascripts/feedy/feedbacks.js
136
+ - app/assets/stylesheets/feedy/application.css
137
+ - app/assets/stylesheets/feedy/feedbacks.css
138
+ - app/controllers/feedy/application_controller.rb
139
+ - app/controllers/feedy/feedbacks_controller.rb
140
+ - app/helpers/feedy/application_helper.rb
141
+ - app/helpers/feedy/feedback_helper.rb
142
+ - app/models/feedy/feedback.rb
143
+ - app/views/feedy/feedbacks/_feedback.html.erb
144
+ - app/views/feedy/feedbacks/_form.html.erb
145
+ - app/views/feedy/feedbacks/index.html.erb
146
+ - app/views/feedy/feedbacks/show.html.erb
147
+ - app/views/layouts/feedy/application.html.erb
148
+ - config/routes.rb
149
+ - db/migrate/20150205092105_create_feedy_feedbacks.rb
150
+ - lib/feedy.rb
151
+ - lib/feedy/engine.rb
152
+ - lib/feedy/version.rb
153
+ - lib/generators/feedy/install/templates/initializer.rb
154
+ - lib/generators/feedy/install/templates/migration.rb
155
+ - lib/generators/feedy/install_generator.rb
156
+ - lib/tasks/feedy_tasks.rake
157
+ homepage: https://github.com/sungwoncho/feedy
158
+ licenses:
159
+ - MIT
160
+ metadata: {}
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 2.4.5
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: Feedy lets you collect and analyze user feedback with ease.
181
+ test_files: []