fuel 0.3.34 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/fuel/application.js +2 -0
- data/app/assets/javascripts/fuel/posts.js.erb +88 -0
- data/app/assets/javascripts/fuel/showdown.js +4 -0
- data/app/assets/javascripts/fuel/to-markdown.js +759 -0
- data/app/assets/stylesheets/fuel/_page-layout.scss +0 -1
- data/app/assets/stylesheets/fuel/base/_base.scss +2 -1
- data/app/assets/stylesheets/fuel/base/_syntax.scss.erb +15 -0
- data/app/assets/stylesheets/fuel/components/_editor.scss +12 -0
- data/app/assets/stylesheets/fuel/components/_forms.scss +1 -1
- data/app/controllers/fuel/admin/posts_controller.rb +5 -2
- data/app/helpers/fuel/posts_helper.rb +4 -0
- data/app/models/fuel/post.rb +27 -4
- data/app/views/fuel/admin/posts/_editor.html.erb +4 -2
- data/app/views/fuel/admin/posts/_form.html.erb +17 -3
- data/app/views/fuel/admin/posts/edit.html.erb +1 -2
- data/config/routes.rb +1 -1
- data/db/migrate/20151014140731_add_format_to_fuel_posts.rb +5 -0
- data/lib/fuel.rb +4 -0
- data/lib/fuel/html.rb +3 -0
- data/lib/fuel/version.rb +1 -1
- data/lib/tasks/fuel_tasks.rake +1 -1
- metadata +36 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%= Rouge::Themes::Github.render(scope: '.highlight') %>
|
|
2
|
+
|
|
3
|
+
.highlight {
|
|
4
|
+
background-color: white;
|
|
5
|
+
border: thin solid $grey-base;
|
|
6
|
+
padding: 10px 20px;
|
|
7
|
+
overflow-x: auto;
|
|
8
|
+
word-break: inherit;
|
|
9
|
+
word-wrap: inherit;
|
|
10
|
+
letter-spacing: 0.2px;
|
|
11
|
+
|
|
12
|
+
span {
|
|
13
|
+
line-height: 25px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -42,4 +42,16 @@ $editor-button-transition: all 0.2s ease-in-out;
|
|
|
42
42
|
cursor: pointer;
|
|
43
43
|
color: $blue-base;
|
|
44
44
|
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
.preview-link-area {
|
|
49
|
+
@include row();
|
|
50
|
+
@include rem(margin-top, 10px);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.preview--link {
|
|
54
|
+
@extend .link-primary;
|
|
55
|
+
@include font-type($primary-sans-serif, normal, 700);
|
|
56
|
+
@include rem(margin-top, 15px);
|
|
45
57
|
}
|
|
@@ -50,8 +50,11 @@ module Fuel
|
|
|
50
50
|
|
|
51
51
|
def preview
|
|
52
52
|
@content = params[:fuel_post][:content]
|
|
53
|
+
content = Fuel::Post.new.to_html(@content)
|
|
54
|
+
html = render_to_string partial: "fuel/admin/posts/content", locals: { content: content }
|
|
55
|
+
|
|
53
56
|
respond_to do |format|
|
|
54
|
-
format.
|
|
57
|
+
format.json { render json: { html: html } }
|
|
55
58
|
end
|
|
56
59
|
end
|
|
57
60
|
|
|
@@ -62,7 +65,7 @@ module Fuel
|
|
|
62
65
|
private
|
|
63
66
|
|
|
64
67
|
def post_params
|
|
65
|
-
params.require(:fuel_post).permit(:tag, :author_id, :content, :title, :teaser, :featured_image, :published, :published_at)
|
|
68
|
+
params.require(:fuel_post).permit(:tag, :author_id, :content, :title, :teaser, :featured_image, :published, :published_at, :format)
|
|
66
69
|
end
|
|
67
70
|
|
|
68
71
|
def update_published_at
|
data/app/models/fuel/post.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Fuel
|
|
|
8
8
|
belongs_to :author
|
|
9
9
|
|
|
10
10
|
if Rails.version[0].to_i < 4
|
|
11
|
-
attr_accessible :tag, :author_id, :content, :title, :teaser, :featured_image, :seo_title, :seo_description, :published_at
|
|
11
|
+
attr_accessible :tag, :author_id, :content, :title, :teaser, :featured_image, :seo_title, :seo_description, :published_at, :format
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
if Fuel.configuration.aws_bucket
|
|
@@ -25,6 +25,13 @@ module Fuel
|
|
|
25
25
|
scope :published, -> { where(published: true) }
|
|
26
26
|
scope :recent, -> { order("published_at DESC").order("created_at DESC") }
|
|
27
27
|
|
|
28
|
+
module Formats
|
|
29
|
+
MARKDOWN = "markdown"
|
|
30
|
+
HTML = "html"
|
|
31
|
+
DISPLAY = { HTML => "HTML", MARKDOWN => "Markdown" }
|
|
32
|
+
DEFAULT = HTML
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
def s3_credentials
|
|
29
36
|
{:bucket => Fuel.configuration.aws_bucket, :access_key_id => Fuel.configuration.aws_access_key, :secret_access_key => Fuel.configuration.aws_secret_access_key}
|
|
30
37
|
end
|
|
@@ -57,11 +64,27 @@ module Fuel
|
|
|
57
64
|
teaser.present? ? teaser : content
|
|
58
65
|
end
|
|
59
66
|
|
|
60
|
-
def to_html
|
|
61
|
-
markdown = Redcarpet::Markdown.new(
|
|
62
|
-
:autolink => true, :space_after_headers => true)
|
|
67
|
+
def to_html(content = raw_content)
|
|
68
|
+
markdown = Redcarpet::Markdown.new(Fuel::Html,
|
|
69
|
+
:autolink => true, :space_after_headers => true, fenced_code_blocks: true, disable_indented_code_blocks: true)
|
|
63
70
|
raw markdown.render(content)
|
|
64
71
|
end
|
|
65
72
|
|
|
73
|
+
def content
|
|
74
|
+
markdown? ? to_html(raw_content) : raw_content
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def raw_content
|
|
78
|
+
attributes["content"]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def html?
|
|
82
|
+
format == Formats::HTML
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def markdown?
|
|
86
|
+
format == Formats::MARKDOWN
|
|
87
|
+
end
|
|
88
|
+
|
|
66
89
|
end
|
|
67
90
|
end
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
$(function() {
|
|
3
3
|
$body = $("body");
|
|
4
4
|
|
|
5
|
-
var editorId = "
|
|
5
|
+
var editorId = "fuel_post_content_html";
|
|
6
6
|
var editorStylesheetPath = "<%= stylesheet_path('fuel/wysihtml') %>";
|
|
7
7
|
var editorSubmitUrl = '<%= s3_direct_post.url %>';
|
|
8
8
|
var editorFormData = JSON.parse('<%= s3_direct_post.fields.to_json.html_safe %>');
|
|
9
9
|
var editorHostUrl = '//<%= @s3_direct_post.url.host %>/';
|
|
10
10
|
|
|
11
11
|
if ($("body").hasClass("posts-controller")){
|
|
12
|
-
|
|
12
|
+
wysihtml5Editor = new wysihtml5.Editor(editorId, { // id of textarea element
|
|
13
13
|
toolbar: "editor", // id of toolbar element
|
|
14
14
|
parserRules: wysihtml5ParserRules,
|
|
15
15
|
stylesheets: editorStylesheetPath
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
<% end %>
|
|
70
|
+
|
|
71
|
+
setCorrectEditor();
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
});
|
|
@@ -36,6 +36,12 @@
|
|
|
36
36
|
<%= f.label :teaser, 'Post Tease' %>
|
|
37
37
|
<%= f.text_area :teaser, class: 'tease' %>
|
|
38
38
|
</fieldset>
|
|
39
|
+
<fieldset>
|
|
40
|
+
<div class="form-group-half">
|
|
41
|
+
<%= f.label :format %>
|
|
42
|
+
<%= f.select :format, options_for_select(format_options, selected: f.object.format) %>
|
|
43
|
+
</div>
|
|
44
|
+
</fieldset>
|
|
39
45
|
</div>
|
|
40
46
|
<div class="form-container--right card">
|
|
41
47
|
<%= f.label :featured_image, 'Featured Image' %>
|
|
@@ -45,7 +51,7 @@
|
|
|
45
51
|
<%= f.file_field :featured_image %>
|
|
46
52
|
</div>
|
|
47
53
|
<div class="form-container--full">
|
|
48
|
-
<fieldset>
|
|
54
|
+
<fieldset class="editor-area" data-format="html">
|
|
49
55
|
<%= f.label :content, 'Your Post' %>
|
|
50
56
|
<ul id="editor" style="display: none;">
|
|
51
57
|
<li class="editor-button" data-wysihtml5-command="bold" title="CTRL+B"><i class="fa fa-bold"></i></li>
|
|
@@ -96,7 +102,14 @@
|
|
|
96
102
|
</fieldset>
|
|
97
103
|
</div>
|
|
98
104
|
</ul>
|
|
99
|
-
<%= f.text_area :content, class: 'post' %>
|
|
105
|
+
<%= f.text_area :content, class: 'post', id: "fuel_post_content_html" %>
|
|
106
|
+
</fieldset>
|
|
107
|
+
<fieldset class="editor-area" data-format="markdown">
|
|
108
|
+
<%= f.label :content, 'Your Post' %>
|
|
109
|
+
<%= f.text_area :content, value: f.object.raw_content, class: 'post', id: "fuel_post_content_markdown" %>
|
|
110
|
+
<div class="preview-link-area">
|
|
111
|
+
<%= link_to 'Preview Post', '#', class: "trigger-preview preview--link", data: { url: fuel.admin_posts_preview_path } %>
|
|
112
|
+
</div>
|
|
100
113
|
</fieldset>
|
|
101
114
|
<fieldset>
|
|
102
115
|
<%= f.submit (action_name == "edit" ? "Update Post" : "Create Post"), class: 'button button--secondary' %>
|
|
@@ -105,4 +118,5 @@
|
|
|
105
118
|
<% end %>
|
|
106
119
|
</fieldset>
|
|
107
120
|
</div>
|
|
108
|
-
<% end %>
|
|
121
|
+
<% end %>
|
|
122
|
+
<%= render partial: 'post_preview' %>
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
<section class="page">
|
|
3
3
|
<header class="page-header">
|
|
4
4
|
<h5 class="page-header--title"><span>Post</span>: <%= @post.title %></h5>
|
|
5
|
-
<%= link_to '
|
|
5
|
+
<%= link_to 'View Post', post_path(@post), class: "page-header--link", target: "_blank" %>
|
|
6
6
|
</header>
|
|
7
7
|
<div class="page-area">
|
|
8
8
|
<%= render 'form' %>
|
|
9
|
-
<%= render partial: 'post_preview' %>
|
|
10
9
|
</div>
|
|
11
10
|
</section>
|
data/config/routes.rb
CHANGED
|
@@ -6,7 +6,7 @@ Fuel::Engine.routes.draw do
|
|
|
6
6
|
# admin namespace is listed first intentionally
|
|
7
7
|
namespace :admin do
|
|
8
8
|
root to: 'posts#index'
|
|
9
|
-
|
|
9
|
+
post "posts/preview" => 'posts#preview'
|
|
10
10
|
get "posts/:slug/posts/preview" => 'posts#preview'
|
|
11
11
|
resources :posts do
|
|
12
12
|
member do
|
data/lib/fuel.rb
CHANGED
data/lib/fuel/html.rb
ADDED
data/lib/fuel/version.rb
CHANGED
data/lib/tasks/fuel_tasks.rake
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fuel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Francis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -192,6 +192,34 @@ dependencies:
|
|
|
192
192
|
- - ">="
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
|
+
- !ruby/object:Gem::Dependency
|
|
196
|
+
name: github-markup
|
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
|
198
|
+
requirements:
|
|
199
|
+
- - ">="
|
|
200
|
+
- !ruby/object:Gem::Version
|
|
201
|
+
version: '0'
|
|
202
|
+
type: :runtime
|
|
203
|
+
prerelease: false
|
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - ">="
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: '0'
|
|
209
|
+
- !ruby/object:Gem::Dependency
|
|
210
|
+
name: rouge
|
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '0'
|
|
216
|
+
type: :runtime
|
|
217
|
+
prerelease: false
|
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - ">="
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '0'
|
|
195
223
|
- !ruby/object:Gem::Dependency
|
|
196
224
|
name: sqlite3
|
|
197
225
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -425,7 +453,9 @@ files:
|
|
|
425
453
|
- app/assets/javascripts/fuel/facebook.js
|
|
426
454
|
- app/assets/javascripts/fuel/pickadate-datepicker.js
|
|
427
455
|
- app/assets/javascripts/fuel/posts.js.erb
|
|
456
|
+
- app/assets/javascripts/fuel/showdown.js
|
|
428
457
|
- app/assets/javascripts/fuel/sliding-panel.js
|
|
458
|
+
- app/assets/javascripts/fuel/to-markdown.js
|
|
429
459
|
- app/assets/javascripts/fuel/wysihtml5x-toolbar.min.js
|
|
430
460
|
- app/assets/stylesheets/fuel/_page-layout.scss
|
|
431
461
|
- app/assets/stylesheets/fuel/_post-editor.scss
|
|
@@ -433,6 +463,7 @@ files:
|
|
|
433
463
|
- app/assets/stylesheets/fuel/application.css.scss
|
|
434
464
|
- app/assets/stylesheets/fuel/base/_base.scss
|
|
435
465
|
- app/assets/stylesheets/fuel/base/_layout.scss
|
|
466
|
+
- app/assets/stylesheets/fuel/base/_syntax.scss.erb
|
|
436
467
|
- app/assets/stylesheets/fuel/base/_typography.scss
|
|
437
468
|
- app/assets/stylesheets/fuel/components/_alerts.scss
|
|
438
469
|
- app/assets/stylesheets/fuel/components/_animations.scss
|
|
@@ -502,6 +533,7 @@ files:
|
|
|
502
533
|
- db/migrate/20150604155028_add_published_at_to_fuel_posts.rb
|
|
503
534
|
- db/migrate/20150604161900_remove_posted_at_from_fuel_posts.rb
|
|
504
535
|
- db/migrate/20150608221309_add_start_date_to_authors.rb
|
|
536
|
+
- db/migrate/20151014140731_add_format_to_fuel_posts.rb
|
|
505
537
|
- lib/blog_importer.rb
|
|
506
538
|
- lib/example_author.rb
|
|
507
539
|
- lib/fuel.rb
|
|
@@ -509,6 +541,7 @@ files:
|
|
|
509
541
|
- lib/fuel/aws.rb
|
|
510
542
|
- lib/fuel/configuration.rb
|
|
511
543
|
- lib/fuel/engine.rb
|
|
544
|
+
- lib/fuel/html.rb
|
|
512
545
|
- lib/fuel/version.rb
|
|
513
546
|
- lib/generators/fuel/install_generator.rb
|
|
514
547
|
- lib/generators/fuel/views_generator.rb
|
|
@@ -598,7 +631,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
598
631
|
version: '0'
|
|
599
632
|
requirements: []
|
|
600
633
|
rubyforge_project:
|
|
601
|
-
rubygems_version: 2.
|
|
634
|
+
rubygems_version: 2.4.8
|
|
602
635
|
signing_key:
|
|
603
636
|
specification_version: 4
|
|
604
637
|
summary: Fuel is a dead simple blogging gem (mountable engine)
|