diff options
author | Phil Hughes <me@iamphill.com> | 2016-10-12 14:50:47 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-10-12 14:50:47 +0300 |
commit | f76f569bb87803b14c763427fc2875cca7dda892 (patch) | |
tree | 36323b0f248a57bae612ec1c5a5487ed98d120a5 | |
parent | 53b3c62e0f889d077ee5b19703c3e04384c85c03 (diff) |
Moved data attribute values into helper method
-rw-r--r-- | app/helpers/boards_helper.rb | 12 | ||||
-rw-r--r-- | app/views/projects/boards/index.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/boards/show.html.haml | 6 |
3 files changed, 14 insertions, 10 deletions
diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb new file mode 100644 index 00000000000..b7247ffa8b2 --- /dev/null +++ b/app/helpers/boards_helper.rb @@ -0,0 +1,12 @@ +module BoardsHelper + def board_data + board = @board || @boards.first + + { + endpoint: namespace_project_boards_path(@project.namespace, @project), + board_id: board.id, + disabled: !can?(current_user, :admin_list, @project), + issue_link_base: namespace_project_issues_path(@project.namespace, @project) + } + end +end diff --git a/app/views/projects/boards/index.html.haml b/app/views/projects/boards/index.html.haml index 9252bbc08c1..885f8e34b55 100644 --- a/app/views/projects/boards/index.html.haml +++ b/app/views/projects/boards/index.html.haml @@ -10,11 +10,7 @@ = render 'shared/issuable/filter', type: :boards -.boards-list#board-app{ "v-cloak" => true, - "data-endpoint" => "#{namespace_project_boards_path(@project.namespace, @project)}", - "data-board-id" => "#{@boards.first.id}", - "data-disabled" => "#{!can?(current_user, :admin_list, @project)}", - "data-issue-link-base" => "#{namespace_project_issues_path(@project.namespace, @project)}" } +.boards-list#board-app{ "v-cloak" => true, data: board_data } .boards-app-loading.text-center{ "v-if" => "loading" } = icon("spinner spin") = render "projects/boards/components/board" diff --git a/app/views/projects/boards/show.html.haml b/app/views/projects/boards/show.html.haml index d6e1ac5f3cf..885f8e34b55 100644 --- a/app/views/projects/boards/show.html.haml +++ b/app/views/projects/boards/show.html.haml @@ -10,11 +10,7 @@ = render 'shared/issuable/filter', type: :boards -.boards-list#board-app{ "v-cloak" => true, - "data-endpoint" => "#{namespace_project_boards_path(@project.namespace, @project)}", - "data-board-id" => "#{@board.id}", - "data-disabled" => "#{!can?(current_user, :admin_list, @project)}", - "data-issue-link-base" => "#{namespace_project_issues_path(@project.namespace, @project)}" } +.boards-list#board-app{ "v-cloak" => true, data: board_data } .boards-app-loading.text-center{ "v-if" => "loading" } = icon("spinner spin") = render "projects/boards/components/board" |