ecm_blog_backend 0.0.2 → 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/app/controllers/ecm/blog/backend/posts_controller.rb +15 -4
- data/app/views/ecm/blog/backend/posts/_form.haml +9 -1
- data/app/views/ecm/blog/backend/posts/_show.haml +6 -7
- data/app/views/ecm/blog/backend/posts/_table.haml +5 -4
- data/lib/ecm/blog/backend/version.rb +1 -1
- data/lib/generators/ecm/blog/backend/install/templates/initializer.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf54d74924f38d51e586a0c55ba652bb3cf86a70
|
4
|
+
data.tar.gz: ebbbb159658337c88bb8016cbcedf5e7e25e3e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c79abec7e9c431ff92430357d2f45e56141a77d1c80af27f843e0e9bef4eb498f99909b1111b99e40516fbeab8fddbd672f2656c6e41764cd59831ed6022ac
|
7
|
+
data.tar.gz: 7945091a943136644930090987df3bd3a8cfe8151f3deaeb22c4110ab41074d5bb5559a55aba1c0312e81b767b891ded591d8b95a6d2dcea3dfbe8d5708fb319
|
@@ -2,7 +2,8 @@ module Ecm
|
|
2
2
|
module Blog
|
3
3
|
module Backend
|
4
4
|
class PostsController < Itsf::Backend::Resource::BaseController
|
5
|
-
include
|
5
|
+
include ResourcesController::ActsAsPublishedConcern
|
6
|
+
include ResourcesController::FriendlyIdConcern
|
6
7
|
|
7
8
|
helper Ecm::Tags::Backend::ApplicationHelper
|
8
9
|
|
@@ -12,16 +13,26 @@ module Ecm
|
|
12
13
|
|
13
14
|
private
|
14
15
|
|
15
|
-
def
|
16
|
+
def initialize_resource
|
17
|
+
super
|
18
|
+
@resource.creator = current_user
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize_resource_for_create
|
22
|
+
super
|
23
|
+
@resource.creator = current_user
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_collection_scope
|
16
27
|
super.friendly.order(updated_at: :desc)
|
17
28
|
end
|
18
29
|
|
19
|
-
def
|
30
|
+
def load_resource_scope
|
20
31
|
super.friendly
|
21
32
|
end
|
22
33
|
|
23
34
|
def permitted_params
|
24
|
-
params.require(:post).permit(:
|
35
|
+
params.require(:post).permit(:title, :body, :published, :tag_list)
|
25
36
|
end
|
26
37
|
end
|
27
38
|
end
|
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
.bottom-margin-1
|
2
|
+
%b= Ecm::Blog::Post.human_attribute_name(:creator)
|
3
|
+
%br
|
4
|
+
- case Ecm::Blog::Backend.creator_label_method
|
5
|
+
- when Symbol, String
|
6
|
+
= form.object.creator.send(Ecm::Blog::Backend.creator_label_method)
|
7
|
+
- when Proc
|
8
|
+
= Ecm::Blog::Backend.creator_label_method.call(form.object.creator)
|
9
|
+
|
2
10
|
= form.input :title
|
3
11
|
= form.input :body, input_html: { 'data-add-editor': Itsf::Backend.features?(:'ace-rails-ap') } #, 'data-editor-syntax': form.object.handler }
|
4
12
|
= form.input :published, as: :boolean
|
@@ -1,9 +1,8 @@
|
|
1
1
|
= table.row :title
|
2
|
-
= table.row(:tags) do |resource|
|
3
|
-
= tag_labels_for(resource)
|
4
2
|
= table.row :body
|
5
|
-
= table.row
|
6
|
-
|
7
|
-
= table.
|
8
|
-
= table.
|
9
|
-
= table.
|
3
|
+
= table.row(:tags) do |resource|
|
4
|
+
- tag_labels_for(resource)
|
5
|
+
= table.association :creator, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
|
6
|
+
= table.association :updater, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
|
7
|
+
= table.timestamp :published_at, format: :short
|
8
|
+
= table.timestamps format: :short
|
@@ -1,5 +1,6 @@
|
|
1
|
-
= table.column :title,
|
2
|
-
= table.column :body,
|
3
|
-
= table.
|
4
|
-
= table.
|
1
|
+
= table.column :title, sort: true
|
2
|
+
= table.column :body, sort: true
|
3
|
+
= table.association :creator, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
|
4
|
+
= table.association :updater, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
|
5
|
+
= table.timestamps format: :short, sort: true
|
5
6
|
= table.acts_as_published_actions
|
@@ -16,4 +16,10 @@ Ecm::Blog::Backend.configure do |config|
|
|
16
16
|
#
|
17
17
|
config.registered_services = -> {[
|
18
18
|
]}
|
19
|
+
|
20
|
+
# Method to call on creator for display. Can be a symbol,
|
21
|
+
# string or Proc.
|
22
|
+
#
|
23
|
+
# default: config.creator_label_method = :to_s
|
24
|
+
config.creator_label_method = :to_s
|
19
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_blog_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|