crowdblog 0.0.12 → 0.0.13
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.
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/crowdblog/templates/posts/edit.jst.eco.slim +17 -14
- data/app/assets/javascripts/crowdblog/views/posts/edit_post_view.js.coffee +5 -0
- data/app/assets/javascripts/crowdblog.js +1 -0
- data/app/assets/stylesheets/crowdblog/posts.css.scss +13 -3
- data/features/posts/manage.feature +5 -0
- data/features/step_definitions/posts_steps.rb +10 -0
- data/lib/crowdblog/version.rb +1 -1
- data/vendor/assets/javascripts/markdown.js +1470 -0
- metadata +181 -55
data/Gemfile.lock
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
h2 <%= (if @isNew then 'New' else 'Edit') %> Post
|
2
2
|
|
3
|
-
= form_tag '/'
|
3
|
+
= form_tag '/' do
|
4
4
|
fieldset
|
5
|
-
.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
.fields.span5
|
6
|
+
.control-group.title
|
7
|
+
= label_tag 'post_title', 'Title', class: 'control-label'
|
8
|
+
.controls
|
9
|
+
= text_field_tag 'post_title', "<%= @post.title %>".html_safe, class: 'input-xlarge span5'
|
10
|
+
span.help-inline.title
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
.control-group.body
|
13
|
+
= label_tag 'post_body', 'Body', class: 'control-label'
|
14
|
+
.controls
|
15
|
+
= text_area_tag 'post_body', "<%= @post.body %>".html_safe, class: 'span5', rows: 30
|
16
|
+
span.help-inline= link_to 'Markdown syntax', 'http://daringfireball.net/projects/markdown/syntax', target: '_BLANK'
|
17
|
+
|
18
|
+
#post_preview.span6
|
16
19
|
|
17
20
|
| <% unless @isNew: %>
|
18
|
-
#attachments.row
|
21
|
+
#attachments.row-fluid.clear
|
19
22
|
h2 Attachments
|
20
23
|
.span8.attachment-list
|
21
24
|
| <% for asset in @post.assets: %>
|
@@ -25,9 +28,9 @@ h2 <%= (if @isNew then 'New' else 'Edit') %> Post
|
|
25
28
|
#uploader
|
26
29
|
|
27
30
|
| <% end %>
|
28
|
-
.form-actions
|
31
|
+
.form-actions.clear
|
29
32
|
.row
|
30
33
|
.span1
|
31
34
|
button.btn.btn-primary.update Save
|
32
35
|
.span1
|
33
|
-
button.btn.btn-danger.cancel Cancel
|
36
|
+
button.btn.btn-danger.cancel Cancel
|
@@ -1,6 +1,7 @@
|
|
1
1
|
$ ->
|
2
2
|
PostsApp.EditPostView = Backbone.View.extend
|
3
3
|
events:
|
4
|
+
'keyup #post_body' : 'updatePreview'
|
4
5
|
'click .cancel' : 'cancelPost'
|
5
6
|
'click .update' : 'updatePost'
|
6
7
|
|
@@ -10,6 +11,7 @@ $ ->
|
|
10
11
|
render: ->
|
11
12
|
this.model.fetch()
|
12
13
|
this.$el.html(this.template({post: this.model.toJSON(), isNew: this.model.isNew()}))
|
14
|
+
@updatePreview()
|
13
15
|
this
|
14
16
|
|
15
17
|
cancelPost: (e) ->
|
@@ -30,6 +32,9 @@ $ ->
|
|
30
32
|
this.$('.control-group.' + key).addClass('error')
|
31
33
|
this.$('.' + key + '.help-inline').html(value.join(','))
|
32
34
|
|
35
|
+
updatePreview: ->
|
36
|
+
@.$('#post_preview').html markdown.toHTML(@.$('#post_body').val())
|
37
|
+
|
33
38
|
extractData: ->
|
34
39
|
{
|
35
40
|
'body' : this.$('#post_body').val(),
|
@@ -1,3 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/* Edit post */
|
2
|
+
#post_preview {
|
3
|
+
position: relative;
|
4
|
+
top: 110px;
|
5
|
+
height: 550px;
|
6
|
+
overflow-y: scroll;
|
7
|
+
padding: 0 25px 0 10px;
|
8
|
+
background: #EBEBEB;
|
9
|
+
}
|
10
|
+
|
11
|
+
form .clear {
|
12
|
+
clear: both;
|
13
|
+
}
|
@@ -29,3 +29,8 @@ Feature: Manage Posts
|
|
29
29
|
Scenario: Navigate to Edit Post
|
30
30
|
When I navigate to Edit Post
|
31
31
|
Then I should see the Edit Post page
|
32
|
+
|
33
|
+
Scenario: Post Preview
|
34
|
+
Given I am on the New Post page
|
35
|
+
When I type in the post body field
|
36
|
+
Then I should see its markdown preview
|
@@ -55,10 +55,20 @@ When /^(?:|I )write a Post$/ do
|
|
55
55
|
click_button 'Save'
|
56
56
|
end
|
57
57
|
|
58
|
+
When /^I type in the post body field$/ do
|
59
|
+
fill_in 'Body', with: "# This is a title\n## And a subtitle"
|
60
|
+
end
|
58
61
|
|
59
62
|
#*****************
|
60
63
|
# THEN steps
|
61
64
|
#-----------------
|
65
|
+
|
66
|
+
Then /^I should see its markdown preview$/ do
|
67
|
+
preview = find('#post_preview')
|
68
|
+
preview.find('h1').should have_content('This is a title')
|
69
|
+
preview.find('h2').should have_content('And a subtitle')
|
70
|
+
end
|
71
|
+
|
62
72
|
Then /^(?:|I )should not see the Test Post$/ do
|
63
73
|
posts = page.find('#posts table')
|
64
74
|
|
data/lib/crowdblog/version.rb
CHANGED