1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-22 16:54:15 +01:00

space edition interface

This commit is contained in:
Sylvain 2017-02-14 13:36:10 +01:00
parent d8acd4c86f
commit 0adb9e29c6
11 changed files with 245 additions and 149 deletions

View File

@ -116,6 +116,26 @@ Application.Controllers.controller 'NewSpaceController', ['$scope', '$state', 'C
new SpacesController($scope, $state) new SpacesController($scope, $state)
] ]
##
# Controller used in the space edition page (admin)
##
Application.Controllers.controller 'EditSpaceController', ['$scope', '$state', '$stateParams', 'spacePromise', 'CSRF',($scope, $state, $stateParams, spacePromise, CSRF) ->
CSRF.setMetaTags()
## API URL where the form will be posted
$scope.actionUrl = "/api/spaces/" + $stateParams.id
## Form action on the above URL
$scope.method = "put"
## space to modify
$scope.space = spacePromise
## Using the SpacesController
new SpacesController($scope, $state)
]
Application.Controllers.controller 'ShowSpaceController', ['$scope', '$state', 'spacePromise', '_t', 'dialogs', 'growl', ($scope, $state, spacePromise, _t, dialogs, growl) -> Application.Controllers.controller 'ShowSpaceController', ['$scope', '$state', 'spacePromise', '_t', 'dialogs', 'growl', ($scope, $state, spacePromise, _t, dialogs, growl) ->
## Details of the space witch id/slug is provided in the URL ## Details of the space witch id/slug is provided in the URL

View File

@ -426,6 +426,19 @@ angular.module('application.router', ['ui.router']).
translations: [ 'Translations', (Translations) -> translations: [ 'Translations', (Translations) ->
Translations.query(['app.public.space_show']).$promise Translations.query(['app.public.space_show']).$promise
] ]
.state 'app.admin.space_edit',
url: '/spaces/:id/edit'
views:
'main@':
templateUrl: '<%= asset_path "spaces/edit.html" %>'
controller: 'EditSpaceController'
resolve:
spacePromise: ['Space', '$stateParams', (Space, $stateParams)->
Space.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.admin.space_edit', 'app.shared.space']).$promise
]
.state 'app.logged.space_reserve', .state 'app.logged.space_reserve',
url: '/spaces/:id/reserve' url: '/spaces/:id/reserve'

View File

@ -1,20 +1,6 @@
<form role="form" <uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
name="spaceForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
unsaved-warning-form
novalidate>
<input name="_method" type="hidden" ng-value="method"> <div class="form-group m-b-lg" ng-class="{'has-error': spaceForm['space[name]'].$dirty && spaceForm['space[name]'].$invalid}">
<section class="panel panel-default bg-light m-lg">
<div class="panel-body m-r">
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
<div class="form-group m-b-lg" ng-class="{'has-error': spaceForm['space[name]'].$dirty && spaceForm['space[name]'].$invalid}">
<label for="space_name" class="col-sm-2 control-label">{{ 'space.name' | translate }} *</label> <label for="space_name" class="col-sm-2 control-label">{{ 'space.name' | translate }} *</label>
<div class="col-sm-4"> <div class="col-sm-4">
<input ng-model="space.name" <input ng-model="space.name"
@ -26,9 +12,9 @@
required> required>
<span class="help-block" ng-show="spaceForm['space[name]'].$dirty && spaceForm['space[name]'].$error.required" translate>{{ 'space.name_is_required' }}</span> <span class="help-block" ng-show="spaceForm['space[name]'].$dirty && spaceForm['space[name]'].$error.required" translate>{{ 'space.name_is_required' }}</span>
</div> </div>
</div> </div>
<div class="form-group m-b-lg"> <div class="form-group m-b-lg">
<label for="space_image" class="col-sm-2 control-label">{{ 'space.illustration' | translate }} *</label> <label for="space_image" class="col-sm-2 control-label">{{ 'space.illustration' | translate }} *</label>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="fileinput" data-provides="fileinput" ng-class="fileinputClass(space.space_image)"> <div class="fileinput" data-provides="fileinput" ng-class="fileinputClass(space.space_image)">
@ -54,10 +40,10 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group m-b-xl" ng-class="{'has-error': spaceForm['space[default_places]'].$dirty && spaceForm['space[default_places]'].$invalid}"> <div class="form-group m-b-xl" ng-class="{'has-error': spaceForm['space[default_places]'].$dirty && spaceForm['space[default_places]'].$invalid}">
<label for="default_places" class="col-sm-2 control-label">{{ 'space.default_places' | translate }} *</label> <label for="default_places" class="col-sm-2 control-label">{{ 'space.default_places' | translate }} *</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="number" <input type="number"
@ -68,10 +54,10 @@
required> required>
<span class="help-block" ng-show="spaceForm['space[default_places]'].$dirty && spaceForm['space[default_places]'].$error.required" translate>{{ 'space.default_places_is_required' }}</span> <span class="help-block" ng-show="spaceForm['space[default_places]'].$dirty && spaceForm['space[default_places]'].$error.required" translate>{{ 'space.default_places_is_required' }}</span>
</div> </div>
</div> </div>
<div class="form-group m-b-xl"> <div class="form-group m-b-xl">
<label for="space_description" class="col-sm-2 control-label" translate>{{ 'space.description' }}</label> <label for="space_description" class="col-sm-2 control-label" translate>{{ 'space.description' }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="hidden" <input type="hidden"
@ -84,9 +70,9 @@
name="space[description]"> name="space[description]">
</summernote> </summernote>
</div> </div>
</div> </div>
<div class="form-group m-b-xl"> <div class="form-group m-b-xl">
<label for="space_characteristics" class="col-sm-2 control-label" translate>{{ 'space.characteristics' }}</label> <label for="space_characteristics" class="col-sm-2 control-label" translate>{{ 'space.characteristics' }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="hidden" <input type="hidden"
@ -99,9 +85,9 @@
name="space[characteristics]"> name="space[characteristics]">
</summernote> </summernote>
</div> </div>
</div> </div>
<div class="form-group m-b-xl"> <div class="form-group m-b-xl">
<label class="col-sm-2 control-label" translate>{{ 'space.attached_files_(pdf)' }}</label> <label class="col-sm-2 control-label" translate>{{ 'space.attached_files_(pdf)' }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<div ng-repeat="file in space.space_files_attributes" ng-show="!file._destroy"> <div ng-repeat="file in space.space_files_attributes" ng-show="!file._destroy">
@ -120,15 +106,4 @@
</div> </div>
<a class="btn btn-default" ng-click="addFile()" role="button"> {{ 'space.add_an_attachment' | translate }} <i class="fa fa-file-o fa-fw"></i></a> <a class="btn btn-default" ng-click="addFile()" role="button"> {{ 'space.add_an_attachment' | translate }} <i class="fa fa-file-o fa-fw"></i></a>
</div> </div>
</div> </div>
</div> <!-- ./panel-body -->
<div class="panel-footer no-padder">
<input type="submit"
value="{{ 'space.add_this_space' | translate }}"
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="spaceForm.$invalid"/>
</div>
</section>
</form>

View File

@ -0,0 +1,50 @@
<section class="heading b-b">
<div class="row no-gutter">
<div class="col-md-1 hidden-xs">
<section class="heading-btn">
<a href="#" ng-click="backPrevLocation($event)"><i class="fa fa-long-arrow-left "></i></a>
</section>
</div>
<div class="col-md-8 b-l b-r">
<section class="heading-title">
<h1 translate translate-values="{NAME: space.name}">{{ 'space_edit.edit_the_space_NAME' }}</h1>
</section>
</div>
</div>
</section>
<div class="row no-gutter" >
<div class="col-md-9 b-r nopadding">
<form role="form"
name="spaceForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
unsaved-warning-form
novalidate>
<input name="_method" type="hidden" ng-value="method">
<section class="panel panel-default bg-light m-lg">
<div class="panel-body m-r">
<ng-include src="'<%= asset_path 'spaces/_form.html' %>'"></ng-include>
</div>
<div class="panel-footer no-padder">
<input type="submit"
value="{{ 'space_edit.validate_the_changes' | translate }}"
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="spaceForm.$invalid"/>
</div>
</section>
</form>
</div>
<div class="col-md-3"/>
</div>

View File

@ -7,7 +7,7 @@
</div> </div>
<div class="col-md-8 b-l b-r"> <div class="col-md-8 b-l b-r">
<section class="heading-title"> <section class="heading-title">
<h1 translate>{{ 'add_a_new_space' }}</h1> <h1 translate>{{ 'space_new.add_a_new_space' }}</h1>
</section> </section>
</div> </div>
@ -22,12 +22,36 @@
<div class="col-md-9 b-r nopadding"> <div class="col-md-9 b-r nopadding">
<div class="m-lg alert alert-warning" role="alert"> <div class="m-lg alert alert-warning" role="alert">
{{ 'watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions' | translate}} {{ 'space_new.watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions' | translate}}
{{ 'consider_changing_its_prices_before_creating_any_reservation_slot' | translate }} {{ 'space_new.consider_changing_its_prices_before_creating_any_reservation_slot' | translate }}
</div> </div>
<form role="form"
name="spaceForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
unsaved-warning-form
novalidate>
<input name="_method" type="hidden" ng-value="method">
<section class="panel panel-default bg-light m-lg">
<div class="panel-body m-r">
<ng-include src="'<%= asset_path 'spaces/_form.html' %>'"></ng-include> <ng-include src="'<%= asset_path 'spaces/_form.html' %>'"></ng-include>
</div> </div>
<div class="panel-footer no-padder">
<input type="submit"
value="{{ 'space_new.add_this_space' | translate }}"
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="spaceForm.$invalid"/>
</div>
</section>
</form>
</div>
<div class="col-md-3"/> <div class="col-md-3"/>
</div> </div>

View File

@ -17,7 +17,7 @@
<section class="heading-actions wrapper"> <section class="heading-actions wrapper">
<a ng-click="reserveSpace($event)" class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs" ng-if="!isAuthorized('admin')" translate>{{ 'space_show.book_this_space' }}</a> <a ng-click="reserveSpace($event)" class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs" ng-if="!isAuthorized('admin')" translate>{{ 'space_show.book_this_space' }}</a>
<a ui-sref="app.admin.space_edit({id: space.slug})" ng-if="isAuthorized('admin')" class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs"><i class="fa fa-edit"></i> {{ 'edit' | translate }}</a> <a ui-sref="app.admin.space_edit({id:space.slug})" ng-if="isAuthorized('admin')" class="btn btn-lg btn-warning bg-white b-2x rounded m-t-xs"><i class="fa fa-edit"></i> {{ 'edit' | translate }}</a>
<a ng-click="deleteSpace($event)" ng-if="isAuthorized('admin')" class="btn btn-lg btn-danger b-2x rounded no-b m-t-xs"><i class="fa fa-trash-o"></i></a> <a ng-click="deleteSpace($event)" ng-if="isAuthorized('admin')" class="btn btn-lg btn-danger b-2x rounded no-b m-t-xs"><i class="fa fa-trash-o"></i></a>
</section> </section>
@ -28,7 +28,7 @@
<div class="row no-gutter"> <div class="row no-gutter">
<div class="col-sm-12 col-md-12 col-lg-8 b-r-lg"> <div class="col-sm-12 col-md-12 col-lg-8 b-r-lg">
<div class="article wrapper-lg" > <div class="article wrapper-lg">
<div class="article-thumbnail" ng-if="space.space_image"> <div class="article-thumbnail" ng-if="space.space_image">
<img ng-src="{{space.space_image}}" alt="{{space.name}}" class="img-responsive"> <img ng-src="{{space.space_image}}" alt="{{space.name}}" class="img-responsive">

View File

@ -1,4 +1,4 @@
json.extract! @space, :id, :name, :description, :characteristics, :created_at, :updated_at json.extract! @space, :id, :name, :description, :characteristics, :created_at, :updated_at, :slug, :default_places
json.space_image @space.space_image.attachment.large.url if @space.space_image json.space_image @space.space_image.attachment.large.url if @space.space_image
json.space_files_attributes @space.space_files do |f| json.space_files_attributes @space.space_files do |f|
json.id f.id json.id f.id

View File

@ -69,12 +69,6 @@ en:
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero." beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training."
space_new:
# create a new space
add_a_new_space: "Add a new space"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
events: events:
# events tracking and management # events tracking and management
events_monitoring: "Events monitoring" events_monitoring: "Events monitoring"
@ -581,3 +575,17 @@ en:
client_successfully_updated: "Client successfully updated." client_successfully_updated: "Client successfully updated."
client_successfully_deleted: "Client successfully deleted." client_successfully_deleted: "Client successfully deleted."
access_successfully_revoked: "Access successfully revoked." access_successfully_revoked: "Access successfully revoked."
space_new:
# create a new space
space_new:
add_a_new_space: "Add a new space"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
add_this_space: "Add this space"
space_edit:
# modify an exiting space
space_edit:
edit_the_space_NAME: "Edit the space: {{NAME}}" # angular interpolation
validate_the_changes: "Validate the changes"

View File

@ -69,12 +69,6 @@ fr:
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Attention, lors de la création d'une formation, ses tarifs de réservation sont initialisés à zero." beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Attention, lors de la création d'une formation, ses tarifs de réservation sont initialisés à zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Pensez à les modifier avant de créer des créneaux pour cette formation." dont_forget_to_change_them_before_creating_slots_for_this_training: "Pensez à les modifier avant de créer des créneaux pour cette formation."
space_new:
# créer un nouvel espace
add_a_new_space: "Ajouter un nouvel espace"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Attention, lors de la création d'un espace, ses tarifs de réservation sont initialisés à zero pour tout les abonnements."
consider_changing_its_prices_before_creating_any_reservation_slot: "Pensez à modifier ces prix avant de créer des créneaux pour cet espace."
events: events:
# gestion et suivi des évènements # gestion et suivi des évènements
events_monitoring: "Suivi des évènements" events_monitoring: "Suivi des évènements"
@ -581,3 +575,17 @@ fr:
client_successfully_updated: "Les modifications ont été enregistrées." client_successfully_updated: "Les modifications ont été enregistrées."
client_successfully_deleted: "Le compte client a bien été supprimé." client_successfully_deleted: "Le compte client a bien été supprimé."
access_successfully_revoked: "L'accès a bien été revoqué." access_successfully_revoked: "L'accès a bien été revoqué."
space_new:
# créer un nouvel espace
space_new:
add_a_new_space: "Ajouter un nouvel espace"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Attention, lors de la création d'un espace, ses tarifs de réservation sont initialisés à zero pour tout les abonnements."
consider_changing_its_prices_before_creating_any_reservation_slot: "Pensez à modifier ces prix avant de créer des créneaux pour cet espace."
add_this_space: "Ajouter cet espace"
space_edit:
# modifier un espace existant
space_edit:
edit_the_space_NAME: "Modifier l'espace : {{NAME}}" # angular interpolation
validate_the_changes: "Valider les modifications"

View File

@ -396,6 +396,5 @@ en:
attached_files_(pdf): "Attached files (pdf)" attached_files_(pdf): "Attached files (pdf)"
attach_a_file: "Attach a file" attach_a_file: "Attach a file"
add_an_attachment: "Add an attachment" add_an_attachment: "Add an attachment"
add_this_space: "Add this space"
default_places: "Default maximum tickets" default_places: "Default maximum tickets"
default_places_is_required: "Default maximum tickets is required." default_places_is_required: "Default maximum tickets is required."

View File

@ -396,6 +396,5 @@ fr:
attached_files_(pdf): "Pièces jointes (pdf)" attached_files_(pdf): "Pièces jointes (pdf)"
attach_a_file: "Joindre un fichier" attach_a_file: "Joindre un fichier"
add_an_attachment: "Ajouter une pièce jointe" add_an_attachment: "Ajouter une pièce jointe"
add_this_space: "Ajouter cet espace"
default_places: "Maximum de places par défaut" default_places: "Maximum de places par défaut"
default_places_is_required: "Le nombre de places maximum par défaut est requis." default_places_is_required: "Le nombre de places maximum par défaut est requis."