Commit f716da65 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds template for table row

parent 58f95c2c
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {}; window.gl.environmentsList = window.gl.environmentsList || {};
debugger;
gl.environmentsList.EnvironmentItem = Vue.extend({ gl.environmentsList.EnvironmentItem = Vue.extend({
template: '#environment-item-template',
props: { props: {
model: Object model: Object
...@@ -19,10 +23,6 @@ ...@@ -19,10 +23,6 @@
computed: { computed: {
isFolder: function () { isFolder: function () {
return this.model.children && this.model.children.length return this.model.children && this.model.children.length
},
isOpen: function () {
return this.open;
} }
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
$(() => { $(() => {
const $environmentsListApp = document.getElementById('environments-list-view'); const environmentsListApp = document.getElementById('environments-list-view');
const Store = gl.environmentsList.EnvironmentsStore; const Store = gl.environmentsList.EnvironmentsStore;
window.gl = window.gl || {}; window.gl = window.gl || {};
...@@ -17,7 +17,7 @@ $(() => { ...@@ -17,7 +17,7 @@ $(() => {
gl.EnvironmentsListApp = new Vue({ gl.EnvironmentsListApp = new Vue({
el: $environmentsListApp, el: '#environments-list-view',
components: { components: {
'environment-item': gl.environmentsList.EnvironmentItem 'environment-item': gl.environmentsList.EnvironmentItem
...@@ -25,7 +25,7 @@ $(() => { ...@@ -25,7 +25,7 @@ $(() => {
data: { data: {
state: Store.state, state: Store.state,
endpoint: $environmentsListApp.dataset.endpoint, endpoint: environmentsListApp.dataset.endpoint,
loading: true loading: true
}, },
......
...@@ -72,6 +72,10 @@ ...@@ -72,6 +72,10 @@
margin-right: 0; margin-right: 0;
} }
} }
.environment-folder-name {
cursor: pointer;
}
} }
.environments-list-loading { .environments-list-loading {
......
%environment-item{"inline-template" => true, %environment-item{"inline-template" => true,
"v-for" => "environment in state.environments", "v-for" => "environment in state.environments",
":model" => "environment"} ":model" => "environment"}
.name{"click" => "toggle"} .environment-folder-name{"@click" => "toggle"}
%i{"v-if" => "isFolder && isOpen"} %span.icon-container{"v-if" => "isFolder"}
= icon("caret-down") %i{"v-show" => "open"}
%i{"v-if" => "isFolder && !isOpen"} = icon("caret-down")
= icon("caret-right")
{{model.name}} %i{"v-show" => "!open"}
= icon("caret-right")
%span.name-container
{{model.name}}
// {"name":"review","children":[{"id":8,"project_id":10,"name":"review/app","created_at":"2016-10-13T14:15:33.550Z","updated_at":"2016-10-13T14:15:33.550Z","external_url":"http://gitlab.com","environment_type":"review","state":"opened"}]}
\ No newline at end of file
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
= link_to new_namespace_project_environment_path(@project.namespace, @project), class: 'btn btn-create' do = link_to new_namespace_project_environment_path(@project.namespace, @project), class: 'btn btn-create' do
New environment New environment
.environments-container#environments-list-view{ "v-cloak" => true, data: environments_list_data } #environments-list-view{ data: environments_list_data, class: "environments-container" }
.environments-list-loading.text-center{ "v-if" => "loading" } .environments-list-loading.text-center{ "v-if" => "loading" }
= icon("spinner spin") = icon("spinner spin")
.blank-state.blank-state-no-icon{ "v-if" => "!loading && state.environments.length === 0" } .blank-state.blank-state-no-icon{ "v-if" => "!loading && !state.environments.length" }
%h2.blank-state-title %h2.blank-state-title
You don't have any environments right now. You don't have any environments right now.
%p.blank-state-text %p.blank-state-text
...@@ -42,13 +42,25 @@ ...@@ -42,13 +42,25 @@
New environment New environment
.table-holder{ "v-if" => "!loading && state.environments.length" } .table-holder{ "v-if" => "!loading && state.environments.length" }
%table.table.ci-table.environments %table.table
%thead %tr{"is"=>"environment-item",
%th Environment "inline-template" => true,
%th Last Deployment "v-for" => "environment in state.environments",
%th Build ":model" => "environment"}
%th Commit
%th
%th.hidden-xs %script#environment-item-template{"type"=> "text/x-template"}
%tbody %tr
=render "projects/environments/components/environment" %td.environment-folder-name{"@click" => "toggle"}
%span.icon-container{"v-if" => "isFolder"}
%i{"v-show" => "open"}
= icon("caret-down")
%i{"v-show" => "!open"}
= icon("caret-right")
%span.name-container
{{model.name}}
%tr{"v-show" => "open", "v-if"=>"isFolder"}
%td{"v-for" => "child in model.children",
":model" => "child"}
{{child.name}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment