Permalink
Browse files

create default board feature

  • Loading branch information...
rauhryan committed Apr 28, 2012
1 parent 05799e1 commit 276ebb17d23aefe5a5a8b3fcd2a80203a27d9941
Showing with 42 additions and 18 deletions.
  1. +1 −1 lib/api.rb
  2. +15 −2 lib/app.rb
  3. +1 −1 public/scripts/modules/board/views/board.js
  4. +10 −0 public/styles/main.css
  5. +1 −8 stint/stint/lib/stint/pebble.rb
  6. +0 −6 views/board.erb
  7. +14 −0 views/create_board.erb
View
@@ -52,7 +52,7 @@ class API < Sinatra::Base
json pebble.move_card params[:user], params[:repo], params[:issue], params[:index]
end
- post '/:user/:repo/close' do
+ post '/:user/:repo/close' do
json pebble.close_card params[:user], params[:repo], params[:issue]
end
View
@@ -70,11 +70,24 @@ def protected!
@parameters = params
erb :milestones
end
- get '/:user/:repo/board' do
- @parameters = params.merge({login:current_user.login})
+
+ get '/:user/:repo/board/create' do
+ @parameters = params
+ erb :create_board
+ end
+
+ post '/:user/:repo/board/create/?' do
+ @parameters = params
+ pebble.create_board(params[:user],params[:repo])
+ redirect "/#{params[:user]}/#{params[:repo]}/board"
+ end
+
+ get '/:user/:repo/board/?' do
+ @parameters = params.merge({:login => current_user.login})
erb :board, :layout => :layout_fluid
end
+
get '/:user/:repo/hook' do
json(pebble.create_hook( params[:user], params[:repo], "#{base_url}/webhook?token=#{encrypted_token}"))
end
@@ -37,7 +37,7 @@ define(["../collections/issues","text!../templates/board.html", "./columnView","
},
onfetch: function(data) {
if (!data.labels.length) {
- $(".instructions").show();
+ window.location.href = "/" + this.user + "/"+ this.repo + "/board/create";
return;
}
View
@@ -312,3 +312,13 @@ table li a.close:hover {
right:10px;
}
+
+.instructions {
+ text-align: center;
+}
+.instructions ol {
+ width: 30px;
+ text-align:left;
+ margin-left: auto;
+ margin-right: auto;
+}
@@ -86,21 +86,14 @@ def labels(user_name, repo)
labels << { name: label["name"], index: hash[:id], text: hash[:name], color: label["color"]} unless hash.nil?
end
- #create labels if empty
- if labels.empty?
- # create_default_labels
- end
-
labels.sort_by { |l| l[:index].to_i }
end
- def create_default_labels
-
+ def create_board(user_name, repo)
github.create_label user_name, repo, :name => "0 - Backlog", :color => "CCCCCC"
github.create_label user_name, repo, :name => "1 - Ready", :color => "CCCCCC"
github.create_label user_name, repo, :name => "2 - Working", :color => "CCCCCC"
github.create_label user_name, repo, :name => "3 - Done", :color => "CCCCCC"
- return self.labels user_name, repo
end
View
@@ -3,12 +3,6 @@
</div>
<a href="#toggle-drawer" class="hide iconic arrow-right arrow-left toggle-drawer"><span></span></a>
</div>
- <div class="instructions hide drop-shadow lifted">
- <h2> We noticed you haven't setup your repository </h2>
- <form action="/api/<%=@parameters[:user]%>/<%=@parameters[:repo]%>/createboard" method="post">
- <input class="btn primary" type="submit" value="Do it for me!"/>
- </form>
- </div>
<% content_for :navigation do %>
<li>
View
@@ -0,0 +1,14 @@
+ <div class="instructions drop-shadow lifted">
+ <h2> We noticed you haven't setup your repository </h2>
+ <p> Huboard can get you started with a default set up </p>
+ <ol>
+ <li> Backlog </li>
+ <li> Ready </li>
+ <li> Working </li>
+ <li> Done </li>
+ </ol>
+ <form action="/<%=@parameters[:user]%>/<%=@parameters[:repo]%>/board/create" method="post">
+ <input class="btn primary" type="submit" value="Do it for me!"/>
+ </form>
+ </div>
+

0 comments on commit 276ebb1

Please sign in to comment.