lokka 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data/Gemfile +48 -0
  2. data/LICENSE +20 -0
  3. data/README.ja.rdoc +46 -0
  4. data/README.rdoc +46 -0
  5. data/Rakefile +116 -0
  6. data/VERSION +1 -0
  7. data/bin/autotest +16 -0
  8. data/bin/bluefeather +16 -0
  9. data/bin/convert_to_should_syntax +16 -0
  10. data/bin/css2sass +16 -0
  11. data/bin/edit_json.rb +16 -0
  12. data/bin/erubis +16 -0
  13. data/bin/exceptional +16 -0
  14. data/bin/haml +16 -0
  15. data/bin/html2haml +16 -0
  16. data/bin/jeweler +16 -0
  17. data/bin/lokka +4 -0
  18. data/bin/prettify_json.rb +16 -0
  19. data/bin/rackup +16 -0
  20. data/bin/rake +16 -0
  21. data/bin/rcov +16 -0
  22. data/bin/sass +16 -0
  23. data/bin/sass-convert +16 -0
  24. data/bin/tilt +16 -0
  25. data/bin/unit_diff +16 -0
  26. data/config.ru +3 -0
  27. data/config.yml +4 -0
  28. data/i18n/en.yml +149 -0
  29. data/i18n/ja.yml +149 -0
  30. data/init.rb +7 -0
  31. data/install.rb +16 -0
  32. data/lib/lokka.rb +138 -0
  33. data/lib/lokka/app.rb +562 -0
  34. data/lib/lokka/before.rb +29 -0
  35. data/lib/lokka/bread_crumb.rb +34 -0
  36. data/lib/lokka/category.rb +33 -0
  37. data/lib/lokka/comment.rb +26 -0
  38. data/lib/lokka/entry.rb +70 -0
  39. data/lib/lokka/helpers.rb +214 -0
  40. data/lib/lokka/option.rb +23 -0
  41. data/lib/lokka/site.rb +19 -0
  42. data/lib/lokka/tag.rb +5 -0
  43. data/lib/lokka/theme.rb +17 -0
  44. data/lib/lokka/user.rb +77 -0
  45. data/lib/sqlite3.dll +0 -0
  46. data/lokka.exe +0 -0
  47. data/lokka.exy +15 -0
  48. data/lokka.gemspec +373 -0
  49. data/lokka.ico +0 -0
  50. data/lokka.rb +11 -0
  51. data/public/admin/categories/edit.haml +6 -0
  52. data/public/admin/categories/form.haml +18 -0
  53. data/public/admin/categories/index.haml +15 -0
  54. data/public/admin/categories/new.haml +5 -0
  55. data/public/admin/comments/edit.haml +6 -0
  56. data/public/admin/comments/form.haml +29 -0
  57. data/public/admin/comments/index.haml +22 -0
  58. data/public/admin/comments/new.haml +5 -0
  59. data/public/admin/css/editor.css +10 -0
  60. data/public/admin/css/jquery.cleditor.css +24 -0
  61. data/public/admin/css/style.css +710 -0
  62. data/public/admin/edit.haml +42 -0
  63. data/public/admin/favicon.ico +0 -0
  64. data/public/admin/images/add.png +0 -0
  65. data/public/admin/images/aside_arrow.png +0 -0
  66. data/public/admin/images/buttons.gif +0 -0
  67. data/public/admin/images/category.png +0 -0
  68. data/public/admin/images/comment.png +0 -0
  69. data/public/admin/images/dashboard.png +0 -0
  70. data/public/admin/images/file.png +0 -0
  71. data/public/admin/images/files.png +0 -0
  72. data/public/admin/images/mail-attachment.png +0 -0
  73. data/public/admin/images/plugin.png +0 -0
  74. data/public/admin/images/post.png +0 -0
  75. data/public/admin/images/setting.png +0 -0
  76. data/public/admin/images/tag.png +0 -0
  77. data/public/admin/images/theme.png +0 -0
  78. data/public/admin/images/toolbar.gif +0 -0
  79. data/public/admin/images/user.png +0 -0
  80. data/public/admin/index.haml +1 -0
  81. data/public/admin/js/editor.js +7 -0
  82. data/public/admin/js/jquery.cleditor.js +1132 -0
  83. data/public/admin/js/jquery.cleditor.min.js +31 -0
  84. data/public/admin/layout.haml +91 -0
  85. data/public/admin/pages/edit.haml +6 -0
  86. data/public/admin/pages/form.haml +33 -0
  87. data/public/admin/pages/index.haml +23 -0
  88. data/public/admin/pages/new.haml +5 -0
  89. data/public/admin/plugins/index.haml +4 -0
  90. data/public/admin/posts/edit.haml +6 -0
  91. data/public/admin/posts/form.haml +33 -0
  92. data/public/admin/posts/index.haml +23 -0
  93. data/public/admin/posts/new.haml +5 -0
  94. data/public/admin/show.haml +7 -0
  95. data/public/admin/signup.haml +17 -0
  96. data/public/admin/site/edit.haml +13 -0
  97. data/public/admin/tags/edit.haml +6 -0
  98. data/public/admin/tags/form.haml +10 -0
  99. data/public/admin/tags/index.haml +19 -0
  100. data/public/admin/themes/index.haml +13 -0
  101. data/public/admin/users/edit.haml +6 -0
  102. data/public/admin/users/form.haml +22 -0
  103. data/public/admin/users/index.haml +24 -0
  104. data/public/admin/users/new.haml +5 -0
  105. data/public/plugin/lokka-google_analytics/lib/lokka/google_analytics.rb +29 -0
  106. data/public/plugin/lokka-google_analytics/views/index.haml +15 -0
  107. data/public/plugin/lokka-hello/lib/lokka/hello.rb +15 -0
  108. data/public/plugin/lokka-markdown/lib/lokka/markdown.rb +12 -0
  109. data/public/plugin/lokka-rbconfig/lib/lokka/rbconfig.rb +11 -0
  110. data/public/plugin/lokka-rbconfig/views/index.haml +7 -0
  111. data/public/plugin/lokka-rbconfig/views/style.css +12 -0
  112. data/public/system/404.haml +20 -0
  113. data/public/system/500.haml +19 -0
  114. data/public/system/comments/form.haml +22 -0
  115. data/public/system/favicon.ico +0 -0
  116. data/public/system/index.builder +25 -0
  117. data/public/system/style.css +8 -0
  118. data/public/theme/default/entries.erb +40 -0
  119. data/public/theme/default/entry.erb +23 -0
  120. data/public/theme/default/layout.erb +74 -0
  121. data/public/theme/default/quote.gif +0 -0
  122. data/public/theme/default/screenshot.png +0 -0
  123. data/public/theme/default/style.css +1147 -0
  124. data/public/theme/jarvi/entries.erb +26 -0
  125. data/public/theme/jarvi/entry.erb +14 -0
  126. data/public/theme/jarvi/favicon.ico +0 -0
  127. data/public/theme/jarvi/images/aside_dt.gif +0 -0
  128. data/public/theme/jarvi/images/aside_dt.png +0 -0
  129. data/public/theme/jarvi/images/footer.gif +0 -0
  130. data/public/theme/jarvi/images/footer.psd +0 -0
  131. data/public/theme/jarvi/images/header_deascription_ul.gif +0 -0
  132. data/public/theme/jarvi/images/header_language.gif +0 -0
  133. data/public/theme/jarvi/images/header_nav.gif +0 -0
  134. data/public/theme/jarvi/images/html.gif +0 -0
  135. data/public/theme/jarvi/images/index_content.gif +0 -0
  136. data/public/theme/jarvi/images/index_content_footer.gif +0 -0
  137. data/public/theme/jarvi/images/index_content_header.gif +0 -0
  138. data/public/theme/jarvi/images/index_header_nav.gif +0 -0
  139. data/public/theme/jarvi/images/section_header_title.gif +0 -0
  140. data/public/theme/jarvi/images/wide_content.gif +0 -0
  141. data/public/theme/jarvi/images/wide_content_body.gif +0 -0
  142. data/public/theme/jarvi/images/wide_content_h3.gif +0 -0
  143. data/public/theme/jarvi/layout.erb +55 -0
  144. data/public/theme/jarvi/screenshot.png +0 -0
  145. data/public/theme/jarvi/style.css +618 -0
  146. data/public/theme/lokka-org/article.haml +9 -0
  147. data/public/theme/lokka-org/entries.haml +9 -0
  148. data/public/theme/lokka-org/entry.haml +1 -0
  149. data/public/theme/lokka-org/favicon.ico +0 -0
  150. data/public/theme/lokka-org/images/aside_dt.gif +0 -0
  151. data/public/theme/lokka-org/images/aside_dt.png +0 -0
  152. data/public/theme/lokka-org/images/download_button.jpg +0 -0
  153. data/public/theme/lokka-org/images/footer.gif +0 -0
  154. data/public/theme/lokka-org/images/footer.psd +0 -0
  155. data/public/theme/lokka-org/images/header_capture.gif +0 -0
  156. data/public/theme/lokka-org/images/header_capture.jpg +0 -0
  157. data/public/theme/lokka-org/images/header_capture_a.gif +0 -0
  158. data/public/theme/lokka-org/images/header_deascription_ul.gif +0 -0
  159. data/public/theme/lokka-org/images/header_h1_a.gif +0 -0
  160. data/public/theme/lokka-org/images/header_language.gif +0 -0
  161. data/public/theme/lokka-org/images/header_nav.gif +0 -0
  162. data/public/theme/lokka-org/images/heder_nav_home.gif +0 -0
  163. data/public/theme/lokka-org/images/heder_nav_home.jpg +0 -0
  164. data/public/theme/lokka-org/images/html.gif +0 -0
  165. data/public/theme/lokka-org/images/index_content.gif +0 -0
  166. data/public/theme/lokka-org/images/index_content_footer.gif +0 -0
  167. data/public/theme/lokka-org/images/index_content_header.gif +0 -0
  168. data/public/theme/lokka-org/images/index_header_h1.gif +0 -0
  169. data/public/theme/lokka-org/images/index_header_nav.gif +0 -0
  170. data/public/theme/lokka-org/images/language_a.png +0 -0
  171. data/public/theme/lokka-org/images/section_header_title.gif +0 -0
  172. data/public/theme/lokka-org/images/wide_content.gif +0 -0
  173. data/public/theme/lokka-org/images/wide_content_body.gif +0 -0
  174. data/public/theme/lokka-org/images/wide_content_h3.gif +0 -0
  175. data/public/theme/lokka-org/index.haml +5 -0
  176. data/public/theme/lokka-org/layout.haml +72 -0
  177. data/public/theme/lokka-org/quote.gif +0 -0
  178. data/public/theme/lokka-org/screenshot.png +0 -0
  179. data/public/theme/lokka-org/style.css +806 -0
  180. data/public/theme/p0t/article.haml +10 -0
  181. data/public/theme/p0t/entries.haml +9 -0
  182. data/public/theme/p0t/entry.haml +7 -0
  183. data/public/theme/p0t/favicon.ico +0 -0
  184. data/public/theme/p0t/images/quote.gif +0 -0
  185. data/public/theme/p0t/layout.haml +68 -0
  186. data/public/theme/p0t/screenshot.png +0 -0
  187. data/public/theme/p0t/style.css +359 -0
  188. data/public/theme/vicuna-mono/entries.erb +40 -0
  189. data/public/theme/vicuna-mono/entry.erb +23 -0
  190. data/public/theme/vicuna-mono/layout.erb +76 -0
  191. data/public/theme/vicuna-mono/quote.gif +0 -0
  192. data/public/theme/vicuna-mono/screenshot.png +0 -0
  193. data/public/theme/vicuna-mono/style.css +1156 -0
  194. data/test/helper.rb +23 -0
  195. data/test/lokka/app_test.rb +15 -0
  196. data/test/lokka/post_test.rb +17 -0
  197. metadata +965 -0
@@ -0,0 +1,31 @@
1
+ /*
2
+ CLEditor WYSIWYG HTML Editor v1.3.0
3
+ http://premiumsoftware.net/cleditor
4
+ requires jQuery v1.4.2 or later
5
+
6
+ Copyright 2010, Chris Landowski, Premium Software, LLC
7
+ Dual licensed under the MIT or GPL Version 2 licenses.
8
+ */
9
+ (function(e){function aa(a){var b=this,c=a.target,d=e.data(c,x),h=s[d],f=h.popupName,i=p[f];if(!(b.disabled||e(c).attr(n)==n)){var g={editor:b,button:c,buttonName:d,popup:i,popupName:f,command:h.command,useCSS:b.options.useCSS};if(h.buttonClick&&h.buttonClick(a,g)===false)return false;if(d=="source"){if(t(b)){delete b.range;b.$area.hide();b.$frame.show();c.title=h.title}else{b.$frame.hide();b.$area.show();c.title="Show Rich Text"}setTimeout(function(){u(b)},100)}else if(!t(b))if(f){var j=e(i);if(f==
10
+ "url"){if(d=="link"&&M(b)===""){z(b,"A selection is required when inserting a link.",c);return false}j.children(":button").unbind(q).bind(q,function(){var k=j.find(":text"),o=e.trim(k.val());o!==""&&v(b,g.command,o,null,g.button);k.val("http://");r();w(b)})}else f=="pastetext"&&j.children(":button").unbind(q).bind(q,function(){var k=j.find("textarea"),o=k.val().replace(/\n/g,"<br />");o!==""&&v(b,g.command,o,null,g.button);k.val("");r();w(b)});if(c!==e.data(i,A)){N(b,i,c);return false}return}else if(d==
11
+ "print")b.$frame[0].contentWindow.print();else if(!v(b,g.command,g.value,g.useCSS,c))return false;w(b)}}function O(a){a=e(a.target).closest("div");a.css(H,a.data(x)?"#FFF":"#FFC")}function P(a){e(a.target).closest("div").css(H,"transparent")}function ba(a){var b=a.data.popup,c=a.target;if(!(b===p.msg||e(b).hasClass(B))){var d=e.data(b,A),h=e.data(d,x),f=s[h],i=f.command,g,j=this.options.useCSS;if(h=="font")g=c.style.fontFamily.replace(/"/g,"");else if(h=="size"){if(c.tagName=="DIV")c=c.children[0];
12
+ g=c.innerHTML}else if(h=="style")g="<"+c.tagName+">";else if(h=="color")g=Q(c.style.backgroundColor);else if(h=="highlight"){g=Q(c.style.backgroundColor);if(l)i="backcolor";else j=true}b={editor:this,button:d,buttonName:h,popup:b,popupName:f.popupName,command:i,value:g,useCSS:j};if(!(f.popupClick&&f.popupClick(a,b)===false)){if(b.command&&!v(this,b.command,b.value,b.useCSS,d))return false;r();w(this)}}}function C(a){for(var b=1,c=0,d=0;d<a.length;++d){b=(b+a.charCodeAt(d))%65521;c=(c+b)%65521}return c<<
13
+ 16|b}function R(a,b,c,d,h){if(p[a])return p[a];var f=e(m).hide().addClass(ca).appendTo("body");if(d)f.html(d);else if(a=="color"){b=b.colors.split(" ");b.length<10&&f.width("auto");e.each(b,function(i,g){e(m).appendTo(f).css(H,"#"+g)});c=da}else if(a=="font")e.each(b.fonts.split(","),function(i,g){e(m).appendTo(f).css("fontFamily",g).html(g)});else if(a=="size")e.each(b.sizes.split(","),function(i,g){e(m).appendTo(f).html("<font size="+g+">"+g+"</font>")});else if(a=="style")e.each(b.styles,function(i,
14
+ g){e(m).appendTo(f).html(g[1]+g[0]+g[1].replace("<","</"))});else if(a=="url"){f.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');c=B}else if(a=="pastetext"){f.html("Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>");c=B}if(!c&&!d)c=S;f.addClass(c);l&&f.attr(I,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(I,"on");if(f.hasClass(S)||h===true)f.children().hover(O,P);p[a]=f[0];
15
+ return f[0]}function T(a,b){if(b){a.$area.attr(n,n);a.disabled=true}else{a.$area.removeAttr(n);delete a.disabled}try{if(l)a.doc.body.contentEditable=!b;else a.doc.designMode=!b?"on":"off"}catch(c){}u(a)}function v(a,b,c,d,h){D(a);if(!l){if(d===undefined||d===null)d=a.options.useCSS;a.doc.execCommand("styleWithCSS",0,d.toString())}d=true;var f;if(l&&b.toLowerCase()=="inserthtml")y(a).pasteHTML(c);else{try{d=a.doc.execCommand(b,0,c||null)}catch(i){f=i.description;d=false}d||("cutcopypaste".indexOf(b)>
16
+ -1?z(a,"For security reasons, your browser does not support the "+b+" command. Try using the keyboard shortcut or context menu instead.",h):z(a,f?f:"Error executing the "+b+" command.",h))}u(a);return d}function w(a){setTimeout(function(){t(a)?a.$area.focus():a.$frame[0].contentWindow.focus();u(a)},0)}function y(a){if(l)return J(a).createRange();return J(a).getRangeAt(0)}function J(a){if(l)return a.doc.selection;return a.$frame[0].contentWindow.getSelection()}function Q(a){var b=/rgba?\((\d+), (\d+), (\d+)/.exec(a),
17
+ c=a.split("");if(b)for(a=(b[1]<<16|b[2]<<8|b[3]).toString(16);a.length<6;)a="0"+a;return"#"+(a.length==6?a:c[1]+c[1]+c[2]+c[2]+c[3]+c[3])}function r(){e.each(p,function(a,b){e(b).hide().unbind(q).removeData(A)})}function U(){var a=e("link[href$='jquery.cleditor.css']").attr("href");return a.substr(0,a.length-19)+"images/"}function K(a){var b=a.$main,c=a.options;a.$frame&&a.$frame.remove();var d=a.$frame=e('<iframe frameborder="0" src="javascript:true;">').hide().appendTo(b),h=d[0].contentWindow,f=
18
+ a.doc=h.document,i=e(f);f.open();f.write(c.docType+"<html>"+(c.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+c.docCSSFile+'" /></head>')+'<body style="'+c.bodyStyle+'"></body></html>');f.close();l&&i.click(function(){w(a)});E(a);if(l){i.bind("beforedeactivate beforeactivate selectionchange keypress",function(g){if(g.type=="beforedeactivate")a.inactive=true;else if(g.type=="beforeactivate"){!a.inactive&&a.range&&a.range.length>1&&a.range.shift();delete a.inactive}else if(!a.inactive){if(!a.range)a.range=
19
+ [];for(a.range.unshift(y(a));a.range.length>2;)a.range.pop()}});d.focus(function(){D(a)})}(e.browser.mozilla?i:e(h)).blur(function(){V(a,true)});i.click(r).bind("keyup mouseup",function(){u(a)});L?a.$area.show():d.show();e(function(){var g=a.$toolbar,j=g.children("div:last"),k=b.width();j=j.offset().top+j.outerHeight()-g.offset().top+1;g.height(j);j=(/%/.test(""+c.height)?b.height():parseInt(c.height))-j;d.width(k).height(j);a.$area.width(k).height(ea?j-2:j);T(a,a.disabled);u(a)})}function u(a){if(!L&&
20
+ e.browser.webkit&&!a.focused){a.$frame[0].contentWindow.focus();window.focus();a.focused=true}var b=a.doc;if(l)b=y(a);var c=t(a);e.each(a.$toolbar.find("."+W),function(d,h){var f=e(h),i=e.cleditor.buttons[e.data(h,x)],g=i.command,j=true;if(a.disabled)j=false;else if(i.getEnabled){j=i.getEnabled({editor:a,button:h,buttonName:i.name,popup:p[i.popupName],popupName:i.popupName,command:i.command,useCSS:a.options.useCSS});if(j===undefined)j=true}else if((c||L)&&i.name!="source"||l&&(g=="undo"||g=="redo"))j=
21
+ false;else if(g&&g!="print"){if(l&&g=="hilitecolor")g="backcolor";if(!l||g!="inserthtml")try{j=b.queryCommandEnabled(g)}catch(k){j=false}}if(j){f.removeClass(X);f.removeAttr(n)}else{f.addClass(X);f.attr(n,n)}})}function D(a){l&&a.range&&a.range[0].select()}function M(a){D(a);if(l)return y(a).text;return J(a).toString()}function z(a,b,c){var d=R("msg",a.options,fa);d.innerHTML=b;N(a,d,c)}function N(a,b,c){var d,h,f=e(b);if(c){var i=e(c);d=i.offset();h=--d.left;d=d.top+i.height()}else{i=a.$toolbar;
22
+ d=i.offset();h=Math.floor((i.width()-f.width())/2)+d.left;d=d.top+i.height()-2}r();f.css({left:h,top:d}).show();if(c){e.data(b,A,c);f.bind(q,{popup:b},e.proxy(ba,a))}setTimeout(function(){f.find(":text,textarea").eq(0).focus().select()},100)}function t(a){return a.$area.is(":visible")}function E(a,b){var c=a.$area.val(),d=a.options,h=d.updateFrame,f=e(a.doc.body);if(h){var i=C(c);if(b&&a.areaChecksum==i)return;a.areaChecksum=i}c=h?h(c):c;c=c.replace(/<(?=\/?script)/ig,"&lt;");if(d.updateTextArea)a.frameChecksum=
23
+ C(c);if(c!=f.html()){f.html(c);e(a).triggerHandler(F)}}function V(a,b){var c=e(a.doc.body).html(),d=a.options,h=d.updateTextArea,f=a.$area;if(h){var i=C(c);if(b&&a.frameChecksum==i)return;a.frameChecksum=i}c=h?h(c):c;if(d.updateFrame)a.areaChecksum=C(c);if(c!=f.val()){f.val(c);e(a).triggerHandler(F)}}e.cleditor={defaultOptions:{width:500,height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",
24
+ colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],
25
+ ["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:false,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},
26
+ imagesPath:function(){return U()}};e.fn.cleditor=function(a){var b=e([]);this.each(function(c,d){if(d.tagName=="TEXTAREA"){var h=e.data(d,Y);h||(h=new cleditor(d,a));b=b.add(h)}});return b};var H="backgroundColor",A="button",x="buttonName",F="change",Y="cleditor",q="click",n="disabled",m="<div>",I="unselectable",W="cleditorButton",X="cleditorDisabled",ca="cleditorPopup",S="cleditorList",da="cleditorColor",B="cleditorPrompt",fa="cleditorMsg",l=e.browser.msie,ea=/msie\s6/i.test(navigator.userAgent),
27
+ L=/iphone|ipad|ipod/i.test(navigator.userAgent),p={},Z,s=e.cleditor.buttons;e.each(s.init.split("|"),function(a,b){var c=b.split(","),d=c[0];s[d]={stripIndex:a,name:d,title:c[1]===""?d.charAt(0).toUpperCase()+d.substr(1):c[1],command:c[2]===""?d:c[2],popupName:c[3]===""?d:c[3]}});delete s.init;cleditor=function(a,b){var c=this;c.options=b=e.extend({},e.cleditor.defaultOptions,b);var d=c.$area=e(a).hide().data(Y,c).blur(function(){E(c,true)}),h=c.$main=e(m).addClass("cleditorMain").width(b.width).height(b.height),
28
+ f=c.$toolbar=e(m).addClass("cleditorToolbar").appendTo(h),i=e(m).addClass("cleditorGroup").appendTo(f);e.each(b.controls.split(" "),function(g,j){if(j==="")return true;if(j=="|"){e(m).addClass("cleditorDivider").appendTo(i);i=e(m).addClass("cleditorGroup").appendTo(f)}else{var k=s[j],o=e(m).data(x,k.name).addClass(W).attr("title",k.title).bind(q,e.proxy(aa,c)).appendTo(i).hover(O,P),G={};if(k.css)G=k.css;else if(k.image)G.backgroundImage="url("+U()+k.image+")";if(k.stripIndex)G.backgroundPosition=
29
+ k.stripIndex*-24;o.css(G);l&&o.attr(I,"on");k.popupName&&R(k.popupName,b,k.popupClass,k.popupContent,k.popupHover)}});h.insertBefore(d).append(d);if(!Z){e(document).click(function(g){g=e(g.target);g.add(g.parents()).is("."+B)||r()});Z=true}/auto|%/.test(""+b.width+b.height)&&e(window).resize(function(){K(c)});K(c)};var $=cleditor.prototype;e.each([["clear",function(a){a.$area.val("");E(a)}],["disable",T],["execCommand",v],["focus",w],["hidePopups",r],["sourceMode",t,true],["refresh",K],["select",
30
+ function(a){setTimeout(function(){t(a)?a.$area.select():v(a,"selectall")},0)}],["selectedHTML",function(a){D(a);a=y(a);if(l)return a.htmlText;var b=e("<layer>")[0];b.appendChild(a.cloneContents());return b.innerHTML},true],["selectedText",M,true],["showMessage",z],["updateFrame",E],["updateTextArea",V]],function(a,b){$[b[0]]=function(){for(var c=[this],d=0;d<arguments.length;d++)c.push(arguments[d]);c=b[1].apply(this,c);if(b[2])return c;return this}});$.change=function(a){var b=e(this);return a?b.bind(F,
31
+ a):b.trigger(F)}})(jQuery);
@@ -0,0 +1,91 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8'}
5
+ %meta{'http-equiv' => 'Content-Style-Type', 'content' => 'text/css'}
6
+ %meta{'http-equiv' => 'Content-Script-Type', 'content' => 'text/javascript'}
7
+ %title== #{@site.title} - Lokka
8
+ %link{:rel => 'shortcut icon', :href => '/admin/favicon.ico'}
9
+ %link{:rel => 'stylesheet', :href => '/admin/css/style.css', :type => 'text/css'}
10
+ %link{:rel => 'stylesheet', :href => '/admin/css/jquery.cleditor.css', :type => 'text/css'}
11
+ %script{:src => "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", :type => "text/javascript"}
12
+ %script{:src => "/admin/js/jquery.cleditor.min.js", :type => "text/javascript"}
13
+ %script{:src => "/admin/js/editor.js", :type => "text/javascript"}
14
+ - head_last = yield_content :head_last
15
+ - unless head_last.blank?
16
+ = head_last
17
+ %body
18
+ #header
19
+ %h1
20
+ %a{:href => '/'}= @site.title
21
+ #nav
22
+ %ul
23
+ - if logged_in?
24
+ %li= link_to current_user.name, "/admin/users/#{current_user.id}/edit"
25
+ %li
26
+ %a{:href => '/admin/logout'}= t.logout
27
+ - else
28
+ %li
29
+ %a{:href => '/admin/login'}= t.login
30
+ #content
31
+ #aside
32
+ %ul
33
+ %li.post.parent
34
+ %h3.title= t.posts
35
+ %ul
36
+ %li.list
37
+ %a{:href => '/admin/posts'}= t.list
38
+ %li.new
39
+ %a{:href => '/admin/posts/new'}= t.new
40
+ %li.page.parent
41
+ %h3.title= t.pages
42
+ %ul
43
+ %li.list
44
+ %a{:href => '/admin/pages'}= t.list
45
+ %li.new
46
+ %a{:href => '/admin/pages/new'}= t.new
47
+ %li.comment.parent
48
+ %h3.title= t.comments
49
+ %ul
50
+ %li.list
51
+ %a{:href => '/admin/comments'}= t.list
52
+ %li.new
53
+ %a{:href => '/admin/comments/new'}= t.new
54
+ %li.category.parent
55
+ %h3.title= t.categories
56
+ %ul
57
+ %li.list
58
+ %a{:href => '/admin/categories'}= t.list
59
+ %li.new
60
+ %a{:href => '/admin/categories/new'}= t.new
61
+ %li.tag.parent
62
+ %h3.title= t.tags
63
+ %ul
64
+ %li.list
65
+ %a{:href => '/admin/tags'}= t.list
66
+ %li.user.parent
67
+ %h3.title= t.users
68
+ %ul
69
+ %li.list
70
+ %a{:href => '/admin/users'}= t.list
71
+ %li.new
72
+ %a{:href => '/admin/users/new'}= t.new
73
+ %li.theme.parent
74
+ %h3
75
+ %a{:href => '/admin/themes'}= t.themes
76
+ %li.plugin.parent
77
+ %h3
78
+ %a{:href => '/admin/plugins'}= t.plugins
79
+ %li.setting.parent
80
+ %h3
81
+ %a{:href => '/admin/site/edit'}= t.settings
82
+ - admin_aside = yield_content :admin_aside
83
+ - unless admin_aside.blank?
84
+ = admin_aside
85
+ #main
86
+ - if flash[:notice]
87
+ #notice
88
+ %p= flash[:notice]
89
+ = yield
90
+ #footer
91
+ %a{:href => 'http://lokka.org/'} Lokka
@@ -0,0 +1,6 @@
1
+ %h2= t.edit_page
2
+ %form{:action => "/admin/pages/#{@page.id}", :method => 'post'}
3
+ %input{:type => 'hidden', :name => '_method', :value => 'put'}
4
+ = partial 'pages/form'
5
+ %p
6
+ %input{:type => 'submit', :value => t.edit}
@@ -0,0 +1,33 @@
1
+ - unless @page.errors.empty?
2
+ #error
3
+ .title= t.error
4
+ %ul
5
+ - @page.errors.each do |error|
6
+ %li= error
7
+ .field
8
+ %label{:for => 'page_title'}= t.page.title
9
+ %br
10
+ %input{:type => 'text', :id => 'page_title', :name => 'page[title]', :value => @page.title}
11
+ .field
12
+ %label{:for => 'page_body'}= t.page.body
13
+ %br
14
+ %textarea{:id => 'page_body', :class => 'editor', :name => 'page[body]', :rows => 10, :cols => 50}= h @page.body
15
+ .field
16
+ %label{:for => 'page_slug'}= t.page.slug
17
+ %br
18
+ %input{:type => 'text', :id => 'page_slug', :name => 'page[slug]', :value => @page.slug}
19
+ .field
20
+ %label{:for => 'page_category'}= t.page.category
21
+ %br
22
+ - if @categories.size > 1
23
+ = select_field @page, :category_id, @categories, :id => 'page_category'
24
+ - else
25
+ = t.no_category
26
+ .field
27
+ %label{:for => 'page_tag_collection'}= t.page.tags
28
+ %br
29
+ %input{:type => 'text', :id => 'page_tag_collection', :name => 'page[tag_collection]', :value => @page.tag_collection}
30
+ .field
31
+ %label{:for => 'page_created_at'}= t.page.created_at
32
+ %br
33
+ %input{:type => 'text', :id => 'page_created_at', :name => 'page[created_at]', :value => @page.created_at}
@@ -0,0 +1,23 @@
1
+ %h2= t.listing_pages
2
+ %table.pages
3
+ %tr
4
+ %th= t.page.title
5
+ %th= t.page.user
6
+ %th= t.page.created_at
7
+ %th{:colspan => 2}
8
+ - @pages.each_with_index do |page, i|
9
+ %tr{:class => (i+1).odd? ? 'odd' : 'even'}
10
+ %td.title
11
+ %a{:href => page.link}= page.title
12
+ %td= page.user.name
13
+ %td= l page.created_at.to_time
14
+ %td
15
+ %a.button{:href => page.edit_link}= t.edit
16
+ %td
17
+ = link_to t.delete, "/admin/pages/#{page.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete
18
+ .pager
19
+ %ul
20
+ - if @pages.pager.previous_page
21
+ %li.previous= link_to t.previous, "?page=#{@pages.pager.previous_page}"
22
+ - if @pages.pager.next_page
23
+ %li.next= link_to t.next, "?page=#{@pages.pager.next_page}"
@@ -0,0 +1,5 @@
1
+ %h2= t.new_page
2
+ %form{:action => '/admin/pages', :method => 'post'}
3
+ = partial 'pages/form'
4
+ %p
5
+ %input{:type => 'submit', :value => t.new}
@@ -0,0 +1,4 @@
1
+ %h2= t.listing_plugins
2
+ %ul.plugins
3
+ - settings.plugins.each do |plugin|
4
+ %li= link_to_if plugin.have_admin_page, plugin.name, "/admin/plugins/#{plugin.name}"
@@ -0,0 +1,6 @@
1
+ %h2= t.edit_post
2
+ %form{:action => "/admin/posts/#{@post.id}", :method => 'post'}
3
+ %input{:type => 'hidden', :name => '_method', :value => 'put'}
4
+ = partial 'posts/form'
5
+ %p
6
+ %input{:type => 'submit', :value => t.edit}
@@ -0,0 +1,33 @@
1
+ - unless @post.errors.empty?
2
+ #error
3
+ .title= t.error
4
+ %ul
5
+ - @post.errors.each do |error|
6
+ %li= error
7
+ .field
8
+ %label{:for => 'post_title'}= t.post.title
9
+ %br
10
+ %input{:type => 'text', :id => 'post_title', :name => 'post[title]', :value => @post.title}
11
+ .field
12
+ %label{:for => 'post_body'}= t.post.body
13
+ %br
14
+ %textarea{:id => 'post_body', :class => 'editor', :name => 'post[body]', :rows => 10, :cols => 50}= h @post.body
15
+ .field
16
+ %label{:for => 'post_slug'}= t.post.slug
17
+ %br
18
+ %input{:type => 'text', :id => 'post_slug', :name => 'post[slug]', :value => @post.slug}
19
+ .field
20
+ %label{:for => 'post_category'}= t.post.category
21
+ %br
22
+ - if @categories.size > 1
23
+ = select_field @post, :category_id, @categories, :id => 'post_category'
24
+ - else
25
+ = t.no_category
26
+ .field
27
+ %label{:for => 'post_tag_collection'}= t.post.tags
28
+ %br
29
+ %input{:type => 'text', :id => 'post_tag_collection', :name => 'post[tag_collection]', :value => @post.tag_collection}
30
+ .field
31
+ %label{:for => 'post_created_at'}= t.post.created_at
32
+ %br
33
+ %input{:type => 'text', :id => 'post_created_at', :name => 'post[created_at]', :value => @post.created_at}
@@ -0,0 +1,23 @@
1
+ %h2= t.listing_posts
2
+ %table.posts
3
+ %tr
4
+ %th= t.post.title
5
+ %th= t.post.user
6
+ %th= t.post.created_at
7
+ %th{:colspan => 2}
8
+ - @posts.each_with_index do |post, i|
9
+ %tr{:class => (i+1).odd? ? 'odd' : 'even'}
10
+ %td.title
11
+ %a{:href => post.link}= post.title
12
+ %td= post.user.name
13
+ %td= l post.created_at.to_time
14
+ %td
15
+ %a.button{:href => post.edit_link}= t.edit
16
+ %td
17
+ = link_to t.delete, "/admin/posts/#{post.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete
18
+ .pager
19
+ %ul
20
+ - if @posts.pager.previous_page
21
+ %li.previous= link_to t.previous, "?page=#{@posts.pager.previous_page}"
22
+ - if @posts.pager.next_page
23
+ %li.next= link_to t.next, "?page=#{@posts.pager.next_page}"
@@ -0,0 +1,5 @@
1
+ %h2= t.new_post
2
+ %form{:action => '/admin/posts', :method => 'post'}
3
+ = partial 'posts/form'
4
+ %p
5
+ %input{:type => 'submit', :value => t.new}
@@ -0,0 +1,7 @@
1
+ #sinatra_authentication
2
+ %h1.page_title
3
+ - if @user.email
4
+ = @user.email
5
+ - if current_user.admin?
6
+ %h2 permission level
7
+ = @user.permission_level
@@ -0,0 +1,17 @@
1
+ %h2 Signup
2
+ %form{:action => '/admin/signup', :method => 'post'}
3
+ %p
4
+ %label{:for => 'user_name'} Name
5
+ %br
6
+ %input{:id => 'user_name', :name => 'user[name]', :type => 'text' }
7
+ %p
8
+ %label{:for => 'user_password'} Password
9
+ %br
10
+ %input{:id => 'user_password', :name => 'user[password]', :type => 'password' }
11
+ %p
12
+ %label{:for => 'user_password_confirmation'} Confirm Password
13
+ %br
14
+ %input{:id => 'user_password_confirmation', :name => 'user[password_confirmation]', :type => 'password' }
15
+ %p
16
+ %input{:value => 'Create account', :type => 'submit' }
17
+ %a{:href => '/admin/login'} Login
@@ -0,0 +1,13 @@
1
+ %h2= t.edit_site
2
+ %form{:action => '/admin/site', :method => 'post'}
3
+ %input{:type => 'hidden', :name => '_method', :value => 'put'}
4
+ %p
5
+ %label{:for => 'site_title'}= t.site.title
6
+ %br
7
+ %input{:type => 'text', :id => 'site_title', :name => 'site[title]', :value => @site.title}
8
+ %p
9
+ %label{:for => 'site_description'}= t.site.description
10
+ %br
11
+ %textarea{:id => 'site_description', :name => 'site[description]', :rows => 10, :cols => 50}= h @site.description
12
+ %p
13
+ %input{:type => 'submit', :value => t.edit}
@@ -0,0 +1,6 @@
1
+ %h2= t.edit_tag
2
+ %form{:action => "/admin/tags/#{@tag.id}", :method => 'post'}
3
+ %input{:type => 'hidden', :name => '_method', :value => 'put'}
4
+ = partial 'tags/form'
5
+ %p
6
+ %input{:type => 'submit', :value => t.edit}
@@ -0,0 +1,10 @@
1
+ - unless @tag.errors.empty?
2
+ #error
3
+ .title= t.error
4
+ %ul
5
+ - @tag.errors.each do |error|
6
+ %li= error
7
+ .field
8
+ %label{:for => 'tag_name'}= t.tag.name
9
+ %br
10
+ %input{:type => 'text', :id => 'tag_name', :name => 'tag[name]', :value => @tag.name}
@@ -0,0 +1,19 @@
1
+ %h2= t.listing_tags
2
+ %table.tags
3
+ %tr
4
+ %th= t.tag.name
5
+ %th{:colspan => 2}
6
+ - @tags.each_with_index do |tag, i|
7
+ %tr{:class => (i+1).odd? ? 'odd' : 'even'}
8
+ %td.title
9
+ %a{:href => tag.link}= "#{tag.name}(#{tag.taggings.count})"
10
+ %td
11
+ %a.button{:href => "/admin/tags/#{tag.id}/edit"}= t.edit
12
+ %td
13
+ = link_to t.delete, "/admin/tags/#{tag.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete
14
+ .pager
15
+ %ul
16
+ - if @tags.pager.previous_page
17
+ %li.previous= link_to t.previous, "?page=#{@tags.pager.previous_page}"
18
+ - if @tags.pager.next_page
19
+ %li.next= link_to t.next, "?page=#{@tags.pager.next_page}"
@@ -0,0 +1,13 @@
1
+ %h2= t.listing_themes
2
+ %ul.themes
3
+ - @themes.each do |theme|
4
+ - class_for_theme = theme.title == @theme.name ? 'theme selected' : 'theme'
5
+ %li{:class => class_for_theme}
6
+ .title
7
+ = link_to theme.title, "/admin/themes?title=#{theme.title}", :confirm => t.are_you_sure, :method => 'put'
8
+ - if theme.screenshot
9
+ .screenshot
10
+ = link_to "<img src=\"#{theme.screenshot}\" />", "/admin/themes?title=#{theme.title}", :confirm => t.may_i_change_the_theme, :method => 'put'
11
+ - else
12
+ .screenshot
13
+ %span no screenshot
@@ -0,0 +1,6 @@
1
+ %h2= t.edit_user
2
+ %form{:action => "/admin/users/#{@user.id}", :method => 'post'}
3
+ %input{:type => 'hidden', :name => '_method', :value => 'put'}
4
+ = partial 'users/form'
5
+ %p
6
+ %input{:type => 'submit', :value => t.edit}
@@ -0,0 +1,22 @@
1
+ - unless @user.errors.empty?
2
+ #error
3
+ .title= t.error
4
+ %ul
5
+ - @user.errors.each do |error|
6
+ %li= error
7
+ %p
8
+ %label{:for => 'user_name'}= t.user.name
9
+ %br
10
+ %input{:type => 'text', :id => 'user_name', :name => 'user[name]', :value => @user.name}
11
+ %p
12
+ %label{:for => 'user_email'}= t.user.email
13
+ %br
14
+ %input{:type => 'text', :id => 'user_email', :name => 'user[email]', :value => @user.email}
15
+ %p
16
+ %label{:for => 'user_password'}= t.user.password
17
+ %br
18
+ %input{:type => 'password', :id => 'user_password', :name => 'user[password]', :value => @user.password}
19
+ %p
20
+ %label{:for => 'user_password_confirmation'}= t.user.password_confirmation
21
+ %br
22
+ %input{:type => 'password', :id => 'user_password_confirmation', :name => 'user[password_confirmation]', :value => @user.password_confirmation}
@@ -0,0 +1,24 @@
1
+ %h2= t.listing_users
2
+ %table.users
3
+ %tr
4
+ %th= t.user.name
5
+ %th= t.user.email
6
+ %th= t.user.created_at
7
+ %th{:colspan => 2}
8
+ - @users.each_with_index do |user, i|
9
+ %tr{:class => (i+1).odd? ? 'odd' : 'even'}
10
+ %td.name
11
+ %a{:href => "/admin/users/#{user.id}/edit"}= user.name
12
+ %td= user.email
13
+ %td= l user.created_at.to_time
14
+ %td
15
+ %a.button{:href => "/admin/users/#{user.id}/edit"}= t.edit
16
+ %td
17
+ - unless user == current_user
18
+ = link_to t.delete, "/admin/users/#{user.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete
19
+ .pager
20
+ %ul
21
+ - if @users.pager.previous_page
22
+ %li.previous= link_to t.previous, "?page=#{@users.pager.previous_page}"
23
+ - if @users.pager.next_page
24
+ %li.next= link_to t.next, "?page=#{@users.pager.next_page}"
@@ -0,0 +1,5 @@
1
+ %h2= t.new_user
2
+ %form{:action => '/admin/users', :method => 'post'}
3
+ = partial 'users/form'
4
+ %p
5
+ %input{:type => 'submit', :value => t.new}
@@ -0,0 +1,29 @@
1
+ module Lokka
2
+ module GoogleAnalytics
3
+ def self.registered(app)
4
+ app.get '/admin/plugins/google_analytics' do
5
+ haml :"plugin/lokka-google_analytics/views/index", :layout => :"admin/layout"
6
+ end
7
+
8
+ app.put '/admin/plugins/google_analytics' do
9
+ Option.tracker = params['tracker']
10
+ Option.tracker_dn = params['tracker_dn']
11
+ flash[:notice] = 'Updated.'
12
+ redirect '/admin/plugins/google_analytics'
13
+ end
14
+
15
+ app.before do
16
+ tracker = Option.tracker
17
+ if !tracker.blank? and ENV['RACK_ENV'] == 'production' and !logged_in?
18
+ dn = Option.tracker_dn
19
+ tracker_script = "<script type=\"text/javascript\">var _gaq=_gaq||[];_gaq.push(['_setAccount','#{tracker}']);"
20
+ tracker_script += "_gaq.push(['_setDomainName', '.#{dn}']);" unless dn.blank?
21
+ tracker_script += "_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();</script>"
22
+ content_for :header do
23
+ tracker_script
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end