Browse files

Browse by account

  • Loading branch information...
1 parent 508c8e7 commit 20d4f9493d6b12ff74c5991915018eb1006d303f @codyaray committed Apr 4, 2012
View
12 app/routes/accounts.rb
@@ -0,0 +1,12 @@
+app do
+ get '/accounts' do
+ @account = Account.all
+ haml :'accounts/index'
+ end
+
+ get '/accounts/:id' do
+ @account = Account.get(params[:id])
+ @artifacts = @account.artifacts || []
+ haml :'accounts/show'
+ end
+end
View
5 app/routes/javascripts.rb → app/routes/assets.rb
@@ -3,4 +3,9 @@
content_type 'text/javascript', :charset => 'UTF-8'
coffee "javascripts/#{params[:javascript]}".to_sym
end
+
+ get '/stylesheets/:stylesheet.css' do
+ content_type 'text/css', :charset => 'UTF-8'
+ scss "stylesheets/#{params[:stylesheet]}".to_sym
+ end
end
View
4 app/routes/index.rb
@@ -1,6 +1,6 @@
app do
get '/' do
- @artifacts = Artifact.all
- haml :index
+ @accounts = Account.all
+ haml :'accounts/index'
end
end
View
6 app/routes/stylesheets.rb
@@ -1,6 +0,0 @@
-app do
- get '/stylesheets/:stylesheet.css' do
- content_type 'text/css', :charset => 'UTF-8'
- scss "stylesheets/#{params[:stylesheet]}".to_sym
- end
-end
View
5 app/views/accounts/index.haml
@@ -0,0 +1,5 @@
+%h1 Accounts
+
+%ul
+- @accounts.each do |account|
+ %li= link_to account.name, "/accounts/#{account.id}"
View
5 app/views/accounts/show.haml
@@ -0,0 +1,5 @@
+%h1= "#{@account.name.capitalize}'s Artifacts"
+
+%ul
+- @artifacts.each do |artifact|
+ %li= link_to artifact.id, "/artifacts/#{artifact.id}"
View
BIN db/development.sqlite3
Binary file not shown.
View
3 public/javascripts/application.js
@@ -1,12 +1,11 @@
-vote = function(rating, artifactId) {
+var vote = function(rating, artifactId) {
return function() {
$.ajax({
url: "/users/0/votes/" + artifactId + "+" + rating,
success: function(output_string) {
var votes = output_string.split("\n").map(function(str) {
return str.split(" ").pop();
});
- console.log(votes);
$("#up").replaceWith("<span id=\"#up\" class=\"thumb\">" + votes[0] + "</span>");
$("#dn").replaceWith("<span id=\"#dn\" class=\"thumb\">" + votes[1] + "</span>");
}

0 comments on commit 20d4f94

Please sign in to comment.