From c9c7fe00c5677cbfbe3dbbb5324372ad020f4998 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 11 Oct 2017 12:54:13 +0200 Subject: [PATCH] filter disabled machines in list + improve responsiveness --- .../controllers/machines.coffee.erb | 12 ++- app/assets/stylesheets/app.components.scss | 10 +++ app/assets/templates/machines/index.html.erb | 74 ++++++++++--------- config/locales/app.public.en.yml | 11 ++- config/locales/app.public.fr.yml | 11 ++- config/locales/app.public.pt.yml | 11 ++- 6 files changed, 84 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/controllers/machines.coffee.erb b/app/assets/javascripts/controllers/machines.coffee.erb index 5a3a5c768..ad85cf6fe 100644 --- a/app/assets/javascripts/controllers/machines.coffee.erb +++ b/app/assets/javascripts/controllers/machines.coffee.erb @@ -126,7 +126,7 @@ _reserveMachine = (machine, e) -> text = '' angular.forEach $scope.machine.trainings, (training) -> if text.length > 0 - text += _this._t('_or_the_') + text += _this._t('machines_list._or_the_') text += training.name.substr(0,1).toLowerCase() + training.name.substr(1) text @@ -172,6 +172,16 @@ Application.Controllers.controller "MachinesController", ["$scope", "$state", '_ _t: _t $uibModal: $uibModal Machine: Machine + + ## Default: we show only enabled machines + $scope.machineFiltering = 'enabled' + + ## Available options for filtering machines by status + $scope.filterDisabled = [ + 'enabled', + 'disabled', + 'all', + ] ] diff --git a/app/assets/stylesheets/app.components.scss b/app/assets/stylesheets/app.components.scss index 6a5026ba7..faf71e911 100644 --- a/app/assets/stylesheets/app.components.scss +++ b/app/assets/stylesheets/app.components.scss @@ -597,4 +597,14 @@ padding: 10px; border-bottom: 1px dashed #00b3ee; cursor: help; } +} + +.machine-card { + @media only screen and (min-width: 768px) { + height: 24em; + } +} + +.disabled-machine { + opacity: 0.5 !important; } \ No newline at end of file diff --git a/app/assets/templates/machines/index.html.erb b/app/assets/templates/machines/index.html.erb index ffa7cbfac..f31626084 100644 --- a/app/assets/templates/machines/index.html.erb +++ b/app/assets/templates/machines/index.html.erb @@ -7,13 +7,13 @@
-

{{ 'the_fablab_s_machines' }}

+

{{ 'machines_list.the_fablab_s_machines' }}

- {{ 'add_a_machine' }} + {{ 'machines_list.add_a_machine' }}
@@ -22,42 +22,46 @@
-
- -
- - -
-
- -
-
-
-
-

{{machine.name}}

-
- -
- - +
+
+ +
+
+
+
+ +
+
+
+
+

{{machine.name}}

+
+ +
+
+
diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index 5a92099cb..383e624cd 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -175,9 +175,14 @@ en: machines_list: # list of machines - the_fablab_s_machines: "The FabLab's machines" - add_a_machine: "Add a machine" - _or_the_: " or the " + machines_list: + the_fablab_s_machines: "The FabLab's machines" + add_a_machine: "Add a machine" + book: "Book" + _or_the_: " or the " + status_enabled: "Enabled" + status_disabled: "Disabled" + status_all: "All" machines_show: # details of a machine diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index 22d7b1843..086483b09 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -175,9 +175,14 @@ fr: machines_list: # liste des machines - the_fablab_s_machines: "Les machines du FabLab" - add_a_machine: "Ajouter une machine" - _or_the_: " ou la " + machines_list: + the_fablab_s_machines: "Les machines du FabLab" + add_a_machine: "Ajouter une machine" + book: "Réserver" + _or_the_: " ou la " + status_enabled: "Actives" + status_disabled: "Désactivées" + status_all: "Toutes" machines_show: # détail d'une machine diff --git a/config/locales/app.public.pt.yml b/config/locales/app.public.pt.yml index 71896dccd..3daf0c58a 100755 --- a/config/locales/app.public.pt.yml +++ b/config/locales/app.public.pt.yml @@ -175,9 +175,14 @@ pt: machines_list: # list of machines - the_fablab_s_machines: "Lista de máquinas no FabLab" - add_a_machine: "Adicionar uma máquina" - _or_the_: " ou o " + machines_list: + the_fablab_s_machines: "Lista de máquinas no FabLab" + add_a_machine: "Adicionar uma máquina" + book: "Reservar" + _or_the_: " ou o " + status_enabled: "Ativos" # TODO + status_disabled: "Desabilitados" # TODO + status_all: "Todos" # TODO machines_show: # details of a machine