mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
basic interface structure for space management
This commit is contained in:
parent
c254cad8e5
commit
40952600e7
@ -28,6 +28,11 @@ Application.Controllers.controller "MainNavController", ["$scope", "$location",
|
|||||||
linkText: 'events_registrations'
|
linkText: 'events_registrations'
|
||||||
linkIcon: 'tags'
|
linkIcon: 'tags'
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
state: 'app.public.spaces_list'
|
||||||
|
linkText: 'reserve_a_space'
|
||||||
|
linkIcon: 'rocket'
|
||||||
|
}
|
||||||
{
|
{
|
||||||
state: 'app.public.calendar'
|
state: 'app.public.calendar'
|
||||||
linkText: 'public_calendar'
|
linkText: 'public_calendar'
|
||||||
@ -86,6 +91,11 @@ Application.Controllers.controller "MainNavController", ["$scope", "$location",
|
|||||||
linkText: 'manage_the_machines'
|
linkText: 'manage_the_machines'
|
||||||
linkIcon: 'cogs'
|
linkIcon: 'cogs'
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
state: 'app.public.spaces_list'
|
||||||
|
linkText: 'manage_the_spaces'
|
||||||
|
linkIcon: 'rocket'
|
||||||
|
}
|
||||||
{
|
{
|
||||||
state: 'app.admin.project_elements'
|
state: 'app.admin.project_elements'
|
||||||
linkText: 'manage_the_projects_elements'
|
linkText: 'manage_the_projects_elements'
|
||||||
|
45
app/assets/javascripts/controllers/spaces.coffee
Normal file
45
app/assets/javascripts/controllers/spaces.coffee
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
##
|
||||||
|
# Manages the transition when a user clicks on the reservation button.
|
||||||
|
# According to the status of user currently logged into the system, redirect him to the reservation page,
|
||||||
|
# or display a modal window asking him to login or to create an account.
|
||||||
|
# @param space {{id:number}} An object containg the id of the space to book,
|
||||||
|
# the object will be completed before the fonction returns.
|
||||||
|
# @param e {Object} see https://docs.angularjs.org/guide/expression#-event-
|
||||||
|
##
|
||||||
|
_reserveSpace = (space, e) ->
|
||||||
|
_this = this
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
|
||||||
|
# if a user is authenticated ...
|
||||||
|
if _this.$scope.isAuthenticated()
|
||||||
|
_this.$state.go('app.logged.space_reserve', { id: space.id })
|
||||||
|
# if the user is not logged, open the login modal window
|
||||||
|
else
|
||||||
|
_this.$scope.login()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# Controller used in the public listing page, allowing everyone to see the list of spaces
|
||||||
|
##
|
||||||
|
Application.Controllers.controller "SpacesController", ["$scope", "$state", 'spacesPromise', ($scope, $state, spacesPromise) ->
|
||||||
|
|
||||||
|
## Retrieve the list of machines
|
||||||
|
$scope.spaces = spacesPromise
|
||||||
|
|
||||||
|
##
|
||||||
|
# Redirect the user to the space details page
|
||||||
|
##
|
||||||
|
$scope.showSpace = (space) ->
|
||||||
|
$state.go('app.public.space_show', { id: space.slug })
|
||||||
|
|
||||||
|
##
|
||||||
|
# Callback to book a reservation for the current machine
|
||||||
|
##
|
||||||
|
$scope.reserveSpace = _reserveSpace.bind
|
||||||
|
$scope: $scope
|
||||||
|
$state: $state
|
||||||
|
]
|
||||||
|
|
@ -388,6 +388,26 @@ angular.module('application.router', ['ui.router']).
|
|||||||
translations: [ 'Translations', (Translations) ->
|
translations: [ 'Translations', (Translations) ->
|
||||||
Translations.query(['app.admin.machines_edit', 'app.shared.machine']).$promise
|
Translations.query(['app.admin.machines_edit', 'app.shared.machine']).$promise
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# spaces
|
||||||
|
.state 'app.public.spaces_list',
|
||||||
|
url: '/spaces'
|
||||||
|
views:
|
||||||
|
'main@':
|
||||||
|
templateUrl: '<%= asset_path "spaces/index.html.erb" %>'
|
||||||
|
controller: 'SpacesController'
|
||||||
|
resolve:
|
||||||
|
spacesPromise: ['Space', (Space)->
|
||||||
|
Space.query().$promise
|
||||||
|
]
|
||||||
|
translations: [ 'Translations', (Translations) ->
|
||||||
|
Translations.query(['app.public.spaces_list']).$promise
|
||||||
|
]
|
||||||
|
.state 'app.logged.space_reserve',
|
||||||
|
url: '/spaces/:id/reserve'
|
||||||
|
.state 'app.admin.space_new',
|
||||||
|
url: '/spaces/new'
|
||||||
|
|
||||||
# trainings
|
# trainings
|
||||||
.state 'app.public.trainings_list',
|
.state 'app.public.trainings_list',
|
||||||
url: '/trainings'
|
url: '/trainings'
|
||||||
|
8
app/assets/javascripts/services/space.coffee
Normal file
8
app/assets/javascripts/services/space.coffee
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
Application.Services.factory 'Space', ["$resource", ($resource)->
|
||||||
|
$resource "/api/spaces/:id",
|
||||||
|
{id: "@id"},
|
||||||
|
update:
|
||||||
|
method: 'PUT'
|
||||||
|
]
|
63
app/assets/templates/spaces/index.html.erb
Normal file
63
app/assets/templates/spaces/index.html.erb
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<section class="heading b-b">
|
||||||
|
<div class="row no-gutter">
|
||||||
|
<div class="col-xs-2 col-sm-2 col-md-1">
|
||||||
|
<section class="heading-btn">
|
||||||
|
<a href="#" ng-click="backPrevLocation($event)"><i class="fa fa-long-arrow-left "></i></a>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-10 col-sm-10 col-md-8 b-l b-r-md">
|
||||||
|
<section class="heading-title">
|
||||||
|
<h1 translate>{{ 'the_spaces' }}</h1>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md" ng-if="isAuthorized('admin')">
|
||||||
|
<section class="heading-actions wrapper">
|
||||||
|
<a class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs" ui-sref="app.admin.space_new" role="button" translate>{{ 'add_a_space' }}</a>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<section class="m-lg">
|
||||||
|
|
||||||
|
<div class="row" ng-repeat="space in (spaces.length/3 | array)">
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-4" ng-repeat="space in spaces.slice(3*$index, 3*$index + 3)">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="widget panel panel-default">
|
||||||
|
<div class="panel-heading picture" ng-if="!space.space_image" ng-click="showMachine(space)">
|
||||||
|
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:/font:FontAwesome/icon" bs-holder class="img-responsive">
|
||||||
|
</div>
|
||||||
|
<div class="panel-heading picture" style="background-image:url({{space.space_image}})" ng-if="space.space_image" ng-click="showMachine(space)">
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<h1 class="text-center m-b">{{space.name}}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer no-padder">
|
||||||
|
|
||||||
|
<div class="text-center clearfix">
|
||||||
|
<div class="col-sm-6 b-r no-padder">
|
||||||
|
<div class="btn btn-default btn-block no-b padder-v red" ng-click="reserveSpace(space, $event)">
|
||||||
|
<i class="fa fa-bookmark"></i> {{ 'book' | translate }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6 no-padder">
|
||||||
|
<div class="btn btn-default btn-block padder-v no-b red" ng-click="showSpace(space)">
|
||||||
|
<i class="fa fa-eye"></i> {{ 'consult' | translate }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</section>
|
@ -31,6 +31,7 @@ en:
|
|||||||
reserve_a_machine: "Reserve a Machine"
|
reserve_a_machine: "Reserve a Machine"
|
||||||
trainings_registrations: "Trainings registrations"
|
trainings_registrations: "Trainings registrations"
|
||||||
events_registrations: "Events registrations"
|
events_registrations: "Events registrations"
|
||||||
|
reserve_a_space: "Reserve a Space"
|
||||||
projects_gallery: "Projects gallery"
|
projects_gallery: "Projects gallery"
|
||||||
subscriptions: "Subscriptions"
|
subscriptions: "Subscriptions"
|
||||||
public_calendar: "Calendar"
|
public_calendar: "Calendar"
|
||||||
@ -44,6 +45,7 @@ en:
|
|||||||
subscriptions_and_prices: "Subscriptions and Prices"
|
subscriptions_and_prices: "Subscriptions and Prices"
|
||||||
manage_the_events: "Manage the events"
|
manage_the_events: "Manage the events"
|
||||||
manage_the_machines: "Manage the Machines"
|
manage_the_machines: "Manage the Machines"
|
||||||
|
manage_the_spaces: "Manage the Spaces"
|
||||||
manage_the_projects_elements: "Manage the Projects Elements"
|
manage_the_projects_elements: "Manage the Projects Elements"
|
||||||
statistics: "Statistics"
|
statistics: "Statistics"
|
||||||
customization: "Customization"
|
customization: "Customization"
|
||||||
@ -246,6 +248,12 @@ en:
|
|||||||
you_can_shift_this_reservation_on_the_following_slots: "You can shift this reservation on the following slots:"
|
you_can_shift_this_reservation_on_the_following_slots: "You can shift this reservation on the following slots:"
|
||||||
|
|
||||||
calendar:
|
calendar:
|
||||||
|
# public calendar
|
||||||
calendar: "Calendar"
|
calendar: "Calendar"
|
||||||
show_no_disponible: "Show the slots no disponibles"
|
show_no_disponible: "Show the slots no disponibles"
|
||||||
filter-calendar: "Filter calendar"
|
filter-calendar: "Filter calendar"
|
||||||
|
|
||||||
|
spaces_list:
|
||||||
|
# list of spaces
|
||||||
|
the_spaces: "The spaces"
|
||||||
|
add_a_space: "Add a space"
|
@ -31,6 +31,7 @@ fr:
|
|||||||
reserve_a_machine: "Réserver une machine"
|
reserve_a_machine: "Réserver une machine"
|
||||||
trainings_registrations: "Inscriptions formations"
|
trainings_registrations: "Inscriptions formations"
|
||||||
events_registrations: "Inscriptions aux évènements"
|
events_registrations: "Inscriptions aux évènements"
|
||||||
|
reserve_a_space: "Réserver un espace"
|
||||||
projects_gallery: "Galerie de projets"
|
projects_gallery: "Galerie de projets"
|
||||||
subscriptions: "Abonnements"
|
subscriptions: "Abonnements"
|
||||||
public_calendar: "Calendrier"
|
public_calendar: "Calendrier"
|
||||||
@ -44,6 +45,7 @@ fr:
|
|||||||
subscriptions_and_prices: "Abonnements & Tarifs"
|
subscriptions_and_prices: "Abonnements & Tarifs"
|
||||||
manage_the_events: "Gérer les évènements"
|
manage_the_events: "Gérer les évènements"
|
||||||
manage_the_machines: "Gérer les machines"
|
manage_the_machines: "Gérer les machines"
|
||||||
|
manage_the_spaces: "Gérer les espaces"
|
||||||
manage_the_projects_elements: "Gérer les éléments projets"
|
manage_the_projects_elements: "Gérer les éléments projets"
|
||||||
statistics: "Statistiques"
|
statistics: "Statistiques"
|
||||||
customization: "Personnalisation"
|
customization: "Personnalisation"
|
||||||
@ -248,6 +250,12 @@ fr:
|
|||||||
you_can_shift_this_reservation_on_the_following_slots: "Vous pouvez déplacer cette réservation sur les créneaux suivants :"
|
you_can_shift_this_reservation_on_the_following_slots: "Vous pouvez déplacer cette réservation sur les créneaux suivants :"
|
||||||
|
|
||||||
calendar:
|
calendar:
|
||||||
|
# calendrier publique
|
||||||
calendar: "Calendrier"
|
calendar: "Calendrier"
|
||||||
show_no_disponible: "Afficher les crénaux non disponibles"
|
show_no_disponible: "Afficher les crénaux non disponibles"
|
||||||
filter-calendar: "Filtrer le calendrier"
|
filter-calendar: "Filtrer le calendrier"
|
||||||
|
|
||||||
|
spaces_list:
|
||||||
|
# liste des espaces
|
||||||
|
the_spaces: "Les espaces"
|
||||||
|
add_a_space: "Ajouter un espace"
|
||||||
|
@ -123,6 +123,7 @@ Rails.application.routes.draw do
|
|||||||
patch :reset_token, on: :member
|
patch :reset_token, on: :member
|
||||||
end
|
end
|
||||||
resources :price_categories
|
resources :price_categories
|
||||||
|
resources :spaces
|
||||||
|
|
||||||
# i18n
|
# i18n
|
||||||
get 'translations/:locale/:state' => 'translations#show', :constraints => { :state => /[^\/]+/ } # allow dots in URL for 'state'
|
get 'translations/:locale/:state' => 'translations#show', :constraints => { :state => /[^\/]+/ } # allow dots in URL for 'state'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user