atomic_cms 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc +16 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +243 -0
- data/README.md +175 -0
- data/Rakefile +15 -0
- data/app/assets/images/icon_add_component.png +0 -0
- data/app/assets/images/icon_add_component@2x.png +0 -0
- data/app/assets/javascripts/atomic_cms.js +286 -0
- data/app/assets/stylesheets/atomic_cms.css.scss +135 -0
- data/app/components/array_component.rb +11 -0
- data/app/controllers/atomic_cms/components_controller.rb +7 -0
- data/app/controllers/atomic_cms/media_controller.rb +18 -0
- data/app/controllers/concerns/media_scrubber.rb +28 -0
- data/app/helpers/component_helper.rb +21 -0
- data/app/models/atomic_cms/image.rb +6 -0
- data/app/models/atomic_cms/media.rb +12 -0
- data/app/views/components/_children_field.html.slim +6 -0
- data/app/views/components/_edit.html.slim +2 -0
- data/app/views/components/_file_field.slim +5 -0
- data/app/views/components/_markdown_field.slim +5 -0
- data/app/views/components/_select_field.slim +5 -0
- data/app/views/components/_template_field.slim +1 -0
- data/app/views/components/_text_area_field.slim +4 -0
- data/app/views/components/_text_field.slim +3 -0
- data/atomic_cms.gemspec +30 -0
- data/bin/rails +12 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20151013175254_create_media.rb +9 -0
- data/lib/generators/atomic_cms/assets/assets_generator.rb +33 -7
- data/lib/generators/atomic_cms/scaffold/scaffold_generator.rb +76 -0
- data/lib/generators/atomic_cms/templates/admin.erb +79 -0
- data/lib/generators/atomic_cms/templates/controller.erb +16 -0
- data/lib/generators/atomic_cms/templates/model.erb +4 -0
- data/lib/generators/atomic_cms/templates/show.html.slim +1 -0
- data/vendor/assets/javascripts/angular-markdown.js +19 -0
- data/vendor/assets/javascripts/showdown.min.js +2 -0
- metadata +40 -21
@@ -1,22 +1,48 @@
|
|
1
1
|
module AtomicCms
|
2
2
|
module Generators
|
3
3
|
class AssetsGenerator < Rails::Generators::Base
|
4
|
+
def install_bourbon
|
5
|
+
gem "bourbon", "~> 4.2.6"
|
6
|
+
end
|
7
|
+
|
8
|
+
def install_neat
|
9
|
+
gem "neat", "~> 1.7.2"
|
10
|
+
end
|
11
|
+
|
12
|
+
def install_bitters
|
13
|
+
gem "bitters", "~> 1.1.0"
|
14
|
+
run "bitters install --path ./app/assets/stylesheets"
|
15
|
+
end
|
16
|
+
|
17
|
+
def install_angular
|
18
|
+
gem "angularjs-rails", "~> 1.3", "< 1.4"
|
19
|
+
end
|
20
|
+
|
4
21
|
def initialize_active_admin_javascript
|
5
|
-
javascript_asset =
|
22
|
+
javascript_asset = "app/assets/javascripts/active_admin.js.coffee"
|
6
23
|
entries = [
|
7
|
-
|
8
|
-
|
9
|
-
|
24
|
+
"#= require angular",
|
25
|
+
"#= require angular-sanitize",
|
26
|
+
"#= require atomic_cms"
|
10
27
|
]
|
11
28
|
append_to_file( asset_file: javascript_asset, entries: entries )
|
12
29
|
end
|
13
30
|
|
14
31
|
def initialize_active_admin_scss
|
15
|
-
scss_asset =
|
32
|
+
scss_asset = "app/assets/stylesheets/active_admin.scss"
|
16
33
|
entries = [
|
17
|
-
'@import "
|
34
|
+
'@import "bourbon";',
|
35
|
+
'@import "neat";',
|
36
|
+
'@import "base/variables";',
|
37
|
+
'@import "base/grid-settings";',
|
38
|
+
'@import "atomic_cms";',
|
18
39
|
'',
|
19
40
|
'#component_preview {',
|
41
|
+
' @import "base/buttons";',
|
42
|
+
' @import "base/forms";',
|
43
|
+
' @import "base/lists";',
|
44
|
+
' @import "base/tables";',
|
45
|
+
' @import "base/typography";',
|
20
46
|
' // When editing a page through Atomic CMS',
|
21
47
|
' // images with broken links should not be displayed.',
|
22
48
|
' img[src="image"] { display:none !important; }',
|
@@ -28,7 +54,7 @@ module AtomicCms
|
|
28
54
|
private
|
29
55
|
|
30
56
|
def append_to_file(options)
|
31
|
-
open(options[:asset_file],
|
57
|
+
open(options[:asset_file], "a") do |asset_file|
|
32
58
|
options[:entries].each do |entry|
|
33
59
|
asset_file.puts entry
|
34
60
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "active_support/core_ext/string"
|
2
|
+
|
3
|
+
module AtomicCms
|
4
|
+
module Generators
|
5
|
+
class ScaffoldGenerator < Rails::Generators::Base
|
6
|
+
argument :model_name, required: true
|
7
|
+
|
8
|
+
desc <<-DESC.strip_heredoc
|
9
|
+
Create a model, controller, view, admin resource, and route.
|
10
|
+
DESC
|
11
|
+
|
12
|
+
source_root File.expand_path("../../templates", __FILE__)
|
13
|
+
|
14
|
+
def install_model_template
|
15
|
+
setup_scaffold
|
16
|
+
create_template(
|
17
|
+
template_name: "model.erb",
|
18
|
+
full_path: "app/models/#{@scaffold.model_file_name}.rb"
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def install_controller_template
|
23
|
+
create_template(
|
24
|
+
template_name: "controller.erb",
|
25
|
+
full_path: controller_template_name
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def install_admin_template
|
30
|
+
create_template(
|
31
|
+
template_name: "admin.erb",
|
32
|
+
full_path: "app/admin/#{@scaffold.model_file_name}.rb"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def install_show_view_template
|
37
|
+
create_template(
|
38
|
+
template_name: "show.html.slim",
|
39
|
+
full_path: "app/views/#{@scaffold.view_folder}/show.html.slim"
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_migration
|
44
|
+
generate "migration", "create#{@scaffold.model_name} name:string content:text"
|
45
|
+
end
|
46
|
+
|
47
|
+
def set_route
|
48
|
+
inject_into_file(
|
49
|
+
"config/routes.rb",
|
50
|
+
"\n resources :#{@scaffold.controller_file_name}\n",
|
51
|
+
after: %r{/atomic_cms"}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def setup_scaffold
|
58
|
+
@scaffold = OpenStruct.new(
|
59
|
+
model_name: model_name.singularize.titlecase,
|
60
|
+
model_file_name: model_name.singularize.downcase.underscore,
|
61
|
+
controller_name: model_name.pluralize.titlecase,
|
62
|
+
controller_file_name: model_name.pluralize.downcase,
|
63
|
+
view_folder: model_name.singularize.downcase.underscore
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
def create_template(options)
|
68
|
+
template(options[:template_name], options[:full_path])
|
69
|
+
end
|
70
|
+
|
71
|
+
def controller_template_name
|
72
|
+
"app/controllers/#{@scaffold.controller_file_name}_controller.rb"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
ActiveAdmin.register <%= @scaffold.model_name %> do
|
2
|
+
permit_params :content
|
3
|
+
|
4
|
+
index do
|
5
|
+
selectable_column
|
6
|
+
column :created_at
|
7
|
+
column :updated_at
|
8
|
+
actions
|
9
|
+
end
|
10
|
+
|
11
|
+
form html: { class: "edit-atomic-content" } do |f|
|
12
|
+
f.semantic_errors(*f.object.errors.keys)
|
13
|
+
|
14
|
+
# new form
|
15
|
+
if !f.object.persisted?
|
16
|
+
f.inputs "Details" do
|
17
|
+
# f.input :name
|
18
|
+
end
|
19
|
+
f.actions
|
20
|
+
|
21
|
+
# edit form
|
22
|
+
else
|
23
|
+
div class: "buttons" do
|
24
|
+
render partial: "admin/edit_buttons"
|
25
|
+
f.actions
|
26
|
+
end
|
27
|
+
|
28
|
+
columns do
|
29
|
+
column span: 3 do
|
30
|
+
panel "Draft", id: "draft-panel" do
|
31
|
+
render partial: "components/edit", locals: { f: f }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
column id: "edit-node-column" do
|
36
|
+
div id: "edit-<%= @scaffold.model_file_name %>" do
|
37
|
+
f.inputs "<%= @scaffold.model_name %> Details" do
|
38
|
+
# f.input :name
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
div id: "edit-node" do
|
43
|
+
f.inputs "Edit Element" do
|
44
|
+
div id: "edit-node-fields"
|
45
|
+
end
|
46
|
+
|
47
|
+
f.actions do
|
48
|
+
li class: "move" do
|
49
|
+
a "Up", "#", class: "button", id: "move-node-up"
|
50
|
+
end
|
51
|
+
li class: "move" do
|
52
|
+
a "Down", "#", class: "button", id: "move-node-down"
|
53
|
+
end
|
54
|
+
li class: "cancel" do
|
55
|
+
a "Done", "#", class: "button", id: "done-edit-node"
|
56
|
+
end
|
57
|
+
li class: "delete" do
|
58
|
+
a "Delete", "#", class: "button", id: "delete-node"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
show do
|
68
|
+
div id: "component_preview" do
|
69
|
+
div page.content_render
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
controller do
|
74
|
+
# permit all params until we can whitelist content_object
|
75
|
+
def permitted_params
|
76
|
+
params.permit!
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class <%= @scaffold.controller_name %>Controller < ApplicationController
|
4
|
+
def show
|
5
|
+
# Standard find by ID
|
6
|
+
<%= "@#{@scaffold.model_file_name}" %> = <%= @scaffold.model_name %>.find(params[:id])
|
7
|
+
# Find by path
|
8
|
+
<%= "@#{@scaffold.model_file_name}" %> = <%= @scaffold.model_name %>.find_by_path(request.path)
|
9
|
+
if <%= "@#{@scaffold.model_file_name}" %>
|
10
|
+
render :show
|
11
|
+
else
|
12
|
+
render file: "#{Rails.root}/public/404.html", status: :not_found
|
13
|
+
Rails.logger.error "404 - Page #{request.path} cannot be found."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= <%= "@#{@scaffold.model_file_name}" %>.content_object.render
|
@@ -0,0 +1,19 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
angular.module('markdown', [])
|
4
|
+
.provider('markdown', [function () {
|
5
|
+
var opts = {};
|
6
|
+
return {
|
7
|
+
config: function (newOpts) {
|
8
|
+
opts = newOpts;
|
9
|
+
},
|
10
|
+
$get: function () {
|
11
|
+
return new window.Showdown.converter(opts);
|
12
|
+
}
|
13
|
+
};
|
14
|
+
}])
|
15
|
+
.filter('markdown', ['markdown', function (markdown) {
|
16
|
+
return function (text) {
|
17
|
+
return markdown.makeHtml(text || '');
|
18
|
+
};
|
19
|
+
}]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! showdown 01-03-2015 */
|
2
|
+
var Showdown={extensions:{}},forEach=Showdown.forEach=function(a,b){if("function"==typeof a.forEach)a.forEach(b);else{var c,d=a.length;for(c=0;d>c;c++)b(a[c],c,a)}},stdExtName=function(a){return a.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(a){var b,c,d,e=0,f=[],g=[];if("undefined"!=typeof module&&"undefined"!=typeof exports&&"undefined"!=typeof require){var h=require("fs");if(h){var i=h.readdirSync((__dirname||".")+"/extensions").filter(function(a){return~a.indexOf(".js")}).map(function(a){return a.replace(/\.js$/,"")});Showdown.forEach(i,function(a){var b=stdExtName(a);Showdown.extensions[b]=require("./extensions/"+a)})}}if(this.makeHtml=function(a){return b={},c={},d=[],a=a.replace(/~/g,"~T"),a=a.replace(/\$/g,"~D"),a=a.replace(/\r\n/g,"\n"),a=a.replace(/\r/g,"\n"),a="\n\n"+a+"\n\n",a=M(a),a=a.replace(/^[ \t]+$/gm,""),Showdown.forEach(f,function(b){a=l(b,a)}),a=z(a),a=n(a),a=m(a),a=p(a),a=K(a),a=a.replace(/~D/g,"$$"),a=a.replace(/~T/g,"~"),Showdown.forEach(g,function(b){a=l(b,a)}),a},a&&a.extensions){var j=this;Showdown.forEach(a.extensions,function(a){if("string"==typeof a&&(a=Showdown.extensions[stdExtName(a)]),"function"!=typeof a)throw"Extension '"+a+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(a(j),function(a){a.type?"language"===a.type||"lang"===a.type?f.push(a):("output"===a.type||"html"===a.type)&&g.push(a):g.push(a)})})}var k,l=function(a,b){if(a.regex){var c=new RegExp(a.regex,"g");return b.replace(c,a.replace)}return a.filter?a.filter(b):void 0},m=function(a){return a+="~0",a=a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(a,d,e,f,g){return d=d.toLowerCase(),b[d]=G(e),f?f+g:(g&&(c[d]=g.replace(/"/g,""")),"")}),a=a.replace(/~0/,"")},n=function(a){a=a.replace(/\n/g,"\n\n");return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,o),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,o),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,o),a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,o),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,o),a=a.replace(/\n\n/g,"\n")},o=function(a,b){var c=b;return c=c.replace(/\n\n/g,"\n"),c=c.replace(/^\n/,""),c=c.replace(/\n+$/g,""),c="\n\n~K"+(d.push(c)-1)+"K\n\n"},p=function(a){a=w(a);var b=A("<hr />");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=x(a),a=y(a),a=E(a),a=n(a),a=F(a)},q=function(a){return a=B(a),a=r(a),a=H(a),a=u(a),a=s(a),a=I(a),a=G(a),a=D(a),a=a.replace(/ +\n/g," <br />\n")},r=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=N(b,"\\`*_")})},s=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,t),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,t),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,t)},t=function(a,d,e,f,g,h,i,j){void 0==j&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(""==n)if(""==m&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m,void 0!=b[m])n=b[m],void 0!=c[m]&&(o=c[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}n=N(n,"*_");var p='<a href="'+n+'"';return""!=o&&(o=o.replace(/"/g,"""),o=N(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>"},u=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,v),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,v)},v=function(a,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(o||(o=""),""==n){if(""==m&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m,void 0==b[m])return k;n=b[m],void 0!=c[m]&&(o=c[m])}l=l.replace(/"/g,"""),n=N(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"""),o=N(o,"*_"),p+=' title="'+o+'"',p+=" />"},w=function(a){function b(a){return a.replace(/[^\w]/g,"").toLowerCase()}return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,c){return A('<h1 id="'+b(c)+'">'+q(c)+"</h1>")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return A('<h2 id="'+b(c)+'">'+q(c)+"</h2>")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return A("<h"+e+' id="'+b(d)+'">'+q(d)+"</h"+e+">")})},x=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return e?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=k(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n"}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=k(f);return h=e+"<"+g+">\n"+h+"</"+g+">\n"})),a=a.replace(/~0/,"")};k=function(a){return e++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b;return g||f.search(/\n{2,}/)>-1?f=p(L(f)):(f=x(L(f)),f=f.replace(/\n$/,""),f=q(f)),"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),e--,a};var y=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=C(L(d)),d=M(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>",A(d)+e}),a=a.replace(/~0/,"")},z=function(a){return a+="~0",a=a.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(a,b,c){var d=b,e=c;return e=C(e),e=M(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="<pre><code"+(d?' class="'+d+'"':"")+">"+e+"\n</code></pre>",A(e)}),a=a.replace(/~0/,"")},A=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(d.push(a)-1)+"K\n\n"},B=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d){var e=d;return e=e.replace(/^([ \t]*)/g,""),e=e.replace(/[ \t]*$/g,""),e=C(e),b+"<code>"+e+"</code>"})},C=function(a){return a=a.replace(/&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=N(a,"*_{}[]\\",!1)},D=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>")},E=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=p(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /gm,"~0"),c=c.replace(/~0/g,"")}),A("<blockquote>\n"+c+"\n</blockquote>")})},F=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");for(var b=a.split(/\n{2,}/g),c=[],e=b.length,f=0;e>f;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?c.push(g):g.search(/\S/)>=0&&(g=q(g),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",c.push(g))}e=c.length;for(var f=0;e>f;f++)for(;c[f].search(/~K(\d+)K/)>=0;){var h=d[RegExp.$1];h=h.replace(/\$/g,"$$$$"),c[f]=c[f].replace(/~K\d+K/,h)}return c.join("\n\n")},G=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<")},H=function(a){return a=a.replace(/\\(\\)/g,O),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,O)},I=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return J(K(b))})},J=function(a){var b=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+a.charCodeAt(0).toString(16)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if("@"==a)a=b[Math.floor(2*Math.random())](a);else if(":"!=a){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a}),a='<a href="'+a+'">'+a+"</a>",a=a.replace(/">.+:/g,'">')},K=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)})},L=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,"")},M=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b){for(var c=b,d=4-c.length%4,e=0;d>e;e++)c+=" ";return c}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,"")},N=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,O)},O=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},"undefined"!=typeof module&&(module.exports=Showdown),"function"==typeof define&&define.amd&&define("showdown",function(){return Showdown}),"undefined"!=typeof angular&&"undefined"!=typeof Showdown&&!function(a,b){function c(){function a(){var a=new b.converter(c);this.makeHtml=function(b){return a.makeHtml(b)},this.stripHtml=function(a){return String(a).replace(/<[^>]+>/gm,"")}}var c={extensions:[],stripHtml:!0};this.setOption=function(a,b){return c.key=b,this},this.getOption=function(a){return c.hasOwnProperty(a)?c.key:null},this.loadExtension=function(a){return c.extensions.push(a),this},this.$get=function(){return new a}}function d(a){var b=function(b,c){b.$watch("model",function(b){var d;d="string"==typeof b?a.makeHtml(b):typeof b,c.html(d)})};return{restrict:"A",link:b,scope:{model:"=sdModelToHtml"}}}function e(){return function(a){return String(a).replace(/<[^>]+>/gm,"")}}a.provider("$Showdown",c).directive("sdModelToHtml",["$Showdown",d]).filter("sdStripHtml",e)}(angular.module("Showdown",[]),Showdown);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Humphreys
|
@@ -38,26 +38,6 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0.pre2
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: angularjs-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.3'
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '1.4'
|
51
|
-
type: :runtime
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '1.3'
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '1.4'
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: atomic_assets
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,12 +232,49 @@ executables: []
|
|
252
232
|
extensions: []
|
253
233
|
extra_rdoc_files: []
|
254
234
|
files:
|
235
|
+
- ".eslintrc"
|
236
|
+
- ".gitignore"
|
237
|
+
- ".rspec"
|
238
|
+
- ".rubocop.yml"
|
239
|
+
- ".ruby-version"
|
240
|
+
- Gemfile
|
241
|
+
- Gemfile.lock
|
242
|
+
- README.md
|
243
|
+
- Rakefile
|
244
|
+
- app/assets/images/icon_add_component.png
|
245
|
+
- app/assets/images/icon_add_component@2x.png
|
246
|
+
- app/assets/javascripts/atomic_cms.js
|
247
|
+
- app/assets/stylesheets/atomic_cms.css.scss
|
248
|
+
- app/components/array_component.rb
|
249
|
+
- app/controllers/atomic_cms/components_controller.rb
|
250
|
+
- app/controllers/atomic_cms/media_controller.rb
|
251
|
+
- app/controllers/concerns/media_scrubber.rb
|
252
|
+
- app/helpers/component_helper.rb
|
253
|
+
- app/models/atomic_cms/image.rb
|
254
|
+
- app/models/atomic_cms/media.rb
|
255
|
+
- app/views/components/_children_field.html.slim
|
256
|
+
- app/views/components/_edit.html.slim
|
257
|
+
- app/views/components/_file_field.slim
|
258
|
+
- app/views/components/_markdown_field.slim
|
259
|
+
- app/views/components/_select_field.slim
|
260
|
+
- app/views/components/_template_field.slim
|
261
|
+
- app/views/components/_text_area_field.slim
|
262
|
+
- app/views/components/_text_field.slim
|
263
|
+
- atomic_cms.gemspec
|
264
|
+
- bin/rails
|
265
|
+
- config/routes.rb
|
266
|
+
- db/migrate/20151013175254_create_media.rb
|
255
267
|
- lib/atomic_cms.rb
|
256
268
|
- lib/atomic_cms/editor.rb
|
257
269
|
- lib/atomic_cms/engine.rb
|
258
270
|
- lib/atomic_cms/has_components.rb
|
259
271
|
- lib/generators/atomic_cms/assets/assets_generator.rb
|
260
272
|
- lib/generators/atomic_cms/install/install_generator.rb
|
273
|
+
- lib/generators/atomic_cms/scaffold/scaffold_generator.rb
|
274
|
+
- lib/generators/atomic_cms/templates/admin.erb
|
275
|
+
- lib/generators/atomic_cms/templates/controller.erb
|
276
|
+
- lib/generators/atomic_cms/templates/model.erb
|
277
|
+
- lib/generators/atomic_cms/templates/show.html.slim
|
261
278
|
- spec/controllers/media_controller_spec.rb
|
262
279
|
- spec/controllers/media_scrubber_spec.rb
|
263
280
|
- spec/dummy/README.rdoc
|
@@ -302,6 +319,8 @@ files:
|
|
302
319
|
- spec/support/media_upload_shared_examples.rb
|
303
320
|
- spec/uploads/cat.jpg
|
304
321
|
- spec/uploads/pdf.pdf
|
322
|
+
- vendor/assets/javascripts/angular-markdown.js
|
323
|
+
- vendor/assets/javascripts/showdown.min.js
|
305
324
|
homepage:
|
306
325
|
licenses: []
|
307
326
|
metadata: {}
|