diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 09395414..81c0c3aa 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -15,6 +15,7 @@ @import "breadcrumbs"; @import "account"; @import "sidebar"; +@import "board/create"; form { margin: 0; diff --git a/app/assets/stylesheets/board/create.scss b/app/assets/stylesheets/board/create.scss new file mode 100644 index 00000000..21ee0ccd --- /dev/null +++ b/app/assets/stylesheets/board/create.scss @@ -0,0 +1,34 @@ +.create-new-board__container { + max-width: 600px; + margin-left: auto; + margin-right: auto; + padding-bottom: 30px; + font-size: 15px; +} + +.create-new-board__message { + margin: 0px auto; +} + +.create-new-board__list { + list-style: none; + padding-left: 10px; + text-align: left; + &__item { + border-left-style: solid; + border-left-color: $lightGrey; + padding-left: 10px; + margin-bottom: 14px; + &--error { + border-left-color: $red; + } + } +} + +.create-new-board__labels { + @include display(flex); + @include align-items(center); + @include justify-content(center); + padding-bottom: 10px; + font-size: 16px; +} diff --git a/app/controllers/board_controller.rb b/app/controllers/board_controller.rb index 48c95524..fc362dda 100644 --- a/app/controllers/board_controller.rb +++ b/app/controllers/board_controller.rb @@ -23,7 +23,7 @@ def index def create_board return not_found unless logged_in? - @parameters = params + @parameters = params || [] @repo = gh.repos(params[:user],params[:repo]) board = huboard.board(params[:user], params[:repo]) @@ -34,11 +34,13 @@ def create_board def create begin - huboard.board(params[:user], params[:repo]).create_board - @event = 'board_created' + board = huboard.board(params[:user], params[:repo]) + board.create_board rescue Ghee::UnprocessableEntity redirect_to "/#{params[:user]}/#{params[:repo]}/" end + + return redirect_to action: 'create_board', create_failed: true unless board.has_board? redirect_to "/#{params[:user]}/#{params[:repo]}/" end end diff --git a/app/views/board/create_board.html.erb b/app/views/board/create_board.html.erb index f2116560..7829a9f9 100644 --- a/app/views/board/create_board.html.erb +++ b/app/views/board/create_board.html.erb @@ -1,21 +1,82 @@ -
-

We noticed your repository issue tracker is not yet configured for HuBoard

- <% if @repo && @repo['permissions'] && @repo['permissions']['push'] %> -

No worries, HuBoard can automatically get you started with a default label configuration

-

HuBoard will create the following labels

-
    -
  1. Backlog
  2. -
  3. Ready
  4. -
  5. Working
  6. -
  7. Review
  8. -
  9. Done
  10. -
- <%= form_tag 'create' do %> - - No thanks, I want to do this manually - <% end %> - <% else %> -

Unfortunately, HuBoard doesn't have permission to fix that for you.

-

You'll need to head over to GitHub for that

- <% end %> +
+
+ <% if @parameters['create_failed']%> +

Oops!

+
+

HuBoard is unable to create a board for you!

+
    +
  • +

    + You will need write permissions to <%= @parameters['user'] %>/<%= @parameters['repo'] %> +

    + <% if @repo['owner'] && @repo['owner']['type'] == "Organization" %> +

    + <%= @repo['owner']['login'] %> is a GitHub Organization: Please ensure no access restrictions are present +

    + <% end %> +

    + Talk to us! +

    +
  • +
+ <%= form_tag 'create', class: 'create-new-board__form' do %> + + + Go Home + + <% end %> +
+ <% elsif @repo && @repo['permissions'] && @repo['permissions']['push'] %> +

<%= @parameters['user'] %>/<%= @parameters['repo'] %> is not yet setup for HuBoard

+
+

We can automatically get you started with a default label configuration:

+
+
+
+

Allow HuBoard to create the following labels?

+
+
+
    +
  • 0 - Backlog
  • +
  • 1 - Ready
  • +
  • 2 - Working
  • +
  • 3 - Review
  • +
  • 4 - Done
  • +
+
+
+ <%= form_tag 'create', class: 'create-new-board__form' do %> + + + Create columns manually + + <% end %> +
+ <% else %> +

<%= @parameters['user'] %>/<%= @parameters['repo'] %> is not yet setup for HuBoard

+
+
    +
  • +

    + You will need write permissions to <%= @parameters['user'] %>/<%= @parameters['repo'] %> +

    + <% if @repo['owner'] && @repo['owner']['type'] == "Organization" %> +

    + <%= @repo['owner']['login'] %> is a GitHub Organization: Please ensure no access restrictions are present +

    + <% end %> +

    + Talk to us! +

    +
  • +
+ + Try again + + + Go Home + +
+ <% end %> +