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 CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- crowdblog (0.0.12)
12
+ crowdblog (0.0.13)
13
13
  backbone-rails
14
14
  carrierwave
15
15
  devise
@@ -1,21 +1,24 @@
1
1
  h2 <%= (if @isNew then 'New' else 'Edit') %> Post
2
2
 
3
- = form_tag '/', class: 'form-horizontal' do
3
+ = form_tag '/' do
4
4
  fieldset
5
- .control-group.title
6
- = label_tag 'post_title', 'Title', class: 'control-label'
7
- .controls
8
- = text_field_tag 'post_title', "<%= @post.title %>".html_safe, class: 'input-xlarge span7'
9
- span.help-inline.title
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
- .control-group.body
12
- = label_tag 'post_body', 'Body', class: 'control-label'
13
- .controls
14
- = text_area_tag 'post_body', "<%= @post.body %>".html_safe, class: 'span9', rows: 30
15
- span.help-inline= link_to 'Markdown syntax', 'http://daringfireball.net/projects/markdown/syntax', target: '_BLANK'
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(),
@@ -5,6 +5,7 @@
5
5
  *= require 'backbone'
6
6
  *= require 'swfobject'
7
7
  *= require 'jquery.uploadify'
8
+ *= require 'markdown'
8
9
  *= require_self
9
10
  *= require_tree ./crowdblog/models
10
11
  *= require_tree ./crowdblog/views
@@ -1,3 +1,13 @@
1
- // Place all the styles related to the admin/posts controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: http://sass-lang.com/
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
 
@@ -1,3 +1,3 @@
1
1
  module Crowdblog
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end