homeland-note 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +22 -0
- data/Rakefile +36 -0
- data/app/assets/config/homeland_note_manifest.js +2 -0
- data/app/assets/javascripts/homeland/note/application.coffee +31 -0
- data/app/assets/stylesheets/homeland/note/application.scss +22 -0
- data/app/controllers/homeland/note/application_controller.rb +18 -0
- data/app/controllers/homeland/note/notes_controller.rb +71 -0
- data/app/helpers/homeland/note/application_helper.rb +14 -0
- data/app/jobs/homeland/note/application_job.rb +6 -0
- data/app/mailers/homeland/note/application_mailer.rb +8 -0
- data/app/models/homeland/note/ability.rb +39 -0
- data/app/models/note.rb +30 -0
- data/app/views/homeland/note/notes/_form.html.erb +30 -0
- data/app/views/homeland/note/notes/_sidebar.html.erb +24 -0
- data/app/views/homeland/note/notes/edit.html.erb +13 -0
- data/app/views/homeland/note/notes/index.html.erb +44 -0
- data/app/views/homeland/note/notes/new.html.erb +13 -0
- data/app/views/homeland/note/notes/show.html.erb +39 -0
- data/app/views/layouts/homeland/note/application.html.erb +15 -0
- data/config/locales/homeland.note.zh-CN.yml +10 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20170321074447_create_notes.rb +22 -0
- data/lib/homeland/note.rb +7 -0
- data/lib/homeland/note/engine.rb +22 -0
- data/lib/homeland/note/version.rb +7 -0
- data/lib/tasks/homeland/note_tasks.rake +4 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e7aec363524f40c012edc4ce703e7f02791e3be
|
4
|
+
data.tar.gz: 7177ab93249a6f46607d8a13a2c08de259ee7508
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9224c323806ff02f012a6722bd7bf5db65d75671a8b9a0cd22a0534447af0a62a7abefbfbf89384d152600f56102831bd1abf3017890b6e189cf6ad45a0a2f8a
|
7
|
+
data.tar.gz: d235280b5941c7e3df1d027c91d24d9c9d5d7383140825e82e969b287dcb6512ff33c09f855eb038578c2430ca89dd09cf91254d377ca3e4dba8ec7952f9ce51
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Jason Lee
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Homeland::Note Plugin
|
2
|
+
---------------------
|
3
|
+
|
4
|
+
记事本插件。
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your Homeland's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'homeland-note'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
$ bundle
|
18
|
+
```
|
19
|
+
|
20
|
+
## License
|
21
|
+
|
22
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
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 = 'Homeland::Note'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
@@ -0,0 +1,31 @@
|
|
1
|
+
window.NoteView = Backbone.View.extend
|
2
|
+
el: "body"
|
3
|
+
events:
|
4
|
+
"click .editor-toolbar .edit a": "toggleEditView"
|
5
|
+
"click .editor-toolbar .preview a": "togglePreviewView"
|
6
|
+
|
7
|
+
initialize: (opts) ->
|
8
|
+
$("<div id='preview' class='markdown form-control' style='display:none;'></div>").insertAfter( $('#note_body') )
|
9
|
+
window._editor = new Editor()
|
10
|
+
|
11
|
+
toggleEditView: (e) ->
|
12
|
+
$(e.target).parent().addClass('active')
|
13
|
+
$('.preview a').parent().removeClass('active')
|
14
|
+
$('#preview').hide()
|
15
|
+
$('#note_body').show()
|
16
|
+
false
|
17
|
+
|
18
|
+
togglePreviewView: (e) ->
|
19
|
+
$(e.target).parent().addClass('active')
|
20
|
+
$('.edit a').parent().removeClass('active')
|
21
|
+
$('#preview').html('Loading...')
|
22
|
+
$('#note_body').hide()
|
23
|
+
$('#preview').show()
|
24
|
+
$.post '/notes/preview', {body: $('#note_body').val()}, (data)->
|
25
|
+
$('#preview').html(data)
|
26
|
+
false
|
27
|
+
false
|
28
|
+
|
29
|
+
document.addEventListener 'turbolinks:load', ->
|
30
|
+
if $('body').data('controller-name') in ['notes']
|
31
|
+
window._noteView = new NoteView()
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#notes {
|
2
|
+
.info { color: #666; }
|
3
|
+
.media {
|
4
|
+
&:last-child {
|
5
|
+
padding-bottom: 0px;
|
6
|
+
border-bottom: 0px;
|
7
|
+
}
|
8
|
+
border-bottom: 1px solid #f0f0f0;
|
9
|
+
padding-bottom: 10px;
|
10
|
+
|
11
|
+
.media-heading {
|
12
|
+
a { font-size: 15px; }
|
13
|
+
}
|
14
|
+
.info { color: #AAA; font-size: 12px; }
|
15
|
+
}
|
16
|
+
|
17
|
+
.markdown {
|
18
|
+
min-height: 493px;
|
19
|
+
|
20
|
+
h2:first-child { text-align: center; }
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Homeland::Note
|
2
|
+
class ApplicationController < ::ApplicationController
|
3
|
+
protect_from_forgery with: :exception
|
4
|
+
layout "homeland/note/application"
|
5
|
+
|
6
|
+
helper Homeland::Note::ApplicationHelper
|
7
|
+
|
8
|
+
helper_method :current_user_notes
|
9
|
+
|
10
|
+
def current_ability
|
11
|
+
@current_ability ||= Homeland::Note::Ability.new(current_user)
|
12
|
+
end
|
13
|
+
|
14
|
+
def current_user_notes
|
15
|
+
@current_user_notes ||= ::Note.where(user_id: current_user.id)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Homeland::Note
|
2
|
+
class NotesController < Homeland::Note::ApplicationController
|
3
|
+
before_action :authenticate_user!
|
4
|
+
before_action :set_recent_notes, only: [:index, :show, :edit, :new, :create, :update]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@notes = current_user_notes.recent_updated.page(params[:page])
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
@note = ::Note.find(params[:id])
|
12
|
+
authorize! :read, @note
|
13
|
+
@note.hits.incr(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
authorize! :create, Note
|
18
|
+
@note = current_user_notes.build
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
@note = current_user_notes.find(params[:id])
|
23
|
+
authorize! :update, @note
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
authorize! :create, Note
|
28
|
+
@note = Note.new(note_params)
|
29
|
+
@note.user_id = current_user.id
|
30
|
+
@note.publish = note_params[:publish] == '1'
|
31
|
+
if @note.save
|
32
|
+
redirect_to(@note, notice: "创建成功。")
|
33
|
+
else
|
34
|
+
render action: 'new'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def update
|
39
|
+
@note = current_user_notes.find(params[:id])
|
40
|
+
authorize! :update, @note
|
41
|
+
if @note.update(note_params)
|
42
|
+
redirect_to(@note, notice: "更新成功。")
|
43
|
+
else
|
44
|
+
render action: 'edit'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def preview
|
49
|
+
out = Homeland::Markdown.call(params[:body])
|
50
|
+
render plain: out
|
51
|
+
end
|
52
|
+
|
53
|
+
def destroy
|
54
|
+
@note = current_user_notes.find(params[:id])
|
55
|
+
authorize! :destroy, @note
|
56
|
+
@note.destroy
|
57
|
+
|
58
|
+
redirect_to(notes_url)
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def set_recent_notes
|
64
|
+
@recent_notes = current_user_notes.recent.limit(10)
|
65
|
+
end
|
66
|
+
|
67
|
+
def note_params
|
68
|
+
params.require(:note).permit(:title, :body, :publish)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Homeland::Note
|
2
|
+
module ApplicationHelper
|
3
|
+
def render_node_name(name, id)
|
4
|
+
link_to(name, main_app.node_topics_path(id), class: 'node')
|
5
|
+
end
|
6
|
+
|
7
|
+
def note_title_tag(note, opts = {})
|
8
|
+
opts[:limit] ||= 50
|
9
|
+
return '' if note.blank?
|
10
|
+
return '' if note.title.blank?
|
11
|
+
truncate(note.title.delete('#'), length: opts[:limit])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Homeland::Note
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
attr_reader :user
|
6
|
+
|
7
|
+
def initialize(u)
|
8
|
+
@user = u
|
9
|
+
if @user.blank?
|
10
|
+
roles_for_anonymous
|
11
|
+
elsif @user.roles?(:member)
|
12
|
+
roles_for_members
|
13
|
+
else
|
14
|
+
roles_for_anonymous
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# 普通会员权限
|
21
|
+
def roles_for_members
|
22
|
+
can :create, Note
|
23
|
+
can [:update, :destroy, :read], Note, user_id: user.id
|
24
|
+
can :read, Note, publish: true
|
25
|
+
basic_read_only
|
26
|
+
end
|
27
|
+
|
28
|
+
# 未登录用户权限
|
29
|
+
def roles_for_anonymous
|
30
|
+
cannot :manage, Note
|
31
|
+
basic_read_only
|
32
|
+
end
|
33
|
+
|
34
|
+
def basic_read_only
|
35
|
+
can :preview, Note
|
36
|
+
can :read, Node
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/app/models/note.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
class Note < ApplicationRecord
|
2
|
+
second_level_cache
|
3
|
+
|
4
|
+
belongs_to :user
|
5
|
+
|
6
|
+
counter :hits, default: 0
|
7
|
+
|
8
|
+
scope :recent_updated, -> { order(updated_at: :desc) }
|
9
|
+
scope :published, -> { where(publish: true) }
|
10
|
+
|
11
|
+
validates :body, presence: true
|
12
|
+
|
13
|
+
before_save :auto_set_value
|
14
|
+
def auto_set_value
|
15
|
+
unless body.blank?
|
16
|
+
self.title = body.split("\n").first[0..50]
|
17
|
+
self.word_count = body.length
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
before_update :update_changes_count
|
22
|
+
def update_changes_count
|
23
|
+
self.changes_count = 0 if changes_count.blank?
|
24
|
+
increment(:changes_count)
|
25
|
+
end
|
26
|
+
|
27
|
+
def display_title
|
28
|
+
(title || '').gsub(/^[\#]+/, '')
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= simple_form_for(@note, html: { class: "" }) do |f| %>
|
2
|
+
<%= render "shared/error_messages", target: @note %>
|
3
|
+
|
4
|
+
<div class="edit-tools">
|
5
|
+
<%= render "/shared/editor_toolbar" %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="form-group">
|
9
|
+
<%= f.text_area :body, rows: 20, class: 'form-control topic-editor' %>
|
10
|
+
|
11
|
+
<p class="help-block">
|
12
|
+
请用 <a href="/markdown" target="_blank">Markdown</a> 格式编写。
|
13
|
+
</p>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="form-group">
|
17
|
+
<label class="control-label" for="note_publish"><%= f.check_box :publish %> 公开 <span class="text-danger"><i class="fa fa-warning"></i> 除非你选择公开,否则此 Note 的所有内容将是保密的!<span></label>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="form-actions">
|
21
|
+
<div class="row">
|
22
|
+
<div class="col-sm-3">
|
23
|
+
<%= f.submit "保存", class: "btn btn-primary btn-lg btn-block", 'data-disable-with' => "保存中..." %>
|
24
|
+
</div>
|
25
|
+
<div class="col-sm-2">
|
26
|
+
<%= link_to "取消", notes_path, class: "btn btn-default btn-lg btn-block" %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="sidebar col-md-3">
|
2
|
+
<div class="panel panel-default">
|
3
|
+
<div class="panel-body">
|
4
|
+
<p><a href="<%= new_note_path %>" class="btn btn-success btn-block">新建 Note</a></p>
|
5
|
+
<div>
|
6
|
+
记事本用于保存个人私密的记事信息,除非你选择公开,否则其他人无法访问。
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div class="panel-footer"><a href="<%= notes_path %>">查看我的 <%= current_user_notes.count %> 条 Note...</a></div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<% if @recent_notes.present? %>
|
13
|
+
<div class="panel panel-default">
|
14
|
+
<div class="panel-heading">我最近创建的 Note</div>
|
15
|
+
<ul class="list-group">
|
16
|
+
<% @recent_notes.each do |note| %>
|
17
|
+
<li class="list-group-item">
|
18
|
+
<%= link_to note.display_title, note %>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<% title_tag t('plugin.note') %>
|
2
|
+
<div class="row">
|
3
|
+
<div class="col-md-9">
|
4
|
+
<div id="notes" class="panel panel-default">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<%= t('plugin.note') %>
|
7
|
+
<span class="total pull-right">
|
8
|
+
已有 <%= current_user_notes.count %> 条 Note
|
9
|
+
</span>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="panel-body">
|
13
|
+
<% if @notes.blank? %>
|
14
|
+
<div style="text-align:center; padding:60px 0;">你还没有创建过一个文件。</div>
|
15
|
+
<% else %>
|
16
|
+
<% @notes.each do |note| %>
|
17
|
+
<div class="media">
|
18
|
+
<div class="media-body">
|
19
|
+
<div class="media-heading">
|
20
|
+
<%= link_to note.display_title, note %>
|
21
|
+
<% if note.publish %>
|
22
|
+
<span class="label warning"><i class="fa fa-share-alt"></i> 公开</span>
|
23
|
+
<% end %>
|
24
|
+
<span class="opts pull-right">
|
25
|
+
<a href="<%= edit_note_path(note.id) %>"><i class="fa fa-pencil"></i></a>
|
26
|
+
</span>
|
27
|
+
</div>
|
28
|
+
<div class="info">
|
29
|
+
<%= note.word_count %> 个字符, 创建于 <%= timeago(note.created_at) %>, <%= note.changes_count %> 次编辑
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="panel-footer clearfix">
|
38
|
+
<%= paginate @notes %>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<%= render "sidebar" %>
|
44
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% title_tag [@note.title, t('plugin.note')].join(' · ') %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-sm-9">
|
5
|
+
<div id="notes" class="panel panel-default">
|
6
|
+
<div class="panel-heading clearfix">
|
7
|
+
<div class="info">
|
8
|
+
共 <%= @note.word_count %> 个字符
|
9
|
+
• <%= user_name_tag(@note.user) if !owner? @note %>
|
10
|
+
<%= l @note.created_at, format: :long %>
|
11
|
+
• <%= @note.hits %> 次阅读
|
12
|
+
• <%= @note.changes_count %> 次修改
|
13
|
+
<% if owner? @note %>
|
14
|
+
<span class="opts pull-right">
|
15
|
+
<%= link_to icon_tag("pencil"), edit_note_path(@note), title: "编辑" %>
|
16
|
+
<%= link_to icon_tag("trash"), note_path(@note), 'data-confirm' => "确定要删除么?", method: :delete %>
|
17
|
+
</span>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<% if @note.publish %>
|
21
|
+
<div class="links">
|
22
|
+
<label>页面链接</label>
|
23
|
+
<%= note_url(@note) %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<div class="panel-body">
|
28
|
+
<% if !@note.publish %>
|
29
|
+
<i class="fa fa-lock text-success pull-right" title="此内容保密"></i>
|
30
|
+
<% end %>
|
31
|
+
<div class="markdown">
|
32
|
+
<%= markdown(@note.body) %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<%= render "sidebar" %>
|
39
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% content_for :stylesheets do %>
|
2
|
+
<%= stylesheet_link_tag "homeland/note/application", media: "all" %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :javascripts do %>
|
6
|
+
<%= javascript_include_tag "homeland/note/application" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% content_for :main do %>
|
10
|
+
<div id="homeland-note">
|
11
|
+
<%= yield %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render template: "/layouts/application" %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateNotes < ActiveRecord::Migration[5.0]
|
2
|
+
def up
|
3
|
+
return if ActiveRecord::Base.connection.table_exists? :notes
|
4
|
+
|
5
|
+
create_table 'notes' do |t|
|
6
|
+
t.string 'title', null: false
|
7
|
+
t.text 'body', null: false
|
8
|
+
t.integer 'user_id', null: false
|
9
|
+
t.integer 'word_count', default: 0, null: false
|
10
|
+
t.integer 'changes_count', default: 0, null: false
|
11
|
+
t.boolean 'publish', default: false
|
12
|
+
t.datetime 'created_at'
|
13
|
+
t.datetime 'updated_at'
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index 'notes', ['user_id'], name: 'index_notes_on_user_id', using: :btree
|
17
|
+
end
|
18
|
+
|
19
|
+
def down
|
20
|
+
drop_table :notes, if_exists: true
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Homeland::Note
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace Homeland::Note
|
4
|
+
|
5
|
+
initializer 'homeland.note.init' do |app|
|
6
|
+
next unless Setting.has_module?(:note)
|
7
|
+
Homeland.register_plugin do |plugin|
|
8
|
+
plugin.name = Homeland::Note::NAME
|
9
|
+
plugin.display_name = '记事本'
|
10
|
+
plugin.version = Homeland::Note::VERSION
|
11
|
+
plugin.description = Homeland::Note::DESCRIPTION
|
12
|
+
plugin.user_menu_link = true
|
13
|
+
plugin.root_path = "/notes"
|
14
|
+
end
|
15
|
+
|
16
|
+
app.routes.prepend do
|
17
|
+
mount Homeland::Note::Engine => '/'
|
18
|
+
end
|
19
|
+
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: homeland-note
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Lee
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-21 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: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
27
|
+
description: Note plugin for Homeland.
|
28
|
+
email:
|
29
|
+
- huacnlee@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/homeland_note_manifest.js
|
38
|
+
- app/assets/javascripts/homeland/note/application.coffee
|
39
|
+
- app/assets/stylesheets/homeland/note/application.scss
|
40
|
+
- app/controllers/homeland/note/application_controller.rb
|
41
|
+
- app/controllers/homeland/note/notes_controller.rb
|
42
|
+
- app/helpers/homeland/note/application_helper.rb
|
43
|
+
- app/jobs/homeland/note/application_job.rb
|
44
|
+
- app/mailers/homeland/note/application_mailer.rb
|
45
|
+
- app/models/homeland/note/ability.rb
|
46
|
+
- app/models/note.rb
|
47
|
+
- app/views/homeland/note/notes/_form.html.erb
|
48
|
+
- app/views/homeland/note/notes/_sidebar.html.erb
|
49
|
+
- app/views/homeland/note/notes/edit.html.erb
|
50
|
+
- app/views/homeland/note/notes/index.html.erb
|
51
|
+
- app/views/homeland/note/notes/new.html.erb
|
52
|
+
- app/views/homeland/note/notes/show.html.erb
|
53
|
+
- app/views/layouts/homeland/note/application.html.erb
|
54
|
+
- config/locales/homeland.note.zh-CN.yml
|
55
|
+
- config/routes.rb
|
56
|
+
- db/migrate/20170321074447_create_notes.rb
|
57
|
+
- lib/homeland/note.rb
|
58
|
+
- lib/homeland/note/engine.rb
|
59
|
+
- lib/homeland/note/version.rb
|
60
|
+
- lib/tasks/homeland/note_tasks.rake
|
61
|
+
homepage: https://github.com/ruby-china/homeland-note
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.6.11
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Note plugin for Homeland
|
85
|
+
test_files: []
|