bcms_garment_district 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,4 +12,3 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
- //= require_tree .
@@ -0,0 +1,13 @@
1
+ $(document).ready ->
2
+ $("[name='preview']").click (event) ->
3
+ event.preventDefault()
4
+ # $('#preview').html $("[name='markdown_block[content]']").val()
5
+ url = $(@).attr 'url'
6
+ form = $(@).parents('form')
7
+ data = {
8
+ markdown_block: {
9
+ content: form.find("[name='markdown_block[content]']").val()
10
+ }
11
+ }
12
+ $('#markdown_preview').load url, data
13
+
@@ -9,5 +9,4 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
- *= require_tree .
13
12
  */
@@ -0,0 +1,17 @@
1
+ #markdown_preview {
2
+ // Adapted from Simple Base Stylesheet - http://fvsch.com/code/base-stylesheet/
3
+
4
+ margin: 0; padding: 0; font-size: 100%; line-height: 1.5;
5
+
6
+ article, aside, figcaption, figure, footer, header, nav, section {display: block;}
7
+ h1, h2, h3, h4 {margin: 1em 0 .5em; line-height: 1.25;}
8
+ h1 {font-size: 2em;}
9
+ h2 {font-size: 1.5em;}
10
+ h3 {font-size: 1.2em;}
11
+ ul, ol {margin: 1em 0; padding-left: 40px;}
12
+ ul {list-style-type: disc;}
13
+ ol {list-style-type: decimal;}
14
+ p, figure {margin: 1em 0;}
15
+ a img {border: none;}
16
+ sup, sub {line-height: 0;}
17
+ }
@@ -2,5 +2,17 @@ require_dependency "bcms_garment_district/application_controller"
2
2
 
3
3
  module BcmsGarmentDistrict
4
4
  class MarkdownBlocksController < Cms::ContentBlockController
5
+ before_filter :check_preview, :only => [:create, :update]
6
+
7
+ private
8
+
9
+ def check_preview
10
+ if params[:preview]
11
+ @content_block = MarkdownBlock.new params[:markdown_block]
12
+ render :template => 'bcms_garment_district/markdown_blocks/render'
13
+ else
14
+ true
15
+ end
16
+ end
5
17
  end
6
18
  end
@@ -0,0 +1,18 @@
1
+ require_dependency "bcms_garment_district/application_controller"
2
+
3
+ module BcmsGarmentDistrict
4
+ class PreviewsController < ApplicationController
5
+
6
+ layout :if_not_xhr
7
+
8
+ def create
9
+ @markdown = MarkdownBlock.new params[:markdown_block]
10
+ end
11
+
12
+ private
13
+
14
+ def if_not_xhr
15
+ !request.xhr?
16
+ end
17
+ end
18
+ end
@@ -1,2 +1,9 @@
1
1
  <%= f.cms_text_field :name %>
2
- <%= f.cms_text_area :content %>
2
+ <%= f.cms_text_area :content %>
3
+ <%= lt_button_wrapper button_tag 'Preview', :name => :preview, :value => true, :url => preview_path %>
4
+ <div id='markdown_preview'></div>
5
+
6
+ <%- content_for :html_head do %>
7
+ <%= stylesheet_link_tag 'bcms_garment_district/markdown_blocks' %>
8
+ <%= javascript_include_tag 'bcms_garment_district/markdown_blocks' %>
9
+ <% end %>
@@ -1 +1 @@
1
- <%= @content_block.to_html %>
1
+ <%= render 'bcms_garment_district/shared/markdown_block', :markdown => @content_block %>
@@ -0,0 +1 @@
1
+ <%= render 'bcms_garment_district/shared/markdown_block', :markdown => @markdown %>
@@ -1,3 +1,4 @@
1
1
  BcmsGarmentDistrict::Engine.routes.draw do
2
2
  content_blocks :markdown_blocks
3
+ resource :preview, :only => :create
3
4
  end
@@ -1,3 +1,3 @@
1
1
  module BcmsGarmentDistrict
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_garment_district
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-02 00:00:00.000000000 Z
12
+ date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: browsercms
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.5.6
30
+ - !ruby/object:Gem::Dependency
31
+ name: coffee-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: maruku
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +75,38 @@ dependencies:
59
75
  - - ! '>='
60
76
  - !ruby/object:Gem::Version
61
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: capybara-firebug
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: capybara-webkit
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
62
110
  - !ruby/object:Gem::Dependency
63
111
  name: guard-cucumber
64
112
  requirement: !ruby/object:Gem::Requirement
@@ -243,16 +291,19 @@ extensions: []
243
291
  extra_rdoc_files: []
244
292
  files:
245
293
  - app/assets/javascripts/bcms_garment_district/application.js
246
- - app/assets/javascripts/bcms_garment_district/markdown_blocks.js
294
+ - app/assets/javascripts/bcms_garment_district/markdown_blocks.js.coffee
247
295
  - app/assets/stylesheets/bcms_garment_district/application.css
248
- - app/assets/stylesheets/bcms_garment_district/markdown_blocks.css
296
+ - app/assets/stylesheets/bcms_garment_district/markdown_blocks.css.scss
249
297
  - app/controllers/bcms_garment_district/application_controller.rb
250
298
  - app/controllers/bcms_garment_district/markdown_blocks_controller.rb
299
+ - app/controllers/bcms_garment_district/previews_controller.rb
251
300
  - app/helpers/bcms_garment_district/application_helper.rb
252
301
  - app/helpers/bcms_garment_district/markdown_blocks_helper.rb
253
302
  - app/models/bcms_garment_district/markdown_block.rb
254
303
  - app/views/bcms_garment_district/markdown_blocks/_form.html.erb
255
304
  - app/views/bcms_garment_district/markdown_blocks/render.html.erb
305
+ - app/views/bcms_garment_district/previews/create.html.erb
306
+ - app/views/bcms_garment_district/shared/_markdown_block.html.erb
256
307
  - app/views/layouts/bcms_garment_district/application.html.erb
257
308
  - config/cucumber.yml
258
309
  - config/routes.rb
@@ -284,7 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
284
335
  version: '0'
285
336
  segments:
286
337
  - 0
287
- hash: -1739672893235067906
338
+ hash: 1395356927304004506
288
339
  required_rubygems_version: !ruby/object:Gem::Requirement
289
340
  none: false
290
341
  requirements:
@@ -293,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
344
  version: '0'
294
345
  segments:
295
346
  - 0
296
- hash: -1739672893235067906
347
+ hash: 1395356927304004506
297
348
  requirements: []
298
349
  rubyforge_project:
299
350
  rubygems_version: 1.8.25
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */