feedbackandscreencap 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ class FeedbackAndScreencapsController < ApplicationController
2
+ # GET /feedback_and_screencaps
3
+ # GET /feedback_and_screencaps.json
4
+ def index
5
+ @feedback_and_screencaps = FeedbackAndScreencap.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @feedback_and_screencaps }
10
+ end
11
+ end
12
+
13
+ # GET /feedback_and_screencaps/1
14
+ # GET /feedback_and_screencaps/1.json
15
+ def show
16
+ @feedback_and_screencap = FeedbackAndScreencap.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @feedback_and_screencap }
21
+ end
22
+ end
23
+
24
+ # POST /feedback_and_screencaps
25
+ # POST /feedback_and_screencaps.json
26
+ def create
27
+ @feedback_and_screencap = FeedbackAndScreencap.new(params[:feedback_and_screencap])
28
+
29
+ respond_to do |format|
30
+ if @feedback_and_screencap.save
31
+ format.html { redirect_to @feedback_and_screencap, notice: 'Feedback and screencap was successfully created.' }
32
+ format.json { render json: @feedback_and_screencap, status: :created, location: @feedback_and_screencap }
33
+ else
34
+ format.html { render action: "new" }
35
+ format.json { render json: @feedback_and_screencap.errors, status: :unprocessable_entity }
36
+ end
37
+ end
38
+ end
39
+
40
+ # DELETE /feedback_and_screencaps/1
41
+ # DELETE /feedback_and_screencaps/1.json
42
+ def destroy
43
+ @feedback_and_screencap = FeedbackAndScreencap.find(params[:id])
44
+ @feedback_and_screencap.destroy
45
+
46
+ respond_to do |format|
47
+ format.html { redirect_to feedback_and_screencaps_url }
48
+ format.json { head :no_content }
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ class FeedbackAndScreencap < ActiveRecord::Base
2
+ attr_accessible :message, :screencap
3
+
4
+ validates_presence_of :message, :screencap
5
+ end
@@ -0,0 +1,25 @@
1
+ <h1>Listing feedback_and_screencaps</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Message</th>
6
+ <th>Screencap</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @feedback_and_screencaps.each do |feedback_and_screencap| %>
13
+ <tr>
14
+ <td><%= feedback_and_screencap.message %></td>
15
+ <td><img src=<%= feedback_and_screencap.screencap %> width="200" height="150"></td>
16
+ <td><%= link_to 'Show', feedback_and_screencap %></td>
17
+ <td><%= link_to 'Edit', edit_feedback_and_screencap_path(feedback_and_screencap) %></td>
18
+ <td><%= link_to 'Destroy', feedback_and_screencap, method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New Feedback and screencap', new_feedback_and_screencap_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Message:</strong>
5
+ <%= @feedback_and_screencap.message %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Screencap:</strong>
10
+ <img src=<%= @feedback_and_screencap.screencap %> width="600" height="400">
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_feedback_and_screencap_path(@feedback_and_screencap) %> |
15
+ <%= link_to 'Back', feedback_and_screencaps_path %>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :feedback_and_screencaps
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/feedbackandscreencap/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Chris Brulak"]
6
+ gem.email = ["chris.brulak@ama.ab.ca"]
7
+ gem.description = %q{Allows website visitors to send annotated screen captures back as feedback}
8
+ gem.summary = %q{Allows website visitors to send annotated screen captures back as feedback}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "feedbackandscreencap"
15
+ gem.require_paths = ["lib"]
16
+ gem.add_development_dependency "rspec"
17
+ gem.add_development_dependency "rails"
18
+ gem.add_development_dependency "rspec-rails"
19
+ gem.add_development_dependency "simplecov"
20
+ gem.add_development_dependency "shoulda-matchers"
21
+ gem.add_development_dependency "sqlite3"
22
+ gem.version = Feedbackandscreencap::VERSION
23
+ end
@@ -0,0 +1,13 @@
1
+ module Feedbackandscreencap
2
+ ## Define ControllerMethods
3
+ module Controller
4
+ ## this one manages the usual self.included, klass_eval stuff
5
+ #extend ActiveSupport::Concern
6
+
7
+
8
+ end
9
+ end
10
+
11
+ ::ActionController::Base.send :include, Feedbackandscreencap::Controller
12
+
13
+
data/lib/engine.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'feedbackandscreencap'
2
+ require 'rails'
3
+ require 'action_controller'
4
+
5
+ module Feedbackandscreencap
6
+ class Engine < Rails::Engine
7
+
8
+
9
+
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ require "feedbackandscreencap/version"
2
+
3
+ module Feedbackandscreencap
4
+ require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
5
+ require 'application_controller'
6
+ end
@@ -0,0 +1,3 @@
1
+ module Feedbackandscreencap
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,56 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ class FeedbackandscreencapGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ def self.source_root
8
+ File.join(File.dirname(__FILE__), 'templates')
9
+ end
10
+
11
+ def self.next_migration_number(dirname) #:nodoc:
12
+ if ActiveRecord::Base.timestamped_migrations
13
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
14
+ else
15
+ "%.3d" % (current_migration_number(dirname) + 1)
16
+ end
17
+ end
18
+
19
+ # Every method that is declared below will be automatically executed when the generator is run
20
+
21
+ def create_migration_file
22
+ f = File.open File.join(File.dirname(__FILE__), 'templates', 'schema.rb')
23
+ schema = f.read; f.close
24
+
25
+ schema.gsub!(/ActiveRecord::Schema.*\n/, '')
26
+ schema.gsub!(/^end\n*$/, '')
27
+
28
+ f = File.open File.join(File.dirname(__FILE__), 'templates', 'migration.rb')
29
+ migration = f.read; f.close
30
+ migration.gsub!(/SCHEMA_AUTO_INSERTED_HERE/, schema)
31
+
32
+ tmp = Tempfile.new('foo')
33
+ tmp.write migration
34
+ tmp.close
35
+
36
+ migration_template tmp.path,'db/migrate/create_feedbackandscreencap_tables.rb'
37
+
38
+ end
39
+
40
+ def copy_model
41
+ copy_file '../../../../../app/models/feedback_and_screencap.rb', 'app/model/feedback_and_screencap.rb'
42
+ end
43
+
44
+ def copy_controller
45
+ copy_file '../../../../../app/controllers/feedback_and_screencaps_controller.rb', 'app/controllers/feedback_and_screencaps_controller.rb'
46
+ end
47
+
48
+ def copy_views
49
+ directory '../../../../../app/views/feedback_and_screencaps/', 'app/views/feedback_and_screencaps/'
50
+ end
51
+
52
+ def copy_assets
53
+ directory '../../../../../app/assets/javascripts/', 'app/assets/javascripts/'
54
+ directory '../../../../../app/assets/stylesheets/', 'app/assets/stylesheets/'
55
+ end
56
+ end
@@ -0,0 +1,5 @@
1
+ module Feedbackandscreencap
2
+ class Engine < Rails::Engine
3
+ config.mount_at = '/feedbackandscreencap'
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class CreateFeedbackandscreencapTables < ActiveRecord::Migration
2
+ def self.up
3
+ SCHEMA_AUTO_INSERTED_HERE
4
+ end
5
+
6
+ def self.down
7
+ drop_table :feedback_and_screencaps
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+
3
+ create_table :feedback_and_screencaps do |t|
4
+ t.string :message
5
+ t.binary :screencap
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :feedback_and_screencaps, [:message]
11
+
12
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ require './app/models/feedback_and_screencap.rb'
4
+
5
+ describe FeedbackAndScreencap do
6
+
7
+ it { should validate_presence_of(:message) }
8
+ it { should validate_presence_of(:screencap) }
9
+
10
+ end
@@ -0,0 +1,35 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
6
+ require 'simplecov'
7
+ require 'rubygems'
8
+ require 'bundler/setup'
9
+ require 'active_record'
10
+ require 'action_controller'
11
+ require 'rspec/rails/extensions/active_record/base'
12
+ require 'shoulda-matchers'
13
+ require 'feedbackandscreencap'
14
+ require 'rspec/autorun'
15
+
16
+ ActiveRecord::Base.establish_connection(
17
+ :adapter => 'sqlite3',
18
+ :database => ':memory:'
19
+ )
20
+
21
+ ActiveRecord::Schema.define do
22
+ self.verbose = false
23
+
24
+ create_table :feedback_and_screencaps, :force => true do |t|
25
+ t.string :message
26
+ t.binary :screencap
27
+
28
+ t.timestamps
29
+ end
30
+ end
31
+
32
+
33
+ RSpec.configure do |config|
34
+ # some (optional) config here
35
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: feedbackandscreencap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris Brulak
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: simplecov
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: shoulda-matchers
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sqlite3
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Allows website visitors to send annotated screen captures back as feedback
111
+ email:
112
+ - chris.brulak@ama.ab.ca
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .rbenv-version
119
+ - .rspec
120
+ - Gemfile
121
+ - LICENSE
122
+ - README.md
123
+ - Rakefile
124
+ - app/assets/javascripts/feedback.js
125
+ - app/assets/javascripts/libs/html2canvas.js
126
+ - app/assets/javascripts/libs/html2canvas.min.js
127
+ - app/assets/stylesheets/feedback/base.css
128
+ - app/controllers/feedback_and_screencaps_controller.rb
129
+ - app/models/feedback_and_screencap.rb
130
+ - app/views/feedback_and_screencaps/index.html.erb
131
+ - app/views/feedback_and_screencaps/show.html.erb
132
+ - config/routes.rb
133
+ - feedbackandscreencap.gemspec
134
+ - lib/application_controller.rb
135
+ - lib/engine.rb
136
+ - lib/feedbackandscreencap.rb
137
+ - lib/feedbackandscreencap/version.rb
138
+ - lib/rails/generators/feedbackandscreencap/feedbackandscreencap_generator.rb
139
+ - lib/rails/generators/feedbackandscreencap/templates/initializer.rb
140
+ - lib/rails/generators/feedbackandscreencap/templates/migration.rb
141
+ - lib/rails/generators/feedbackandscreencap/templates/schema.rb
142
+ - spec/models/feedbackandscreencap_spec.rb
143
+ - spec/spec_helper.rb
144
+ homepage: ''
145
+ licenses: []
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 1.8.23
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Allows website visitors to send annotated screen captures back as feedback
168
+ test_files:
169
+ - spec/models/feedbackandscreencap_spec.rb
170
+ - spec/spec_helper.rb