milksteak 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. data/.DS_Store +0 -0
  2. data/lib/milksteak.rb +20 -2
  3. data/lib/milksteak/cms.rb +1 -1
  4. data/lib/milksteak/version.rb +1 -1
  5. data/lib/public/milksteak/js/moment.min.js +6 -0
  6. data/lib/public/milksteak/markitup/sets/markdown/images/bold.png +0 -0
  7. data/lib/public/milksteak/markitup/sets/markdown/images/code.png +0 -0
  8. data/lib/public/milksteak/markitup/sets/markdown/images/h1.png +0 -0
  9. data/lib/public/milksteak/markitup/sets/markdown/images/h2.png +0 -0
  10. data/lib/public/milksteak/markitup/sets/markdown/images/h3.png +0 -0
  11. data/lib/public/milksteak/markitup/sets/markdown/images/h4.png +0 -0
  12. data/lib/public/milksteak/markitup/sets/markdown/images/h5.png +0 -0
  13. data/lib/public/milksteak/markitup/sets/markdown/images/h6.png +0 -0
  14. data/lib/public/milksteak/markitup/sets/markdown/images/italic.png +0 -0
  15. data/lib/public/milksteak/markitup/sets/markdown/images/link.png +0 -0
  16. data/lib/public/milksteak/markitup/sets/markdown/images/list-bullet.png +0 -0
  17. data/lib/public/milksteak/markitup/sets/markdown/images/list-numeric.png +0 -0
  18. data/lib/public/milksteak/markitup/sets/markdown/images/paragraph.png +0 -0
  19. data/lib/public/milksteak/markitup/sets/markdown/images/picture.png +0 -0
  20. data/lib/public/milksteak/markitup/sets/markdown/images/preview.png +0 -0
  21. data/lib/public/milksteak/markitup/sets/markdown/images/quotes.png +0 -0
  22. data/lib/public/milksteak/markitup/sets/markdown/images/stroke.png +0 -0
  23. data/lib/public/milksteak/markitup/sets/markdown/set.js +82 -0
  24. data/lib/public/milksteak/markitup/sets/markdown/style.css +54 -0
  25. data/lib/public/milksteak/markitup/sets/textile/set.js +1 -1
  26. data/lib/views/admin.erb +25 -4
  27. data/lib/views/admin/fragments/edit.erb +8 -0
  28. data/lib/views/admin/login.erb +23 -0
  29. data/lib/views/app.coffee +33 -0
  30. data/lib/views/layouts/admin.erb +7 -0
  31. data/milksteak.gemspec +1 -0
  32. data/spec/lib/milksteak/cms_spec.rb +2 -1
  33. data/spec/models/layout_spec.rb +1 -0
  34. data/spec/spec_helper.rb +1 -1
  35. metadata +42 -2
Binary file
@@ -70,11 +70,29 @@ module Milksteak
70
70
  end
71
71
 
72
72
  get "/ms-admin" do
73
+ @fragments = Milksteak::Fragment.list
73
74
  erb "admin", :layout => "admin"
74
75
  end
75
-
76
+
77
+ # fragment editing
78
+ get "/ms-admin/fragments/:stub/edit" do
79
+ @fragment = Milksteak::Fragment.load(params[:stub])
80
+ erb "admin/fragments/edit", :layout => "admin"
81
+ end
82
+ post "/ms-admin/fragments/:stub/update" do
83
+ flash[:success] = "Section content updated successfully."
84
+ @fragment = Milksteak::Fragment.load(params[:stub])
85
+ @fragment = Milksteak::Fragment.write(params[:stub], @fragment.data, params[:page][:content])
86
+ erb "admin/fragments/edit", :layout => "admin"
87
+ end
88
+
76
89
  get "/ms-admin/login" do
77
- return "asdf"
90
+ erb "admin/login", :layout => "admin"
91
+ end
92
+
93
+ get "/ms-admin/app.js" do
94
+ content_type :js
95
+ coffee "app"
78
96
  end
79
97
 
80
98
  end
@@ -93,7 +93,7 @@ puts match.inspect
93
93
  @length = page.data["route"].length
94
94
  @page = page
95
95
  @pattern = build_expression(page.data["route"])
96
- super
96
+ super()
97
97
  end
98
98
 
99
99
  private
@@ -1,3 +1,3 @@
1
1
  module Milksteak
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -0,0 +1,6 @@
1
+ // moment.js
2
+ // version : 1.5.0
3
+ // author : Tim Wood
4
+ // license : MIT
5
+ // momentjs.com
6
+ (function(a,b){function u(a,b){this._d=a,this._isUTC=!!b}function v(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function w(b,c,d,e){var f=typeof c=="string",g=f?{}:c,h,i,j,k;return f&&e&&(g[c]=+e),h=(g.ms||g.milliseconds||0)+(g.s||g.seconds||0)*1e3+(g.m||g.minutes||0)*6e4+(g.h||g.hours||0)*36e5,i=(g.d||g.days||0)+(g.w||g.weeks||0)*7,j=(g.M||g.months||0)+(g.y||g.years||0)*12,h&&b.setTime(+b+h*d),i&&b.setDate(b.getDate()+i*d),j&&(k=b.getDate(),b.setDate(1),b.setMonth(b.getMonth()+j*d),b.setDate(Math.min((new a(b.getFullYear(),b.getMonth()+1,0)).getDate(),k))),b}function x(a){return Object.prototype.toString.call(a)==="[object Array]"}function y(b){return new a(b[0],b[1]||0,b[2]||1,b[3]||0,b[4]||0,b[5]||0,b[6]||0)}function z(b,d){function r(d){var j,s;switch(d){case"M":return e+1;case"Mo":return e+1+p(e+1);case"MM":return v(e+1,2);case"MMM":return c.monthsShort[e];case"MMMM":return c.months[e];case"D":return f;case"Do":return f+p(f);case"DD":return v(f,2);case"DDD":return j=new a(g,e,f),s=new a(g,0,1),~~((j-s)/864e5+1.5);case"DDDo":return j=r("DDD"),j+p(j);case"DDDD":return v(r("DDD"),3);case"d":return h;case"do":return h+p(h);case"ddd":return c.weekdaysShort[h];case"dddd":return c.weekdays[h];case"w":return j=new a(g,e,f-h+5),s=new a(j.getFullYear(),0,4),~~((j-s)/864e5/7+1.5);case"wo":return j=r("w"),j+p(j);case"ww":return v(r("w"),2);case"YY":return v(g%100,2);case"YYYY":return g;case"a":return i>11?q.pm:q.am;case"A":return i>11?q.PM:q.AM;case"H":return i;case"HH":return v(i,2);case"h":return i%12||12;case"hh":return v(i%12||12,2);case"m":return m;case"mm":return v(m,2);case"s":return n;case"ss":return v(n,2);case"zz":case"z":return(b._d.toString().match(l)||[""])[0].replace(k,"");case"Z":return(o<0?"-":"+")+v(~~(Math.abs(o)/60),2)+":"+v(~~(Math.abs(o)%60),2);case"ZZ":return(o<0?"-":"+")+v(~~(10*Math.abs(o)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return z(b,c.longDateFormat[d]);default:return d.replace(/(^\[)|(\\)|\]$/g,"")}}var e=b.month(),f=b.date(),g=b.year(),h=b.day(),i=b.hours(),m=b.minutes(),n=b.seconds(),o=-b.zone(),p=c.ordinal,q=c.meridiem;return d.replace(j,r)}function A(b,d){function p(a,b){var d;switch(a){case"M":case"MM":e[1]=~~b-1;break;case"MMM":case"MMMM":for(d=0;d<12;d++)if(c.monthsParse[d].test(b)){e[1]=d;break}break;case"D":case"DD":case"DDD":case"DDDD":e[2]=~~b;break;case"YY":b=~~b,e[0]=b+(b>70?1900:2e3);break;case"YYYY":e[0]=~~Math.abs(b);break;case"a":case"A":o=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"Z":case"ZZ":h=!0,d=(b||"").match(r),d&&d[1]&&(f=~~d[1]),d&&d[2]&&(g=~~d[2]),d&&d[0]==="+"&&(f=-f,g=-g)}}var e=[0,0,1,0,0,0,0],f=0,g=0,h=!1,i=b.match(n),j=d.match(m),k=Math.min(i.length,j.length),l,o;for(l=0;l<k;l++)p(j[l],i[l]);return o&&e[3]<12&&(e[3]+=12),o===!1&&e[3]===12&&(e[3]=0),e[3]+=f,e[4]+=g,h?new a(a.UTC.apply({},e)):y(e)}function B(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function C(a,b){var c,d=a.match(n),e=[],f=99,g,h,i;for(g=0;g<b.length;g++)h=A(a,b[g]),i=B(d,z(new u(h),b[g]).match(n)),i<f&&(f=i,c=h);return c}function D(b){var c="YYYY-MM-DDT",d;if(o.exec(b)){for(d=0;d<3;d++)if(q[d][1].exec(b)){c+=q[d][0];break}return A(b,c+"Z")}return new a(b)}function E(a,b,d){var e=c.relativeTime[a];return typeof e=="function"?e(b||1,!!d,a):e.replace(/%d/i,b||1)}function F(a,b){var c=d(Math.abs(a)/1e3),e=d(c/60),f=d(e/60),g=d(f/24),h=d(g/365),i=c<45&&["s",c]||e===1&&["m"]||e<45&&["mm",e]||f===1&&["h"]||f<22&&["hh",f]||g===1&&["d"]||g<=25&&["dd",g]||g<=45&&["M"]||g<345&&["MM",d(g/30)]||h===1&&["y"]||["yy",h];return i[2]=b,E.apply({},i)}function G(a,b){c.fn[a]=function(a){var c=this._isUTC?"UTC":"";return a!=null?(this._d["set"+c+b](a),this):this._d["get"+c+b]()}}var c,d=Math.round,e={},f=typeof module!="undefined",g="months|monthsShort|monthsParse|weekdays|weekdaysShort|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),h,i=/^\/?Date\((\-?\d+)/i,j=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LT|LL?L?L?)/g,k=/[^A-Z]/g,l=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,m=/(\\)?(MM?M?M?|dd?d?d|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?|T)/g,n=/(\\)?([0-9]+|([a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+|([\+\-]\d\d:?\d\d))/gi,o=/\d{4}.\d\d.\d\d(T(\d\d(.\d\d(.\d\d)?)?)?([\+\-]\d\d:?\d\d)?)?/,p="YYYY-MM-DDTHH:mm:ssZ",q=[["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/]],r=/([\+\-]|\d\d)/gi,s="1.5.0",t="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|");c=function(c,d){if(c===null||c==="")return null;var e,f;return c&&c._d instanceof a?e=new a(+c._d):d?x(d)?e=C(c,d):e=A(c,d):(f=i.exec(c),e=c===b?new a:f?new a(+f[1]):c instanceof a?c:x(c)?y(c):typeof c=="string"?D(c):new a(c)),new u(e)},c.utc=function(b,d){return x(b)?new u(new a(a.UTC.apply({},b)),!0):d&&b?c(b+" 0",d+" Z").utc():c(b).utc()},c.humanizeDuration=function(a,b,d){var e=+a,f=c.relativeTime,g;switch(b){case"seconds":e*=1e3;break;case"minutes":e*=6e4;break;case"hours":e*=36e5;break;case"days":e*=864e5;break;case"weeks":e*=6048e5;break;case"months":e*=2592e6;break;case"years":e*=31536e6;break;default:d=!!b}return g=F(e,!d),d?(e<=0?f.past:f.future).replace(/%s/i,g):g},c.version=s,c.defaultFormat=p,c.lang=function(a,b){var d,h,i,j=[];if(b){for(d=0;d<12;d++)j[d]=new RegExp("^"+b.months[d]+"|^"+b.monthsShort[d].replace(".",""),"i");b.monthsParse=b.monthsParse||j,e[a]=b}if(e[a])for(d=0;d<g.length;d++)h=g[d],c[h]=e[a][h]||c[h];else f&&(i=require("./lang/"+a),c.lang(a,i))},c.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},meridiem:{AM:"AM",am:"am",PM:"PM",pm:"pm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),c.isMoment=function(a){return a instanceof u},c.fn=u.prototype={clone:function(){return c(this)},valueOf:function(){return+this._d},"native":function(){return this._d},toString:function(){return this._d.toString()},toDate:function(){return this._d},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(a){return z(this,a?a:c.defaultFormat)},add:function(a,b){return this._d=w(this._d,a,1,b),this},subtract:function(a,b){return this._d=w(this._d,a,-1,b),this},diff:function(a,b,e){var f=c(a),g=(this.zone()-f.zone())*6e4,h=this._d-f._d-g,i=this.year()-f.year(),j=this.month()-f.month(),k=this.date()-f.date(),l;return b==="months"?l=i*12+j+k/30:b==="years"?l=i+j/12:l=b==="seconds"?h/1e3:b==="minutes"?h/6e4:b==="hours"?h/36e5:b==="days"?h/864e5:b==="weeks"?h/6048e5:h,e?l:d(l)},from:function(a,b){return c.humanizeDuration(this.diff(a),!b)},fromNow:function(a){return this.from(c(),a)},calendar:function(){var a=this.diff(c().sod(),"days",!0),b=c.calendar,d=b.sameElse,e=a<-6?d:a<-1?b.lastWeek:a<0?b.lastDay:a<1?b.sameDay:a<2?b.nextDay:a<7?b.nextWeek:d;return this.format(typeof e=="function"?e.apply(this):e)},isLeapYear:function(){var a=this.year();return a%4===0&&a%100!==0||a%400===0},isDST:function(){return this.zone()<c([this.year()]).zone()||this.zone()<c([this.year(),5]).zone()},day:function(a){var b=this._d.getDay();return a==null?b:this.add({d:a-b})},sod:function(){return this.clone().hours(0).minutes(0).seconds(0).milliseconds(0)},eod:function(){return this.sod().add({d:1,ms:-1})},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return this.clone().month(this.month()+1).date(0).date()}};for(h=0;h<t.length;h++)G(t[h].toLowerCase(),t[h]);G("year","FullYear"),f&&(module.exports=c),typeof window!="undefined"&&(window.moment=c),typeof define=="function"&&define.amd&&define("moment",[],function(){return c})})(Date);
@@ -0,0 +1,82 @@
1
+ // ----------------------------------------------------------------------------
2
+ // markItUp!
3
+ // ----------------------------------------------------------------------------
4
+ // Copyright (C) 2008 Jay Salvat
5
+ // http://markitup.jaysalvat.com/
6
+ // ----------------------------------------------------------------------------
7
+ mySettings = {
8
+ nameSpace: 'markdown', // Useful to prevent multi-instances CSS conflict
9
+ onShiftEnter: {keepDefault:false, openWith:'\n\n'},
10
+ markupSet: [
11
+ {name:'First Level Heading', key:"1", placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
12
+ {name:'Second Level Heading', key:"2", placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } },
13
+ {name:'Heading 3', key:"3", openWith:'### ', placeHolder:'Your title here...' },
14
+ {name:'Heading 4', key:"4", openWith:'#### ', placeHolder:'Your title here...' },
15
+ {name:'Heading 5', key:"5", openWith:'##### ', placeHolder:'Your title here...' },
16
+ {name:'Heading 6', key:"6", openWith:'###### ', placeHolder:'Your title here...' },
17
+ {separator:'---------------' },
18
+ {name:'Bold', key:"B", openWith:'**', closeWith:'**'},
19
+ {name:'Italic', key:"I", openWith:'_', closeWith:'_'},
20
+ {separator:'---------------' },
21
+ {name:'Bulleted List', openWith:'- ' },
22
+ {name:'Numeric List', openWith:function(markItUp) {
23
+ return markItUp.line+'. ';
24
+ }},
25
+ {separator:'---------------' },
26
+ {name:'Picture', key:"P", replaceWith: function (markItUp) {
27
+ MarkupHelper.showDialog(markItUp);
28
+ return false;
29
+ }},
30
+ {name:'Link', key:"L", openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
31
+ {separator:'---------------'},
32
+ {name:'Quotes', openWith:'> '},
33
+ {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
34
+ {separator:'---------------'},
35
+ {name:'Preview', call:'preview', className:"preview"}
36
+ ]
37
+ }
38
+
39
+ // mIu nameSpace to avoid conflict.
40
+ miu = {
41
+ markdownTitle: function(markItUp, char) {
42
+ heading = '';
43
+ n = $.trim(markItUp.selection||markItUp.placeHolder).length;
44
+ for(i = 0; i < n; i++) {
45
+ heading += char;
46
+ }
47
+ return '\n'+heading+'\n';
48
+ }
49
+ }
50
+
51
+ var current_markitup_editor = null;
52
+
53
+ var MarkupHelper = {
54
+ eventsAttached: false,
55
+
56
+ showDialog: function (markItUp) {
57
+ this.bindEvents(markItUp);
58
+ current_markitup_editor = markItUp;
59
+ $("div#image-modal-placeholder").html("<img src=\"/img/spinner.gif\"/>");
60
+ $("div#image-modal").modal("show");
61
+ $("div#image-modal-placeholder").load("/ms-media/images");
62
+ },
63
+
64
+ bindEvents: function (markItUp) {
65
+ if (this.eventsAttached) {
66
+ return;
67
+ }
68
+ this.eventsAttached = true;
69
+
70
+ $('#link-submit').bind('click', function (event) {
71
+ event.stopPropagation();
72
+ event.preventDefault();
73
+ var linkElement = '[image tag goes here]';
74
+ $(markItUp.textarea).trigger('insertion', [{replaceWith: linkElement}]);
75
+ });
76
+
77
+ $('#link-cancel').bind('click', function (event) {
78
+ event.preventDefault();
79
+ });
80
+ }
81
+ };
82
+
@@ -0,0 +1,54 @@
1
+ /* -------------------------------------------------------------------
2
+ // markItUp!
3
+ // By Jay Salvat - http://markitup.jaysalvat.com/
4
+ // ------------------------------------------------------------------*/
5
+ .markdown .markItUpButton1 a {
6
+ background-image:url(images/h1.png);
7
+ }
8
+ .markdown .markItUpButton2 a {
9
+ background-image:url(images/h2.png);
10
+ }
11
+ .markdown .markItUpButton3 a {
12
+ background-image:url(images/h3.png);
13
+ }
14
+ .markdown .markItUpButton4 a {
15
+ background-image:url(images/h4.png);
16
+ }
17
+ .markdown .markItUpButton5 a {
18
+ background-image:url(images/h5.png);
19
+ }
20
+ .markdown .markItUpButton6 a {
21
+ background-image:url(images/h6.png);
22
+ }
23
+
24
+ .markdown .markItUpButton7 a {
25
+ background-image:url(images/bold.png);
26
+ }
27
+ .markdown .markItUpButton8 a {
28
+ background-image:url(images/italic.png);
29
+ }
30
+
31
+ .markdown .markItUpButton9 a {
32
+ background-image:url(images/list-bullet.png);
33
+ }
34
+ .markdown .markItUpButton10 a {
35
+ background-image:url(images/list-numeric.png);
36
+ }
37
+
38
+ .markdown .markItUpButton11 a {
39
+ background-image:url(images/picture.png);
40
+ }
41
+ .markdown .markItUpButton12 a {
42
+ background-image:url(images/link.png);
43
+ }
44
+
45
+ .markdown .markItUpButton13 a {
46
+ background-image:url(images/quotes.png);
47
+ }
48
+ .markdown .markItUpButton14 a {
49
+ background-image:url(images/code.png);
50
+ }
51
+
52
+ .markdown .preview a {
53
+ background-image:url(images/preview.png);
54
+ }
@@ -4,7 +4,7 @@
4
4
  // Copyright (C) 2008 Jay Salvat
5
5
  // http://markitup.jaysalvat.com/
6
6
  // ----------------------------------------------------------------------------
7
- myTextileSettings = {
7
+ mySettings = {
8
8
  nameSpace: "textile", // Useful to prevent multi-instances CSS conflict
9
9
  previewParserPath: "~/sets/textile/preview.php",
10
10
  onShiftEnter: {keepDefault:false, replaceWith:'\n\n'},
@@ -1,5 +1,26 @@
1
- <h1>Admin</h1>
1
+ <div class="page-heading">
2
+ <h1>Admin</h1>
3
+ </div>
2
4
 
3
- <p>
4
- Note, Milksteak is still very much beta.
5
- </p>
5
+ <table class="table">
6
+ <thead>
7
+ <tr>
8
+ <th class="span7">Section Name</th><th>Size</th><th>Updated Date</th><th>&nbsp;</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @fragments.each do |p| %>
13
+ <% name = p.match(/^.+\/(.+)\.yml/)[1] %>
14
+ <tr>
15
+ <td><%= name %></td>
16
+ <td><%= File.size(p) %></td>
17
+ <td><%= File.mtime(p).getlocal %></td>
18
+ <td>
19
+ <div class="pull-right btn-group">
20
+ <a href="/ms-admin/fragments/<%= name %>/edit" class="btn btn-small"><i class="icon-pencil"></i></a>
21
+ </div>
22
+ </td>
23
+ </tr>
24
+ <% end %>
25
+ </tbody>
26
+ </table>
@@ -0,0 +1,8 @@
1
+ <div class="page-header">
2
+ <h1>Editing Content Section <small><%= @fragment.name %></small></h1>
3
+ </div>
4
+
5
+ <form action="/ms-admin/fragments/<%= @fragment.name %>/update" method="post">
6
+ <textarea id="textile" class="markitup" cols="800" rows="20" name="page[content]"><%= RDiscount.new(@fragment.content, :filter_html, :smart).text.gsub("&", "&amp;").gsub("<", "&lt;") %></textarea>
7
+ <p><input type="submit" value="Publish Changes" class="btn btn-primary" /> </p>
8
+ </form>
@@ -0,0 +1,23 @@
1
+ <form class="form-horizontal" method="post" action="/admin/login">
2
+ <fieldset>
3
+ <legend>Administrator Login</legend>
4
+ <div class="control-group">
5
+ <label class="control-label" for="email_address">Email Address</label>
6
+ <div class="controls">
7
+ <input type="email" class="input-xlarge" id="email_address" name="email_address" required="required">
8
+ </div>
9
+ </div>
10
+ <div class="control-group">
11
+ <label class="control-label" for="password">Password</label>
12
+ <div class="controls">
13
+ <input type="password" class="input-xlarge" id="password" name="password" required="required">
14
+ </div>
15
+ </div>
16
+ <div class="control-group">
17
+ <label class="control-label">&nbsp;</label>
18
+ <div class="controls">
19
+ <input type="submit" value="Log In" class="btn btn-primary btn-small"/>
20
+ </div>
21
+ </div>
22
+ </fieldset>
23
+ </form>
@@ -0,0 +1,33 @@
1
+ $ ->
2
+ $('[data-toggle="modal"]').click (event) ->
3
+ event.preventDefault()
4
+ href = $(this).attr('href')
5
+ urlModal href
6
+
7
+ #$("input.date").calendricalDate { usa: true }
8
+ #$("input.time").calendricalTime { }
9
+
10
+ root = exports ? this
11
+ root.urlModal = (href) ->
12
+ app_modal = $("div#app_modal")
13
+ if app_modal[0]
14
+ app_modal.modal('hide')
15
+ if (href.indexOf('#') == 0)
16
+ $(href).modal('open')
17
+ else
18
+ $.ajax href,
19
+ type: 'GET'
20
+ dataType: 'html'
21
+ error: (jqXHR, status, error) ->
22
+ console.log "Error: #{status}"
23
+ success: (data, status, jqXHR) ->
24
+ if app_modal[0]
25
+ app_modal.html(data)
26
+ app_modal.modal('show')
27
+ else
28
+ $('<div class="modal" id="app_modal">' + data + '</div>').modal()
29
+ $('input:text:visible:first').focus()
30
+
31
+ $("a[rel=tooltip]").tooltip()
32
+
33
+ $(".markitup").markItUp(mySettings)
@@ -100,6 +100,13 @@
100
100
  <script src="/milksteak/js/bootstrap-collapse.js"></script>
101
101
  <script src="/milksteak/js/bootstrap-carousel.js"></script>
102
102
  <script src="/milksteak/js/bootstrap-typeahead.js"></script>
103
+
104
+ <script type="text/javascript" src="/milksteak/markitup/jquery.markitup.js"></script>
105
+ <script type="text/javascript" src="/milksteak/markitup/sets/markdown/set.js"></script>
106
+ <link rel="stylesheet" type="text/css" href="/milksteak/markitup/skins/simple/style.css" />
107
+ <link rel="stylesheet" type="text/css" href="/milksteak/markitup/sets/markdown/style.css" />
108
+ <script type="text/javascript" src="/ms-media/library.js"></script>
109
+
103
110
  <script src="/ms-admin/app.js"></script>
104
111
 
105
112
  </body>
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency "liquid"
32
32
  s.add_runtime_dependency "rdiscount" # using RDiscount for more advanced Markdown
33
33
  s.add_runtime_dependency "sinatra"
34
+ s.add_runtime_dependency "coffee-script"
34
35
  end
@@ -1,8 +1,9 @@
1
1
  require File.join(File.dirname(__FILE__), "../../spec_helper.rb")
2
2
 
3
3
  describe Milksteak do
4
- it "should have milk_root settings" do
4
+ it "should have milk_root and site_id settings" do
5
5
  Milksteak::Admin.milk_root.should_not be_nil
6
+ Milksteak::Admin.site_id.should_not be_nil
6
7
  end
7
8
 
8
9
  context "non-logged-in visitors" do
@@ -1,4 +1,5 @@
1
1
  require File.join(File.dirname(__FILE__), "../spec_helper.rb")
2
2
 
3
3
  describe Milksteak::Layout do
4
+
4
5
  end
@@ -15,7 +15,7 @@ RSpec.configure do |config|
15
15
  end
16
16
 
17
17
  Milksteak::Admin.set :milk_root, "/tmp/milk_site"
18
-
18
+ Milksteak::Admin.set :site_id, SecureRandom.hex(6)
19
19
 
20
20
  def app
21
21
  Milksteak::Admin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milksteak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-19 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -123,6 +123,22 @@ dependencies:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: coffee-script
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
126
142
  description: ! 'Super tiny and simple ruby-based cms that uses yml for content '
127
143
  email:
128
144
  - bryan.thompson@firespring.com
@@ -130,6 +146,7 @@ executables: []
130
146
  extensions: []
131
147
  extra_rdoc_files: []
132
148
  files:
149
+ - .DS_Store
133
150
  - .gitignore
134
151
  - .rspec
135
152
  - Gemfile
@@ -328,6 +345,7 @@ files:
328
345
  - lib/public/milksteak/js/jquery.calendrical.js
329
346
  - lib/public/milksteak/js/jquery.easing.js
330
347
  - lib/public/milksteak/js/jquery.js
348
+ - lib/public/milksteak/js/moment.min.js
331
349
  - lib/public/milksteak/js/mustache.js
332
350
  - lib/public/milksteak/js/prettify.js
333
351
  - lib/public/milksteak/js/underscore.js
@@ -345,6 +363,25 @@ files:
345
363
  - lib/public/milksteak/markitup/sets/default/images/stroke.png
346
364
  - lib/public/milksteak/markitup/sets/default/set.js
347
365
  - lib/public/milksteak/markitup/sets/default/style.css
366
+ - lib/public/milksteak/markitup/sets/markdown/images/bold.png
367
+ - lib/public/milksteak/markitup/sets/markdown/images/code.png
368
+ - lib/public/milksteak/markitup/sets/markdown/images/h1.png
369
+ - lib/public/milksteak/markitup/sets/markdown/images/h2.png
370
+ - lib/public/milksteak/markitup/sets/markdown/images/h3.png
371
+ - lib/public/milksteak/markitup/sets/markdown/images/h4.png
372
+ - lib/public/milksteak/markitup/sets/markdown/images/h5.png
373
+ - lib/public/milksteak/markitup/sets/markdown/images/h6.png
374
+ - lib/public/milksteak/markitup/sets/markdown/images/italic.png
375
+ - lib/public/milksteak/markitup/sets/markdown/images/link.png
376
+ - lib/public/milksteak/markitup/sets/markdown/images/list-bullet.png
377
+ - lib/public/milksteak/markitup/sets/markdown/images/list-numeric.png
378
+ - lib/public/milksteak/markitup/sets/markdown/images/paragraph.png
379
+ - lib/public/milksteak/markitup/sets/markdown/images/picture.png
380
+ - lib/public/milksteak/markitup/sets/markdown/images/preview.png
381
+ - lib/public/milksteak/markitup/sets/markdown/images/quotes.png
382
+ - lib/public/milksteak/markitup/sets/markdown/images/stroke.png
383
+ - lib/public/milksteak/markitup/sets/markdown/set.js
384
+ - lib/public/milksteak/markitup/sets/markdown/style.css
348
385
  - lib/public/milksteak/markitup/sets/textile/images/bold.png
349
386
  - lib/public/milksteak/markitup/sets/textile/images/code.png
350
387
  - lib/public/milksteak/markitup/sets/textile/images/h1.png
@@ -475,6 +512,9 @@ files:
475
512
  - lib/public/milksteak/wymeditor/skins/twopanels/skin.js
476
513
  - lib/public/milksteak/wymeditor/skins/wymeditor_icon.png
477
514
  - lib/views/admin.erb
515
+ - lib/views/admin/fragments/edit.erb
516
+ - lib/views/admin/login.erb
517
+ - lib/views/app.coffee
478
518
  - lib/views/layouts/admin.erb
479
519
  - lib/views/login.erb
480
520
  - milksteak.gemspec