homeland-pm 1.0.0.beta1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b27890a73d7806a658c70c28d1b18ce51ed74f77
4
+ data.tar.gz: 890f606313306ca7d335d627dfa9696f8f3f4dd4
5
+ SHA512:
6
+ metadata.gz: abe1a836938e242759f3a10924ae7c5ce1a71fe433397b1681e5e4e2bad188c32ed4f780db04ba8f362e10c832fadd2a8f6f718c9e5f8e5e55be85044819d00d
7
+ data.tar.gz: 2260f0bdbd36c6dda6affb6d4773ca34c64d653862327c920b7af0f0acdd631b1fdfadbf33acda3246848438ffb41ac207f50216a428e87889714d1f37c3e2a9
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at pmq2001@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in homeland-pm.gemspec
4
+ gemspec
@@ -0,0 +1,151 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ homeland-pm (1.0.0.beta1)
5
+ homeland (~> 1.0.0.beta3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.6)
11
+ actionpack (= 4.2.6)
12
+ actionview (= 4.2.6)
13
+ activejob (= 4.2.6)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.6)
17
+ actionview (= 4.2.6)
18
+ activesupport (= 4.2.6)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ actionview (4.2.6)
24
+ activesupport (= 4.2.6)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ activejob (4.2.6)
30
+ activesupport (= 4.2.6)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.6)
33
+ activesupport (= 4.2.6)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.6)
36
+ activemodel (= 4.2.6)
37
+ activesupport (= 4.2.6)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.6)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ arel (6.0.3)
46
+ builder (3.2.2)
47
+ coderay (1.1.1)
48
+ concurrent-ruby (1.0.1)
49
+ diff-lcs (1.2.5)
50
+ erubis (2.7.0)
51
+ font-awesome-rails (4.5.0.1)
52
+ railties (>= 3.2, < 5.1)
53
+ globalid (0.3.6)
54
+ activesupport (>= 4.1.0)
55
+ homeland (1.0.0)
56
+ activerecord (>= 4.2.0, <= 5.1.0)
57
+ font-awesome-rails (>= 4.4.0.0)
58
+ jquery-rails (>= 4.0.0, <= 5.1.0)
59
+ rails (>= 4.2.0, <= 5.1.0)
60
+ redcarpet (>= 3.3.0)
61
+ will_paginate (>= 3.0.0)
62
+ i18n (0.7.0)
63
+ jquery-rails (4.1.1)
64
+ rails-dom-testing (>= 1, < 3)
65
+ railties (>= 4.2.0)
66
+ thor (>= 0.14, < 2.0)
67
+ json (1.8.3)
68
+ loofah (2.0.3)
69
+ nokogiri (>= 1.5.9)
70
+ mail (2.6.4)
71
+ mime-types (>= 1.16, < 4)
72
+ method_source (0.8.2)
73
+ mime-types (3.0)
74
+ mime-types-data (~> 3.2015)
75
+ mime-types-data (3.2016.0221)
76
+ mini_portile2 (2.0.0)
77
+ minitest (5.8.4)
78
+ nokogiri (1.6.7.2)
79
+ mini_portile2 (~> 2.0.0.rc2)
80
+ pry (0.10.3)
81
+ coderay (~> 1.1.0)
82
+ method_source (~> 0.8.1)
83
+ slop (~> 3.4)
84
+ rack (1.6.4)
85
+ rack-test (0.6.3)
86
+ rack (>= 1.0)
87
+ rails (4.2.6)
88
+ actionmailer (= 4.2.6)
89
+ actionpack (= 4.2.6)
90
+ actionview (= 4.2.6)
91
+ activejob (= 4.2.6)
92
+ activemodel (= 4.2.6)
93
+ activerecord (= 4.2.6)
94
+ activesupport (= 4.2.6)
95
+ bundler (>= 1.3.0, < 2.0)
96
+ railties (= 4.2.6)
97
+ sprockets-rails
98
+ rails-deprecated_sanitizer (1.0.3)
99
+ activesupport (>= 4.2.0.alpha)
100
+ rails-dom-testing (1.0.7)
101
+ activesupport (>= 4.2.0.beta, < 5.0)
102
+ nokogiri (~> 1.6.0)
103
+ rails-deprecated_sanitizer (>= 1.0.1)
104
+ rails-html-sanitizer (1.0.3)
105
+ loofah (~> 2.0)
106
+ railties (4.2.6)
107
+ actionpack (= 4.2.6)
108
+ activesupport (= 4.2.6)
109
+ rake (>= 0.8.7)
110
+ thor (>= 0.18.1, < 2.0)
111
+ rake (10.5.0)
112
+ redcarpet (3.3.4)
113
+ rspec (3.4.0)
114
+ rspec-core (~> 3.4.0)
115
+ rspec-expectations (~> 3.4.0)
116
+ rspec-mocks (~> 3.4.0)
117
+ rspec-core (3.4.4)
118
+ rspec-support (~> 3.4.0)
119
+ rspec-expectations (3.4.0)
120
+ diff-lcs (>= 1.2.0, < 2.0)
121
+ rspec-support (~> 3.4.0)
122
+ rspec-mocks (3.4.1)
123
+ diff-lcs (>= 1.2.0, < 2.0)
124
+ rspec-support (~> 3.4.0)
125
+ rspec-support (3.4.1)
126
+ slop (3.6.0)
127
+ sprockets (3.5.2)
128
+ concurrent-ruby (~> 1.0)
129
+ rack (> 1, < 3)
130
+ sprockets-rails (3.0.4)
131
+ actionpack (>= 4.0)
132
+ activesupport (>= 4.0)
133
+ sprockets (>= 3.0.0)
134
+ thor (0.19.1)
135
+ thread_safe (0.3.5)
136
+ tzinfo (1.2.2)
137
+ thread_safe (~> 0.1)
138
+ will_paginate (3.1.0)
139
+
140
+ PLATFORMS
141
+ ruby
142
+
143
+ DEPENDENCIES
144
+ bundler (~> 1.11)
145
+ homeland-pm!
146
+ pry (>= 0.10.3)
147
+ rake (~> 10.0)
148
+ rspec (~> 3.0)
149
+
150
+ BUNDLED WITH
151
+ 1.11.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Minqi Pan (P.S.V.R)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Homeland::Pm
2
+
3
+ 本 Gem 为 Homeland 添加短消息(小窗私信)功能 —— 一个基于 Rails Engine 实现的论坛社区 Gem。
4
+
5
+ This gem adds Personal Message service to Homeland -- a new style forum for small communities.
6
+
7
+ > A new style forum for tiny community as Rails Engine. You can mount this in any of you Rails apps.
8
+
9
+ ## Installation
10
+
11
+ Add these lines to your application's Gemfile, if they do not already exist:
12
+
13
+ ```ruby
14
+ gem 'homeland'
15
+ gem 'homeland-pm'
16
+ gem 'font-awesome-sass-rails'
17
+ gem 'github-markup' # 如果你用其他 markup 可以不用依赖 github-markup
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Then execute,
25
+
26
+ $ bundle exec rails generate homeland:pm:install
27
+
28
+ Finally, migrate the database,
29
+
30
+ $ bundle exec rake db:migrate
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pmq20/homeland-pm. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,39 @@
1
+ module Homeland
2
+ class PersonalMessagesController < Homeland::ApplicationController
3
+ def index
4
+ @items = PersonalMessage.recent.includes(:sender).page(params[:page])
5
+
6
+ set_seo_meta(t("homeland.nav.pm"))
7
+ end
8
+
9
+ def new
10
+ @item = PersonalMessage.new
11
+
12
+ set_seo_meta(t("homeland.nav.new"))
13
+ end
14
+
15
+ def show
16
+ @item = PersonalMessage.find_by(id: params[:id], receiver_id: current_user.id)
17
+ @item.update_attribute(:read_at, Time.now)
18
+
19
+ set_seo_meta(t("homeland.nav.pm"))
20
+ end
21
+
22
+ def create
23
+ @item = PersonalMessage.new(personal_message_params)
24
+ @item.sender = current_user
25
+
26
+ if @item.save
27
+ redirect_to(personal_message_path(@item.id), notice: t('homeland.pm_created'))
28
+ else
29
+ render action: "new"
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def personal_message_params
36
+ params.require(:personal_message).permit(:receiver_id, :title, :body)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,21 @@
1
+ module Homeland
2
+ class PersonalMessage < ActiveRecord::Base
3
+ include Homeland::Concerns::SoftDelete
4
+ include Homeland::Concerns::Markup
5
+ include Homeland::Concerns::UserDelegates
6
+
7
+ self.per_page = Homeland.config.per_page
8
+
9
+ belongs_to :sender, class_name: Homeland.config.user_class.to_s
10
+ belongs_to :receiver, class_name: Homeland.config.user_class.to_s
11
+
12
+ validates :sender_id, :receiver_id, :title, :body, presence: true
13
+
14
+ scope :recent, -> { order('id desc') }
15
+ scope :unread, -> { where(read_at: nil) }
16
+
17
+ def read?
18
+ read_at.present?
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,45 @@
1
+ <ol class="breadcrumb">
2
+ <li><a href="<%= homeland.root_path %>"><%= t('homeland.nav.home') %></a></li>
3
+ <li class="active"><%= t('homeland.nav.pm') %></li>
4
+ </ol>
5
+
6
+ <p><a class="btn btn-primary-outline" href="<%= homeland.new_personal_message_path %>"><i class="fa fa-plus"></i> <%= t('homeland.nav.new_pm') %></a></p>
7
+
8
+ <div class="pms">
9
+ <table class="table">
10
+ <thead class="thead-default">
11
+ <tr class="pm">
12
+ <th class="sender"><%= t('activerecord.attributes.homeland/pm.sender')%></th>
13
+ <th class="title"><%= t('activerecord.attributes.homeland/pm.title')%></th>
14
+ <th class="activity"><%= t('activerecord.attributes.homeland/pm.created_at')%></th>
15
+ </tr>
16
+ </thad>
17
+ <tbody>
18
+ <% if @items.blank? %>
19
+ <tr>
20
+ <th>
21
+ <span class="text-mutted">
22
+ <%= t('homeland.pms.empty') %>
23
+ </span>
24
+ </td>
25
+ </tr>
26
+ <% else %>
27
+ <% @items.each do |item| %>
28
+ <tr class="pm">
29
+ <td class="sender">
30
+ <%= item.sender.send(Homeland.config.user_name_method) %>
31
+ </td>
32
+ <td class="title">
33
+ <%= link_to(item.title, homeland.personal_message_path(item)) %>
34
+ </td>
35
+ <td class="activity">
36
+ <%= timeago item.created_at %>
37
+ </td>
38
+ </tr>
39
+ <% end %>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
43
+
44
+ <%= homeland_paginate @items %>
45
+ </div>
@@ -0,0 +1,29 @@
1
+ <ol class="breadcrumb">
2
+ <li><a href="<%= homeland.root_path %>"><%= t('homeland.nav.home') %></a></li>
3
+ <li><a href="<%= homeland.personal_messages_path %>"><%= t('homeland.nav.pm') %></a></li>
4
+ <li class="active"><%= t('homeland.new') %></li>
5
+ </ol>
6
+
7
+
8
+ <%= form_for(@item) do |f| %>
9
+ <%= render_errors @item %>
10
+ <div class="form-group">
11
+ <%= f.label :receiver_id %>
12
+ <%= f.select :receiver_id, Homeland.config.user_class.constantize.all.collect { |n| [n.send(Homeland.config.user_name_method), n.id] }, {}, { class: 'form-control' } %>
13
+ </div>
14
+
15
+ <div class="form-group">
16
+ <%= f.label :title %>
17
+ <%= f.text_field :title, class: "form-control" %>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :body %>
22
+ <%= f.text_area :body, class: "form-control", rows: "10" %>
23
+ </div>
24
+
25
+ <div class="form-group">
26
+ <button type="submit" class="btn btn-primary btn-lg" data-disable-with="<%= t('homeland.submiting') %>"><%= t('homeland.submit') %></button>
27
+ <a href="<%= homeland.personal_messages_path %>" class="btn btn-lg btn-default"><%= t('homeland.cancel') %></a>
28
+ </div>
29
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <ol class="breadcrumb">
2
+ <li><a href="<%= homeland.root_path %>"><%= t('homeland.nav.home') %></a></li>
3
+ <li><a href="<%= homeland.personal_messages_path %>"><%= t('homeland.nav.pm') %></a></li>
4
+ <li class="active"><%= @item.title %></li>
5
+ </ol>
6
+
7
+ <div class="row">
8
+ <div class="pm-detail col-lg-9">
9
+ <h1>
10
+ <%= @item.title %>
11
+ </h1>
12
+
13
+ <p><%= t('activerecord.attributes.homeland/pm.sender') %>:<%= @item.sender.send(Homeland.config.user_name_method) %></p>
14
+ <p><%= t('activerecord.attributes.homeland/pm.created_at') %>:<%= l @item.created_at %></p>
15
+
16
+ <div class="pm-content">
17
+ <%= @item.body %>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "homeland/pm"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ zh-CN:
2
+ homeland:
3
+ pm_created: 短消息发送成功
4
+ nav:
5
+ pm: 短消息
6
+ new_pm: 发送消息
7
+ activerecord:
8
+ attributes:
9
+ homeland/pm:
10
+ sender: 发件人
11
+ receiver: 收件人
12
+ body: 内容
13
+ body_html: 内容
14
+ read_at: 阅读于
15
+ deleted_at: 删除于
16
+ created_at: 发送于
17
+ updated_at: 更新于
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'homeland/pm/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "homeland-pm"
8
+ spec.version = Homeland::Pm::VERSION
9
+ spec.authors = ["P.S.V.R"]
10
+ spec.licenses = ['MIT']
11
+ spec.email = ["pmq2001@gmail.com"]
12
+
13
+ spec.summary = %q{adds Personal Message service to Homeland}
14
+ spec.description = %q{adds Personal Message service to Homeland -- a new style forum for small communities.}
15
+ spec.homepage = "https://github.com/pmq20/homeland-pm"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "pry", '>= 0.10.3'
26
+
27
+ spec.add_dependency 'homeland', "~> 1.0.0.beta3"
28
+ end
@@ -0,0 +1,28 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module Homeland
5
+ module Pm
6
+ module Generators
7
+ class InstallGenerator < ActiveRecord::Generators::Base
8
+ desc "Create Homeland-Pm's base files"
9
+ argument :name, type: :string, default: 'homeland_pm'
10
+ source_root File.expand_path("../templates", __FILE__)
11
+
12
+ def copy_homeland_pm_migration
13
+ migration_template "migration.rb", "db/migrate/homeland_pm_create_pms.rb", migration_version: migration_version
14
+ end
15
+
16
+ def rails5?
17
+ Rails.version.start_with? '5'
18
+ end
19
+
20
+ def migration_version
21
+ if rails5?
22
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ class HomelandPmCreatePms < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ create_table :homeland_personal_messages do |t|
4
+ t.integer :sender_id
5
+ t.integer :receiver_id
6
+ t.string :title
7
+ t.text :body
8
+ t.text :body_html
9
+ t.datetime :read_at
10
+ t.datetime :deleted_at
11
+
12
+ t.timestamps null: false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ require "homeland"
2
+ require "homeland/pm/version"
3
+ require "homeland/pm/engine"
@@ -0,0 +1,18 @@
1
+ require "homeland"
2
+ require "homeland/engine"
3
+
4
+ module Homeland
5
+ module Pm
6
+ class Engine < ::Rails::Engine
7
+ initializer "homeland.pm.i18n.load_path" do |app|
8
+ app.config.i18n.load_path += Dir[File.expand_path('../../../locales/**/*.yml', __FILE__)]
9
+ end
10
+
11
+ initializer "homeland.pm.routes.append", before: :load_config_initializers do |app|
12
+ Homeland::Engine.routes.append do
13
+ resources :personal_messages, path: 'pm'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Homeland
2
+ module Pm
3
+ VERSION = "1.0.0.beta1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: homeland-pm
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - P.S.V.R
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.10.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.10.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: homeland
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.0.beta3
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0.beta3
83
+ description: adds Personal Message service to Homeland -- a new style forum for small
84
+ communities.
85
+ email:
86
+ - pmq2001@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
+ - CODE_OF_CONDUCT.md
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE
97
+ - README.md
98
+ - Rakefile
99
+ - app/controllers/homeland/personal_messages_controller.rb
100
+ - app/models/homeland/personal_message.rb
101
+ - app/views/homeland/personal_messages/index.html.erb
102
+ - app/views/homeland/personal_messages/new.html.erb
103
+ - app/views/homeland/personal_messages/show.html.erb
104
+ - bin/console
105
+ - bin/setup
106
+ - config/locales/homeland.pm.zh-CN.yml
107
+ - homeland-pm.gemspec
108
+ - lib/generators/homeland/pm/install_generator.rb
109
+ - lib/generators/homeland/pm/templates/migration.rb
110
+ - lib/homeland/pm.rb
111
+ - lib/homeland/pm/engine.rb
112
+ - lib/homeland/pm/version.rb
113
+ homepage: https://github.com/pmq20/homeland-pm
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">"
129
+ - !ruby/object:Gem::Version
130
+ version: 1.3.1
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.5.1
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: adds Personal Message service to Homeland
137
+ test_files: []