ui: show and hide list view on mobile

This commit is contained in:
Jack Pearkes 2014-06-05 13:24:03 -04:00
parent d8d79fbe1a
commit c3cbe998fa
4 changed files with 34 additions and 26 deletions

View File

@ -245,7 +245,7 @@
<script type="text/x-handlebars" id="services"> <script type="text/x-handlebars" id="services">
<div class="row"> <div class="row">
<div class="col-md-6 col-lg-5 padded-right-middle"> <div {{ bind-attr class=":col-md-6 :col-lg-5 :padded-right-middle isShowingItem:hidden-xs isShowingItem:hidden-sm" }}>
{{view App.ActionBarView }} {{view App.ActionBarView }}
{{#if filteredContent}} {{#if filteredContent}}
@ -294,10 +294,6 @@
<div class="border-left hidden-xs hidden-sm"> <div class="border-left hidden-xs hidden-sm">
</div> </div>
<div class="visible-xs visible-sm">
<hr>
</div>
<div class="col-md-6 col-lg-7 border-left scrollable"> <div class="col-md-6 col-lg-7 border-left scrollable">
<div class="row padded-border"> <div class="row padded-border">
{{outlet}} {{outlet}}
@ -307,6 +303,11 @@
</script> </script>
<script type="text/x-handlebars" id="service"> <script type="text/x-handlebars" id="service">
<div class="col-xs-12 col-sm-12 visible-xs visible-sm">
{{#link-to "services" class="btn btn-default btn-block" }}Back to all services{{/link-to}}
<hr>
</div>
<h3 class="no-margin">{{ model.0.Service.Service }}</h3> <h3 class="no-margin">{{ model.0.Service.Service }}</h3>
<hr> <hr>
@ -342,7 +343,7 @@
<script type="text/x-handlebars" id="nodes"> <script type="text/x-handlebars" id="nodes">
<div class="row"> <div class="row">
<div class="col-md-6 col-lg-5 padded-right-middle"> <div {{ bind-attr class=":col-md-6 :col-lg-5 :padded-right-middle isShowingItem:hidden-xs isShowingItem:hidden-sm" }}>
{{view App.ActionBarView }} {{view App.ActionBarView }}
{{#if filteredContent}} {{#if filteredContent}}
@ -390,10 +391,6 @@
<div class="border-left hidden-xs hidden-sm"> <div class="border-left hidden-xs hidden-sm">
</div> </div>
<div class="visible-xs visible-sm">
<hr>
</div>
<div class="col-md-6 col-lg-7 border-left scrollable"> <div class="col-md-6 col-lg-7 border-left scrollable">
<div class="row padded-border"> <div class="row padded-border">
{{outlet}} {{outlet}}
@ -403,8 +400,14 @@
</script> </script>
<script type="text/x-handlebars" id="node"> <script type="text/x-handlebars" id="node">
<div class="col-xs-12 col-sm-12 visible-xs visible-sm">
{{#link-to "nodes" class="btn btn-default btn-block" }}Back to all nodes{{/link-to}}
<hr>
</div>
<h3 class="no-margin">{{ model.Node }} <small> {{ model.Address }}</small></h3> <h3 class="no-margin">{{ model.Node }} <small> {{ model.Address }}</small></h3>
<hr> <hr>
{{foobar}}
<h5>Service Tags</h5> <h5>Service Tags</h5>
{{#if model.nodeTags}} {{#if model.nodeTags}}
@ -451,8 +454,6 @@
</div> </div>
{{/each}} {{/each}}
{{#link-to "nodes" class="btn btn-default col-xs-12 visible-xs" }}All Nodes{{/link-to}}
</script> </script>
<script type="text/x-handlebars" id="index"> <script type="text/x-handlebars" id="index">

View File

@ -1,3 +1,9 @@
App.ApplicationController = Ember.ObjectController.extend({
updateCurrentPath: function() {
App.set('currentPath', this.get('currentPath'));
}.observes('currentPath')
});
App.DcController = Ember.Controller.extend({ App.DcController = Ember.Controller.extend({
// Whether or not the dropdown menu can be seen // Whether or not the dropdown menu can be seen
isDropdownVisible: false, isDropdownVisible: false,
@ -230,7 +236,7 @@ App.KvEditController = KvBaseController.extend({
}); });
ItemBaseController = Ember.ArrayController.extend({ ItemBaseController = Ember.ArrayController.extend({
needs: ["dc"], needs: ["dc", "application"],
queryParams: ["filter", "status", "condensed"], queryParams: ["filter", "status", "condensed"],
dc: Ember.computed.alias("controllers.dc"), dc: Ember.computed.alias("controllers.dc"),
condensed: true, condensed: true,
@ -238,6 +244,12 @@ ItemBaseController = Ember.ArrayController.extend({
status: "any status", // default status: "any status", // default
statuses: ["any status", "passing", "failing"], statuses: ["any status", "passing", "failing"],
isShowingItem: function() {
var currentPath = this.get('controllers.application.currentPath');
console.log(currentPath);
return (currentPath === "dc.nodes.show" || currentPath === "dc.services.show");
}.property('controllers.application.currentPath'),
filteredContent: function() { filteredContent: function() {
var filter = this.get('filter'); var filter = this.get('filter');
var status = this.get('status'); var status = this.get('status');
@ -270,7 +282,6 @@ App.NodesController = ItemBaseController.extend({
items: Ember.computed.alias("nodes"), items: Ember.computed.alias("nodes"),
}); });
App.ServicesController = ItemBaseController.extend({ App.ServicesController = ItemBaseController.extend({
items: Ember.computed.alias("services"), items: Ember.computed.alias("services"),
}); });

View File

@ -1,5 +1,6 @@
window.App = Ember.Application.create({ window.App = Ember.Application.create({
rootElement: "#app" rootElement: "#app",
currentPath: ''
}); });

View File

@ -13,12 +13,6 @@
// } // }
// } // }
// @media (min-width: 970px) { // + 22
// .container {
// width: 970px;
// }
// }
@media (min-width: 1120px) { // + 30 @media (min-width: 1120px) { // + 30
.container { .container {
width: 1100px; width: 1100px;
@ -47,11 +41,12 @@ a {
height: 50px; height: 50px;
} }
.border-left { @media (min-width: 991px) {
border-left: 1px $gray-background solid; .border-left {
border-left: 1px $gray-background solid;
.padded-border{ .padded-border{
padding-left: 30px; padding-left: 30px;
}
} }
} }
.padded-right-middle { .padded-right-middle {