Skip to content

Commit

Permalink
剥离记事本成为独立插件 homeland-note
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Mar 21, 2017
2 parents 6443c5d + 29f9474 commit 67ac147
Show file tree
Hide file tree
Showing 47 changed files with 16 additions and 583 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -122,6 +122,7 @@ gem 'bundler-audit', require: false
gem 'homeland-press'
gem 'homeland-jobs'
gem 'homeland-wiki'
gem 'homeland-note'

gem 'sdoc', '1.0.0.rc1'

Expand Down
5 changes: 4 additions & 1 deletion Gemfile.lock
Expand Up @@ -164,9 +164,11 @@ GEM
hiredis (0.6.1)
homeland-jobs (0.1.1)
rails (~> 5)
homeland-note (0.1.2)
rails (~> 5)
homeland-press (0.3.3)
rails (~> 5)
homeland-wiki (0.2.2)
homeland-wiki (0.3.0)
rails (~> 5)
html-pipeline (2.5.0)
activesupport (>= 2)
Expand Down Expand Up @@ -449,6 +451,7 @@ DEPENDENCIES
font-awesome-rails
hiredis
homeland-jobs
homeland-note
homeland-press
homeland-wiki
html-pipeline
Expand Down
2 changes: 1 addition & 1 deletion PLUGIN_DEV.md
Expand Up @@ -29,7 +29,7 @@ module Homeland

initializer 'homeland.foo.init' do |app|
# 确定应用 config.modules 启用了 foo,才开启
return unless Setting.has_module?(:foo)
next unless Setting.has_module?(:foo)
# 注册 Homeland Plugin
Homeland.register_plugin do |plugin|
# 插件名称,应用 Ruby 的变量命名风格,例如 foo_bar
Expand Down
10 changes: 1 addition & 9 deletions app/assets/javascripts/app.coffee
Expand Up @@ -21,7 +21,6 @@
#= require action_cable
#= require form_storage
#= require topics
#= require notes
#= require editor
#= require toc
#= require turbolinks
Expand Down Expand Up @@ -57,14 +56,7 @@ AppView = Backbone.View.extend
if $('body').data('controller-name') in ['topics', 'replies']
window._topicView = new TopicView({parentView: @})

if $('body').data('controller-name') in ['pages']
window._pageView = new PageView({parentView: @})

if $('body').data('controller-name') in ['notes']
window._noteView = new NoteView({parentView: @})

if $('body').data('controller-name') in ['topics', 'pages']
window._tocView = new TOCView({parentView: @})
window._tocView = new TOCView({parentView: @})

initComponents: () ->
$("abbr.timeago").timeago()
Expand Down
28 changes: 0 additions & 28 deletions app/assets/javascripts/notes.coffee

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/stylesheets/front.scss
Expand Up @@ -5,7 +5,6 @@
*= require notifications
*= require home
*= require users
*= require notes
*= require teams
*= require search
*= require toc
Expand Down
22 changes: 0 additions & 22 deletions app/assets/stylesheets/notes.scss

This file was deleted.

65 changes: 0 additions & 65 deletions app/controllers/notes_controller.rb

This file was deleted.

7 changes: 1 addition & 6 deletions app/controllers/users/user_actions.rb
Expand Up @@ -4,7 +4,7 @@ module UserActions

included do
before_action :authenticate_user!, only: [:block, :unblock, :blocked, :follow, :unfollow]
before_action :only_user!, only: [:topics, :replies, :favorites, :notes,
before_action :only_user!, only: [:topics, :replies, :favorites,
:block, :unblock, :follow, :unfollow,
:followers, :following, :calendar, :reward]
end
Expand All @@ -24,11 +24,6 @@ def favorites
@topics = @topics.page(params[:page])
end

def notes
@notes = @user.notes.published.recent
@notes = @notes.page(params[:page])
end

def block
current_user.block_user(@user.id)
render json: { code: 0 }
Expand Down
12 changes: 0 additions & 12 deletions app/helpers/notes_helper.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/helpers/topics_helper.rb
Expand Up @@ -52,4 +52,8 @@ def topic_close_tag(topic)
return '' unless topic.closed?
content_tag(:i, '', title: '问题已解决/话题已结束讨论', class: 'fa fa-check', data: { toggle: 'tooltip' })
end

def render_node_name(name, id)
link_to(name, node_topics_path(id), class: 'node')
end
end
9 changes: 0 additions & 9 deletions app/models/ability.rb
Expand Up @@ -22,7 +22,6 @@ def initialize(u)
def roles_for_members
roles_for_topics
roles_for_replies
roles_for_notes
roles_for_comments
roles_for_photos
roles_for_sites
Expand Down Expand Up @@ -62,12 +61,6 @@ def current_lock_reply?
Time.zone.now.hour > 22 || Time.zone.now.hour < 9
end

def roles_for_notes
can :create, Note
can [:update, :destroy, :read], Note, user_id: user.id
can :read, Note, publish: true
end

def roles_for_photos
can :tiny_new, Photo
can :create, Photo
Expand Down Expand Up @@ -105,11 +98,9 @@ def roles_for_team_users
def basic_read_only
can [:read, :feed, :node], Topic
can [:read, :reply_to], Reply
can :preview, Note
can :read, Photo
can :read, Site
can :read, Section
can :read, Node
can :read, Comment
can :read, Team
end
Expand Down
31 changes: 0 additions & 31 deletions app/models/note.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/models/user.rb
Expand Up @@ -24,7 +24,6 @@ class User < ApplicationRecord
mount_uploader :avatar, AvatarUploader

has_many :topics, dependent: :destroy
has_many :notes
has_many :replies, dependent: :destroy
has_many :authorizations, dependent: :destroy
has_many :notifications, dependent: :destroy
Expand Down
12 changes: 0 additions & 12 deletions app/views/admin/home/index.html.erb
Expand Up @@ -71,18 +71,6 @@
</div>
</div>

<div class="col-sm-3" id="note-stat">
<div class="stat">
<div class="total">0</div>
<div class="name">
记事本总数
<span class="total-week" rel="twipsy" title="本周新增">+0</span>
<span class="total-month" rel="twipsy" title="本月新增">+0</span>
</div>
</div>
</div>



<div class="col-sm-3" id="photo-stat">
<div class="stat">
Expand Down
3 changes: 1 addition & 2 deletions app/views/devise/menu/_registration_items.html.erb
@@ -1,10 +1,9 @@
<% if user_signed_in? %>
你好 <strong><a href="<%= user_path(current_user.login)%>"><%= current_user.login %></a></strong>,
<% if not params[:controller].match(/admin/) %>
<a href="<%= notes_path %>">记事本</a> |
<%= link_to('设置', setting_path) %> |
<% if admin? current_user %><a href="/admin">后台</a> | <% end %>
<% end %>
<% else %>
<%= link_to('加入社区', new_user_registration_path) %>
<%= link_to('加入社区', new_user_registration_path) %>
<% end %>
31 changes: 0 additions & 31 deletions app/views/notes/_form.html.erb

This file was deleted.

21 changes: 0 additions & 21 deletions app/views/notes/_sidebar.html.erb

This file was deleted.

0 comments on commit 67ac147

Please sign in to comment.