ecm_blog 0.0.1
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.rdoc +3 -0
- data/Rakefile +17 -0
- data/app/assets/javascripts/ecm/blog/application.js +13 -0
- data/app/assets/stylesheets/ecm/blog/application.css +14 -0
- data/app/controllers/ecm/blog/application_controller.rb +6 -0
- data/app/controllers/ecm/blog/posts_controller.rb +30 -0
- data/app/helpers/ecm/blog/application_helper.rb +6 -0
- data/app/models/ecm/blog/post.rb +37 -0
- data/app/views/ecm/blog/posts/_post.haml +8 -0
- data/app/views/ecm/blog/posts/_post_in_index.haml +12 -0
- data/app/views/ecm/blog/posts/index.haml +6 -0
- data/app/views/ecm/blog/posts/show.haml +3 -0
- data/app/views/layouts/ecm/blog/application.html.erb +14 -0
- data/config/locales/de.yml +10 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20160214133500_create_ecm_blog_posts.rb +13 -0
- data/lib/ecm/blog/configuration.rb +16 -0
- data/lib/ecm/blog/engine.rb +7 -0
- data/lib/ecm/blog/version.rb +5 -0
- data/lib/ecm/blog.rb +7 -0
- data/lib/ecm_blog.rb +6 -0
- data/lib/generators/ecm/blog/install/install_generator.rb +21 -0
- data/lib/generators/ecm/blog/install/templates/initializer.rb +9 -0
- data/lib/generators/ecm/blog/install/templates/routes.source +3 -0
- data/lib/tasks/ecm/blog_tasks.rake +4 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0fedf503cacfb14e451b8ab0265fd542add95e46
|
4
|
+
data.tar.gz: 9009fa4b5106ec11776a7a21eaf3c6dc5cb41d9a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9cea6c72c865dcf04f4b68583f6d469519a572d8a8a8eb8fb20d16ae3440f012a555fe85185524a3f0408d98f8b3ae739036584a838b3d499ef931ab8a7718a0
|
7
|
+
data.tar.gz: 413aaf7322fe7b9d2ba216de7c8c6612ff90e0a57a88431bd98a9560a2acd5dcc9039db90f9906764e80f00832cc185bd01421376d034ba448020c0f66e5fdd1
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Roberto Vasquez Angel
|
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.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
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 = 'Ecm::Blog'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. It is generally better to create a new file per style scope.
|
11
|
+
*
|
12
|
+
*= require_tree .
|
13
|
+
*= require_self
|
14
|
+
*/
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ecm
|
2
|
+
module Blog
|
3
|
+
class PostsController < Ecm::Blog::Configuration.base_controller.constantize
|
4
|
+
include Controller::ResourceConcern
|
5
|
+
include Controller::ResourceUrlsConcern
|
6
|
+
include Controller::ResourceInflectionsConcern
|
7
|
+
include Controller::RestActionsConcern
|
8
|
+
|
9
|
+
helper Ecm::Comments::ApplicationHelper
|
10
|
+
|
11
|
+
def self.resource_class
|
12
|
+
Ecm::Blog::Post
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def collection_scope
|
18
|
+
super.published.order(updated_at: :desc)
|
19
|
+
end
|
20
|
+
|
21
|
+
def load_collection
|
22
|
+
collection_scope.page(params[:page])
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_scope
|
26
|
+
super.published
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ecm::Blog
|
2
|
+
class Post < ActiveRecord::Base
|
3
|
+
has_many :comments, as: :commentable, class_name: 'Ecm::Comments::Comment'
|
4
|
+
|
5
|
+
include Model::Ecm::Tags::TaggableConcern
|
6
|
+
|
7
|
+
# acts as published
|
8
|
+
include ActsAsPublished::ActiveRecord
|
9
|
+
acts_as_published
|
10
|
+
|
11
|
+
belongs_to :creator, class_name: Ecm::Blog.creator_class_name, foreign_key: 'created_by_id'
|
12
|
+
belongs_to :updater, class_name: Ecm::Blog.creator_class_name, foreign_key: 'updated_by_id', optional: true
|
13
|
+
|
14
|
+
def human
|
15
|
+
title
|
16
|
+
end
|
17
|
+
|
18
|
+
module Markdown
|
19
|
+
def body(format: :html)
|
20
|
+
case format
|
21
|
+
when :html
|
22
|
+
to_markdown(read_attribute(:body))
|
23
|
+
else
|
24
|
+
read_attribute(:body)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def to_markdown(string)
|
31
|
+
Kramdown::Document.new(string).to_html
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
include Markdown
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%div{ id: dom_id(post), class: dom_class(post) }
|
2
|
+
%h1.post-title
|
3
|
+
= post.title
|
4
|
+
%small.post-creation-information.pull-right
|
5
|
+
= "#{l(post.created_at)} | #{post.creator.try(:human)}"
|
6
|
+
%p.post-tags= tag_labels_for(post)
|
7
|
+
|
8
|
+
%p.post-body= post.body(format: :html).html_safe
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%div{ id: dom_id(post), class: "#{dom_class(post)} bottom-margin-5" }
|
2
|
+
%h2.post-title
|
3
|
+
= link_to(post.title, ecm_blog.url_for(post))
|
4
|
+
%small.post-creation-information.pull-right
|
5
|
+
= "#{l(post.created_at)} | #{post.creator.try(:human)}"
|
6
|
+
%p
|
7
|
+
%span.post-tags<= tag_labels_for(post)
|
8
|
+
|
|
9
|
+
%span.comments-information
|
10
|
+
= link_to(t('ecm.comments.commentable.comments_information', comments_count: post.comments.count), ecm_blog.post_url(post, anchor: 'comments'))
|
11
|
+
|
12
|
+
%p.post-body= post.body(format: :html).html_safe
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Blog</title>
|
5
|
+
<%= stylesheet_link_tag "ecm/blog/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "ecm/blog/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcmBlogPosts < ActiveRecord::Migration[4.2]
|
2
|
+
def change
|
3
|
+
create_table :ecm_blog_posts do |t|
|
4
|
+
t.string :title
|
5
|
+
t.text :body
|
6
|
+
t.timestamp :published_at
|
7
|
+
t.integer :created_by_id
|
8
|
+
t.integer :updated_by_id
|
9
|
+
|
10
|
+
t.timestamps null: false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'active_support/core_ext/module/delegation'
|
2
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
3
|
+
require 'active_support/hash_with_indifferent_access'
|
4
|
+
|
5
|
+
module Ecm
|
6
|
+
module Blog
|
7
|
+
module Configuration
|
8
|
+
def configure
|
9
|
+
yield self
|
10
|
+
end
|
11
|
+
|
12
|
+
mattr_accessor(:base_controller) { '::FrontendController' }
|
13
|
+
mattr_accessor(:creator_class_name) { 'User' }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/ecm/blog.rb
ADDED
data/lib/ecm_blog.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Ecm
|
2
|
+
module Blog
|
3
|
+
module Generators
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
desc 'Generates the initializer'
|
6
|
+
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def generate_initializer
|
10
|
+
copy_file 'initializer.rb', 'config/initializers/ecm_blog.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_routes
|
14
|
+
inject_into_file 'config/routes.rb', before: "\nend" do
|
15
|
+
File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ecm_blog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roberto Vasquez Angel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-31 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: acts_as_published
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: kaminari
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: kramdown
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Ecm::Blog Module.
|
70
|
+
email:
|
71
|
+
- roberto@vasquez-angel.de
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- MIT-LICENSE
|
77
|
+
- README.rdoc
|
78
|
+
- Rakefile
|
79
|
+
- app/assets/javascripts/ecm/blog/application.js
|
80
|
+
- app/assets/stylesheets/ecm/blog/application.css
|
81
|
+
- app/controllers/ecm/blog/application_controller.rb
|
82
|
+
- app/controllers/ecm/blog/posts_controller.rb
|
83
|
+
- app/helpers/ecm/blog/application_helper.rb
|
84
|
+
- app/models/ecm/blog/post.rb
|
85
|
+
- app/views/ecm/blog/posts/_post.haml
|
86
|
+
- app/views/ecm/blog/posts/_post_in_index.haml
|
87
|
+
- app/views/ecm/blog/posts/index.haml
|
88
|
+
- app/views/ecm/blog/posts/show.haml
|
89
|
+
- app/views/layouts/ecm/blog/application.html.erb
|
90
|
+
- config/locales/de.yml
|
91
|
+
- config/routes.rb
|
92
|
+
- db/migrate/20160214133500_create_ecm_blog_posts.rb
|
93
|
+
- lib/ecm/blog.rb
|
94
|
+
- lib/ecm/blog/configuration.rb
|
95
|
+
- lib/ecm/blog/engine.rb
|
96
|
+
- lib/ecm/blog/version.rb
|
97
|
+
- lib/ecm_blog.rb
|
98
|
+
- lib/generators/ecm/blog/install/install_generator.rb
|
99
|
+
- lib/generators/ecm/blog/install/templates/initializer.rb
|
100
|
+
- lib/generators/ecm/blog/install/templates/routes.source
|
101
|
+
- lib/tasks/ecm/blog_tasks.rake
|
102
|
+
homepage: https://github.com/robotex82/ecm_blog
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.6.11
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Ecm::Blog.
|
126
|
+
test_files: []
|