ecrire 0.28.3 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +22 -0
- data/lib/ecrire/app/assets/images/favicon.ico +0 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/content.coffee +3 -0
- data/lib/ecrire/app/assets/javascripts/admin/navigation/save.js.coffee +9 -2
- data/lib/ecrire/app/assets/javascripts/admin/posts/filter.js.coffee +19 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/filters/tags.js.coffee +15 -6
- data/lib/ecrire/app/assets/javascripts/admin/posts/header.coffee +17 -9
- data/lib/ecrire/app/assets/javascripts/admin/posts/list.coffee +6 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/tags/form.coffee +39 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/tags/list.coffee +27 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/tags/tag.coffee +17 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/tags.coffee +11 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/title.coffee +6 -39
- data/lib/ecrire/app/assets/javascripts/admin/posts/titles.coffee +8 -0
- data/lib/ecrire/app/assets/javascripts/shared/popup.js.coffee +17 -4
- data/lib/ecrire/app/assets/stylesheets/admin/header.scss +126 -17
- data/lib/ecrire/app/assets/stylesheets/admin/navigation.scss +5 -1
- data/lib/ecrire/app/assets/stylesheets/admin/posts.scss +80 -281
- data/lib/ecrire/app/assets/stylesheets/admin/preview.scss +55 -0
- data/lib/ecrire/app/assets/stylesheets/admin/tags.scss +59 -0
- data/lib/ecrire/app/assets/stylesheets/admin/title.scss +79 -89
- data/lib/ecrire/app/assets/stylesheets/shared/popup.scss +4 -20
- data/lib/ecrire/app/assets/stylesheets/vendor/prism.scss +1 -0
- data/lib/ecrire/app/controllers/admin/posts/tags_controller.rb +30 -2
- data/lib/ecrire/app/controllers/admin/posts/titles_controller.rb +10 -5
- data/lib/ecrire/app/controllers/admin/posts_controller.rb +10 -10
- data/lib/ecrire/app/helpers/admin/posts_helper.rb +7 -3
- data/lib/ecrire/app/helpers/application_helper.rb +20 -0
- data/lib/ecrire/app/helpers/content_tag_helper.rb +4 -0
- data/lib/ecrire/app/models/admin/post.rb +23 -0
- data/lib/ecrire/app/models/post.rb +1 -1
- data/lib/ecrire/app/models/tag.rb +8 -0
- data/lib/ecrire/app/views/admin/posts/_post.html.erb +9 -0
- data/lib/ecrire/app/views/admin/posts/edit.html.erb +21 -61
- data/lib/ecrire/app/views/admin/posts/header/_base.html.erb +54 -0
- data/lib/ecrire/app/views/admin/posts/index.html.erb +52 -33
- data/lib/ecrire/app/views/admin/posts/index.js.erb +1 -1
- data/lib/ecrire/app/views/admin/posts/show.html.erb +5 -23
- data/lib/ecrire/app/views/admin/posts/tags/_tag.html.erb +11 -2
- data/lib/ecrire/app/views/admin/posts/tags/_tags.html.erb +12 -0
- data/lib/ecrire/app/views/admin/posts/tags/create.js.erb +2 -0
- data/lib/ecrire/app/views/admin/posts/tags/index.js.erb +1 -0
- data/lib/ecrire/app/views/admin/posts/tags/toggle.js.erb +2 -1
- data/lib/ecrire/app/views/admin/posts/titles/_form.html.erb +2 -2
- data/lib/ecrire/app/views/admin/posts/titles/_index.html.erb +10 -0
- data/lib/ecrire/app/views/admin/posts/titles/_titles.html.erb +6 -0
- data/lib/ecrire/app/views/admin/posts/titles/index.html.erb +2 -37
- data/lib/ecrire/app/views/admin/posts/titles/index.js.erb +2 -0
- data/lib/ecrire/app/views/admin/posts/titles/update.js.erb +1 -0
- data/lib/ecrire/app/views/admin/tags/_tags.html.erb +6 -10
- data/lib/ecrire/app/views/admin/tags/index.js.erb +1 -1
- data/lib/ecrire/app/views/layouts/admin/application.html.erb +1 -1
- data/lib/ecrire/application.rb +0 -2
- data/lib/ecrire/commands/console.rb +1 -1
- data/lib/ecrire/config/environment/development.rb +2 -0
- data/lib/ecrire/db/migrate/20140618321984_add_properties_to_posts.rb +1 -1
- data/lib/ecrire/onboarding/assets/stylesheets/shared/base.scss +11 -10
- data/lib/ecrire/onboarding/assets/stylesheets/shared/complete.scss +1 -0
- data/lib/ecrire/onboarding/assets/stylesheets/shared/welcome.scss +1 -1
- data/lib/ecrire/routes.rb +1 -1
- data/lib/ecrire/theme/template/assets/stylesheets/shared/{base.css.scss → base.scss} +4 -18
- data/lib/ecrire/theme/template/assets/stylesheets/shared/code.scss +33 -0
- data/lib/ecrire/theme/template/assets/stylesheets/shared/{header.css.scss → header.scss} +13 -3
- data/lib/ecrire/theme/template/assets/stylesheets/shared/{posts.css.scss → posts.scss} +10 -0
- data/lib/ecrire/theme/template/controllers/posts_controller.rb +0 -4
- data/lib/ecrire/theme/template/secrets.yml +4 -4
- data/lib/ecrire/theme/template/views/layouts/application.html.erb +2 -2
- data/lib/ecrire/version.rb +1 -1
- data/lib/ecrire.rb +1 -0
- data/test/editor/models/post_test.rb +1 -1
- data/test/theme/theme/views/layouts/application.html.erb +1 -0
- metadata +35 -18
- data/lib/ecrire/app/assets/javascripts/admin/posts/filters/filter.js.coffee +0 -21
- data/lib/ecrire/app/assets/javascripts/admin/posts/tag.js.coffee +0 -11
- data/lib/ecrire/app/views/admin/posts/_posts.html.erb +0 -26
- /data/lib/ecrire/app/assets/javascripts/admin/posts/{new.js.coffee → new.coffee} +0 -0
- /data/lib/ecrire/app/assets/javascripts/admin/posts/{toggle.js.coffee → toggle.coffee} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/browser/{base.css.scss → base.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/{browser.css.scss → browser.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/mobile/{base.css.scss → base.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/{mobile.css.scss → mobile.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/shared/{tags.css.scss → tags.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/tablet/{base.css.scss → base.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/{tablet.css.scss → tablet.scss} +0 -0
- /data/lib/ecrire/theme/template/assets/stylesheets/{variables.css.scss → variables.scss} +0 -0
@@ -1,116 +1,105 @@
|
|
1
|
-
#TitlesIndex, #TitlesCreate {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
margin: 1em 0 0 0;
|
7
|
-
}
|
8
|
-
|
9
|
-
form {
|
10
|
-
@include display(flex);
|
11
|
-
@include align-items(flex-start);
|
12
|
-
width: 100%;
|
13
|
-
max-width: 500px;
|
14
|
-
margin: 5em auto 0 auto;
|
15
|
-
div.fieldset {
|
16
|
-
@include display(flex);
|
17
|
-
width: 100%;
|
18
|
-
}
|
19
|
-
|
20
|
-
& ~ p {
|
21
|
-
max-width: 500px;
|
22
|
-
width: 100%;
|
23
|
-
margin: 0.3em 0 3em 0;
|
24
|
-
font-size: 0.8em;
|
25
|
-
}
|
1
|
+
#TitlesIndex > section.titles, #TitlesCreate > section.titles, #Popup.titles {
|
2
|
+
h3 {
|
3
|
+
text-align: center;
|
4
|
+
margin: 1em 0 0 0;
|
5
|
+
}
|
26
6
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
form {
|
8
|
+
@include display(flex);
|
9
|
+
@include align-items(flex-start);
|
10
|
+
width: 100%;
|
11
|
+
max-width: 500px;
|
12
|
+
margin: 1em auto 0 auto;
|
13
|
+
padding: 0 20px;
|
14
|
+
}
|
31
15
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
16
|
+
form div.fieldset {
|
17
|
+
@include flex-direction(column);
|
18
|
+
@include display(flex);
|
19
|
+
width: 100%;
|
20
|
+
margin: 0 1em 0 0;
|
21
|
+
}
|
38
22
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
font-weight: bold;
|
46
|
-
padding: 4px 8px;
|
47
|
-
border-radius: 2px;
|
48
|
-
color: lighten($green, 35%);
|
49
|
-
text-shadow: 0 -1px darken($green, 10%);
|
50
|
-
text-decoration: none;
|
51
|
-
background-color: darken($green, 5%);
|
52
|
-
box-shadow: inset 0 1px 1px 0 lighten($green, 15%);
|
53
|
-
|
54
|
-
&:hover {
|
55
|
-
box-shadow: inset 0 0 0 0 lighten($green, 15%), 0 1px 1px darken($green, 25%);
|
56
|
-
}
|
57
|
-
|
58
|
-
&:active {
|
59
|
-
box-shadow: none;
|
60
|
-
}
|
23
|
+
form ~ p {
|
24
|
+
max-width: 500px;
|
25
|
+
width: 100%;
|
26
|
+
margin: 0.3em 0 3em 0;
|
27
|
+
font-size: 0.8em;
|
28
|
+
}
|
61
29
|
|
62
|
-
|
30
|
+
form input {
|
31
|
+
@include flex(1);
|
32
|
+
border: 1px solid $gray-blue;
|
33
|
+
font-family: inherit;
|
34
|
+
font-size: inherit;
|
35
|
+
}
|
63
36
|
|
37
|
+
form button {
|
38
|
+
@include transition(box-shadow 0.2s);
|
39
|
+
@include flex(0 0 auto);
|
40
|
+
margin: 2px 0 0 0;
|
41
|
+
text-transform: uppercase;
|
42
|
+
font-size: 0.8em;
|
43
|
+
font-weight: bold;
|
44
|
+
padding: 4px 8px;
|
45
|
+
border-radius: 2px;
|
46
|
+
color: lighten($green, 35%);
|
47
|
+
text-shadow: 0 -1px darken($green, 10%);
|
48
|
+
text-decoration: none;
|
49
|
+
background-color: darken($green, 5%);
|
50
|
+
|
51
|
+
&:active {
|
52
|
+
box-shadow: inset 0 0 1px 0 darken($green, 25%);
|
64
53
|
}
|
65
54
|
}
|
66
|
-
}
|
67
55
|
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
ul.titles {
|
57
|
+
width: 100%;
|
58
|
+
max-width: 500px;
|
59
|
+
padding: 0 20px;
|
60
|
+
margin: 1em auto 0 auto;
|
61
|
+
}
|
71
62
|
|
72
|
-
h3 {
|
63
|
+
ul.titles h3 {
|
73
64
|
@include justify-content(center);
|
74
65
|
}
|
75
66
|
|
76
|
-
|
67
|
+
ul.titles li {
|
68
|
+
@include flex-direction(column);
|
69
|
+
@include align-items(flex-start);
|
70
|
+
padding: 0.5em 0;
|
71
|
+
|
72
|
+
&:first-child {
|
73
|
+
position: relative;
|
77
74
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
position: absolute;
|
89
|
-
text-transform: uppercase;
|
90
|
-
right: calc(100% + 1em);
|
91
|
-
top: 1em;
|
92
|
-
font-size: 0.7em;
|
93
|
-
font-weight: normal;
|
94
|
-
color: lighten($gray-blue, 20%);
|
75
|
+
&:before {
|
76
|
+
content: "Current";
|
77
|
+
position: absolute;
|
78
|
+
text-transform: uppercase;
|
79
|
+
right: calc(100% + 1em);
|
80
|
+
top: 1.1em;
|
81
|
+
font-size: 0.7em;
|
82
|
+
font-weight: normal;
|
83
|
+
color: $gray-blue;
|
84
|
+
}
|
95
85
|
}
|
96
86
|
}
|
97
87
|
|
98
|
-
p {
|
88
|
+
ul.titles li p {
|
99
89
|
margin: 0;
|
100
90
|
}
|
101
|
-
|
91
|
+
|
92
|
+
ul.titles li a {
|
102
93
|
font-size: 0.7em;
|
103
94
|
font-weight: lighter;
|
104
95
|
}
|
105
|
-
}
|
106
96
|
|
107
|
-
|
108
|
-
input {
|
97
|
+
div.fieldset.errors input {
|
109
98
|
border: 1px solid darken($red, 5%);
|
110
99
|
border-radius: 2px 2px 0 0;
|
111
100
|
}
|
112
101
|
|
113
|
-
input + ul.errors {
|
102
|
+
div.fieldset.errors input + ul.errors {
|
114
103
|
font-size: 0.8em;
|
115
104
|
margin: 0;
|
116
105
|
padding: 0 1em;
|
@@ -124,9 +113,10 @@
|
|
124
113
|
|
125
114
|
color: darken($red, 50%);
|
126
115
|
text-shadow: 0 1px lighten($red, 5%);
|
116
|
+
}
|
127
117
|
|
128
|
-
|
118
|
+
div.fieldset.errors input + ul.errors li {
|
129
119
|
@include justify-content(center);
|
130
|
-
}
|
131
120
|
}
|
132
121
|
}
|
122
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
[as='Overlay'] {
|
2
2
|
@include display(flex);
|
3
3
|
@include justify-content(center);
|
4
4
|
@include align-items(center);
|
@@ -15,7 +15,7 @@ main.overlayed {
|
|
15
15
|
position: fixed;
|
16
16
|
}
|
17
17
|
|
18
|
-
|
18
|
+
[as='Popup'] {
|
19
19
|
@include display(flex);
|
20
20
|
@include flex-direction(column);
|
21
21
|
border-radius: 2px;
|
@@ -33,7 +33,7 @@ div.popup {
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
-
|
36
|
+
[as='Popup'] header {
|
37
37
|
@include flex(0 0 auto);
|
38
38
|
@include display(flex);
|
39
39
|
@include align-items(center);
|
@@ -50,7 +50,7 @@ div.popup header {
|
|
50
50
|
}
|
51
51
|
}
|
52
52
|
|
53
|
-
|
53
|
+
[as='Popup'].errors {
|
54
54
|
background: rgb(200, 158, 158);
|
55
55
|
|
56
56
|
header {
|
@@ -64,19 +64,3 @@ div.popup.errors {
|
|
64
64
|
margin: 1em;
|
65
65
|
}
|
66
66
|
}
|
67
|
-
|
68
|
-
#PostsListPopup {
|
69
|
-
ol {
|
70
|
-
list-style-type: none;
|
71
|
-
font-size: 1.2em;
|
72
|
-
padding: 0;
|
73
|
-
li {
|
74
|
-
margin: 1.2em 1em;
|
75
|
-
padding: 0;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
div.empty {
|
80
|
-
text-align: center;
|
81
|
-
}
|
82
|
-
}
|
@@ -1,14 +1,32 @@
|
|
1
1
|
module Admin
|
2
2
|
module Posts
|
3
3
|
class TagsController < Admin::ApplicationController
|
4
|
+
before_action :post
|
4
5
|
|
5
6
|
def index
|
6
|
-
@post = Admin::Post.find(params[:post_id])
|
7
7
|
@tags = Admin::Tag.all
|
8
|
+
if params.has_key?(:q) && !params[:q].blank?
|
9
|
+
@tags = @tags.search_by_name(params[:q])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
@tag = Tag.search_by_name(tag_params[:name]).first
|
15
|
+
if @tag.nil?
|
16
|
+
@tag = Tag.create(tag_params)
|
17
|
+
end
|
18
|
+
|
19
|
+
if @post.tags.include? @tag
|
20
|
+
@post.tags = @post.tags.where.not(id: @tag.id)
|
21
|
+
else
|
22
|
+
@post.tags << @tag
|
23
|
+
end
|
24
|
+
|
25
|
+
@post.save!
|
26
|
+
|
8
27
|
end
|
9
28
|
|
10
29
|
def toggle
|
11
|
-
@post = Admin::Post.find(params[:post_id])
|
12
30
|
@tag = Admin::Tag.find(params[:tag_id])
|
13
31
|
if @post.tags.include? @tag
|
14
32
|
@post.tags = @post.tags.where.not(id: @tag.id)
|
@@ -19,6 +37,16 @@ module Admin
|
|
19
37
|
@post.save!
|
20
38
|
end
|
21
39
|
|
40
|
+
protected
|
41
|
+
|
42
|
+
def post
|
43
|
+
@post ||= Admin::Post.find(params[:post_id])
|
44
|
+
end
|
45
|
+
|
46
|
+
def tag_params
|
47
|
+
params.require(:tag).permit(:name)
|
48
|
+
end
|
49
|
+
|
22
50
|
end
|
23
51
|
end
|
24
52
|
end
|
@@ -18,16 +18,21 @@ module Admin
|
|
18
18
|
redirect_to admin_post_titles_path(@title.post) and return
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
respond_to do |format|
|
22
|
+
format.html { render 'index' }
|
23
|
+
format.js
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
def update
|
28
|
+
@post = Admin::Post.find(params[:post_id])
|
25
29
|
@title = Admin::Title.find(params[:id])
|
26
|
-
|
27
|
-
redirect_to admin_post_titles_path(@title.post) and return
|
28
|
-
end
|
30
|
+
@title.update(title_params)
|
29
31
|
|
30
|
-
|
32
|
+
respond_to do |format|
|
33
|
+
format.html { render 'index' }
|
34
|
+
format.js
|
35
|
+
end
|
31
36
|
end
|
32
37
|
|
33
38
|
protected
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Admin
|
2
2
|
class PostsController < Admin::ApplicationController
|
3
3
|
before_action :fetch_post, only: [:show, :edit, :update]
|
4
|
+
helper_method :search_posts_params
|
4
5
|
|
5
6
|
def new
|
6
7
|
@post = Admin::Post.new
|
@@ -9,15 +10,7 @@ module Admin
|
|
9
10
|
def index
|
10
11
|
posts = Admin::Post
|
11
12
|
|
12
|
-
|
13
|
-
@titles = Admin::Title.search_by_name(params[:q])
|
14
|
-
posts = posts.where('id in (?)', @titles.pluck(:post_id).uniq.compact)
|
15
|
-
end
|
16
|
-
|
17
|
-
if params.has_key?(:tid) && !params[:tid].blank?
|
18
|
-
posts = posts.where('? = ANY(posts.tags)', params[:tid])
|
19
|
-
end
|
20
|
-
|
13
|
+
posts = posts.search search_posts_params
|
21
14
|
@posts = posts.order('posts.created_at').includes(:titles)
|
22
15
|
|
23
16
|
respond_to do |format|
|
@@ -75,11 +68,18 @@ module Admin
|
|
75
68
|
|
76
69
|
protected
|
77
70
|
|
71
|
+
def search_posts_params
|
72
|
+
params.require(:posts).permit(:title, :tag, :status)
|
73
|
+
rescue ActionController::ParameterMissing
|
74
|
+
{
|
75
|
+
status: 'all'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
78
79
|
def title_params
|
79
80
|
params.require(:post).permit(:title)
|
80
81
|
end
|
81
82
|
|
82
|
-
|
83
83
|
def post_params
|
84
84
|
params.require(:post).permit(:content, :status, :stylesheet, :javascript, :slug)
|
85
85
|
end
|
@@ -2,10 +2,14 @@ module Admin
|
|
2
2
|
module PostsHelper
|
3
3
|
|
4
4
|
def post_tags(post)
|
5
|
-
|
6
|
-
|
5
|
+
if post.tags.any?
|
6
|
+
tags = post.tags.map(&:name).join(', ') << '.'
|
7
|
+
else
|
8
|
+
tags = 'No tag yet.'
|
7
9
|
end
|
8
|
-
|
10
|
+
|
11
|
+
tags << ' ' << link_to('Change tags', admin_post_tags_path(post), remote: true)
|
12
|
+
content_tag :div, tags.html_safe, class: %w(tags), as: 'Post.Tags'
|
9
13
|
end
|
10
14
|
|
11
15
|
def edit_content_tag(post)
|
@@ -97,4 +97,24 @@ module ApplicationHelper
|
|
97
97
|
content_tag :main, html_options, &block
|
98
98
|
end
|
99
99
|
|
100
|
+
##
|
101
|
+
# Render a popup tag
|
102
|
+
#
|
103
|
+
def popup_tag(partial = nil, html_options = {}, &block)
|
104
|
+
html_options.reverse_merge!({
|
105
|
+
as: 'Popup',
|
106
|
+
id: 'Popup',
|
107
|
+
class: 'popup',
|
108
|
+
overlay: true
|
109
|
+
})
|
110
|
+
|
111
|
+
if html_options.delete(:overlay) == true
|
112
|
+
content_tag :div, class: %w(overlay), as: 'Overlay' do
|
113
|
+
content_tag :div, partial, html_options, &block
|
114
|
+
end
|
115
|
+
else
|
116
|
+
content_tag :div, partial, html_options, &block
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
100
120
|
end
|
@@ -7,6 +7,25 @@ module Admin
|
|
7
7
|
before_save :compile!, prepend: true
|
8
8
|
before_save :excerptize!
|
9
9
|
|
10
|
+
def self.search(params = {})
|
11
|
+
rel = self
|
12
|
+
|
13
|
+
if params.has_key?(:tag) && !params[:tag].blank?
|
14
|
+
rel = rel.where('? = ANY(posts.tags)', params[:tag])
|
15
|
+
end
|
16
|
+
|
17
|
+
if params.has_key?(:title) && !params[:title].blank?
|
18
|
+
titles = Admin::Title.search_by_name(params[:title])
|
19
|
+
rel = rel.where('id in (?)', titles.pluck(:post_id).uniq.compact)
|
20
|
+
end
|
21
|
+
|
22
|
+
if params.has_key?(:status)
|
23
|
+
rel = rel.status(params[:status])
|
24
|
+
end
|
25
|
+
|
26
|
+
rel
|
27
|
+
end
|
28
|
+
|
10
29
|
def publish!(params = {})
|
11
30
|
self.assign_attributes(params)
|
12
31
|
self.published_at = DateTime.now
|
@@ -31,6 +50,10 @@ module Admin
|
|
31
50
|
read_attribute(:content) || ""
|
32
51
|
end
|
33
52
|
|
53
|
+
def status
|
54
|
+
published? ? 'published' : 'draft'
|
55
|
+
end
|
56
|
+
|
34
57
|
private
|
35
58
|
|
36
59
|
def compile!
|
@@ -25,9 +25,17 @@ class Tag < ActiveRecord::Base
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
include PgSearch
|
28
29
|
include ActiveModel::Validations
|
29
30
|
validates_with Tag::Validator
|
30
31
|
|
32
|
+
pg_search_scope :search_by_name,
|
33
|
+
against: :name,
|
34
|
+
:using => {
|
35
|
+
:tsearch => {:prefix => true}
|
36
|
+
}
|
37
|
+
|
38
|
+
|
31
39
|
def ==(other)
|
32
40
|
self.class.table_name == other.class.table_name && self.id == other.id
|
33
41
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<li>
|
2
|
+
<%= content_tag :h3, link_to(post.title, edit_admin_post_path(post)), class: %w(title) %>
|
3
|
+
<%= content_tag :span, class: %w(status) do %>
|
4
|
+
<%= content_tag :span, post.status.capitalize, class: %W(status #{post.status}) %>
|
5
|
+
<% if post.published? %>
|
6
|
+
<%= content_tag :span, time_ago_in_words(post.published_at).capitalize, class: %w(published date) %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
</li>
|
@@ -1,74 +1,34 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
<div class='meta'>
|
4
|
-
<button class='button' as='Editor.Save'>
|
5
|
-
Save
|
6
|
-
<template for='Editor.Save'>
|
7
|
-
<%= content_tag :div, as: 'Editor.Save.Dialog', id: 'SavePost', href: admin_post_path(@post), method: 'PUT' do %>
|
8
|
-
<div class='progress'></div>
|
9
|
-
<p class='message'>
|
10
|
-
Saving...
|
11
|
-
</p>
|
12
|
-
<% end %>
|
13
|
-
</template>
|
14
|
-
</button>
|
1
|
+
<%= content_for :post_buttons do %>
|
2
|
+
<%= content_tag :button do |button|%>
|
15
3
|
|
16
|
-
|
17
|
-
|
18
|
-
<%= link_to 'Tags', admin_post_tags_path(@post), class: %w(button) %>
|
19
|
-
<%= link_to 'Title', admin_post_titles_path(@post), class: %w(button) %>
|
20
|
-
</div>
|
4
|
+
<% button[:class] << 'button' %>
|
5
|
+
<% button[:as] = 'Editor.Save' %>
|
21
6
|
|
7
|
+
Save & Preview
|
22
8
|
|
23
|
-
|
24
|
-
|
25
|
-
<label>Draft</label>
|
26
|
-
<% end %>
|
27
|
-
</nav>
|
28
|
-
<template for='Post.Header'>
|
29
|
-
<%= render 'admin/posts/header/dropping', css: %w(status dropping hidden) %>
|
30
|
-
<%= render 'admin/posts/header/uploading', css: %w(status uploading hidden) %>
|
31
|
-
<%= render 'admin/posts/header/error', css: %w(status error hidden) %>
|
32
|
-
</template>
|
33
|
-
|
34
|
-
<% if @post.header? %>
|
35
|
-
<% header[:style] = "background-image: url(#{@post.header.url});" %>
|
36
|
-
<% end %>
|
37
|
-
<div class='drop'>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<div class='title'>
|
9
|
+
<template for='Editor.Save'>
|
10
|
+
<%= content_tag :div do |div| %>
|
41
11
|
|
42
|
-
|
43
|
-
|
44
|
-
href
|
45
|
-
|
46
|
-
version: "1.1",
|
47
|
-
xmlns: "http://www.w3.org/2000/svg",
|
48
|
-
'xmlns:xlink' => "http://www.w3.org/1999/xlink",
|
49
|
-
x: "0px",
|
50
|
-
y: "0px",
|
51
|
-
viewBox: "0 0 20 20",
|
52
|
-
'enable-background' => "new 0 0 20 20",
|
53
|
-
'xml:space' => "preserve" do |svg| %>
|
12
|
+
<% div[:as] = 'Editor.Save.Dialog' %>
|
13
|
+
<% div[:id] = 'SavePost' %>
|
14
|
+
<% div[:href] = admin_post_path(@post) %>
|
15
|
+
<% div[:method] = 'PUT' %>
|
54
16
|
|
55
|
-
|
56
|
-
|
57
|
-
|
17
|
+
<div class='progress'></div>
|
18
|
+
<p class='message'>
|
19
|
+
Saving...
|
20
|
+
</p>
|
58
21
|
|
59
|
-
<path d="M16,2H4C2.9,2,2,2.9,2,4v12c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C18,2.9,17.1,2,16,2z M13.061,14.789L10,11.729
|
60
|
-
l-3.061,3.06l-1.729-1.728L8.271,10L5.211,6.939l1.729-1.729L10,8.271l3.059-3.061l1.729,1.729L11.729,10l3.06,3.061L13.061,14.789z
|
61
|
-
"/>
|
62
22
|
<% end %>
|
23
|
+
</template>
|
63
24
|
|
64
|
-
|
65
|
-
<input type='file' />
|
66
|
-
<p class='browse'>Set a header image. Either <strong>drop</strong> an image here or <strong>select an image</strong>.</p>
|
67
|
-
</div>
|
68
|
-
|
25
|
+
<% end %>
|
69
26
|
<% end %>
|
70
27
|
|
71
|
-
|
28
|
+
<%= render 'admin/posts/header/base', post: @post %>
|
29
|
+
|
30
|
+
<section id='PostEditContent'>
|
31
|
+
<%= post_tags(@post) %>
|
72
32
|
|
73
33
|
<%= edit_content_tag(@post) do %>
|
74
34
|
<%= h @post.content %>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<%= content_tag :header, as: "Post.Header", id: 'PostHeader', href: admin_post_image_path(post), method: 'post' do |header| %>
|
2
|
+
|
3
|
+
<nav class='actions'>
|
4
|
+
<%= content_tag :div, yield(:post_buttons), class: %w(buttons) %>
|
5
|
+
|
6
|
+
<%= content_tag :div, class: %w(publish state), href: admin_post_toggle_path(@post), method: :put, published: @post.published?, as: 'Post.Publish' do %>
|
7
|
+
<label>Published</label>
|
8
|
+
<label>Draft</label>
|
9
|
+
<% end %>
|
10
|
+
</nav>
|
11
|
+
|
12
|
+
<template for='Post.Header'>
|
13
|
+
<%= render 'admin/posts/header/dropping', css: %w(status dropping hidden) %>
|
14
|
+
<%= render 'admin/posts/header/uploading', css: %w(status uploading hidden) %>
|
15
|
+
<%= render 'admin/posts/header/error', css: %w(status error hidden) %>
|
16
|
+
</template>
|
17
|
+
|
18
|
+
<% if @post.header? %>
|
19
|
+
<% header[:style] = "background-image: url(#{@post.header.url});" %>
|
20
|
+
<% end %>
|
21
|
+
<div class='drop'>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class='title'>
|
25
|
+
|
26
|
+
<%= content_tag :svg,
|
27
|
+
method: 'DELETE',
|
28
|
+
href: admin_post_image_path(@post),
|
29
|
+
class: %w(clear),
|
30
|
+
version: "1.1",
|
31
|
+
xmlns: "http://www.w3.org/2000/svg",
|
32
|
+
'xmlns:xlink' => "http://www.w3.org/1999/xlink",
|
33
|
+
x: "0px",
|
34
|
+
y: "0px",
|
35
|
+
viewBox: "0 0 20 20",
|
36
|
+
'enable-background' => "new 0 0 20 20",
|
37
|
+
'xml:space' => "preserve" do |svg| %>
|
38
|
+
|
39
|
+
<% if !@post.header? %>
|
40
|
+
<% svg.css << 'hidden' %>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<path d="M16,2H4C2.9,2,2,2.9,2,4v12c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C18,2.9,17.1,2,16,2z M13.061,14.789L10,11.729
|
44
|
+
l-3.061,3.06l-1.729-1.728L8.271,10L5.211,6.939l1.729-1.729L10,8.271l3.059-3.061l1.729,1.729L11.729,10l3.06,3.061L13.061,14.789z
|
45
|
+
"/>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<%= link_to @post.title, admin_post_titles_path(@post), class: %w(title), remote: true, as: 'Post.Title' %>
|
49
|
+
<input type='file' />
|
50
|
+
<p class='browse'>Set a header image. Either <strong>drop</strong> an image here or <strong>select an image</strong>.</p>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<% end %>
|
54
|
+
|