rails_page_comment 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/Rakefile +34 -34
- data/app/assets/javascripts/rails_page_comment/application.js +13 -13
- data/app/assets/javascripts/rails_page_comment/page_comments.js +2 -2
- data/app/assets/stylesheets/rails_page_comment/application.css +15 -15
- data/app/assets/stylesheets/rails_page_comment/page_comments.css +4 -4
- data/app/assets/stylesheets/scaffold.css +56 -56
- data/app/controllers/rails_page_comment/application_controller.rb +11 -4
- data/app/controllers/rails_page_comment/page_comments_controller.rb +69 -62
- data/app/helpers/rails_page_comment/application_helper.rb +4 -4
- data/app/helpers/rails_page_comment/page_comments_helper.rb +4 -4
- data/app/mailers/rails_page_comment/notify_changes.rb +15 -0
- data/app/models/rails_page_comment/page_comment.rb +4 -4
- data/app/views/layouts/rails_page_comment/application.html.erb +14 -14
- data/app/views/rails_page_comment/notify_changes/notice_changes.html.erb +2 -0
- data/app/views/rails_page_comment/page_comments/_form.html.erb +13 -13
- data/app/views/rails_page_comment/page_comments/index.html.erb +27 -27
- data/app/views/rails_page_comment/page_comments/show.html.erb +14 -14
- data/config/routes.rb +5 -5
- data/db/migrate/20141105030748_create_rails_page_comment_page_comments.rb +10 -10
- data/lib/generators/rails_page_comment/install_generator.rb +51 -51
- data/lib/generators/rails_page_comment/mailer_views_generator.rb +36 -0
- data/lib/generators/rails_page_comment/templates/active_record/rails_page_comment/page_comment.rb +3 -3
- data/lib/generators/rails_page_comment/templates/mailer/notice_changes.html.erb +2 -0
- data/lib/generators/rails_page_comment/templates/rails_page_comment.rb +20 -7
- data/lib/rails_page_comment.rb +38 -20
- data/lib/rails_page_comment/controller_additions.rb +38 -34
- data/lib/rails_page_comment/controller_resource.rb +52 -52
- data/lib/rails_page_comment/engine.rb +10 -10
- data/lib/rails_page_comment/version.rb +3 -3
- data/lib/tasks/rails_page_comment_tasks.rake +4 -4
- data/test/controllers/rails_page_comment/page_comments_controller_test.rb +51 -51
- data/test/dummy/README.rdoc +28 -28
- data/test/dummy/Rakefile +6 -6
- data/test/dummy/app/assets/javascripts/application.js +13 -13
- data/test/dummy/app/assets/stylesheets/application.css +15 -15
- data/test/dummy/app/controllers/application_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +2 -2
- data/test/dummy/app/views/layouts/application.html.erb +14 -14
- data/test/dummy/bin/bundle +3 -3
- data/test/dummy/bin/rails +4 -4
- data/test/dummy/bin/rake +4 -4
- data/test/dummy/config.ru +4 -4
- data/test/dummy/config/application.rb +23 -23
- data/test/dummy/config/boot.rb +5 -5
- data/test/dummy/config/database.yml +25 -25
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/environments/development.rb +37 -37
- data/test/dummy/config/environments/production.rb +82 -82
- data/test/dummy/config/environments/test.rb +39 -39
- data/test/dummy/config/initializers/assets.rb +8 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -2
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/test/dummy/config/initializers/inflections.rb +16 -16
- data/test/dummy/config/initializers/mime_types.rb +4 -4
- data/test/dummy/config/initializers/session_store.rb +3 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/test/dummy/config/locales/en.yml +23 -23
- data/test/dummy/config/routes.rb +4 -4
- data/test/dummy/config/secrets.yml +22 -22
- data/test/dummy/public/404.html +67 -67
- data/test/dummy/public/422.html +67 -67
- data/test/dummy/public/500.html +66 -66
- data/test/fixtures/rails_page_comment/page_comments.yml +9 -9
- data/test/helpers/rails_page_comment/page_comments_helper_test.rb +6 -6
- data/test/integration/navigation_test.rb +10 -10
- data/test/mailers/previews/rails_page_comment/notify_changes_preview.rb +6 -0
- data/test/mailers/rails_page_comment/notify_changes_test.rb +9 -0
- data/test/models/rails_page_comment/page_comment_test.rb +9 -9
- data/test/rails_page_comment_test.rb +7 -7
- data/test/test_helper.rb +15 -15
- metadata +11 -4
- data/README.rdoc +0 -45
@@ -1,4 +1,4 @@
|
|
1
|
-
module RailsPageComment
|
2
|
-
module ApplicationHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module RailsPageComment
|
2
|
+
module ApplicationHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module RailsPageComment
|
2
|
-
module PageCommentsHelper
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module RailsPageComment
|
2
|
+
module PageCommentsHelper
|
3
|
+
end
|
4
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RailsPageComment
|
2
|
+
class NotifyChanges < ActionMailer::Base
|
3
|
+
|
4
|
+
|
5
|
+
default from: "from@example.com"
|
6
|
+
|
7
|
+
|
8
|
+
def notice_changes(page_comment)
|
9
|
+
@page_comment = page_comment
|
10
|
+
mail(to: RailsPageComment.recipient_email,
|
11
|
+
subject: "画面/機能の詳細仕様を変更しました。", from: RailsPageComment.email_from)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module RailsPageComment
|
2
|
-
class PageComment < ActiveRecord::Base
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module RailsPageComment
|
2
|
+
class PageComment < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>RailsPageComment</title>
|
5
|
-
<%= stylesheet_link_tag "rails_page_comment/application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "rails_page_comment/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>RailsPageComment</title>
|
5
|
+
<%= stylesheet_link_tag "rails_page_comment/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "rails_page_comment/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<div style="text-align: center" id="page_comment">
|
2
|
-
<h1>本画面/機能の詳細仕様説明:</h1><br/>
|
3
|
-
<%= form_for(@page_comment, :remote => true) do |f| %>
|
4
|
-
<%= hidden_field_tag :authenticity_token, @_csrf_token%>
|
5
|
-
<div class="field">
|
6
|
-
<%= f.hidden_field :page_uri%>
|
7
|
-
<%= f.text_area :content, cols:
|
8
|
-
</div>
|
9
|
-
<div class="actions">
|
10
|
-
<%= f.submit "保存"%>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
1
|
+
<div style="text-align: center" id="page_comment">
|
2
|
+
<h1>本画面/機能の詳細仕様説明:</h1><br/>
|
3
|
+
<%= form_for(@page_comment, :remote => true) do |f| %>
|
4
|
+
<%= hidden_field_tag :authenticity_token, @_csrf_token%>
|
5
|
+
<div class="field">
|
6
|
+
<%= f.hidden_field :page_uri%>
|
7
|
+
<%= f.text_area :content, cols: RailsPageComment.text_area_cols, rows: RailsPageComment.text_area_rows%>
|
8
|
+
</div>
|
9
|
+
<div class="actions">
|
10
|
+
<%= f.submit "保存"%>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
@@ -1,27 +1,27 @@
|
|
1
|
-
<h1>Listing page_comments</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<thead>
|
5
|
-
<tr>
|
6
|
-
<th>Requst uri</th>
|
7
|
-
<th>Content</th>
|
8
|
-
<th colspan="3"></th>
|
9
|
-
</tr>
|
10
|
-
</thead>
|
11
|
-
|
12
|
-
<tbody>
|
13
|
-
<% @page_comments.each do |page_comment| %>
|
14
|
-
<tr>
|
15
|
-
<td><%= page_comment.requst_uri %></td>
|
16
|
-
<td><%= page_comment.content %></td>
|
17
|
-
<td><%= link_to 'Show', page_comment %></td>
|
18
|
-
<td><%= link_to 'Edit', edit_page_comment_path(page_comment) %></td>
|
19
|
-
<td><%= link_to 'Destroy', page_comment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
-
</tr>
|
21
|
-
<% end %>
|
22
|
-
</tbody>
|
23
|
-
</table>
|
24
|
-
|
25
|
-
<br>
|
26
|
-
|
27
|
-
<%= link_to 'New Page comment', new_page_comment_path %>
|
1
|
+
<h1>Listing page_comments</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Requst uri</th>
|
7
|
+
<th>Content</th>
|
8
|
+
<th colspan="3"></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
|
12
|
+
<tbody>
|
13
|
+
<% @page_comments.each do |page_comment| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= page_comment.requst_uri %></td>
|
16
|
+
<td><%= page_comment.content %></td>
|
17
|
+
<td><%= link_to 'Show', page_comment %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_page_comment_path(page_comment) %></td>
|
19
|
+
<td><%= link_to 'Destroy', page_comment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br>
|
26
|
+
|
27
|
+
<%= link_to 'New Page comment', new_page_comment_path %>
|
@@ -1,14 +1,14 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<strong>Requst uri:</strong>
|
5
|
-
<%= @page_comment.requst_uri %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<strong>Content:</strong>
|
10
|
-
<%= @page_comment.content %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<%= link_to 'Edit', edit_page_comment_path(@page_comment) %> |
|
14
|
-
<%= link_to 'Back', page_comments_path %>
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Requst uri:</strong>
|
5
|
+
<%= @page_comment.requst_uri %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Content:</strong>
|
10
|
+
<%= @page_comment.content %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_page_comment_path(@page_comment) %> |
|
14
|
+
<%= link_to 'Back', page_comments_path %>
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
RailsPageComment::Engine.routes.draw do
|
2
|
-
|
3
|
-
resources :page_comments
|
4
|
-
|
5
|
-
end
|
1
|
+
RailsPageComment::Engine.routes.draw do
|
2
|
+
|
3
|
+
resources :page_comments
|
4
|
+
|
5
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
class CreateRailsPageCommentPageComments < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :rails_page_comment_page_comments do |t|
|
4
|
-
t.string :page_uri
|
5
|
-
t.text :content
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
1
|
+
class CreateRailsPageCommentPageComments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :rails_page_comment_page_comments do |t|
|
4
|
+
t.string :page_uri
|
5
|
+
t.text :content
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
|
4
|
-
module RailsPageComment
|
5
|
-
module Generators
|
6
|
-
class InstallGenerator < Rails::Generators::Base
|
7
|
-
include Rails::Generators::Migration
|
8
|
-
|
9
|
-
desc "Generates migration for Page Comment (RailsPageComment) models"
|
10
|
-
|
11
|
-
def self.source_root
|
12
|
-
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.next_migration_number(dirname)
|
16
|
-
Time.now.strftime("%Y%m%d%H%M%S")
|
17
|
-
end
|
18
|
-
|
19
|
-
# copy configuration
|
20
|
-
def copy_initializer
|
21
|
-
template "rails_page_comment.rb", "config/initializers/rails_page_comment.rb"
|
22
|
-
end
|
23
|
-
|
24
|
-
def mount_engine
|
25
|
-
route "mount RailsPageComment::Engine => '/rails_page_comment'"
|
26
|
-
end
|
27
|
-
|
28
|
-
# def create_models
|
29
|
-
# [:page_comment].each do |filename|
|
30
|
-
# template "#{generator_dir}/rails_page_comment/#{filename}.rb",
|
31
|
-
# File.join('app/models', rails_page_comment_dir, "#{filename}.rb")
|
32
|
-
# end
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
def create_migrations
|
36
|
-
migration_template "#{generator_dir}/migration.rb", File.join('db/migrate', "create_rails_page_comment_page_comments.rb")
|
37
|
-
end
|
38
|
-
|
39
|
-
protected
|
40
|
-
|
41
|
-
def rails_page_comment_dir
|
42
|
-
'rails_page_comment'
|
43
|
-
end
|
44
|
-
|
45
|
-
def generator_dir
|
46
|
-
@generator_dir ||= 'active_record'
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
module RailsPageComment
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
|
9
|
+
desc "Generates migration for Page Comment (RailsPageComment) models"
|
10
|
+
|
11
|
+
def self.source_root
|
12
|
+
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.next_migration_number(dirname)
|
16
|
+
Time.now.strftime("%Y%m%d%H%M%S")
|
17
|
+
end
|
18
|
+
|
19
|
+
# copy configuration
|
20
|
+
def copy_initializer
|
21
|
+
template "rails_page_comment.rb", "config/initializers/rails_page_comment.rb"
|
22
|
+
end
|
23
|
+
|
24
|
+
def mount_engine
|
25
|
+
route "mount RailsPageComment::Engine => '/rails_page_comment'"
|
26
|
+
end
|
27
|
+
|
28
|
+
# def create_models
|
29
|
+
# [:page_comment].each do |filename|
|
30
|
+
# template "#{generator_dir}/rails_page_comment/#{filename}.rb",
|
31
|
+
# File.join('app/models', rails_page_comment_dir, "#{filename}.rb")
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
def create_migrations
|
36
|
+
migration_template "#{generator_dir}/migration.rb", File.join('db/migrate', "create_rails_page_comment_page_comments.rb")
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def rails_page_comment_dir
|
42
|
+
'rails_page_comment'
|
43
|
+
end
|
44
|
+
|
45
|
+
def generator_dir
|
46
|
+
@generator_dir ||= 'active_record'
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
module RailsPageComment
|
5
|
+
module Generators
|
6
|
+
class MailerViewsGenerator < Rails::Generators::Base
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
|
9
|
+
desc "Generates migration for Page Comment (RailsPageComment) mailer views"
|
10
|
+
|
11
|
+
def self.source_root
|
12
|
+
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.next_migration_number(dirname)
|
16
|
+
Time.now.strftime("%Y%m%d%H%M%S")
|
17
|
+
end
|
18
|
+
|
19
|
+
# copy configuration
|
20
|
+
def copy_views
|
21
|
+
template "mailer/notice_changes.html.erb", "app/views/#{rails_page_comment_dir}/notify_changes/notice_changes.html.erb"
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def rails_page_comment_dir
|
27
|
+
'rails_page_comment'
|
28
|
+
end
|
29
|
+
|
30
|
+
def generator_dir
|
31
|
+
@generator_dir ||= 'active_record'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/generators/rails_page_comment/templates/active_record/rails_page_comment/page_comment.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
class RailsPageComment::PageComment < ActiveRecord::Base
|
2
|
-
|
3
|
-
end
|
1
|
+
class RailsPageComment::PageComment < ActiveRecord::Base
|
2
|
+
|
3
|
+
end
|
@@ -1,7 +1,20 @@
|
|
1
|
-
# Use this hook to configure RailsPageComment
|
2
|
-
RailsPageComment.setup do |config|
|
3
|
-
|
4
|
-
|
5
|
-
config.show_on_page = true
|
6
|
-
|
7
|
-
|
1
|
+
# Use this hook to configure RailsPageComment
|
2
|
+
RailsPageComment.setup do |config|
|
3
|
+
|
4
|
+
# show comment on page or not
|
5
|
+
config.show_on_page = true
|
6
|
+
|
7
|
+
config.notify_changes_class_name = "RailsPageComment::NotifyChanges"
|
8
|
+
|
9
|
+
# After Changed send email's recipients
|
10
|
+
config.recipient_email = ["to@example.com"]
|
11
|
+
|
12
|
+
# After Changed send email from
|
13
|
+
config.email_from = ["from@example.com"]
|
14
|
+
|
15
|
+
# text_area size cols, default: 90
|
16
|
+
# config.text_area_cols = 90
|
17
|
+
# config.text_area_rows = 20
|
18
|
+
|
19
|
+
|
20
|
+
end
|
data/lib/rails_page_comment.rb
CHANGED
@@ -1,20 +1,38 @@
|
|
1
|
-
require "rails_page_comment/version"
|
2
|
-
require 'rails_page_comment/engine'
|
3
|
-
require 'rails_page_comment/controller_resource'
|
4
|
-
require 'rails_page_comment/controller_additions'
|
5
|
-
|
6
|
-
module RailsPageComment
|
7
|
-
# Your code goes here...
|
8
|
-
mattr_accessor :show_on_page
|
9
|
-
@@show_on_page = true
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
require "rails_page_comment/version"
|
2
|
+
require 'rails_page_comment/engine'
|
3
|
+
require 'rails_page_comment/controller_resource'
|
4
|
+
require 'rails_page_comment/controller_additions'
|
5
|
+
|
6
|
+
module RailsPageComment
|
7
|
+
# Your code goes here...
|
8
|
+
mattr_accessor :show_on_page
|
9
|
+
@@show_on_page = true
|
10
|
+
|
11
|
+
mattr_accessor :notify_changes_class_name
|
12
|
+
@@notify_changes_class_name = "RailsPageComment::NotifyChanges"
|
13
|
+
|
14
|
+
mattr_accessor :notify_changes_method_name
|
15
|
+
@@notify_changes_method_name = [:notice_changes]
|
16
|
+
|
17
|
+
mattr_accessor :recipient_email
|
18
|
+
@@recipient_email = []
|
19
|
+
|
20
|
+
mattr_accessor :email_from
|
21
|
+
@@recipient_email = ""
|
22
|
+
|
23
|
+
mattr_accessor :text_area_cols
|
24
|
+
@@text_area_cols = 90
|
25
|
+
|
26
|
+
mattr_accessor :text_area_rows
|
27
|
+
@@text_area_rows = 20
|
28
|
+
|
29
|
+
module Helpers
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def self.setup
|
35
|
+
yield self
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|