all repos — h3rald @ 9504a69adcee918506f2e81007520b76e07505bc

The sources of https://h3rald.com

Styled project pages.
h3rald h3rald@h3rald.com
Wed, 15 Sep 2010 14:07:56 +0200
commit

9504a69adcee918506f2e81007520b76e07505bc

parent

b6022cddfcae6063038dfcb6fd2759a787ad3863

3 files changed, 41 insertions(+), 76 deletions(-)

jump to
M content/js/feeds.jscontent/js/feeds.js

@@ -9,70 +9,17 @@ $.getJSON(uri,

function(data){ var list = $("<ul></ul>"); for (var i=0; i<options.max; i++){ - switch(options.element){ - case "#backtype": - var item = backtype_entry(data.comments[i]) - break; - case "#delicious": - var item = delicious_entry(data[i]) - break; - case "#twitter": - var item = twitter_entry(data[i]) - break; - case "#github": - var item = github_entry(data.commits[i], options.repo) - break; - } + var item = github_entry(data.commits[i], options.repo) item.appendTo(list); } list.appendTo(options.element).fadeIn(1000); }); } -function backtype_entry(comment){ - var c = $("<li></li>").addClass('feed-item'); - var dt = $("<span></span>").addClass('feed-item-date').html(format_date(comment.comment.date+" GMT")+":"); - var tx = $("<span>&#0187; </span>").addClass('feed-item-text').append($('<a></a>').attr('href', comment.comment.url).html(comment.post.title)); - c.append(dt); - c.append(tx); - return c -} - -function twitter_entry(tweet){ - var it = $("<li></li>").addClass('feed-item'); - var content = tweet.text - .replace(/^h3rald:/, '') - .replace(/((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)/g, '<a href="$1">$1</a>') - .replace(/@([a-zA-Z0-9_-]*)/g, '<a href="http://www.twitter.com/$1">@$1</a>') - .replace(/#([a-zA-Z0-9_-]*)/g, '<a href="http://www.twitter.com/search?q=%23$1">#$1</a>') - var dt = $("<span></span>").addClass('feed-item-date').html(format_date(tweet.created_at)+":"); - var tx = $("<span>&#0187; </span>").addClass('feed-item-text').html(content); - it.append(dt); - it.append(tx); - return it -} - -function delicious_entry(bookmark){ - var it = $("<li></li>").addClass('feed-item'); - var content = "<a href='"+bookmark.u+"'>"+bookmark.d+"</a>"; - content += "<br />tags: "; - var categories = Array(); - for (i=0; i<bookmark.t.length; i++) - { - categories[i] = "<a href='http://delicious.com/h3rald/"+bookmark.t[i]+"'>"+bookmark.t[i]+"</a>"; - } - content += categories.join(', ').replace(/ $/, ''); - var dt = $("<span></span>").addClass('feed-item-date').html(format_date(bookmark.dt)+":"); - var tx = $("<span>&#0187; </span>").addClass('feed-item-text').html(content); - it.append(dt); - it.append(tx); - return it -} - function github_entry(commit, repo){ var it = $("<li></li>").addClass('commit-data'); var dt = $("<span></span>").addClass('commit-date').html(format_date(commit.committed_date)+" &middot; "); - var link = $("<span></span><br />").addClass('commit-link').append($('<a></a>').attr('href', commit.url).html("View")); + var link = $("<span></span><br />").addClass('commit-link').append($('<a></a>').attr('href', commit.url).html("VIEW &raquo;")); var tx = $("<span></span>").addClass('commit-text').html(commit.message .replace(/(closes) #(\d+)/ig, "$1 <a href='http://github.com/h3rald/"+repo+"/issues/#issue/$2'>#$2</a>")+"<br />"); it.append(tx);

@@ -81,21 +28,6 @@ it.append(link);

return it } - -// http://api.backtype.com/user/h3rald/comments.json?key=47bf0031e3a18a598b85&html=1 -function display_opinions(max){ - get_json_data("/data/opinions.json", {max: max, element: '#backtype'}) -} - -// http://twitter.com/status/user_timeline/h3rald.json -function display_tweets(max){ - get_json_data("/data/tweets.json", {max: max, element: '#twitter'}) -} - -// http://feeds.delicious.com/v2/json/h3rald -function display_bookmarks(max){ - get_json_data("/data/bookmarks.json", {max: max, element: '#delicious'}) -} /* http://github.com/api/v2/json/commits/list/h3rald/concatenative/master
M content/styles/_content.scsscontent/styles/_content.scss

@@ -272,6 +272,35 @@ margin: 0 10px;

font-size: 0.93em; } +/* Projects */ + +#github { + border: 1px solid $light-gray; + padding: 5px; + margin-left: 5px; + float: right; + width: 400px; + .commit-date { + font-style: italic; + } + a { + font-size: 90%; + font-weight: bold; + } +} + +.project-links { + width: 500px; + border: 1px solid $light-gray; + margin-bottom: 10px; + padding: 0 5px; + text-align: center; + a { + font-weight: bold; + } +} + + /* Classes */ .clear-left {
M layouts/project_data.erblayouts/project_data.erb

@@ -1,9 +1,13 @@

----- filter: erb ----- -<div class="project-data right-column" >Project Status: <strong><%= @item.attributes[:status] %></strong><div class="project-version">Version: <strong><%= @item.attributes[:version]%></strong></div> - <div class="project-links"> - Links: <%= @item.attributes[:links].map{ |l| res=nil; l.each_pair{ |label, value| res = %{<a href="#{value}">#{label}</a>}}; res }.join(" &middot; ") %> - </div> - <div id="github">Recent Activity:</div> -</div> +<div id="github"><strong>Recent Activity</strong></div> +<nav class="project-links"> + <%= @item.attributes[:links].map{ |l| + res=nil; l.each_pair{ |label, value| res = %{<a href="#{value}">#{label.to_s.upcase}</a>}}; res + }.join(" | ") %> +</nav> +<ul class="project-data"> + <li>Project Status: <strong><%= @item.attributes[:status] %></strong></li> + <li>Version: <strong><%= @item.attributes[:version]%></strong></li> +</ul>