lato_blog 2.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.md +27 -0
- data/Rakefile +5 -0
- data/app/assets/config/lato_blog_manifest.js +2 -0
- data/app/assets/javascripts/lato_blog/application.js +19 -0
- data/app/assets/javascripts/lato_blog/initializers/Fields.js +56 -0
- data/app/assets/javascripts/lato_blog/initializers/Posts.js +54 -0
- data/app/assets/stylesheets/lato_blog/_helpers.scss +37 -0
- data/app/assets/stylesheets/lato_blog/application.scss +20 -0
- data/app/assets/stylesheets/lato_blog/fields/_composed.scss +7 -0
- data/app/assets/stylesheets/lato_blog/fields/_datetime.scss +0 -0
- data/app/assets/stylesheets/lato_blog/fields/_editor.scss +3 -0
- data/app/assets/stylesheets/lato_blog/fields/_fields.scss +8 -0
- data/app/assets/stylesheets/lato_blog/fields/_general.scss +9 -0
- data/app/assets/stylesheets/lato_blog/fields/_geolocalization.scss +3 -0
- data/app/assets/stylesheets/lato_blog/fields/_image.scss +3 -0
- data/app/assets/stylesheets/lato_blog/fields/_relay.scss +121 -0
- data/app/assets/stylesheets/lato_blog/fields/_text.scss +3 -0
- data/app/assets/stylesheets/lato_blog/pages/_categories.scss +18 -0
- data/app/assets/stylesheets/lato_blog/pages/_pages.scss +2 -0
- data/app/assets/stylesheets/lato_blog/pages/_posts.scss +25 -0
- data/app/assets/stylesheets/lato_blog/theme.scss.erb +12 -0
- data/app/assets/stylesheets/lato_blog/widgets/_switchlang.scss +3 -0
- data/app/assets/stylesheets/lato_blog/widgets/_widgets.scss +1 -0
- data/app/controllers/lato_blog/api/api_controller.rb +5 -0
- data/app/controllers/lato_blog/api/categories_controller.rb +51 -0
- data/app/controllers/lato_blog/api/posts_controller.rb +93 -0
- data/app/controllers/lato_blog/application_controller.rb +13 -0
- data/app/controllers/lato_blog/back/back_controller.rb +45 -0
- data/app/controllers/lato_blog/back/categories_controller.rb +141 -0
- data/app/controllers/lato_blog/back/post_fields_controller.rb +86 -0
- data/app/controllers/lato_blog/back/posts_controller.rb +340 -0
- data/app/controllers/lato_blog/doc/doc_controller.rb +16 -0
- data/app/controllers/lato_blog/doc/fields_controller.rb +19 -0
- data/app/controllers/lato_blog/doc/general_controller.rb +11 -0
- data/app/helpers/lato_blog/application_helper.rb +13 -0
- data/app/helpers/lato_blog/fields_helper.rb +100 -0
- data/app/jobs/lato_blog/application_job.rb +4 -0
- data/app/mailers/lato_blog/application_mailer.rb +6 -0
- data/app/models/lato_blog/application_record.rb +5 -0
- data/app/models/lato_blog/category.rb +119 -0
- data/app/models/lato_blog/category/entity_helpers.rb +55 -0
- data/app/models/lato_blog/category/serializer_helpers.rb +66 -0
- data/app/models/lato_blog/category_parent.rb +9 -0
- data/app/models/lato_blog/category_post.rb +35 -0
- data/app/models/lato_blog/post.rb +112 -0
- data/app/models/lato_blog/post/entity_helpers.rb +42 -0
- data/app/models/lato_blog/post/serializer_helpers.rb +85 -0
- data/app/models/lato_blog/post_field.rb +50 -0
- data/app/models/lato_blog/post_field/entity_helpers.rb +5 -0
- data/app/models/lato_blog/post_field/serializer_helpers.rb +127 -0
- data/app/models/lato_blog/post_parent.rb +20 -0
- data/app/views/lato_blog/back/back/switch_current_language.js +2 -0
- data/app/views/lato_blog/back/categories/edit.html.erb +44 -0
- data/app/views/lato_blog/back/categories/index.html.erb +18 -0
- data/app/views/lato_blog/back/categories/new.html.erb +40 -0
- data/app/views/lato_blog/back/categories/shared/_form.html.erb +38 -0
- data/app/views/lato_blog/back/categories/shared/edit/_edit_child_tree.html.erb +23 -0
- data/app/views/lato_blog/back/categories/shared/edit/_edit_child_tree_level.html.erb +7 -0
- data/app/views/lato_blog/back/categories/shared/edit/_edit_informations.html.erb +24 -0
- data/app/views/lato_blog/back/categories/shared/edit/_edit_languages.html.erb +38 -0
- data/app/views/lato_blog/back/categories/shared/new/_new_informations.html.erb +21 -0
- data/app/views/lato_blog/back/post_fields/create_relay_field.js.erb +14 -0
- data/app/views/lato_blog/back/post_fields/destroy_relay_field.js.erb +14 -0
- data/app/views/lato_blog/back/post_fields/fields/_composed.html.erb +24 -0
- data/app/views/lato_blog/back/post_fields/fields/_datetime.html.erb +17 -0
- data/app/views/lato_blog/back/post_fields/fields/_editor.html.erb +17 -0
- data/app/views/lato_blog/back/post_fields/fields/_geolocalization.html.erb +22 -0
- data/app/views/lato_blog/back/post_fields/fields/_image.html.erb +18 -0
- data/app/views/lato_blog/back/post_fields/fields/_relay.html.erb +39 -0
- data/app/views/lato_blog/back/post_fields/fields/_text.html.erb +17 -0
- data/app/views/lato_blog/back/post_fields/index.html.erb +28 -0
- data/app/views/lato_blog/back/posts/edit.html.erb +48 -0
- data/app/views/lato_blog/back/posts/index.html.erb +38 -0
- data/app/views/lato_blog/back/posts/new.html.erb +40 -0
- data/app/views/lato_blog/back/posts/shared/_fields.html.erb +13 -0
- data/app/views/lato_blog/back/posts/shared/_form.html.erb +69 -0
- data/app/views/lato_blog/back/posts/shared/edit/_edit_categories.html.erb +36 -0
- data/app/views/lato_blog/back/posts/shared/edit/_edit_informations.html.erb +26 -0
- data/app/views/lato_blog/back/posts/shared/edit/_edit_languages.html.erb +40 -0
- data/app/views/lato_blog/back/posts/shared/edit/_edit_pubblication_datetime.html.erb +24 -0
- data/app/views/lato_blog/back/posts/shared/edit/_edit_status_switch.html.erb +27 -0
- data/app/views/lato_blog/back/posts/shared/index/_index.html.erb +28 -0
- data/app/views/lato_blog/back/posts/shared/index/_index_informations.html.erb +37 -0
- data/app/views/lato_blog/back/posts/shared/index/_index_status_switch.html.erb +29 -0
- data/app/views/lato_blog/back/posts/shared/new/_new_informations.html.erb +21 -0
- data/app/views/lato_blog/doc/doc/index.html.erb +83 -0
- data/app/views/lato_blog/doc/fields/composed.html.erb +87 -0
- data/app/views/lato_blog/doc/fields/datetime.html.erb +0 -0
- data/app/views/lato_blog/doc/fields/editor.html.erb +1 -0
- data/app/views/lato_blog/doc/fields/geolocalization.html.erb +1 -0
- data/app/views/lato_blog/doc/fields/image.html.erb +70 -0
- data/app/views/lato_blog/doc/fields/relay.html.erb +87 -0
- data/app/views/lato_blog/doc/fields/text.html.erb +70 -0
- data/app/views/lato_blog/doc/general/api.html.erb +0 -0
- data/app/views/lato_blog/doc/general/installation.html.erb +49 -0
- data/app/views/lato_blog/doc/general/personalization.html.erb +0 -0
- data/app/views/lato_blog/partials/_relay_destroy_button.html.erb +5 -0
- data/app/views/lato_blog/widgets/_switchlang.html.erb +20 -0
- data/config/configs.yml +109 -0
- data/config/initializers/assets.rb +4 -0
- data/config/initializers/init_system.rb +22 -0
- data/config/languages/default.yml +87 -0
- data/config/languages/it.yml +87 -0
- data/config/routes.rb +16 -0
- data/config/routes/api.rb +11 -0
- data/config/routes/back.rb +17 -0
- data/config/routes/doc.rb +19 -0
- data/db/migrate/20170504222008_create_lato_blog_posts.rb +19 -0
- data/db/migrate/20170504223521_create_lato_blog_post_parents.rb +9 -0
- data/db/migrate/20170516063317_create_lato_blog_categories.rb +16 -0
- data/db/migrate/20170516063320_create_lato_blog_category_parents.rb +9 -0
- data/db/migrate/20170516063330_create_lato_blog_category_posts.rb +10 -0
- data/db/migrate/20170516063330_create_lato_blog_post_fields.rb +18 -0
- data/lib/lato_blog.rb +6 -0
- data/lib/lato_blog/engine.rb +15 -0
- data/lib/lato_blog/interface.rb +17 -0
- data/lib/lato_blog/interfaces/categories.rb +34 -0
- data/lib/lato_blog/interfaces/fields.rb +195 -0
- data/lib/lato_blog/interfaces/languages.rb +15 -0
- data/lib/lato_blog/interfaces/posts.rb +13 -0
- data/lib/lato_blog/version.rb +3 -0
- data/lib/tasks/lato_blog_tasks.rake +4 -0
- metadata +223 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
module LatoBlog
|
2
|
+
module Post::SerializerHelpers
|
3
|
+
|
4
|
+
# This function serializes a complete version of the post.
|
5
|
+
def serialize
|
6
|
+
serialized = {}
|
7
|
+
|
8
|
+
# set basic info
|
9
|
+
serialized[:id] = id
|
10
|
+
serialized[:title] = title
|
11
|
+
serialized[:subtitle] = subtitle
|
12
|
+
serialized[:excerpt] = excerpt
|
13
|
+
serialized[:content] = content
|
14
|
+
serialized[:meta_language] = meta_language
|
15
|
+
serialized[:meta_permalink] = meta_permalink
|
16
|
+
serialized[:meta_status] = meta_status
|
17
|
+
|
18
|
+
# add fields informations
|
19
|
+
serialized[:fields] = serialize_fields
|
20
|
+
|
21
|
+
# add categories informations
|
22
|
+
serialized[:categories] = serialize_categories
|
23
|
+
|
24
|
+
# add post parent informations
|
25
|
+
serialized[:other_informations] = serialize_other_informations
|
26
|
+
|
27
|
+
# return serialized post
|
28
|
+
serialized
|
29
|
+
end
|
30
|
+
|
31
|
+
# This function serializes a basic version of the post.
|
32
|
+
def serialize_base
|
33
|
+
serialized = {}
|
34
|
+
|
35
|
+
# set basic info
|
36
|
+
serialized[:id] = id
|
37
|
+
serialized[:title] = title
|
38
|
+
serialized[:meta_language] = meta_language
|
39
|
+
serialized[:meta_permalink] = meta_permalink
|
40
|
+
serialized[:meta_status] = meta_status
|
41
|
+
|
42
|
+
# return serialized post
|
43
|
+
serialized
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# This function serializes the list of fields for the post.
|
49
|
+
def serialize_fields
|
50
|
+
serialized = {}
|
51
|
+
post_fields.visibles.roots.order('position ASC').each do |post_field|
|
52
|
+
serialized[post_field.key] = post_field.serialize_base
|
53
|
+
end
|
54
|
+
serialized
|
55
|
+
end
|
56
|
+
|
57
|
+
# This function serializes the list of cateogories for the post.
|
58
|
+
def serialize_categories
|
59
|
+
serialized = {}
|
60
|
+
categories.each do |category|
|
61
|
+
serialized[category.id] = category.serialize_base
|
62
|
+
end
|
63
|
+
serialized
|
64
|
+
end
|
65
|
+
|
66
|
+
# This function serializes other informations for the post.
|
67
|
+
def serialize_other_informations
|
68
|
+
serialized = {}
|
69
|
+
|
70
|
+
# set pubblication datetime
|
71
|
+
serialized[:publication_datetime] = post_parent.publication_datetime
|
72
|
+
|
73
|
+
# set translations links
|
74
|
+
serialized[:translations] = {}
|
75
|
+
post_parent.posts.published.each do |post|
|
76
|
+
next if post.id == id
|
77
|
+
serialized[:translations][post.meta_language] = post.serialize_base
|
78
|
+
end
|
79
|
+
|
80
|
+
# return serialzed informations
|
81
|
+
serialized
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module LatoBlog
|
2
|
+
class PostField < ApplicationRecord
|
3
|
+
|
4
|
+
include PostField::EntityHelpers
|
5
|
+
include PostField::SerializerHelpers
|
6
|
+
|
7
|
+
# Properties:
|
8
|
+
|
9
|
+
serialize :meta_datas, Hash
|
10
|
+
|
11
|
+
# Relations:
|
12
|
+
|
13
|
+
belongs_to :post, foreign_key: :lato_blog_post_id,
|
14
|
+
class_name: 'LatoBlog::Post'
|
15
|
+
|
16
|
+
has_many :post_fields, foreign_key: :lato_blog_post_field_id,
|
17
|
+
class_name: 'LatoBlog::PostField',
|
18
|
+
dependent: :destroy
|
19
|
+
belongs_to :post_field, foreign_key: :lato_blog_post_field_id,
|
20
|
+
class_name: 'LatoBlog::PostField',
|
21
|
+
optional: true
|
22
|
+
|
23
|
+
# Validations:
|
24
|
+
|
25
|
+
validates :key, presence: true
|
26
|
+
|
27
|
+
# Scopes:
|
28
|
+
|
29
|
+
scope :visibles, -> { where(meta_visible: true) }
|
30
|
+
scope :not_visibles, -> { where(meta_visible: false) }
|
31
|
+
scope :roots, -> { where(lato_blog_post_field_id: nil) }
|
32
|
+
|
33
|
+
# Callbacks:
|
34
|
+
|
35
|
+
after_update do
|
36
|
+
update_child_visibility
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# This functions update all post fields child visibility with the current
|
42
|
+
# post field visibility.
|
43
|
+
def update_child_visibility
|
44
|
+
return if meta_visible == meta_visible_was
|
45
|
+
post_fields.map { |pf| pf.update(meta_visible: meta_visible) }
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module LatoBlog
|
2
|
+
module PostField::SerializerHelpers
|
3
|
+
|
4
|
+
# This function serializes a basic version of the post field.
|
5
|
+
def serialize_base
|
6
|
+
serialized = {}
|
7
|
+
|
8
|
+
# set basic info
|
9
|
+
serialized[:key] = key
|
10
|
+
serialized[:typology] = typology
|
11
|
+
serialized[:value] = serialize_field_value
|
12
|
+
|
13
|
+
# return serialized post
|
14
|
+
serialized
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# Serializer field value:
|
20
|
+
# **************************************************************************
|
21
|
+
|
22
|
+
# This function serialize the field value of the post field.
|
23
|
+
def serialize_field_value
|
24
|
+
case typology
|
25
|
+
when 'text'
|
26
|
+
serialize_field_value_text
|
27
|
+
when 'datetime'
|
28
|
+
serialize_field_value_datetime
|
29
|
+
when 'editor'
|
30
|
+
serialize_field_value_editor
|
31
|
+
when 'geolocalization'
|
32
|
+
serialize_field_value_geolocalization
|
33
|
+
when 'image'
|
34
|
+
serialize_field_value_image
|
35
|
+
when 'composed'
|
36
|
+
serialize_field_value_composed
|
37
|
+
when 'relay'
|
38
|
+
serialize_field_value_relay
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Serializer specific field value:
|
43
|
+
# **************************************************************************
|
44
|
+
|
45
|
+
# Text.
|
46
|
+
def serialize_field_value_text
|
47
|
+
value
|
48
|
+
end
|
49
|
+
|
50
|
+
# Datetime.
|
51
|
+
def serialize_field_value_datetime
|
52
|
+
date = DateTime.parse(value)
|
53
|
+
serialized = {}
|
54
|
+
|
55
|
+
# add basic info
|
56
|
+
serialized[:datetime] = date
|
57
|
+
serialized[:year] = date.year
|
58
|
+
serialized[:month] = date.month
|
59
|
+
serialized[:day] = date.day
|
60
|
+
serialized[:hour] = date.hour
|
61
|
+
serialized[:minute] = date.min
|
62
|
+
serialized[:second] = date.sec
|
63
|
+
|
64
|
+
# return serialized data
|
65
|
+
serialized
|
66
|
+
end
|
67
|
+
|
68
|
+
# Editor.
|
69
|
+
def serialize_field_value_editor
|
70
|
+
value
|
71
|
+
end
|
72
|
+
|
73
|
+
# Geolocalization.
|
74
|
+
def serialize_field_value_geolocalization
|
75
|
+
return unless value
|
76
|
+
value_object = eval(value)
|
77
|
+
serialized = {}
|
78
|
+
|
79
|
+
# add basic info
|
80
|
+
serialized[:latitude] = value_object[:lat]
|
81
|
+
serialized[:longitude] = value_object[:lng]
|
82
|
+
serialized[:address] = value_object[:address]
|
83
|
+
|
84
|
+
# return serialized data
|
85
|
+
serialized
|
86
|
+
end
|
87
|
+
|
88
|
+
# Image.
|
89
|
+
def serialize_field_value_image
|
90
|
+
media = LatoMedia::Media.find_by(id: value)
|
91
|
+
return unless media
|
92
|
+
|
93
|
+
# add basic info
|
94
|
+
serialized = {}
|
95
|
+
serialized[:id] = media.id
|
96
|
+
serialized[:title] = media.title
|
97
|
+
serialized[:url] = media.attachment.url
|
98
|
+
|
99
|
+
# add image info
|
100
|
+
serialized[:thumb_url] = (media.image? ? media.attachment.url(:thumb) : nil)
|
101
|
+
serialized[:medium_url] = (media.image? ? media.attachment.url(:medium) : nil)
|
102
|
+
serialized[:large_url] = (media.image? ? media.attachment.url(:large) : nil)
|
103
|
+
|
104
|
+
# return serialized media
|
105
|
+
serialized
|
106
|
+
end
|
107
|
+
|
108
|
+
# Composed.
|
109
|
+
def serialize_field_value_composed
|
110
|
+
serialized = {}
|
111
|
+
post_fields.visibles.order('position ASC').each do |post_field|
|
112
|
+
serialized[post_field.key] = post_field.serialize_base
|
113
|
+
end
|
114
|
+
serialized
|
115
|
+
end
|
116
|
+
|
117
|
+
# Relay.
|
118
|
+
def serialize_field_value_relay
|
119
|
+
serialized = []
|
120
|
+
post_fields.visibles.order('position ASC').each do |post_field|
|
121
|
+
serialized.push(post_field.serialize_base)
|
122
|
+
end
|
123
|
+
serialized
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module LatoBlog
|
2
|
+
class PostParent < ApplicationRecord
|
3
|
+
|
4
|
+
# Validations:
|
5
|
+
|
6
|
+
validates :publication_datetime, presence: true
|
7
|
+
|
8
|
+
# Relations:
|
9
|
+
|
10
|
+
has_many :posts, foreign_key: :lato_blog_post_parent_id,
|
11
|
+
class_name: 'LatoBlog::Post', dependent: :destroy
|
12
|
+
|
13
|
+
# Calbacks:
|
14
|
+
|
15
|
+
before_validation do
|
16
|
+
self.publication_datetime = DateTime.now if !self.publication_datetime
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<%
|
2
|
+
row = cell(:elements, :row).new
|
3
|
+
block = cell(:elements, :block).new(class: 'xs-12 sm-12 md-12')
|
4
|
+
container_block_big = cell(:elements, :block).new(class: 'xs-12 sm-12 md-8 no-padding no-background no-shadow')
|
5
|
+
container_block_small = cell(:elements, :block).new(class: 'xs-12 sm-12 md-4 no-padding no-background no-shadow')
|
6
|
+
%>
|
7
|
+
|
8
|
+
<!-- MAIN CONTAINER -->
|
9
|
+
<%=raw row.open %>
|
10
|
+
|
11
|
+
<!-- BIG SECTION CONTAINER -->
|
12
|
+
<%=raw container_block_big.open %>
|
13
|
+
|
14
|
+
<%=raw row.open %>
|
15
|
+
|
16
|
+
<%=raw block.open %>
|
17
|
+
|
18
|
+
<%= render 'lato_blog/back/categories/shared/form', url: lato_blog.category_path(@category.id), method: :put %>
|
19
|
+
|
20
|
+
<%=raw block.close %>
|
21
|
+
|
22
|
+
<%=raw row.close %>
|
23
|
+
|
24
|
+
<%=raw container_block_big.close %>
|
25
|
+
<!-- / BIG SECTION CONTAINER -->
|
26
|
+
|
27
|
+
<!-- SMALL SECTION CONTAINER -->
|
28
|
+
<%=raw container_block_small.open %>
|
29
|
+
|
30
|
+
<%=raw row.open %>
|
31
|
+
|
32
|
+
<%= render 'lato_blog/back/categories/shared/edit/edit_informations' %>
|
33
|
+
|
34
|
+
<%= render 'lato_blog/back/categories/shared/edit/edit_languages' %>
|
35
|
+
|
36
|
+
<%= render 'lato_blog/back/categories/shared/edit/edit_child_tree' %>
|
37
|
+
|
38
|
+
<%=raw row.close %>
|
39
|
+
|
40
|
+
<%=raw container_block_small.close %>
|
41
|
+
<!-- / SMALL SECTION CONTAINER -->
|
42
|
+
|
43
|
+
<%=raw row.close %>
|
44
|
+
<!-- / MAIN CONTAINER -->
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%
|
2
|
+
row = cell(:elements, :row).new
|
3
|
+
block = cell(:elements, :block).new(class: 'xs-12 sm-12 md-12')
|
4
|
+
%>
|
5
|
+
|
6
|
+
<!-- MAIN CONTAINER -->
|
7
|
+
<%=raw row.open %>
|
8
|
+
|
9
|
+
<%=raw block.open %>
|
10
|
+
|
11
|
+
<%=raw cell(:widgets, :index).new(records: @widget_index_categories, index_url: lato_blog.categories_path,
|
12
|
+
head: [LANGUAGES[:lato_blog][:forms][:title], LANGUAGES[:lato_blog][:forms][:language], LANGUAGES[:lato_blog][:forms][:category_father], LANGUAGES[:lato_blog][:mixed][:number_of_posts]],
|
13
|
+
columns: ['title', 'get_pretty_language', 'get_category_father_title', 'get_number_of_posts'], actions: {show: true, new: true, delete: true}, search: true, pagination: true) %>
|
14
|
+
|
15
|
+
<%=raw block.close %>
|
16
|
+
|
17
|
+
<%=raw row.close %>
|
18
|
+
<!-- / MAIN CONTAINER -->
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
row = cell(:elements, :row).new
|
3
|
+
block = cell(:elements, :block).new(class: 'xs-12 sm-12 md-12')
|
4
|
+
container_block_big = cell(:elements, :block).new(class: 'xs-12 sm-12 md-8 no-padding no-background no-shadow')
|
5
|
+
container_block_small = cell(:elements, :block).new(class: 'xs-12 sm-12 md-4 no-padding no-background no-shadow')
|
6
|
+
%>
|
7
|
+
|
8
|
+
<!-- MAIN CONTAINER -->
|
9
|
+
<%=raw row.open %>
|
10
|
+
|
11
|
+
<!-- BIG SECTION CONTAINER -->
|
12
|
+
<%=raw container_block_big.open %>
|
13
|
+
|
14
|
+
<%=raw row.open %>
|
15
|
+
|
16
|
+
<%=raw block.open %>
|
17
|
+
|
18
|
+
<%= render 'lato_blog/back/categories/shared/form', url: lato_blog.categories_path, method: :post %>
|
19
|
+
|
20
|
+
<%=raw block.close %>
|
21
|
+
|
22
|
+
<%=raw row.close %>
|
23
|
+
|
24
|
+
<%=raw container_block_big.close %>
|
25
|
+
<!-- / BIG SECTION CONTAINER -->
|
26
|
+
|
27
|
+
<!-- SMALL SECTION CONTAINER -->
|
28
|
+
<%=raw container_block_small.open %>
|
29
|
+
|
30
|
+
<%=raw row.open %>
|
31
|
+
|
32
|
+
<%= render 'lato_blog/back/categories/shared/new/new_informations' %>
|
33
|
+
|
34
|
+
<%=raw row.close %>
|
35
|
+
|
36
|
+
<%=raw container_block_small.close %>
|
37
|
+
<!-- / SMALL SECTION CONTAINER -->
|
38
|
+
|
39
|
+
<%=raw row.close %>
|
40
|
+
<!-- / MAIN CONTAINER -->
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%
|
2
|
+
row = cell(:elements, :row).new
|
3
|
+
form = cell(:inputs, :form).new(url: url, method: method)
|
4
|
+
%>
|
5
|
+
|
6
|
+
<%=raw form.open %>
|
7
|
+
|
8
|
+
<input type="hidden" name="parent" value="<%= @category_parent ? @category_parent.id : nil %>">
|
9
|
+
|
10
|
+
<%=raw row.open %>
|
11
|
+
|
12
|
+
<% if method === :put %>
|
13
|
+
|
14
|
+
<%=raw cell(:inputs, :text).new(name: 'category[meta_permalink]', label: LANGUAGES[:lato_blog][:forms][:permalink],
|
15
|
+
required: true, class: 'md-12', value: @category.meta_permalink) %>
|
16
|
+
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%=raw cell(:inputs, :text).new(name: 'category[title]', label: LANGUAGES[:lato_blog][:forms][:title],
|
20
|
+
required: true, class: 'md-12', value: @category.title) %>
|
21
|
+
|
22
|
+
<%=raw cell(:inputs, :select).new(name: 'category[lato_blog_category_id]', label: LANGUAGES[:lato_blog][:forms][:category_father],
|
23
|
+
required: false, class: 'md-12', options: @categories_list, option_value: 'value', option_name: 'title',
|
24
|
+
value: @category.lato_blog_category_id) %>
|
25
|
+
|
26
|
+
<%=raw row.close %>
|
27
|
+
|
28
|
+
<div class="text-right">
|
29
|
+
|
30
|
+
<%=raw cell(:elements, :button).new(type: 'link', label: LANGUAGES[:lato_blog][:mixed][:cancel],
|
31
|
+
style: 'danger', icon: 'ban', url: lato_blog.categories_path) %>
|
32
|
+
|
33
|
+
<%=raw cell(:elements, :button).new(type: 'submit', label: LANGUAGES[:lato_blog][:mixed][:save],
|
34
|
+
style: 'success', icon: 'check') %>
|
35
|
+
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<%=raw form.close %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% if @category.category_children.length > 0 %>
|
2
|
+
|
3
|
+
<%
|
4
|
+
block = cell(:elements, :block).new(class: 'xs-12 sm-12 md-12 categories__edit-child-tree')
|
5
|
+
%>
|
6
|
+
|
7
|
+
<%=raw block.open %>
|
8
|
+
|
9
|
+
<%=raw cell(:elements, :title).new(label: LANGUAGES[:lato_blog][:mixed][:child_tree], size: 6) %>
|
10
|
+
|
11
|
+
<div class="child-tree-container">
|
12
|
+
|
13
|
+
<ul>
|
14
|
+
<% @category.category_children.each do |child| %>
|
15
|
+
<%= render 'lato_blog/back/categories/shared/edit/edit_child_tree_level', category: child %>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<%=raw block.close %>
|
22
|
+
|
23
|
+
<% end %>
|