feather_cms 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/{README.md → README.rdoc} +13 -12
  3. data/Rakefile +40 -1
  4. data/app/assets/images/feather_cms/images/edit.png +0 -0
  5. data/app/assets/images/feather_cms/images/fullscreen.png +0 -0
  6. data/app/assets/images/feather_cms/images/preview.png +0 -0
  7. data/app/assets/javascripts/feather_cms/application.js +14 -0
  8. data/app/assets/javascripts/feather_cms/editor.js +21 -0
  9. data/app/assets/javascripts/feather_cms/epiceditor.js +716 -0
  10. data/app/assets/javascripts/feather_cms/epiceditor.min.js +4 -0
  11. data/app/assets/stylesheets/feather_cms/application.css.sass +37 -0
  12. data/{lib/generators/feather_cms/templates → app/assets/stylesheets/feather_cms}/bootstrap.css +0 -0
  13. data/app/assets/stylesheets/feather_cms/themes/base/epiceditor.css +31 -0
  14. data/app/assets/stylesheets/feather_cms/themes/editor/epic-dark.css +47 -0
  15. data/app/assets/stylesheets/feather_cms/themes/editor/epic-light.css +48 -0
  16. data/app/assets/stylesheets/feather_cms/themes/preview/github.css +82 -0
  17. data/app/assets/stylesheets/feather_cms/themes/preview/preview-dark.css +113 -0
  18. data/app/controllers/feather_cms/application_controller.rb +4 -0
  19. data/app/controllers/feather_cms/pages_controller.rb +84 -0
  20. data/app/helpers/feather_cms/application_helper.rb +4 -0
  21. data/app/models/feather_cms/page.rb +11 -0
  22. data/app/views/feather_cms/pages/_form.html.haml +24 -0
  23. data/app/views/feather_cms/pages/edit.html.haml +17 -0
  24. data/app/views/feather_cms/pages/index.html.haml +22 -0
  25. data/app/views/feather_cms/pages/new.html.haml +4 -0
  26. data/app/views/layouts/feather_layout.html.haml +30 -0
  27. data/config/routes.rb +7 -0
  28. data/lib/feather_cms/config.rb +6 -18
  29. data/lib/feather_cms/engine.rb +5 -0
  30. data/lib/feather_cms/version.rb +1 -1
  31. data/lib/feather_cms.rb +1 -13
  32. data/lib/generators/feather_cms/USAGE +3 -8
  33. data/lib/generators/feather_cms/feather_cms_generator.rb +5 -39
  34. data/lib/generators/feather_cms/templates/initializer.rb +0 -5
  35. data/lib/generators/feather_cms/templates/migration.rb +2 -3
  36. data/lib/tasks/feather_cms_tasks.rake +4 -0
  37. data/test/dummy/README.rdoc +261 -0
  38. data/test/dummy/Rakefile +7 -0
  39. data/test/dummy/app/assets/javascripts/application.js +15 -0
  40. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  41. data/test/dummy/app/controllers/application_controller.rb +3 -0
  42. data/test/dummy/app/helpers/application_helper.rb +2 -0
  43. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/test/dummy/config/application.rb +59 -0
  45. data/test/dummy/config/boot.rb +10 -0
  46. data/test/dummy/config/database.yml +25 -0
  47. data/test/dummy/config/environment.rb +5 -0
  48. data/test/dummy/config/environments/development.rb +37 -0
  49. data/test/dummy/config/environments/production.rb +67 -0
  50. data/test/dummy/config/environments/test.rb +37 -0
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/test/dummy/config/initializers/inflections.rb +15 -0
  53. data/test/dummy/config/initializers/mime_types.rb +5 -0
  54. data/test/dummy/config/initializers/secret_token.rb +7 -0
  55. data/test/dummy/config/initializers/session_store.rb +8 -0
  56. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/test/dummy/config/locales/en.yml +5 -0
  58. data/test/dummy/config/routes.rb +4 -0
  59. data/test/dummy/config.ru +4 -0
  60. data/test/dummy/public/404.html +26 -0
  61. data/test/dummy/public/422.html +26 -0
  62. data/test/dummy/public/500.html +25 -0
  63. data/test/dummy/public/favicon.ico +0 -0
  64. data/test/dummy/script/rails +6 -0
  65. data/test/feather_cms_test.rb +7 -0
  66. data/test/fixtures/feather_cms/pages.yml +11 -0
  67. data/test/integration/navigation_test.rb +10 -0
  68. data/test/test_helper.rb +15 -0
  69. data/test/unit/feather_cms/page_test.rb +9 -0
  70. metadata +123 -26
  71. data/.gitignore +0 -4
  72. data/Gemfile +0 -4
  73. data/feather_cms.gemspec +0 -24
  74. data/lib/feather_cms/model.rb +0 -59
  75. data/lib/feather_cms/railtie.rb +0 -13
  76. data/lib/feather_cms/template_cache.rb +0 -52
  77. data/lib/generators/feather_cms/templates/controller.rb +0 -40
  78. data/lib/generators/feather_cms/templates/form.html.erb +0 -40
  79. data/lib/generators/feather_cms/templates/helper.rb +0 -18
  80. data/lib/generators/feather_cms/templates/index.html.erb +0 -11
  81. data/lib/generators/feather_cms/templates/layout.html.erb +0 -52
  82. data/lib/generators/feather_cms/templates/model.rb +0 -5
@@ -0,0 +1,4 @@
1
+ /**
2
+ * EpicEditor - An Embeddable JavaScript Markdown Editor (https://github.com/OscarGodson/EpicEditor)
3
+ * Copyright (c) 2011-2012, Oscar Godson. (MIT Licensed)
4
+ */(function(a,b){function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function d(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])}function e(b,c){var d=b,e=null;return a.getComputedStyle?e=document.defaultView.getComputedStyle(d,null).getPropertyValue(c):d.currentStyle&&(e=d.currentStyle[c]),e}function f(a,b,c){var f={},g;if(b==="save"){for(g in c)c.hasOwnProperty(g)&&(f[g]=e(a,g));d(a,c)}else b==="apply"&&d(a,c);return f}function g(a){var b=parseInt(e(a,"border-left-width"),10)+parseInt(e(a,"border-right-width"),10),c=parseInt(e(a,"padding-left"),10)+parseInt(e(a,"padding-right"),10),d=a.offsetWidth,f;return isNaN(b)&&(b=0),f=b+c+d,f}function h(a){var b=parseInt(e(a,"border-top-width"),10)+parseInt(e(a,"border-bottom-width"),10),c=parseInt(e(a,"padding-top"),10)+parseInt(e(a,"padding-bottom"),10),d=a.offsetHeight,f;return isNaN(b)&&(b=0),f=b+c+d,f}function i(a,b,d){d=d||"";var e=b.getElementsByTagName("head")[0],f=b.createElement("link");c(f,{type:"text/css",id:d,rel:"stylesheet",href:a,name:a,media:"screen"}),e.appendChild(f)}function j(a,b,c){a.className=a.className.replace(b,c)}function k(a){return a.contentDocument||a.contentWindow.document}function l(a){var b;return document.body.innerText?b=a.innerText:(b=a.innerHTML.replace(/<br>/gi,"\n"),b=b.replace(/<(?:.|\n)*?>/gm,""),b=b.replace(/&lt;/gi,"<"),b=b.replace(/&gt;/gi,">")),b}function m(a,b){return document.body.innerText?a.innerText=b:a.innerHTML=b.replace(/\n/g,"<br>"),!0}function n(){var a=-1,b=navigator.userAgent,c;return navigator.appName=="Microsoft Internet Explorer"&&(c=/MSIE ([0-9]{1,}[\.0-9]{0,})/,c.exec(b)!=null&&(a=parseFloat(RegExp.$1,10))),a}function o(a){var b={};return a&&b.toString.call(a)==="[object Function]"}function p(){var a=arguments[0]||{},c=1,d=arguments.length,e=!1,f,g,h,i;typeof a=="boolean"&&(e=a,a=arguments[1]||{},c=2),typeof a!="object"&&!o(a)&&(a={}),d===c&&(a=this,--c);for(;c<d;c++)if((f=arguments[c])!=null)for(g in f)if(f.hasOwnProperty(g)){h=a[g],i=f[g];if(a===i)continue;e&&i&&typeof i=="object"&&!i.nodeType?a[g]=p(e,h||(i.length!=null?[]:{}),i):i!==b&&(a[g]=i)}return a}function q(a){var c=this,d=a||{},e,f,g={container:"epiceditor",basePath:"epiceditor",clientSideStorage:!0,localStorageName:"epiceditor",file:{name:null,defaultContent:"",autoSave:100},theme:{base:"/themes/base/epiceditor.css",preview:"/themes/preview/github.css",editor:"/themes/editor/epic-dark.css"},focusOnLoad:!1,shortcut:{modifier:18,fullscreen:70,preview:80,edit:79},parser:typeof marked=="function"?marked:null},h;c.settings=p(!0,g,d);if(typeof c.settings.parser!="function"||typeof c.settings.parser("TEST")!="string")c.settings.parser=function(a){return a};return typeof c.settings.container=="string"?c.element=document.getElementById(c.settings.container):typeof c.settings.container=="object"&&(c.element=c.settings.container),c.settings.file.name||(typeof c.settings.container=="string"?c.settings.file.name=c.settings.container:typeof c.settings.container=="object"&&(c.element.id?c.settings.file.name=c.element.id:(q._data.unnamedEditors||(q._data.unnamedEditors=[]),q._data.unnamedEditors.push(c),c.settings.file.name="__epiceditor-untitled-"+q._data.unnamedEditors.length))),c._instanceId="epiceditor-"+Math.round(Math.random()*1e5),c._storage={},c._canSave=!0,c._defaultFileSchema=function(){return{content:c.settings.file.defaultContent,created:new Date,modified:new Date}},localStorage&&c.settings.clientSideStorage&&(this._storage=localStorage,this._storage[c.settings.localStorageName]&&c.getFiles(c.settings.file.name)===b&&(f=c.getFiles(c.settings.file.name),f=c._defaultFileSchema(),f.content=c.settings.file.defaultContent)),this._storage[c.settings.localStorageName]||(h={},h[c.settings.file.name]=c._defaultFileSchema(),h=JSON.stringify(h),this._storage[c.settings.localStorageName]=h),c.events||(c.events={}),this}q.prototype.load=function(b){function G(a){for(var b=0;b<a.length;b++)a[b].style.width=c.element.offsetWidth-o+"px",a[b].style.height=c.element.offsetHeight-p+"px"}function H(a){o=g(c.element)-c.element.offsetWidth;for(var b=0;b<a.length;b++)a[b].style.width=c.element.offsetWidth-o+"px"}function I(b){if(Math.abs(u.y-b.pageY)>=5||Math.abs(u.x-b.pageX)>=5)r.style.display="block",s&&clearTimeout(s),s=a.setTimeout(function(){r.style.display="none"},1e3);u={y:b.pageY,x:b.pageX}}function J(a){a.keyCode==c.settings.shortcut.modifier&&(C=!0),a.keyCode==17&&(D=!0),C===!0&&a.keyCode==c.settings.shortcut.preview&&!c.eeState.fullscreen&&(a.preventDefault(),c.preview()),C===!0&&a.keyCode==c.settings.shortcut.edit&&(a.preventDefault(),c.eeState.fullscreen||c.edit()),C===!0&&a.keyCode==c.settings.shortcut.fullscreen&&(a.preventDefault(),y(B)),C===!0&&a.keyCode!==c.settings.shortcut.modifier&&(C=!1),a.keyCode==27&&c.eeState.fullscreen&&(document.body.webkitRequestFullScreen||z(B)),D===!0&&a.keyCode==83&&(c.save(),a.preventDefault(),D=!1),a.metaKey&&a.keyCode==83&&(c.save(),a.preventDefault())}function K(a){a.keyCode==c.settings.shortcut.modifier&&(C=!1),a.keyCode==17&&(D=!1)}var c=this,j,l,m,o,p,q,r,s,t,u={y:-1,x:-1},v,w,x=document.body.webkitRequestFullScreen?!0:!1,y,z,A,B,C=!1,D=!1,E,F;b=b||function(){},c.eeState={fullscreen:!1,preview:!1,edit:!0,loaded:!1,unloaded:!1},j={chrome:'<div id="epiceditor-wrapper" class="epiceditor-edit-mode"><iframe frameborder="0" id="epiceditor-editor-frame"></iframe><iframe frameborder="0" id="epiceditor-previewer-frame"></iframe><div id="epiceditor-utilbar"><img width="30" src="'+this.settings.basePath+'/images/preview.png" title="Toggle Preview Mode" class="epiceditor-toggle-btn epiceditor-toggle-preview-btn"> '+'<img width="30" src="'+this.settings.basePath+'/images/edit.png" title="Toggle Edit Mode" class="epiceditor-toggle-btn epiceditor-toggle-edit-btn"> '+'<img width="30" src="'+this.settings.basePath+'/images/fullscreen.png" title="Enter Fullscreen" class="epiceditor-fullscreen-btn">'+"</div>"+"</div>",previewer:'<div id="epiceditor-preview"></div>'},c.element.innerHTML='<iframe scrolling="no" frameborder="0" id= "'+c._instanceId+'"></iframe>',l=document.getElementById(c._instanceId),c.iframeElement=l,c.iframe=k(l),c.iframe.open(),c.iframe.write(j.chrome),c.editorIframe=c.iframe.getElementById("epiceditor-editor-frame"),c.previewerIframe=c.iframe.getElementById("epiceditor-previewer-frame"),c.editorIframeDocument=k(c.editorIframe),c.editorIframeDocument.open(),c.editorIframeDocument.write(""),c.editorIframeDocument.close(),c.previewerIframeDocument=k(c.previewerIframe),c.previewerIframeDocument.open(),c.previewerIframeDocument.write(j.previewer),m=c.previewerIframeDocument.createElement("base"),m.target="_blank",c.previewerIframeDocument.getElementsByTagName("head")[0].appendChild(m),c.previewerIframeDocument.close(),o=g(c.element)-c.element.offsetWidth,p=h(c.element)-c.element.offsetHeight,A=[c.iframeElement,c.editorIframe,c.previewerIframe],G(A),i(c.settings.basePath+c.settings.theme.base,c.iframe,"theme"),i(c.settings.basePath+c.settings.theme.editor,c.editorIframeDocument,"theme"),i(c.settings.basePath+c.settings.theme.preview,c.previewerIframeDocument,"theme"),c.iframe.getElementById("epiceditor-wrapper").style.position="relative",c.editor=c.editorIframeDocument.body,c.previewer=c.previewerIframeDocument.getElementById("epiceditor-preview"),c.editor.contentEditable=!0,c.iframe.body.style.height=this.element.offsetHeight+"px",this.previewerIframe.style.display="none",n()>-1&&(this.previewer.style.height=parseInt(e(this.previewer,"height"),10)+2),this.open(c.settings.file.name),c.settings.focusOnLoad&&c.iframe.addEventListener("readystatechange",function(){c.iframe.readyState=="complete"&&c.editorIframeDocument.body.focus()}),q=c.iframe.getElementById("epiceditor-utilbar"),v={},y=function(b){if(c.eeState.fullscreen){z(b);return}x&&b.webkitRequestFullScreen(),w=c.eeState.edit,c.eeState.fullscreen=!0,c.eeState.edit=!0,c.eeState.preview=!0;var d=a.innerWidth,g=a.innerHeight,h=a.outerWidth,i=a.outerHeight;x||(i=a.innerHeight),v.editorIframe=f(c.editorIframe,"save",{width:h/2+"px",height:i+"px","float":"left",cssFloat:"left",styleFloat:"left",display:"block"}),v.previewerIframe=f(c.previewerIframe,"save",{width:h/2+"px",height:i+"px","float":"right",cssFloat:"right",styleFloat:"right",display:"block"}),v.element=f(c.element,"save",{position:"fixed",top:"0",left:"0",width:"100%","z-index":"9999",zIndex:"9999",border:"none",margin:"0",background:e(c.editor,"background-color"),height:g+"px"}),v.iframeElement=f(c.iframeElement,"save",{width:h+"px",height:g+"px"}),q.style.visibility="hidden",x||(document.body.style.overflow="hidden"),c.preview(),c.editorIframeDocument.body.focus()},z=function(a){f(c.element,"apply",v.element),f(c.iframeElement,"apply",v.iframeElement),f(c.editorIframe,"apply",v.editorIframe),f(c.previewerIframe,"apply",v.previewerIframe),c.element.style.width="",c.element.style.height="",q.style.visibility="visible",x?document.webkitCancelFullScreen():document.body.style.overflow="auto",c.eeState.fullscreen=!1,w?c.edit():c.preview(),H(A)},c.editor.addEventListener("keyup",function(){t&&a.clearTimeout(t),t=a.setTimeout(function(){c.eeState.fullscreen&&c.preview()},250)}),B=c.iframeElement,q.addEventListener("click",function(a){var b=a.target.className;b.indexOf("epiceditor-toggle-preview-btn")>-1?c.preview():b.indexOf("epiceditor-toggle-edit-btn")>-1?c.edit():b.indexOf("epiceditor-fullscreen-btn")>-1&&y(B)}),document.body.webkitRequestFullScreen&&B.addEventListener("webkitfullscreenchange",function(){document.webkitIsFullScreen||z(B)},!1),r=c.iframe.getElementById("epiceditor-utilbar"),r.style.display="none",r.addEventListener("mouseover",function(){s&&clearTimeout(s)}),E=[c.previewerIframeDocument,c.editorIframeDocument];for(F=0;F<E.length;F++)E[F].addEventListener("mousemove",function(a){I(a)}),E[F].addEventListener("scroll",function(a){I(a)}),E[F].addEventListener("keyup",function(a){K(a)}),E[F].addEventListener("keydown",function(a){J(a)});return c.settings.file.autoSave&&(c.saveInterval=a.setInterval(function(){if(!c._canSave)return;c.save()},c.settings.file.autoSave)),a.addEventListener("resize",function(){!c.iframe.webkitRequestFullScreen&&c.eeState.fullscreen?(d(c.iframeElement,{width:a.outerWidth+"px",height:a.innerHeight+"px"}),d(c.element,{height:a.innerHeight+"px"}),d(c.previewerIframe,{width:a.outerWidth/2+"px",height:a.innerHeight+"px"}),d(c.editorIframe,{width:a.outerWidth/2+"px",height:a.innerHeight+"px"})):c.eeState.fullscreen||H(A)}),c.iframe.close(),c.eeState.loaded=!0,c.eeState.unloaded=!1,b.call(this),this.emit("load"),this},q.prototype.unload=function(b){if(this.eeState.unloaded)throw new Error("Editor isn't loaded");var c=this,d=a.parent.document.getElementById(c._instanceId);return d.parentNode.removeChild(d),c.eeState.loaded=!1,c.eeState.unloaded=!0,b=b||function(){},c.saveInterval&&a.clearInterval(c.saveInterval),b.call(this),c.emit("unload"),c},q.prototype.preview=function(a){var b=this;return a=a||b.settings.basePath+b.settings.theme.preview,j(b.getElement("wrapper"),"epiceditor-edit-mode","epiceditor-preview-mode"),b.previewerIframeDocument.getElementById("theme")?b.previewerIframeDocument.getElementById("theme").name!==a&&(b.previewerIframeDocument.getElementById("theme").href=a):i(a,b.previewerIframeDocument,"theme"),b.previewer.innerHTML=b.exportFile(null,"html"),b.eeState.fullscreen||(b.editorIframe.style.display="none",b.previewerIframe.style.display="block",b.eeState.preview=!0,b.eeState.edit=!1,b.previewerIframe.focus()),b.emit("preview"),b},q.prototype.edit=function(){var a=this;return j(a.getElement("wrapper"),"epiceditor-preview-mode","epiceditor-edit-mode"),a.eeState.preview=!1,a.eeState.edit=!0,a.editorIframe.style.display="block",a.previewerIframe.style.display="none",a.editorIframe.focus(),a.emit("edit"),this},q.prototype.getElement=function(a){var b={container:this.element,wrapper:this.iframe.getElementById("epiceditor-wrapper"),wrapperIframe:this.iframeElement,editor:this.editorIframeDocument,editorIframe:this.editorIframe,previewer:this.previewerIframeDocument,previewerIframe:this.previewerIframe};return!b[a]||this.eeState.unloaded?null:b[a]},q.prototype.open=function(a){var c=this,d=c.settings.file.defaultContent,e;return a=a||c.settings.file.name,c.settings.file.name=a,this._storage[c.settings.localStorageName]&&(e=c.getFiles(),e[a]!==b?(m(c.editor,e[a].content),c.emit("read")):(m(c.editor,d),c.save(),c.emit("create")),c.previewer.innerHTML=c.exportFile(null,"html"),c.emit("open")),this},q.prototype.save=function(){var a=this,c,d=!1,e=a.settings.file.name,f=l(this.editor);return this._canSave=!0,c=JSON.parse(this._storage[a.settings.localStorageName]),c[e]===b?c[e]=a._defaultFileSchema():f!==c[e].content&&(c[e].modified=new Date,d=!0),c[e].content=f,this._storage[a.settings.localStorageName]=JSON.stringify(c),d&&a.emit("update"),this.emit("save"),this},q.prototype.remove=function(a){var b=this,c;return a=a||b.settings.file.name,a==b.settings.file.name&&(b._canSave=!1),c=JSON.parse(this._storage[b.settings.localStorageName]),delete c[a],this._storage[b.settings.localStorageName]=JSON.stringify(c),this.emit("remove"),this},q.prototype.rename=function(a,b){var c=this,d=JSON.parse(this._storage[c.settings.localStorageName]);return d[b]=d[a],delete d[a],this._storage[c.settings.localStorageName]=JSON.stringify(d),c.open(b),this},q.prototype.importFile=function(a,c,d,e){var f=this,g=!1;return a=a||f.settings.file.name,c=c||"",d=d||"md",e=e||{},JSON.parse(this._storage[f.settings.localStorageName])[a]===b&&(g=!0),f.settings.file.name=a,m(f.editor,c),g&&f.emit("create"),f.save(),f.eeState.fullscreen&&f.preview(),this},q.prototype.exportFile=function(a,c){var d=this,e,f;a=a||d.settings.file.name,c=c||"text",e=d.getFiles(a);if(e===b)return;f=e.content;switch(c){case"html":return f=f.replace(/\u00a0/g," ").replace(/&nbsp;/g," "),d.settings.parser(f);case"text":return f=f.replace(/&nbsp;/g," "),f;default:return f}},q.prototype.getFiles=function(a){var b=JSON.parse(this._storage[this.settings.localStorageName]);return a?b[a]:b},q.prototype.on=function(a,b){var c=this;return this.events[a]||(this.events[a]=[]),this.events[a].push(b),c},q.prototype.emit=function(a,b){function e(a){a.call(c,b)}var c=this,d;b=b||c.getFiles(c.settings.file.name);if(!this.events[a])return;for(d=0;d<c.events[a].length;d++)e(c.events[a][d]);return c},q.prototype.removeListener=function(a,b){var c=this;return b?this.events[a]?(this.events[a].splice(this.events[a].indexOf(b),1),c):c:(this.events[a]=[],c)},q.version="0.1.1",q._data={},a.EpicEditor=q})(window),function(){function c(a,c){return a[0][0]!=="!"?'<a href="'+j(c.href)+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"+b.lexer(a[1])+"</a>":'<img src="'+j(c.href)+'" alt="'+j(a[1])+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"}function f(){return e=d.pop()}function g(){switch(e.type){case"space":return"";case"hr":return"<hr>\n";case"heading":return"<h"+e.depth+">"+b.lexer(e.text)+"</h"+e.depth+">\n";case"code":return p.highlight&&(e.code=p.highlight(e.text,e.lang),e.code!=null&&e.code!==e.text&&(e.escaped=!0,e.text=e.code)),e.escaped||(e.text=j(e.text,!0)),"<pre><code"+(e.lang?' class="lang-'+e.lang+'"':"")+">"+e.text+"</code></pre>\n";case"blockquote_start":var a="";while(f().type!=="blockquote_end")a+=g();return"<blockquote>\n"+a+"</blockquote>\n";case"list_start":var c=e.ordered?"ol":"ul",a="";while(f().type!=="list_end")a+=g();return"<"+c+">\n"+a+"</"+c+">\n";case"list_item_start":var a="";while(f().type!=="list_item_end")a+=e.type==="text"?h():g();return"<li>"+a+"</li>\n";case"loose_item_start":var a="";while(f().type!=="list_item_end")a+=g();return"<li>"+a+"</li>\n";case"html":return p.sanitize?b.lexer(e.text):!e.pre&&!p.pedantic?b.lexer(e.text):e.text;case"paragraph":return"<p>"+b.lexer(e.text)+"</p>\n";case"text":return"<p>"+h()+"</p>\n"}}function h(){var a=e.text,c;while((c=d[d.length-1])&&c.type==="text")a+="\n"+f().text;return b.lexer(a)}function i(a){d=a.reverse();var b="";while(f())b+=g();return d=null,e=null,b}function j(a,b){return a.replace(b?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k(a){var b="",c=a.length,d=0,e;for(;d<c;d++)e=a.charCodeAt(d),Math.random()>.5&&(e="x"+e.toString(16)),b+="&#"+e+";";return b}function l(){var a="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+";return a}function m(a,b){return a=a.source,b=b||"",function c(d,e){return d?(a=a.replace(d,e.source||e),c):new RegExp(a,b)}}function n(){}function o(b,c){return r(c),i(a.lexer(b))}function r(c){c||(c=q);if(p===c)return;p=c,p.gfm?(a.fences=a.gfm.fences,a.paragraph=a.gfm.paragraph,b.text=b.gfm.text,b.url=b.gfm.url):(a.fences=a.normal.fences,a.paragraph=a.normal.paragraph,b.text=b.normal.text,b.url=b.normal.url),p.pedantic?(b.em=b.pedantic.em,b.strong=b.pedantic.strong):(b.em=b.normal.em,b.strong=b.normal.strong)}var a={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:n,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [^\0]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^([^\n]+\n?(?!body))+\n*/,text:/^[^\n]+/};a.bullet=/(?:[*+-]|\d+\.)/,a.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,a.item=m(a.item,"gm")(/bull/g,a.bullet)(),a.list=m(a.list)(/bull/g,a.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),a.html=m(a.html)("comment",/<!--[^\0]*?-->/)("closed",/<(tag)[^\0]+?<\/\1>/)("closing",/<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,l())(),a.paragraph=function(){var b=a.paragraph.source,c=[];return function d(b){return b=a[b]?a[b].source:b,c.push(b.replace(/(^|[^\[])\^/g,"$1")),d}("hr")("heading")("lheading")("blockquote")("<"+l())("def"),new RegExp(b.replace("body",c.join("|")))}(),a.normal={fences:a.fences,paragraph:a.paragraph},a.gfm={fences:/^ *``` *(\w+)? *\n([^\0]+?)\s*``` *(?:\n+|$)/,paragraph:/^/},a.gfm.paragraph=m(a.paragraph)("(?!","(?!"+a.gfm.fences.source.replace(/(^|[^\[])\^/g,"$1")+"|")(),a.lexer=function(b){var c=[];return c.links={},b=b.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),a.token(b,c,!0)},a.token=function(b,c,d){var b=b.replace(/^ +$/gm,""),e,f,g,h,i,j,k;while(b){if(g=a.newline.exec(b))b=b.substring(g[0].length),g[0].length>1&&c.push({type:"space"});if(g=a.code.exec(b)){b=b.substring(g[0].length),g=g[0].replace(/^ {4}/gm,""),c.push({type:"code",text:p.pedantic?g:g.replace(/\n+$/,"")});continue}if(g=a.fences.exec(b)){b=b.substring(g[0].length),c.push({type:"code",lang:g[1],text:g[2]});continue}if(g=a.heading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[1].length,text:g[2]});continue}if(g=a.lheading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[2]==="="?1:2,text:g[1]});continue}if(g=a.hr.exec(b)){b=b.substring(g[0].length),c.push({type:"hr"});continue}if(g=a.blockquote.exec(b)){b=b.substring(g[0].length),c.push({type:"blockquote_start"}),g=g[0].replace(/^ *> ?/gm,""),a.token(g,c,d),c.push({type:"blockquote_end"});continue}if(g=a.list.exec(b)){b=b.substring(g[0].length),c.push({type:"list_start",ordered:isFinite(g[2])}),g=g[0].match(a.item),e=!1,k=g.length,j=0;for(;j<k;j++)h=g[j],i=h.length,h=h.replace(/^ *([*+-]|\d+\.) +/,""),~h.indexOf("\n ")&&(i-=h.length,h=p.pedantic?h.replace(/^ {1,4}/gm,""):h.replace(new RegExp("^ {1,"+i+"}","gm"),"")),f=e||/\n\n(?!\s*$)/.test(h),j!==k-1&&(e=h[h.length-1]==="\n",f||(f=e)),c.push({type:f?"loose_item_start":"list_item_start"}),a.token(h,c),c.push({type:"list_item_end"});c.push({type:"list_end"});continue}if(g=a.html.exec(b)){b=b.substring(g[0].length),c.push({type:"html",pre:g[1]==="pre",text:g[0]});continue}if(d&&(g=a.def.exec(b))){b=b.substring(g[0].length),c.links[g[1].toLowerCase()]={href:g[2],title:g[3]};continue}if(d&&(g=a.paragraph.exec(b))){b=b.substring(g[0].length),c.push({type:"paragraph",text:g[0]});continue}if(g=a.text.exec(b)){b=b.substring(g[0].length),c.push({type:"text",text:g[0]});continue}}return c};var b={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:n,tag:/^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/,em:/^\b_((?:__|[^\0])+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,code:/^(`+)([^\0]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[^\0]+?(?=[\\<!\[_*`]| {2,}\n|$)/};b._linkInside=/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,b._linkHref=/\s*<?([^\s]*?)>?(?:\s+['"]([^\0]*?)['"])?\s*/,b.link=m(b.link)("inside",b._linkInside)("href",b._linkHref)(),b.reflink=m(b.reflink)("inside",b._linkInside)(),b.normal={url:b.url,strong:b.strong,em:b.em,text:b.text},b.pedantic={strong:/^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([^\0]*?\S)_(?!_)|^\*(?=\S)([^\0]*?\S)\*(?!\*)/},b.gfm={url:/^(https?:\/\/[^\s]+[^.,:;"')\]\s])/,text:/^[^\0]+?(?=[\\<!\[_*`]|https?:\/\/| {2,}\n|$)/},b.lexer=function(a){var e="",f=d.links,g,h,i,l;while(a){if(l=b.escape.exec(a)){a=a.substring(l[0].length),e+=l[1];continue}if(l=b.autolink.exec(a)){a=a.substring(l[0].length),l[2]==="@"?(h=l[1][6]===":"?k(l[1].substring(7)):k(l[1]),i=k("mailto:")+h):(h=j(l[1]),i=h),e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.url.exec(a)){a=a.substring(l[0].length),h=j(l[1]),i=h,e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.tag.exec(a)){a=a.substring(l[0].length),e+=p.sanitize?j(l[0]):l[0];continue}if(l=b.link.exec(a)){a=a.substring(l[0].length),e+=c(l,{href:l[2],title:l[3]});continue}if((l=b.reflink.exec(a))||(l=b.nolink.exec(a))){a=a.substring(l[0].length),g=(l[2]||l[1]).replace(/\s+/g," "),g=f[g.toLowerCase()];if(!g||!g.href){e+=l[0][0],a=l[0].substring(1)+a;continue}e+=c(l,g);continue}if(l=b.strong.exec(a)){a=a.substring(l[0].length),e+="<strong>"+b.lexer(l[2]||l[1])+"</strong>";continue}if(l=b.em.exec(a)){a=a.substring(l[0].length),e+="<em>"+b.lexer(l[2]||l[1])+"</em>";continue}if(l=b.code.exec(a)){a=a.substring(l[0].length),e+="<code>"+j(l[2],!0)+"</code>";continue}if(l=b.br.exec(a)){a=a.substring(l[0].length),e+="<br>";continue}if(l=b.text.exec(a)){a=a.substring(l[0].length),e+=j(l[0]);continue}}return e};var d,e;n.exec=n;var p,q;o.options=o.setOptions=function(a){return q=a,r(a),o},o.setOptions({gfm:!0,pedantic:!1,sanitize:!1,highlight:null}),o.parser=function(a,b){return r(b),i(a)},o.lexer=function(b,c){return r(c),a.lexer(b)},o.parse=o,typeof module!="undefined"?module.exports=o:this.marked=o}.call(function(){return this||(typeof window!="undefined"?window:global)}());
@@ -0,0 +1,37 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require feather_cms/bootstrap
13
+ */
14
+
15
+ body
16
+ padding-top: 40px
17
+ padding-bottom: 10px
18
+
19
+ .nav-collapse .nav
20
+ font-size: 15px
21
+
22
+ .page-header
23
+ padding-bottom: 10px
24
+ margin: 5px 0
25
+ border-bottom: 1px solid #EEE
26
+
27
+ #epiceditor
28
+ width: 880px
29
+ height: 700px
30
+ // background-color: #292929
31
+ //border: 1px solid black
32
+ margin-bottom: 25px
33
+ box-shadow: rgba(0, 0, 0, 0.75) 0 2px 5px
34
+ border-radius: 3px
35
+
36
+ .epiceditors
37
+ background-color: #292929 !important
@@ -0,0 +1,31 @@
1
+ html, body, iframe, div { margin:0; padding:0; }
2
+
3
+ #epiceditor-utilbar {
4
+ position:fixed;
5
+ bottom:10px;
6
+ right:10px;
7
+ padding:5px;
8
+ }
9
+
10
+ #epiceditor-utilbar img {
11
+ display:block;
12
+ float:left;
13
+ width: 30px;
14
+ height: 30px;
15
+ }
16
+
17
+ #epiceditor-utilbar img:last-child {
18
+ margin-left: 15px;
19
+ }
20
+
21
+ #epiceditor-utilbar img:hover {
22
+ cursor:pointer;
23
+ }
24
+
25
+ .epiceditor-edit-mode #epiceditor-utilbar img.epiceditor-toggle-edit-btn {
26
+ display: none;
27
+ }
28
+
29
+ .epiceditor-preview-mode #epiceditor-utilbar img.epiceditor-toggle-preview-btn {
30
+ display: none;
31
+ }
@@ -0,0 +1,47 @@
1
+ .epiceditor-textarea{
2
+ margin:0; /* needed to get rid of a 1 pixel top-border in firefox*/
3
+ }
4
+
5
+ .epiceditor-wrapper {
6
+ background:rgb(241,241,241);
7
+ }
8
+ .epiceditor-utilbar {
9
+ position:fixed;
10
+ bottom:10px;
11
+ right:10px;
12
+ padding:5px;
13
+ border-radius:3px;
14
+ box-shadow:0 0 5px rgba(0,0,0,0.25);
15
+ background:#000;
16
+ background:rgba(0,0,0,0.5);
17
+ }
18
+
19
+ .epiceditor-utilbar img {
20
+ display:block;
21
+ float:left;
22
+ }
23
+
24
+ .epiceditor-utilbar img:first-child {
25
+ margin:0 3px 0 0;
26
+ }
27
+
28
+ .epiceditor-utilbar img:hover {
29
+ cursor:pointer;
30
+ }
31
+
32
+ .epiceditor-utilbar:hover {
33
+ display:block !important; /* No, really, important so when hovering the element it wont go away after N secs */
34
+ }
35
+
36
+ .epiceditor-wrapper textarea {
37
+ border:0;
38
+ resize: none;
39
+ width:100%;
40
+ background:rgb(41,41,41);
41
+ font-family:monospace;
42
+ font-size:14px;
43
+ padding:10px;
44
+ color:#ddd;
45
+ }
46
+
47
+ .epiceditor-wrapper textarea:focus { outline:none; }
@@ -0,0 +1,48 @@
1
+ .epiceditor-wrapper {
2
+ background:rgb(241,241,241);
3
+ }
4
+ .epiceditor-utilbar {
5
+ position:fixed;
6
+ bottom:10px;
7
+ right:10px;
8
+ padding:5px;
9
+ border-radius:3px;
10
+ box-shadow:0 0 5px rgba(0,0,0,0.25);
11
+ background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
12
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
13
+ background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
14
+ background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
15
+ background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
16
+ background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C */
17
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
18
+ }
19
+
20
+ .epiceditor-utilbar img {
21
+ display:block;
22
+ float:left;
23
+ }
24
+
25
+ .epiceditor-utilbar img:first-child {
26
+ margin:0 3px 0 0;
27
+ }
28
+
29
+ .epiceditor-utilbar img:hover {
30
+ cursor:pointer;
31
+ }
32
+
33
+ .epiceditor-utilbar:hover {
34
+ display:block !important; /* No, really, important so when hovering the element it wont go away after N secs */
35
+ }
36
+
37
+ .epiceditor-wrapper textarea {
38
+ border:0;
39
+ resize: none;
40
+ width:100%;
41
+ background:rgb(241,241,241);
42
+ font-family:monospace;
43
+ font-size:14px;
44
+ padding:10px;
45
+ color:#141414;
46
+ }
47
+
48
+ .epiceditor-wrapper textarea:focus { outline:none; }
@@ -0,0 +1,82 @@
1
+ .epiceditor-utilbar {
2
+ position:fixed;
3
+ bottom:10px;
4
+ right:10px;
5
+ padding:5px;
6
+ border-radius:3px;
7
+ box-shadow:0 0 5px rgba(0,0,0,0.25);
8
+ background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
9
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
10
+ background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
11
+ background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
12
+ background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
13
+ background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C */
14
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
15
+ }
16
+
17
+ .epiceditor-preview {
18
+ font:13.34px helvetica,arial,freesans,clean,sans-serif;
19
+ color:black;
20
+ line-height:1.4em;
21
+ background: #fff;
22
+ margin:0 auto;
23
+ }
24
+ .epiceditor-preview p {
25
+ margin:1em 0;
26
+ line-height:1.5em;
27
+ }
28
+ .epiceditor-preview table {
29
+ font-size:inherit;
30
+ font:100%;
31
+ margin:1em;
32
+ }
33
+ .epiceditor-preview table th{border-bottom:1px solid #bbb;padding:.2em 1em;}
34
+ .epiceditor-preview table td{border-bottom:1px solid #ddd;padding:.2em 1em;}
35
+ .epiceditor-preview input[type=text],input[type=password],input[type=image],.epiceditor-preview textarea{font:99% helvetica,arial,freesans,sans-serif;}
36
+ .epiceditor-preview select,.epiceditor-preview option{padding:0 .25em;}
37
+ .epiceditor-preview optgroup{margin-top:.5em;}
38
+ .epiceditor-preview pre,.epiceditor-preview code{font:12px Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;}
39
+
40
+ .epiceditor-preview pre {
41
+ margin:1em 0;
42
+ font-size:12px;
43
+ background-color:#eee;
44
+ border:1px solid lightgray;
45
+ padding:5px;
46
+ line-height:1.5em;
47
+ color:#444;
48
+ overflow:auto;
49
+ border-radius:3px;
50
+ }
51
+ .epiceditor-preview pre code {
52
+ padding:0;
53
+ font-size:12px;
54
+ background-color:#eee;
55
+ border:none;
56
+ }
57
+ .epiceditor-preview code {
58
+ font-size:12px;
59
+ background-color:#eee;
60
+ color:#444;
61
+ padding:0 .2em;
62
+ border:1px solid lightgray;
63
+ }
64
+ .epiceditor-preview img{border:0;max-width:100%;}
65
+ .epiceditor-preview abbr{border-bottom:none;}
66
+ .epiceditor-preview a{color:#4183c4;text-decoration:none;}
67
+ .epiceditor-preview a:hover{text-decoration:underline;}
68
+ .epiceditor-preview a code,.epiceditor-preview a:link code,.epiceditor-preview a:visited code{color:#4183c4;}
69
+ .epiceditor-preview h2,.epiceditor-preview h3{margin:1em 0;}
70
+ .epiceditor-preview h1,.epiceditor-preview h2,.epiceditor-preview h3,.epiceditor-preview h4,.epiceditor-preview h5,.epiceditor-preview h6{border:0;}
71
+ .epiceditor-preview h1{font-size:170%;border-top:4px solid #aaa;padding-top:.5em;margin-top:1.5em;}
72
+ .epiceditor-preview h1:first-child{margin-top:0;padding-top:.25em;border-top:none;}
73
+ .epiceditor-preview h2{font-size:150%;margin-top:1.5em;padding-top:.5em;}
74
+ .epiceditor-preview h3{margin-top:1em;}
75
+ .epiceditor-preview hr{border:0;border-bottom:1px solid #ddd;}
76
+ .epiceditor-preview ul{margin:1em 0;}
77
+ .epiceditor-preview ol{margin:1em 0;}
78
+ .epiceditor-preview ul li,.epiceditor-preview ol li{margin:1em 0;}
79
+ .epiceditor-preview ul ul,.epiceditor-preview ul ol,.epiceditor-preview ol ol,.epiceditor-preview ol ul{margin-top:0;margin-bottom:0;}
80
+ .epiceditor-preview blockquote{margin:1em 0;border-left:5px solid #ddd;padding-left:.6em;color:#555;}
81
+ .epiceditor-preview dt{font-weight:bold;margin-left:1em;}
82
+ .epiceditor-preview dd{margin-left:2em;margin-bottom:1em;}
@@ -0,0 +1,113 @@
1
+ .epiceditor-preview h1,
2
+ .epiceditor-preview h2,
3
+ .epiceditor-preview h3,
4
+ .epiceditor-preview h4,
5
+ .epiceditor-preview h5,
6
+ .epiceditor-preview h6,
7
+ .epiceditor-preview p,
8
+ .epiceditor-preview blockquote {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+ .epiceditor-preview {
13
+ background:#000;
14
+ font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
15
+ font-size: 13px;
16
+ line-height: 18px;
17
+ color: #ccc;
18
+ }
19
+ .epiceditor-preview a {
20
+ color: #fff;
21
+ }
22
+ .epiceditor-preview a:hover {
23
+ color: #00ff00;
24
+ text-decoration: none;
25
+ }
26
+ .epiceditor-preview a img {
27
+ border: none;
28
+ }
29
+ .epiceditor-preview p {
30
+ margin-bottom: 9px;
31
+ }
32
+ .epiceditor-preview h1,
33
+ .epiceditor-preview h2,
34
+ .epiceditor-preview h3,
35
+ .epiceditor-preview h4,
36
+ .epiceditor-preview h5,
37
+ .epiceditor-preview h6 {
38
+ color: #cdcdcd;
39
+ line-height: 36px;
40
+ }
41
+ .epiceditor-preview h1 {
42
+ margin-bottom: 18px;
43
+ font-size: 30px;
44
+ }
45
+ .epiceditor-preview h2 {
46
+ font-size: 24px;
47
+ }
48
+ .epiceditor-preview h3 {
49
+ font-size: 18px;
50
+ }
51
+ .epiceditor-preview h4 {
52
+ font-size: 16px;
53
+ }
54
+ .epiceditor-preview h5 {
55
+ font-size: 14px;
56
+ }
57
+ .epiceditor-preview h6 {
58
+ font-size: 13px;
59
+ }
60
+ .epiceditor-preview hr {
61
+ margin: 0 0 19px;
62
+ border: 0;
63
+ border-bottom: 1px solid #ccc;
64
+ }
65
+ .epiceditor-preview blockquote {
66
+ padding: 13px 13px 21px 15px;
67
+ margin-bottom: 18px;
68
+ font-family:georgia,serif;
69
+ font-style: italic;
70
+ }
71
+ .epiceditor-preview blockquote:before {
72
+ content:"\201C";
73
+ font-size:40px;
74
+ margin-left:-10px;
75
+ font-family:georgia,serif;
76
+ color:#eee;
77
+ }
78
+ .epiceditor-preview blockquote p {
79
+ font-size: 14px;
80
+ font-weight: 300;
81
+ line-height: 18px;
82
+ margin-bottom: 0;
83
+ font-style: italic;
84
+ }
85
+ .epiceditor-preview code, .epiceditor-preview pre {
86
+ font-family: Monaco, Andale Mono, Courier New, monospace;
87
+ }
88
+ .epiceditor-preview code {
89
+ background-color: #000;
90
+ color: #f92672;
91
+ padding: 1px 3px;
92
+ font-size: 12px;
93
+ -webkit-border-radius: 3px;
94
+ -moz-border-radius: 3px;
95
+ border-radius: 3px;
96
+ }
97
+ .epiceditor-preview pre {
98
+ display: block;
99
+ padding: 14px;
100
+ color:#66d9ef;
101
+ margin: 0 0 18px;
102
+ line-height: 16px;
103
+ font-size: 11px;
104
+ border: 1px solid #d9d9d9;
105
+ white-space: pre-wrap;
106
+ word-wrap: break-word;
107
+ }
108
+ .epiceditor-preview pre code {
109
+ background-color: #000;
110
+ color:#ccc;
111
+ font-size: 11px;
112
+ padding: 0;
113
+ }
@@ -0,0 +1,4 @@
1
+ module FeatherCms
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,84 @@
1
+ module FeatherCms
2
+ class PagesController < ApplicationController
3
+
4
+ if FeatherCms::Config.authentication.kind_of?(Hash)
5
+ http_basic_authenticate_with FeatherCms::Config.authentication.merge(:except => :published)
6
+ else
7
+ before_filter FeatherCms::Config.authentication.to_sym, :except => :published
8
+ end
9
+
10
+ before_filter :find_page, :only => [:edit, :update, :destroy, :preview]
11
+ before_filter :all_page, :except => [:preview, :published]
12
+
13
+ layout 'feather_layout', :except => [:preview, :published]
14
+
15
+ def index
16
+ end
17
+
18
+ def new
19
+ @page = Page.new
20
+ @page.status = 'draft'
21
+ end
22
+
23
+ def edit
24
+ @draft_page = Page.where(:name => @page.name, :status => 'draft').first
25
+ @published_page = Page.where(:name => @page.name, :status => 'published').first
26
+ end
27
+
28
+ def create
29
+ @page = Page.new(params[:page])
30
+ @page.name = @page.name.parameterize
31
+
32
+ @page.status = 'draft'
33
+ @page.template_type = 'html'
34
+
35
+ if @page.save
36
+ redirect_to pages_path
37
+ else
38
+ render :new
39
+ end
40
+ end
41
+
42
+ def update
43
+ status = params[:page].delete(:status)
44
+
45
+ @page.attributes = params[:page]
46
+ @page.name = @page.name.parameterize
47
+ @page.status = status
48
+ @page.template_type = 'html'
49
+
50
+ if @page.save
51
+ redirect_to pages_path
52
+ else
53
+ render :new
54
+ end
55
+ end
56
+
57
+ def destroy
58
+ @page.destroy
59
+ redirect_to pages_path
60
+ end
61
+
62
+ def preview
63
+ render :inline => @page.content.html_safe, :type => @page.template_type, :layout => @page.layout
64
+ end
65
+
66
+ def published
67
+ @page = Page.where(:name => params[:name], :status => 'published').first
68
+ if @page
69
+ render :inline => @page.content, :type => @page.template_type, :layout => @page.layout
70
+ else
71
+ redirect_to '/404.html'
72
+ end
73
+ end
74
+
75
+ def find_page
76
+ @page = Page.find(params[:id])
77
+ end
78
+
79
+ def all_page
80
+ @pages = Page.order(:name)
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,4 @@
1
+ module FeatherCms
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module FeatherCms
2
+ class Page < ActiveRecord::Base
3
+
4
+ STATUS = [:draft, :published]
5
+
6
+ attr_accessible :name, :layout, :template_type, :content
7
+
8
+ validates :name, :content, :presence => true
9
+ validates :name, :uniqueness => {:scope => [:status]}
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ - content_for :head do
2
+ = javascript_include_tag 'feather_cms/epiceditor.min'
3
+ = javascript_include_tag 'feather_cms/editor'
4
+ .well.row
5
+ .span12
6
+ = form_for(@page, :html => {:id => 'page_form'}) do |f|
7
+ .control-group
8
+ %label.control-label{:for => 'status'} Name*
9
+ .controls
10
+ = f.text_field :name
11
+ .control-group
12
+ - unless @page.new_record?
13
+ %label.control-label{:for => 'status'} Status
14
+ .controls
15
+ = f.select :status, FeatherCms::Page::STATUS
16
+ %label.control-label{:for => 'layout'} Layout
17
+ .controls
18
+ = f.select :layout, FeatherCms::Config.layouts
19
+ .control-group
20
+ %label.control-label{:for => 'textarea'} Content*
21
+ .controls
22
+ = f.hidden_field :content, :id => 'page_content'
23
+ #epiceditor
24
+ = f.submit 'Save', :class => 'btn btn-primary btn-large'
@@ -0,0 +1,17 @@
1
+ .row
2
+ %header.page-header
3
+ %h3 Edit Page
4
+ .row
5
+ %header
6
+ .subnav
7
+ %ul.nav.nav-pills
8
+ - if @draft_page
9
+ %li{:class => (@draft_page.status == 'draft' ? 'active ' : '')}
10
+ = link_to 'Draft Page', edit_page_path(@draft_page)
11
+ - if @published_page
12
+ %li{:class => (@published_page.status == 'published' ? 'active ' : '')}
13
+ = link_to 'Publishedi Page', edit_page_path(@published_page)
14
+ %li
15
+ = link_to 'Preview', page_preview_path(@page), target: '_blank'
16
+ %hr/
17
+ = render 'form'
@@ -0,0 +1,22 @@
1
+ %header.page-header
2
+ %h3 Pages
3
+ .well
4
+ %table.table
5
+ %thead
6
+ %tr
7
+ %th #
8
+ %th Name
9
+ %th Status
10
+ %th Actions
11
+ %tbody
12
+ - @pages.each_with_index do |page,i|
13
+ %tr
14
+ %td= (i + 1)
15
+ %td= link_to page.name.humanize, edit_page_path(page)
16
+ %td= page.status.humanize
17
+ %td
18
+ = link_to 'Preview', page_preview_path(page), :target => '_blank'
19
+ |
20
+ = link_to 'Edit', edit_page_path(page)
21
+ |
22
+ = link_to 'Destroy', page_path(page), :method => :delete, :confirm => 'Are you sure?'
@@ -0,0 +1,4 @@
1
+ .row
2
+ %header.page-header
3
+ %h3 New Page
4
+ = render 'form'
@@ -0,0 +1,30 @@
1
+ !!!
2
+ %html{:lang => 'en'}
3
+ %head
4
+ %meta{:charset => 'utf-8'}/
5
+ %title Feather CMS
6
+ %meta{:content => 'width=device-width, initial-scale=1.0', :name => 'viewport'}/
7
+ %meta{:content => '', :name => 'description'}/
8
+ %meta{:content => '', :name => 'author'}/
9
+ / Le styles
10
+ = stylesheet_link_tag 'feather_cms/application', :media => 'all'
11
+ = javascript_include_tag 'feather_cms/application'
12
+ = yield(:head)
13
+ / Le HTML5 shim, for IE6-8 support of HTML5 elements
14
+ /[if lt IE 9]
15
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
16
+ %body
17
+ .navbar.navbar-fixed-top
18
+ .navbar-inner
19
+ .container
20
+ = link_to 'Feather CMS', pages_path, :class => 'brand'
21
+ .nav-collapse
22
+ %ul.nav
23
+ %li
24
+ = link_to 'Add Page' , new_page_path
25
+ - if FeatherCms::Config.sign_out_url
26
+ %ul.nav.pull-right
27
+ %li
28
+ = link_to 'Sign Out', sign_out_url
29
+ .container
30
+ = yield
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ FeatherCms::Engine.routes.draw do
2
+
3
+ get 'preview/:id' => 'pages#preview', :as => 'page_preview'
4
+
5
+ resources :pages
6
+
7
+ end