smithycms 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
var ace_edit = function(id, template_type) {
|
2
|
-
|
3
|
-
var
|
4
|
-
|
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());
|
@@ -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
|
data/lib/smithy/version.rb
CHANGED
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.
|
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:
|
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:
|
1118
|
+
hash: 737641260117366301
|
1118
1119
|
requirements: []
|
1119
1120
|
rubyforge_project:
|
1120
1121
|
rubygems_version: 1.8.23
|