From d873a3bd552bf63d8037392bdf56b86b1c7996d9 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 20 Oct 2016 20:37:54 +0100 Subject: Adds commit partial for vue component --- app/controllers/projects/environments_controller.rb | 5 +++-- .../environments/components/_commit.html.haml | 20 ++++++++++++++++++++ .../environments/components/_environment.html.haml | 6 +++--- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 app/views/projects/environments/components/_commit.html.haml diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index c760f885a4c..20b4ed46d0a 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -76,8 +76,9 @@ class Projects::EnvironmentsController < Projects::ApplicationController last_deployment: { include: { user: { only: [:id, :name, :username], methods: [:avatar_url] }, - deployable: { only: [:id, :name, :ref, :tag, :short_sha] } - } + deployable: { only: [:id, :name, :ref, :tag] } + }, + methods: [:short_sha, :commit_title, :commit] } } ) diff --git a/app/views/projects/environments/components/_commit.html.haml b/app/views/projects/environments/components/_commit.html.haml new file mode 100644 index 00000000000..25bd6223841 --- /dev/null +++ b/app/views/projects/environments/components/_commit.html.haml @@ -0,0 +1,20 @@ +.branch-commit{"v-if" => "!isFolder && model.last_deployment"} + %div{ "v-if" => "model.last_deployment.ref" } + .icon-container{ "v-if" => "model.last_deployment.tag" } + =icon("tag") + .icon-container{ "v-if" => "!model.last_deployment.tag" } + =icon("code-fork") + %a.monospace.branch-name{} + {{model.last_deployment.ref}} + + .icon-container.commit-icon + = custom_icon("icon_commit") + %a.commit-id.monospace{":href" => ""} + {{model.last_deployment.short_sha}} + + %p.commit-title + %span{ "v-if" => "model.last_deployment.commit_title"} + %a.commit-row-message{":href" => ""} + {{model.last_deployment.commit_title}} + %span{ "v-if" => "!model.last_deployment.commit_title"} + Cant find HEAD commit for this branch diff --git a/app/views/projects/environments/components/_environment.html.haml b/app/views/projects/environments/components/_environment.html.haml index 76d921e9fd3..3e11141d01a 100644 --- a/app/views/projects/environments/components/_environment.html.haml +++ b/app/views/projects/environments/components/_environment.html.haml @@ -31,13 +31,13 @@ %td %a.build-link{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.deployable", ":href" => "'#{namespace_project_builds_path(@project.namespace, @project)}/' + model.last_deployment.deployable.id"} - {{model.last_deployment.deployble.name}} + {{model.last_deployment.deployable.name}} = precede "#" do {{model.last_deployment.deployable.id}} %td - %a{ "v-if" => "!isFolder && model.last_deployment"} - commit message goes here + =render "projects/environments/components/commit" + %p.commit-title{ "v-if" => "!isFolder && !model.last_deployment"} No deployments yet -- cgit v1.2.1