feedy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1cb097c269f0dde74b0b28e93b63cfb31f20628
4
- data.tar.gz: ed27323c07e531394c75cf78a757b59e9c170e20
3
+ metadata.gz: d3c5ad420932660bfcba62c74c9a0faffa58cacf
4
+ data.tar.gz: be9276fdd7cafaf29d0d844f77d81e1e70e16712
5
5
  SHA512:
6
- metadata.gz: ad9afe018d521cd478a63348f4ede2bf3fbcdb696afda08d0e3f2b0f7bb338a60294276a4bd9eb04a257bb3c65518fe0d7e9302fbfaced26087e6f0ef4974371
7
- data.tar.gz: 94241b8bdafb15338d4fcb913e2cf90aa36052d63c10c6cbba76189c41f211f09f842966c05fb5d07ddda1373c896fb10a6f374ba6f348307bbb6ff756f44587
6
+ metadata.gz: e1fc2ede3b94964d8d1229cfda327753d2e67646c10f408ec93da57beb633d3e31ce3be587ff23efa48822675c1dd729c74f8af6ff37358e497db95474000600
7
+ data.tar.gz: a7bf34fee4deabc8a2637d8d58283548046c805a5825549aa90875558815f63a1a633c8eb135411252c4a6944d525d0f50048fc65bfd05a0d13617c33df3f24a
@@ -1,7 +1,7 @@
1
1
  module Feedy
2
2
  module FeedbackHelper
3
3
  def feedback_input
4
- render 'feedy/feedback/form'
4
+ render 'feedy/feedbacks/form'
5
5
  end
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@
3
3
  <td><%= feedback.created_at %></td>
4
4
  <td><%= feedback.author.try :id %></td>
5
5
  <td><%= feedback.subject %></td>
6
- <td><%= feedback.body %></td>
6
+ <td><%= truncate feedback.body %></td>
7
7
  <td>
8
8
  <%= link_to 'view', feedback %>
9
9
  </td>
@@ -4,7 +4,7 @@
4
4
  </div>
5
5
 
6
6
  <div class="feedback-input">
7
- <%= form_for :feedback, url: feedy.feedback_index_path, html: { id: 'feedback-form' }, remote: true do |f| %>
7
+ <%= form_for :feedback, url: feedy.feedbacks_path, html: { id: 'feedback-form' }, remote: true do |f| %>
8
8
  <%= f.label :subject %>
9
9
  <%= f.text_field :subject %>
10
10
 
@@ -2,7 +2,7 @@ require "feedy/engine"
2
2
  require "active_support"
3
3
 
4
4
  module Feedy
5
-
5
+
6
6
  mattr_accessor :user_class, :current_user_helper, :anonymous_feedback
7
7
 
8
8
  class << self
@@ -14,7 +14,7 @@ module Feedy
14
14
  end
15
15
 
16
16
  def user_class
17
- Object.const_get(@@user_class)
17
+ Object.const_get(@@user_class) if @@user_class
18
18
  end
19
19
 
20
20
  def current_user_helper
@@ -28,5 +28,5 @@ module Feedy
28
28
  end
29
29
 
30
30
  ActiveSupport.on_load(:active_record) do
31
- Feedy.extend_user_class!
31
+ Feedy.extend_user_class! if Feedy.user_class
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module Feedy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  Feedy.anonymous_feedback = false
2
- Feedy.user_class = "User"
3
- Feedy.current_user_helper = :current_user
2
+ Feedy.user_class = "<%= user_class %>"
3
+ Feedy.current_user_helper = :<%= current_user_helper %>
@@ -5,17 +5,39 @@ module Feedy
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  include Rails::Generators::Migration
7
7
 
8
+ class_option 'user_class', type: :string
9
+ class_option 'current_user_helper', type: :string
10
+
11
+ attr_reader :user_class, :current_user_helper
12
+
8
13
  source_root File.expand_path("../install/templates", __FILE__)
9
- desc "Copies Feedy migrations"
14
+ desc "Copies Feedy migrations and the initializer"
10
15
 
11
- def self.next_migration_number(path)
12
- Time.now.utc.strftime("%Y%m%d%H%M%S")
16
+ def copy_migration_file
17
+ Dir.chdir(Rails.root) do
18
+ `rake feedy:install:migrations`
19
+ end
13
20
  end
14
21
 
15
- def copy_migration_file
16
- migration_template "migration.rb", "db/migrate/create_feedbacks.rb"
22
+ def determine_user_class
23
+ @user_class = options["user_class"].presence ||
24
+ ask("What is your user class called? [User]").presence ||
25
+ "User"
17
26
  end
18
27
 
28
+ def determine_current_user_helper
29
+ @current_user_helper = options["current_user_helper"].presence ||
30
+ ask("What is the current user helper in your application? [current_user]").presence ||
31
+ 'current_user'
32
+ end
33
+
34
+ def copy_initializer
35
+ template 'initializer.rb', 'config/initializers/feedy.rb'
36
+ end
37
+
38
+ def mount_engine
39
+ route 'mount Feedy::Engine, at: "/feedy"'
40
+ end
19
41
  end
20
42
  end
21
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sung Won Cho
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +151,6 @@ files:
151
151
  - lib/feedy/engine.rb
152
152
  - lib/feedy/version.rb
153
153
  - lib/generators/feedy/install/templates/initializer.rb
154
- - lib/generators/feedy/install/templates/migration.rb
155
154
  - lib/generators/feedy/install_generator.rb
156
155
  - lib/tasks/feedy_tasks.rake
157
156
  homepage: https://github.com/sungwoncho/feedy
@@ -1,16 +0,0 @@
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