smithycms 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Smithy CMS
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/smithycms.png)](http://badge.fury.io/rb/smithycms)
3
4
  [![Code Climate](https://codeclimate.com/github/sterrym/smithy.png)](https://codeclimate.com/github/sterrym/smithy)
4
5
 
5
6
  ## Templates & Includes
@@ -1,7 +1,9 @@
1
- var ace_edit = function(id, template_type) {
2
- $('#template_content_editor-'+id).show();
3
- var editor = ace.edit('template_content_editor-'+id);
4
- var textarea = $('textarea[id="template_content-'+id+'"]').hide();
1
+ var ace_edit = function(id, template_type, name) {
2
+ if (!name) { name = 'template_content' }
3
+ var editor_name = name + '_editor-' + id
4
+ $('#'+editor_name).show();
5
+ var editor = ace.edit(editor_name);
6
+ var textarea = $('textarea[id="' + name + '-'+id+'"]').hide();
5
7
  var session = editor.getSession();
6
8
  session.setMode("ace/mode/" + template_type);
7
9
  session.setValue(textarea.val());
@@ -5,7 +5,8 @@ textarea[name="content[content]"],
5
5
  #template_content,
6
6
  #content_content { height:100%; width:97%; }
7
7
 
8
- .template_content_editor {
8
+ .template_content_editor,
9
+ .ace_editor {
9
10
  display:none;
10
11
  min-height:40em;
11
12
  width:97%;
@@ -14,6 +14,19 @@ module Smithy
14
14
  form_builder.hidden_field(:_destroy) + @template.link_to(name, "javascript:void(0)", :class => "remove_nested_fields")
15
15
  end
16
16
 
17
+ def render_markdown_input(fieldname, editor_name, form_builder)
18
+ content_for(:javascript) do
19
+ javascript_tag do
20
+ raw("var editor = ace_edit('#{form_builder.object.id || 'new'}', 'markdown', '#{editor_name}');\n") +
21
+ raw("editor.renderer.setShowGutter(false);")
22
+ end
23
+ end
24
+ hint = "Use markdown syntax for formatting. You can also use HTML directly. <a href=\"#{guide_path('markdown')}\" data-toggle=\"remote-load\" data-target=\"#content-guide\">See our markdown syntax reference</a>".html_safe
25
+ form_builder.input(fieldname, :as => :text, :input_html => { :class => "span12", :id => "#{editor_name}-#{form_builder.object.id || 'new'}" }, :hint => hint) +
26
+ content_tag(:div, nil, :id => "#{editor_name}_editor-#{form_builder.object.id || 'new'}", :class => "#{editor_name}_editor ace_editor") +
27
+ content_tag(:div, nil, :id => 'content-guide')
28
+ end
29
+
17
30
  private
18
31
  def model_object(form_builder, association)
19
32
  model_object = form_builder.object.class.reflect_on_association(association).klass.new
@@ -1,3 +1,3 @@
1
1
  module Smithy
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smithycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -667,7 +667,8 @@ dependencies:
667
667
  - - ! '>='
668
668
  - !ruby/object:Gem::Version
669
669
  version: '0'
670
- description: Better than the rest.
670
+ description: Smithy CMS is a Rails Engine built to manage your content easily and
671
+ play nicely with other parts of your app.
671
672
  email:
672
673
  - tim@tag.ca
673
674
  executables: []
@@ -1114,7 +1115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1114
1115
  version: '0'
1115
1116
  segments:
1116
1117
  - 0
1117
- hash: 1273625855759782898
1118
+ hash: 737641260117366301
1118
1119
  requirements: []
1119
1120
  rubyforge_project:
1120
1121
  rubygems_version: 1.8.23