1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

Merge branch 'webpacker' into dev

This commit is contained in:
Sylvain 2020-10-05 17:52:46 +02:00
commit c1564d5eae
405 changed files with 9412 additions and 1638 deletions

1
.browserslistrc Normal file
View File

@ -0,0 +1 @@
defaults

7
.gitignore vendored
View File

@ -56,3 +56,10 @@
/node_modules /node_modules
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

2
.nvmrc
View File

@ -1 +1 @@
10.13.0 12.18.3

View File

@ -23,6 +23,14 @@
- Fix a bug: unable to create a subscription plan for only one group - Fix a bug: unable to create a subscription plan for only one group
- Fix a bug: removed unexpected character in coupon form - Fix a bug: removed unexpected character in coupon form
- Updated coveralls gem to a supported version - Updated coveralls gem to a supported version
- Fix a bug: changing the date of a training session does not prevent the selection of a different type of training
- Updated summernote to 0.8.18
- Updated angular-summernote to 0.8.1
- Updated FontAwesome from v4 to v5
- Updated jquery-minicolors to 2.3.5
- Updated angular-bootstrap-switch to 0.5.2
- Updated bootstrap-switch to 3.4.0
- Updated fullCalendar to 3.10.2
## v4.5.6 2020 September 1st ## v4.5.6 2020 September 1st

20
Gemfile
View File

@ -2,29 +2,18 @@
source 'https://rubygems.org' source 'https://rubygems.org'
git 'https://github.com/judynjagi/compass.git', branch: 'stable' do
gem 'compass-core'
end
gem 'compass-rails', '3.1.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.4' gem 'rails', '~> 5.2.4'
# Used by rails 5.2 to reduce the app boot time by over 50% # Used by rails 5.2 to reduce the app boot time by over 50%
gem 'bootsnap' gem 'bootsnap'
# Use Puma as web server # Use Puma as web server
gem 'puma', '3.12.6' gem 'puma', '3.12.6'
# Use SCSS for stylesheets gem 'webpacker', '~> 5.x'
gem 'sass-rails', '~> 5.0', '>= 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 4.1.20'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5' gem 'jbuilder', '~> 2.5'
gem 'jbuilder_cache_multi' gem 'jbuilder_cache_multi'
gem "json", ">= 2.3.0" gem 'json', '>= 2.3.0'
gem 'forgery' gem 'forgery'
gem 'responders', '~> 2.0' gem 'responders', '~> 2.0'
@ -72,6 +61,7 @@ gem 'seed_dump'
gem 'pg' gem 'pg'
gem 'pg_search' gem 'pg_search'
# authentication
gem 'devise', '>= 4.6.0' gem 'devise', '>= 4.6.0'
gem 'omniauth', '~> 1.9.0' gem 'omniauth', '~> 1.9.0'
@ -80,11 +70,9 @@ gem 'omniauth-rails_csrf_protection', '~> 0.1'
gem 'rolify' gem 'rolify'
# pagination
gem 'kaminari' gem 'kaminari'
gem 'bootstrap-sass', '>= 3.4.1'
gem 'font-awesome-rails'
# Image processing ruby wrapper for ImageMagick # Image processing ruby wrapper for ImageMagick
gem 'mini_magick' gem 'mini_magick'
# upload files # upload files

View File

@ -1,21 +1,3 @@
GIT
remote: https://github.com/judynjagi/compass.git
revision: 1692c0a7fd8ada392ad5f524bef756ab74e300d0
branch: stable
specs:
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
compass-import-once (~> 1.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
sass (>= 3.3.13, < 3.5)
compass-core (1.0.2)
multi_json (~> 1.0)
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -75,8 +57,6 @@ GEM
rails (>= 4.1) rails (>= 4.1)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
autoprefixer-rails (9.7.4)
execjs
awesome_print (1.8.0) awesome_print (1.8.0)
axiom-types (0.1.1) axiom-types (0.1.1)
descendants_tracker (~> 0.0.4) descendants_tracker (~> 0.0.4)
@ -86,9 +66,6 @@ GEM
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.6) bootsnap (1.4.6)
msgpack (~> 1.0) msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.4) builder (3.2.4)
camertron-eprun (1.1.1) camertron-eprun (1.1.1)
carrierwave (2.1.0) carrierwave (2.1.0)
@ -107,15 +84,10 @@ GEM
actionpack (>= 3.1) actionpack (>= 3.1)
caxlsx (>= 3.0) caxlsx (>= 3.0)
chroma (0.2.0) chroma (0.2.0)
chunky_png (1.3.11)
cldr-plurals-runtime-rb (1.0.1) cldr-plurals-runtime-rb (1.0.1)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
compass-rails (3.1.0) concurrent-ruby (1.1.6)
compass (~> 1.0.0)
sass-rails (< 5.1)
sprockets (< 4.0)
concurrent-ruby (1.1.7)
connection_pool (2.2.3) connection_pool (2.2.3)
coveralls_reborn (0.18.0) coveralls_reborn (0.18.0)
simplecov (>= 0.18.1, < 0.20.0) simplecov (>= 0.18.1, < 0.20.0)
@ -163,14 +135,11 @@ GEM
erubi (1.9.0) erubi (1.9.0)
et-orbi (1.2.1) et-orbi (1.2.1)
tzinfo tzinfo
execjs (2.7.0)
faker (2.10.2) faker (2.10.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
faraday (0.17.3) faraday (0.17.3)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.12.2) ffi (1.12.2)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
foreman (0.87.0) foreman (0.87.0)
forgery (0.7.0) forgery (0.7.0)
friendly_id (5.1.0) friendly_id (5.1.0)
@ -201,10 +170,6 @@ GEM
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jbuilder_cache_multi (0.1.0) jbuilder_cache_multi (0.1.0)
jbuilder (>= 1.5.0, < 3) jbuilder (>= 1.5.0, < 3)
jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.3.1) json (2.3.1)
jwt (2.2.1) jwt (2.2.1)
kaminari (1.2.1) kaminari (1.2.1)
@ -303,6 +268,8 @@ GEM
rack (2.2.3) rack (2.2.3)
rack-protection (2.0.8.1) rack-protection (2.0.8.1)
rack rack
rack-proxy (0.6.5)
rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
railroady (1.5.3) railroady (1.5.3)
@ -369,18 +336,10 @@ GEM
rubyzip (>= 1.3.0) rubyzip (>= 1.3.0)
rubyzip (1.3.0) rubyzip (1.3.0)
safe_yaml (1.0.5) safe_yaml (1.0.5)
sass (3.4.25)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.2.1)
ffi (~> 1.9)
seed_dump (3.3.1) seed_dump (3.3.1)
activerecord (>= 4) activerecord (>= 4)
activesupport (>= 4) activesupport (>= 4)
semantic_range (2.3.0)
sha3 (1.0.1) sha3 (1.0.1)
sidekiq (6.0.7) sidekiq (6.0.7)
connection_pool (>= 2.2.2) connection_pool (>= 2.2.2)
@ -418,7 +377,6 @@ GEM
tins (~> 1.0) tins (~> 1.0)
thor (0.20.3) thor (0.20.3)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10)
tins (1.25.0) tins (1.25.0)
sync sync
ttfunk (1.5.1) ttfunk (1.5.1)
@ -428,8 +386,6 @@ GEM
tzinfo tzinfo
tzinfo (1.2.7) tzinfo (1.2.7)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.1) unicode-display_width (1.4.1)
vcr (3.0.1) vcr (3.0.1)
virtus (1.0.5) virtus (1.0.5)
@ -448,6 +404,11 @@ GEM
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.2.1)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.3) websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
@ -463,13 +424,10 @@ DEPENDENCIES
apipie-rails apipie-rails
awesome_print awesome_print
bootsnap bootsnap
bootstrap-sass (>= 3.4.1)
carrierwave carrierwave
caxlsx caxlsx
caxlsx_rails caxlsx_rails
chroma chroma
compass-core!
compass-rails (= 3.1.0)
coveralls_reborn (~> 0.18.0) coveralls_reborn (~> 0.18.0)
database_cleaner database_cleaner
devise (>= 4.6.0) devise (>= 4.6.0)
@ -479,14 +437,12 @@ DEPENDENCIES
elasticsearch-rails (~> 5) elasticsearch-rails (~> 5)
faker faker
faraday (~> 0.17) faraday (~> 0.17)
font-awesome-rails
foreman foreman
forgery forgery
friendly_id (~> 5.1.0) friendly_id (~> 5.1.0)
icalendar icalendar
jbuilder (~> 2.5) jbuilder (~> 2.5)
jbuilder_cache_multi jbuilder_cache_multi
jquery-rails
json (>= 2.3.0) json (>= 2.3.0)
kaminari kaminari
listen (~> 3.0.5) listen (~> 3.0.5)
@ -518,7 +474,6 @@ DEPENDENCIES
rubocop (~> 0.61.1) rubocop (~> 0.61.1)
rubyXL rubyXL
rubyzip (>= 1.3.0) rubyzip (>= 1.3.0)
sass-rails (~> 5.0, >= 5.0.6)
seed_dump seed_dump
sha3 sha3
sidekiq (>= 6.0.7) sidekiq (>= 6.0.7)
@ -528,10 +483,10 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
stripe (= 5.1.1) stripe (= 5.1.1)
sys-filesystem sys-filesystem
uglifier (>= 4.1.20)
vcr (= 3.0.1) vcr (= 3.0.1)
web-console (>= 3.3.0) web-console (>= 3.3.0)
webmock webmock
webpacker (~> 5.x)
BUNDLED WITH BUNDLED WITH
2.1.4 2.1.4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,87 +0,0 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require polyfill
//= require angular
//= require angular-cookies
//= require angular-resource
//= require angular-sanitize
//= require angular-cookies
//= require angular-touch
//= require @uirouter/angularjs/release/angular-ui-router
//= require angular-ui-bootstrap/dist/ui-bootstrap-tpls
//= require ui-select/dist/select
//= require moment/moment
//= require moment-timezone/builds/moment-timezone-with-data-2012-2022
//= require angular-ui-calendar/src/calendar
//= require fullcalendar/dist/fullcalendar
//= require angular-moment/angular-moment
//= require ngUpload/ng-upload
//= require jasny-bootstrap/js/fileinput
//= require holderjs/holder
//= require AngularDevise/lib/devise
//= require devise-modal
//= require angular-growl-v2/build/angular-growl
//= require angular-xeditable/dist/js/xeditable
//= require checklist-model/checklist-model
//= require angular-unsavedchanges/lib/unsavedChanges
//= require angular-loading-bar/src/loading-bar
//= require angular-scroll/angular-scroll
//= require angular-google-analytics/dist/angular-google-analytics
//= require dirDisqus
//= require humanize
//= require underscore/underscore
//= require elasticsearch-browser/elasticsearch.angular
//= require d3/d3
//= require nvd3/build/nv.d3.js
//= require twitter-fetcher
//= require app
//= require router
//= require medium-editor/dist/js/medium-editor
//= require angular-medium-editor/dist/angular-medium-editor
//= require bootstrap-switch/dist/js/bootstrap-switch.min
//= require angular-bootstrap-switch/dist/angular-bootstrap-switch.min
//= require angular-base64-upload/dist/angular-base64-upload.min
//= require summernote/dist/summernote
//= require angular-summernote/dist/angular-summernote
//= require summernote-ext-nugget
//= require jquery-minicolors/jquery.minicolors.js
//= require angular-minicolors/angular-minicolors.js
//= require angular-translate/dist/angular-translate
//= require angular-translate-loader-partial/angular-translate-loader-partial
//= require messageformat/messageformat
//= require angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat
//= require ng-fittext/dist/ng-FitText.min
//= require angular-aside/dist/js/angular-aside
//= require ng-caps-lock/ng-caps-lock
//= require angular-recaptcha
//= require codemirror/lib/codemirror
//= require codemirror/addon/edit/matchbrackets
//= require codemirror/mode/css/css
//= require codemirror/mode/sass/sass
//= require angular-ui-codemirror/src/ui-codemirror
//= require angular-hotkeys/build/hotkeys
//= require hone/dist/hone
//= require tether/dist/js/tether
//= require angular-bind-html-compile/angular-bind-html-compile
//= require angular-ui-tour/dist/angular-ui-tour
//= require_tree ./controllers
//= require_tree ./services
//= require_tree ./directives
//= require_tree ./filters
<%
PluginRegistry.javascripts.each { |js| require_asset(js) }
%>

View File

@ -1,3 +0,0 @@
/*
*= require fullcalendar/dist/fullcalendar.print
*/

View File

@ -1,43 +0,0 @@
/*
*= require_self
*= require ui-select/dist/select
*= require fullcalendar/dist/fullcalendar
*= require jasny-bootstrap/dist/css/jasny-bootstrap
*= require angular-growl-v2/build/angular-growl
*= require angular-xeditable/dist/css/xeditable
*= require angular-loading-bar/build/loading-bar
*= require nvd3/build/nv.d3
*= require font-awesome
*= require medium-editor/dist/css/medium-editor
*= require medium-editor/dist/css/themes/default
*= require bootstrap-switch/dist/css/bootstrap3/bootstrap-switch
*= require summernote/dist/summernote
*= require jquery-minicolors/jquery.minicolors.css
*= require angular-aside/dist/css/angular-aside
*= require codemirror/lib/codemirror
*/
@import "app.functions";
@import "bootstrap-compass";
@import "bootstrap-sprockets";
@import "compass";
@import "bootstrap_and_overrides";
@import "app.utilities";
@import "app.colors";
@import "app.base";
@import "app.layout";
@import "app.nav";
@import "app.buttons";
@import "app.components";
@import "app.plugins";
@import "modules/*";
@import "app.responsive";
<% PluginRegistry.stylesheets.each do |stylesheet| %>
<% basename = File.basename(stylesheet,'.scss') %>
<%= "@import '#{basename}';" %>
<% end %>

View File

@ -1,35 +0,0 @@
<form class="{{classes}}" name="settingSelectMultipleForm">
<div class="form-group">
<label for="setting-{{setting.name}}" class="control-label m-r" translate>{{ label }}</label>
<select class="form-control"
id="setting-{{setting.name}}"
ng-model="selection"
ng-required="required"
ng-options="opt for opt in options"
multiple>
</select>
</div>
<div>
<button ng-click="removeItem()" class="btn btn-default"><i class="fa fa-trash"></i></button>
<button ng-click="addItem()" class="btn btn-default"><i class="fa fa-plus"></i></button>
</div>
<button name="button" class="btn btn-warning m-t" ng-click="save(setting)" ng-disabled="settingSelectMultipleForm.$invalid" translate>{{ 'app.shared.buttons.save' }}</button>
</form>
<script type="text/ng-template" id="newSelectOption.html">
<div>
<div class="modal-header">
<h3 class="modal-title" translate>{{ titleNew }}</h3>
</div>
<div class="modal-body">
<p class="alert alert-info" ng-show="descriptionNew" ng-bind-html="descriptionNew | translate"></p>
<form class="row m-md" name="newSelectOptionForm">
<input type="text" class="form-control" ng-model="value" required>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-warning" ng-disabled="newSelectOptionForm.$invalid" ng-click="ok()" translate>{{ 'app.shared.buttons.confirm' }}</button>
<button class="btn btn-default" ng-click="dismiss()" translate>{{ 'app.shared.buttons.cancel' }}</button>
</div>
</div>
</script>

View File

@ -1,18 +0,0 @@
<div>
<section class="heading">
<div class="row no-gutter">
<ng-include src="'<%= asset_path "dashboard/nav.html" %>'"></ng-include>
</div>
</section>
<div class="row no-gutter">
<div class="col-md-12 m m-t-lg">
<ng-include src="'<%= asset_path "wallet/show.html" %>'"></ng-include>
</div>
<div class="col-md-12 m m-t-lg">
<ng-include src="'<%= asset_path "wallet/transactions.html" %>'"></ng-include>
</div>
</div>
</div>

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1015 B

After

Width:  |  Height:  |  Size: 1015 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,87 @@
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'jquery';
import {} from 'jquery-ujs';
import 'bootstrap-sass';
import '../src/javascript/lib/polyfill';
import 'angular';
import 'angular-i18n/angular-locale_<%= Rails.application.secrets.angular_locale %>.js';
import 'angular-cookies';
import 'angular-resource';
import 'angular-sanitize';
import 'angular-touch';
import '@uirouter/angularjs';
import 'angular-ui-bootstrap';
import 'ui-select';
import 'moment';
import 'moment/locale/<%= Rails.application.secrets.moment_locale %>.js';
import 'moment-timezone';
import 'angular-ui-calendar';
import 'fullcalendar';
import 'fullcalendar/dist/locale/<%= Rails.application.secrets.fullcalendar_locale %>.js';
import 'angular-moment';
import 'ngUpload';
import 'jasny-bootstrap/js/fileinput';
import 'holderjs';
import 'AngularDevise';
import '../src/javascript/lib/devise-modal';
import 'angular-growl-v2';
import 'angular-xeditable';
import 'checklist-model/checklist-model';
import 'angular-unsavedchanges/lib/unsavedChanges';
import 'angular-loading-bar/src/loading-bar';
import 'angular-scroll/angular-scroll';
import 'angular-google-analytics/dist/angular-google-analytics';
import '../src/javascript/lib/dirDisqus';
import '../src/javascript/lib/humanize';
import 'underscore/underscore';
import 'elasticsearch-browser/elasticsearch.angular';
import 'd3/d3';
import 'nvd3/build/nv.d3.js';
import 'twitter-fetcher';
import 'medium-editor/dist/js/medium-editor';
import 'angular-medium-editor/dist/angular-medium-editor';
import 'bootstrap-switch/dist/js/bootstrap-switch';
import 'angular-bootstrap-switch/dist/angular-bootstrap-switch';
import 'angular-base64-upload/dist/angular-base64-upload.min';
import 'summernote';
import 'summernote/lang/summernote-<%= Rails.application.secrets.summernote_locale %>.js';
import 'angular-summernote/dist/angular-summernote';
import '../src/javascript/lib/summernote-ext-nugget';
import '@claviska/jquery-minicolors/jquery.minicolors.js';
import 'angular-minicolors/angular-minicolors.js';
import 'angular-translate/dist/angular-translate';
import 'angular-translate-loader-partial/angular-translate-loader-partial';
import 'messageformat/messageformat';
import 'angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat';
import 'ng-fittext/dist/ng-FitText.min';
import 'angular-aside/dist/js/angular-aside';
import 'ng-caps-lock/ng-caps-lock';
import 'angular-recaptcha';
import 'codemirror/lib/codemirror';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/mode/css/css';
import 'codemirror/mode/sass/sass';
import 'angular-ui-codemirror/src/ui-codemirror';
import 'angular-hotkeys/build/hotkeys';
import 'hone/dist/hone';
import 'tether/dist/js/tether';
import 'angular-bind-html-compile/angular-bind-html-compile';
import 'angular-ui-tour/app/angular-ui-tour';
import '@fortawesome/fontawesome-free';
import '@fortawesome/fontawesome-free/js/v4-shims';
require('../src/javascript/app.js');
require('../src/javascript/router.js');
require('../src/javascript/plugins.js.erb');
function importAll (r) { r.keys().forEach(r); }
importAll(require.context('../src/javascript/controllers/', true, /.*/));
importAll(require.context('../src/javascript/services/', true, /.*/));
importAll(require.context('../src/javascript/directives/', true, /.*/));
importAll(require.context('../src/javascript/filters/', true, /.*/));
importAll(require.context('../images', true));
importAll(require.context('../templates', true));

View File

@ -0,0 +1,18 @@
@import '~ui-select/dist/select';
@import '~fullcalendar/dist/fullcalendar';
@import '~jasny-bootstrap/dist/css/jasny-bootstrap';
@import '~angular-growl-v2/build/angular-growl';
@import '~angular-xeditable/dist/css/xeditable';
@import '~angular-loading-bar/build/loading-bar';
@import '~nvd3/build/nv.d3';
@import '~@fortawesome/fontawesome-free/css/all';
@import '~@fortawesome/fontawesome-free/css/v4-shims';
@import '~medium-editor/dist/css/medium-editor';
@import '~medium-editor/dist/css/themes/default';
@import '~bootstrap-switch/dist/css/bootstrap3/bootstrap-switch';
@import '~summernote/src/styles/summernote-bs3';
@import '~@claviska/jquery-minicolors/jquery.minicolors';
@import '~angular-aside/dist/css/angular-aside';
@import '~codemirror/lib/codemirror';
@import '../src/stylesheets/application.scss';

View File

@ -0,0 +1,4 @@
<% PluginRegistry.stylesheets.each do |stylesheet| %>
<% basename = File.basename(stylesheet,'.scss') %>
<%= "@import '#{basename}';" %>
<% end %>

View File

@ -0,0 +1,2 @@
@import '../src/stylesheets/app.printer';

View File

@ -8,7 +8,6 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
var Application = Application || {}; var Application = Application || {};
Application.Constants = angular.module('application.constants', []);
Application.Services = angular.module('application.services', []); Application.Services = angular.module('application.services', []);
Application.Controllers = angular.module('application.controllers', []); Application.Controllers = angular.module('application.controllers', []);
Application.Filters = angular.module('application.filters', []); Application.Filters = angular.module('application.filters', []);
@ -16,7 +15,7 @@ Application.Directives = angular.module('application.directives', []);
angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ui.bootstrap', angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ui.bootstrap',
'ngUpload', 'duScroll', 'application.filters', 'application.services', 'application.directives', 'ngUpload', 'duScroll', 'application.filters', 'application.services', 'application.directives',
'frapontillo.bootstrap-switch', 'application.constants', 'application.controllers', 'application.router', 'frapontillo.bootstrap-switch', 'application.controllers', 'application.router',
'ui.select', 'ui.calendar', 'angularMoment', 'Devise', 'angular-growl', 'xeditable', 'ui.select', 'ui.calendar', 'angularMoment', 'Devise', 'angular-growl', 'xeditable',
'checklist-model', 'unsavedChanges', 'angular-loading-bar', 'ngTouch', 'angular-google-analytics', 'checklist-model', 'unsavedChanges', 'angular-loading-bar', 'ngTouch', 'angular-google-analytics',
'angularUtils.directives.dirDisqus', 'summernote', 'elasticsearch', 'angular-medium-editor', 'naif.base64', 'angularUtils.directives.dirDisqus', 'summernote', 'elasticsearch', 'angular-medium-editor', 'naif.base64',
@ -66,8 +65,8 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
$translateProvider.preferredLanguage(Fablab.locale); $translateProvider.preferredLanguage(Fablab.locale);
// End the tour when the user clicks the forward or back buttons of the browser // End the tour when the user clicks the forward or back buttons of the browser
TourConfigProvider.enableNavigationInterceptors(); TourConfigProvider.enableNavigationInterceptors();
}]).run(['$rootScope', '$log', 'AuthService', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics', }]).run(['$rootScope', '$log', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics',
function ($rootScope, $log, AuthService, Auth, amMoment, $state, editableOptions, Analytics) { function ($rootScope, $log, Auth, amMoment, $state, editableOptions, Analytics) {
// Angular-moment (date-time manipulations library) // Angular-moment (date-time manipulations library)
amMoment.changeLocale(Fablab.moment_locale); amMoment.changeLocale(Fablab.moment_locale);
@ -141,8 +140,10 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
}; };
}]).constant('angularMomentConfig', { }]).constant('angularMomentConfig', {
timezone: Fablab.timezone timezone: Fablab.timezone
}); }).constant('moment', require('moment-timezone'));
angular.isUndefinedOrNull = function (val) { angular.isUndefinedOrNull = function (val) {
return angular.isUndefined(val) || val === null; return angular.isUndefined(val) || val === null;
}; };
module.exports = { Application };

View File

@ -87,7 +87,7 @@ class AuthenticationController {
*/ */
$scope.defineDataMapping = function (mapping) { $scope.defineDataMapping = function (mapping) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/authentications/_data_mapping.html" %>', templateUrl: '../../../../templates/admin/authentications/_data_mapping.html',
size: 'md', size: 'md',
resolve: { resolve: {
field () { return mapping; }, field () { return mapping; },

View File

@ -46,18 +46,17 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
$scope.eventsInCalendar = (settingsPromise.events_in_calendar === 'true'); $scope.eventsInCalendar = (settingsPromise.events_in_calendar === 'true');
// bind the availabilities slots with full-Calendar events // bind the availabilities slots with full-Calendar events
$scope.eventSources = []; $scope.eventSources = [{
$scope.eventSources.push({
url: '/api/availabilities', url: '/api/availabilities',
textColor: 'black' textColor: 'black'
}); }];
// fullCalendar (v2) configuration // fullCalendar (v2) configuration
$scope.calendarConfig = CalendarConfig({ $scope.calendarConfig = CalendarConfig({
slotDuration: BASE_SLOT, slotDuration: BASE_SLOT,
snapDuration: BOOKING_SNAP, snapDuration: BOOKING_SNAP,
selectable: true, selectable: true,
selecHelper: true, selectHelper: true,
minTime: moment.duration(moment(bookingWindowStart.setting.value).format('HH:mm:ss')), minTime: moment.duration(moment(bookingWindowStart.setting.value).format('HH:mm:ss')),
maxTime: moment.duration(moment(bookingWindowEnd.setting.value).format('HH:mm:ss')), maxTime: moment.duration(moment(bookingWindowEnd.setting.value).format('HH:mm:ss')),
select (start, end, jsEvent, view) { select (start, end, jsEvent, view) {
@ -69,7 +68,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
eventRender (event, element, view) { eventRender (event, element, view) {
return eventRenderCb(event, element, view); return eventRenderCb(event, element, view);
}, },
viewRender(view, element) { viewRender (view, element) {
return viewRenderCb(view, element); return viewRenderCb(view, element);
}, },
loading (isLoading, view) { loading (isLoading, view) {
@ -101,7 +100,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
{ id: slot.slot_id }, { id: slot.slot_id },
function (data, status) { // success function (data, status) { // success
// update the canceled_at attribute // update the canceled_at attribute
for (let resa of Array.from($scope.reservations)) { for (const resa of Array.from($scope.reservations)) {
if (resa.slot_id === data.id) { if (resa.slot_id === data.id) {
resa.canceled_at = data.canceled_at; resa.canceled_at = data.canceled_at;
break; break;
@ -185,9 +184,9 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
}, },
function () { function () {
// the admin has confirmed, remove the plan // the admin has confirmed, remove the plan
const plans = _.drop($scope.availability.plan_ids, plan.id); _.drop($scope.availability.plan_ids, plan.id);
return Availability.update({ id: $scope.availability.id }, { availability: { plans_attributes: [{ id: plan.id, _destroy: true }] } } Availability.update({ id: $scope.availability.id }, { availability: { plans_attributes: [{ id: plan.id, _destroy: true }] } }
, function (data, status) { // success , function (data, status) { // success
// update the plan_ids attribute // update the plan_ids attribute
$scope.availability.plan_ids = data.plan_ids; $scope.availability.plan_ids = data.plan_ids;
@ -273,7 +272,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
// open a confirmation dialog // open a confirmation dialog
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "admin/calendar/deleteRecurrent.html" %>', templateUrl: '../../../../templates/admin/calendar/deleteRecurrent.html',
size: 'md', size: 'md',
controller: 'DeleteRecurrentAvailabilityController', controller: 'DeleteRecurrentAvailabilityController',
resolve: { resolve: {
@ -282,7 +281,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
}); });
// once the dialog was closed, do things depending on the result // once the dialog was closed, do things depending on the result
modalInstance.result.then(function (res) { modalInstance.result.then(function (res) {
if (res.status == 'success') { if (res.status === 'success') {
$scope.availability = null; $scope.availability = null;
} }
for (const availability of res.availabilities) { for (const availability of res.availabilities) {
@ -355,7 +354,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('calendar') < 0) { if (settingsPromise.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('calendar') < 0) {
uitour.start(); uitour.start();
} }
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -380,12 +379,12 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
* *
* @returns {array} * @returns {array}
*/ */
var availabilityPlans = function() { const availabilityPlans = function () {
const plansClassifiedByGroup = []; const plansClassifiedByGroup = [];
const _plans = _.filter(plansPromise, function (p) { return _.include($scope.availability.plan_ids, p.id) }); const _plans = _.filter(plansPromise, function (p) { return _.includes($scope.availability.plan_ids, p.id); });
for (let group of Array.from(groupsPromise)) { for (const group of Array.from(groupsPromise)) {
const groupObj = { id: group.id, name: group.name, plans: [] }; const groupObj = { id: group.id, name: group.name, plans: [] };
for (let plan of Array.from(_plans)) { for (const plan of Array.from(_plans)) {
if (plan.group_id === group.id) { groupObj.plans.push(plan); } if (plan.group_id === group.id) { groupObj.plans.push(plan); }
} }
if (groupObj.plans.length > 0) { if (groupObj.plans.length > 0) {
@ -419,14 +418,14 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
// then we open a modal window to let the admin specify the slot type // then we open a modal window to let the admin specify the slot type
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
templateUrl: '<%= asset_path "admin/calendar/eventModal.html" %>', templateUrl: '../../../../templates/admin/calendar/eventModal.html',
controller: 'CreateEventModalController', controller: 'CreateEventModalController',
backdrop: 'static', backdrop: 'static',
keyboard: false, keyboard: false,
resolve: { resolve: {
start() { return start; }, start () { return start; },
end() { return end; }, end () { return end; },
slots() { return Math.ceil(slots); }, slots () { return Math.ceil(slots); },
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }], machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }], trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }], spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
@ -434,7 +433,8 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }], plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }], groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
slotDurationPromise: ['Setting', function (Setting) { return Setting.get({ name: 'slot_duration' }).$promise; }] slotDurationPromise: ['Setting', function (Setting) { return Setting.get({ name: 'slot_duration' }).$promise; }]
} }); }
});
// when the modal is closed, we send the slot to the server for saving // when the modal is closed, we send the slot to the server for saving
modalInstance.result.then( modalInstance.result.then(
function (availability) { function (availability) {
@ -472,10 +472,10 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
$scope.availability.plans = availabilityPlans(); $scope.availability.plans = availabilityPlans();
if ($scope.availabilityDom) { if ($scope.availabilityDom) {
$scope.availabilityDom.classList.remove("fc-selected") $scope.availabilityDom.classList.remove('fc-selected');
} }
$scope.availabilityDom = jsEvent.target.closest('.fc-event'); $scope.availabilityDom = jsEvent.target.closest('.fc-event');
$scope.availabilityDom.classList.add("fc-selected") $scope.availabilityDom.classList.add('fc-selected');
// if the user has clicked on the delete event button, delete the event // if the user has clicked on the delete event button, delete the event
if ($(jsEvent.target).hasClass('remove-event')) { if ($(jsEvent.target).hasClass('remove-event')) {
@ -495,14 +495,13 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
if (event.available_type !== 'event') { if (event.available_type !== 'event') {
element.find('.fc-content').prepend('<span class="remove-event">x&nbsp;</span>'); element.find('.fc-content').prepend('<span class="remove-event">x&nbsp;</span>');
} }
if (event.tags.length > 0) { if (event.tags && event.tags.length > 0) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (const tag of Array.from(event.tags)) {
html += `<span class='label label-success text-white'>${tag.name}</span> `; html += `<span class='label label-success text-white'>${tag.name}</span> `;
} }
element.find('.fc-title').append(`<br/>${html}`); element.find('.fc-title').append(`<br/>${html}`);
} }
// force return to prevent coffee-script auto-return to return random value (possiblity falsy)
}; };
/** /**
@ -510,10 +509,9 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
* @see https://fullcalendar.io/docs/resource_data/loading/ * @see https://fullcalendar.io/docs/resource_data/loading/
*/ */
const loadingCb = function (isLoading, view) { const loadingCb = function (isLoading, view) {
if (isLoading) { if (isLoading && uiCalendarConfig.calendars.calendar) {
// we remove existing events when fetching starts to prevent duplicates // we remove existing events when fetching starts to prevent duplicates
uiCalendarConfig.calendars.calendar.fullCalendar('removeEvents'); uiCalendarConfig.calendars.calendar.fullCalendar('removeEvents');
} }
}; };
@ -521,7 +519,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
* Triggered when the view is changed * Triggered when the view is changed
* @see https://fullcalendar.io/docs/v3/viewRender#v2 * @see https://fullcalendar.io/docs/v3/viewRender#v2
*/ */
const viewRenderCb = function(view, element) { const viewRenderCb = function (view, element) {
// we unselect the current event to keep consistency // we unselect the current event to keep consistency
$scope.availability = null; $scope.availability = null;
$scope.availabilityDom = null; $scope.availabilityDom = null;
@ -634,7 +632,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
/** /**
* Select/unselect all the machines * Select/unselect all the machines
*/ */
$scope.toggleAll = function() { $scope.toggleAll = function () {
const count = $scope.selectedMachines.length; const count = $scope.selectedMachines.length;
$scope.selectedMachines = []; $scope.selectedMachines = [];
$scope.selectedMachinesBinding = {}; $scope.selectedMachinesBinding = {};
@ -642,9 +640,9 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
$scope.machines.forEach(function (machine) { $scope.machines.forEach(function (machine) {
$scope.selectedMachines.push(machine); $scope.selectedMachines.push(machine);
$scope.selectedMachinesBinding[machine.id] = true; $scope.selectedMachinesBinding[machine.id] = true;
}) });
}
} }
};
/** /**
* Adds or removes the provided plan from the current slot * Adds or removes the provided plan from the current slot
@ -662,7 +660,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
/** /**
* Select/unselect all the plans * Select/unselect all the plans
*/ */
$scope.toggleAllPlans = function() { $scope.toggleAllPlans = function () {
const count = $scope.selectedPlans.length; const count = $scope.selectedPlans.length;
$scope.selectedPlans = []; $scope.selectedPlans = [];
$scope.selectedPlansBinding = {}; $scope.selectedPlansBinding = {};
@ -670,7 +668,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
plansPromise.forEach(function (plan) { plansPromise.forEach(function (plan) {
$scope.selectedPlans.push(plan); $scope.selectedPlans.push(plan);
$scope.selectedPlansBinding[plan.id] = true; $scope.selectedPlansBinding[plan.id] = true;
}) });
} }
}; };
@ -739,7 +737,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
*/ */
$scope.isTypeDivided = function () { $scope.isTypeDivided = function () {
return isTypeDivided($scope.availability.available_type); return isTypeDivided($scope.availability.available_type);
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -755,7 +753,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
} }
// when disable is only subscriptions option, reset all selected plans // when disable is only subscriptions option, reset all selected plans
$scope.$watch('isOnlySubscriptions', function(value) { $scope.$watch('isOnlySubscriptions', function (value) {
if (!value) { if (!value) {
$scope.selectedPlans = []; $scope.selectedPlans = [];
$scope.selectedPlansBinding = {}; $scope.selectedPlansBinding = {};
@ -763,9 +761,9 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
}); });
// group plans by Group // group plans by Group
for (let group of groupsPromise.filter(g => !g.disabled)) { for (const group of groupsPromise.filter(g => !g.disabled)) {
const groupObj = { id: group.id, name: group.name, plans: [] }; const groupObj = { id: group.id, name: group.name, plans: [] };
for (let plan of plansPromise.filter(g => !g.disabled)) { for (const plan of plansPromise.filter(g => !g.disabled)) {
if (plan.group_id === group.id) { groupObj.plans.push(plan); } if (plan.group_id === group.id) { groupObj.plans.push(plan); }
} }
if (groupObj.plans.length > 0) { if (groupObj.plans.length > 0) {
@ -845,7 +843,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
*/ */
const isTypeDivided = function (type) { const isTypeDivided = function (type) {
return ((type === 'machines') || (type === 'space')); return ((type === 'machines') || (type === 'space'));
} };
/** /**
* Validates that a machine or more was/were selected before continuing to step 3 (adjust time + tags) * Validates that a machine or more was/were selected before continuing to step 3 (adjust time + tags)
@ -891,7 +889,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
$scope.availability.slot_duration = parseInt(slotDurationPromise.setting.value, 10); $scope.availability.slot_duration = parseInt(slotDurationPromise.setting.value, 10);
} }
$scope.step++; $scope.step++;
} };
/** /**
* Compute the various occurrences of the availability, according to the recurrence settings * Compute the various occurrences of the availability, according to the recurrence settings
@ -923,7 +921,7 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
$scope.reservableName = ''; $scope.reservableName = '';
switch ($scope.availability.available_type) { switch ($scope.availability.available_type) {
case 'machines': case 'machines':
$scope.reservableName = localizedList($scope.selectedMachines) $scope.reservableName = localizedList($scope.selectedMachines);
break; break;
case 'training': case 'training':
$scope.reservableName = `<strong>${$scope.selectedTraining.name}</strong>`; $scope.reservableName = `<strong>${$scope.selectedTraining.name}</strong>`;
@ -932,25 +930,25 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
$scope.reservableName = `<strong>${$scope.selectedSpace.name}</strong>`; $scope.reservableName = `<strong>${$scope.selectedSpace.name}</strong>`;
break; break;
default: default:
$scope.reservableName = `<span class="warning">${_t("app.admin.calendar.none")}</span>`; $scope.reservableName = `<span class="warning">${_t('app.admin.calendar.none')}</span>`;
} }
const tags = $scope.tags.filter(function (t) { const tags = $scope.tags.filter(function (t) {
return $scope.availability.tag_ids.indexOf(t.id) > -1; return $scope.availability.tag_ids.indexOf(t.id) > -1;
}) });
$scope.tagsName = localizedList(tags); $scope.tagsName = localizedList(tags);
if ($scope.isOnlySubscriptions && $scope.selectedPlans.length > 0) { if ($scope.isOnlySubscriptions && $scope.selectedPlans.length > 0) {
$scope.plansName = localizedList($scope.selectedPlans); $scope.plansName = localizedList($scope.selectedPlans);
} }
} };
const localizedList = function (items) { const localizedList = function (items) {
if (items.length === 0) return `<span class="text-gray text-italic">${_t("app.admin.calendar.none")}</span>`; if (items.length === 0) return `<span class="text-gray text-italic">${_t('app.admin.calendar.none')}</span>`;
const names = items.map(function (i) { return $sce.trustAsHtml(`<strong>${i.name}</strong>`); }); const names = items.map(function (i) { return $sce.trustAsHtml(`<strong>${i.name}</strong>`); });
if (items.length > 1) return names.slice(0, -1).join(', ') + ` ${_t('app.admin.calendar.and')} ` + names[names.length - 1]; if (items.length > 1) return names.slice(0, -1).join(', ') + ` ${_t('app.admin.calendar.and')} ` + names[names.length - 1];
return names[0]; return names[0];
} };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller
return initialize(); return initialize();
@ -962,7 +960,6 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
*/ */
Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$scope', '$uibModalInstance', 'Availability', 'availabilityPromise', 'growl', '_t', Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$scope', '$uibModalInstance', 'Availability', 'availabilityPromise', 'growl', '_t',
function ($scope, $uibModalInstance, Availability, availabilityPromise, growl, _t) { function ($scope, $uibModalInstance, Availability, availabilityPromise, growl, _t) {
// is the current slot (to be deleted) recurrent? // is the current slot (to be deleted) recurrent?
$scope.isRecurrent = availabilityPromise.is_recurrent; $scope.isRecurrent = availabilityPromise.is_recurrent;
@ -982,17 +979,17 @@ Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$s
if (res.deleted > 1) { if (res.deleted > 1) {
growl.success(_t( growl.success(_t(
'app.admin.calendar.slots_deleted', 'app.admin.calendar.slots_deleted',
{START: moment(start_at).format('LL LT'), COUNT: res.deleted - 1} { START: moment(start_at).format('LL LT'), COUNT: res.deleted - 1 }
)); ));
} else { } else {
growl.success(_t( growl.success(_t(
'app.admin.calendar.slot_successfully_deleted', 'app.admin.calendar.slot_successfully_deleted',
{START: moment(start_at).format('LL LT'), END: moment(end_at).format('LT')} { START: moment(start_at).format('LL LT'), END: moment(end_at).format('LT') }
)); ));
} }
$uibModalInstance.close({ $uibModalInstance.close({
status: 'success', status: 'success',
availabilities: res.details.map(function (d) { return d.availability.id }) availabilities: res.details.map(function (d) { return d.availability.id; })
}); });
}, },
function (res) { function (res) {
@ -1001,32 +998,30 @@ Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$s
if (data.total > 1) { if (data.total > 1) {
growl.warning(_t( growl.warning(_t(
'app.admin.calendar.slots_not_deleted', 'app.admin.calendar.slots_not_deleted',
{TOTAL: data.total, COUNT: data.total - data.deleted} { TOTAL: data.total, COUNT: data.total - data.deleted }
)); ));
} else { } else {
growl.error(_t( growl.error(_t(
'app.admin.calendar.unable_to_delete_the_slot', 'app.admin.calendar.unable_to_delete_the_slot',
{START: moment(start_at).format('LL LT'), END: moment(end_at).format('LT')} { START: moment(start_at).format('LL LT'), END: moment(end_at).format('LT') }
)); ));
} }
$uibModalInstance.close({ $uibModalInstance.close({
status: 'failed', status: 'failed',
availabilities: data.details.filter(function (d) { return d.status }).map(function (d) { return d.availability.id }) availabilities: data.details.filter(function (d) { return d.status; }).map(function (d) { return d.availability.id; })
}); });
}); });
} };
/** /**
* Cancellation callback * Cancellation callback
*/ */
$scope.cancel = function () { $scope.cancel = function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} };
} }
]); ]);
/** /**
* Controller used in the iCalendar (ICS) imports management page * Controller used in the iCalendar (ICS) imports management page
*/ */
@ -1061,8 +1056,8 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
// failed // failed
growl.error(_t('app.admin.icalendar.create_error')); growl.error(_t('app.admin.icalendar.create_error'));
console.error(error); console.error(error);
}) });
} };
/** /**
* Return a CSS-like style of the given calendar configuration * Return a CSS-like style of the given calendar configuration
@ -1071,11 +1066,11 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
$scope.calendarStyle = function (calendar) { $scope.calendarStyle = function (calendar) {
return { return {
'border-color': calendar.color, 'border-color': calendar.color,
'color': calendar.text_color, color: calendar.text_color,
'width': calendar.text_hidden ? '50px' : 'auto', width: calendar.text_hidden ? '50px' : 'auto',
'height': calendar.text_hidden ? '21px' : 'auto' height: calendar.text_hidden ? '21px' : 'auto'
};
}; };
}
/** /**
* Delete the given calendar from the database * Delete the given calendar from the database
@ -1108,8 +1103,8 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
} }
); );
} }
) );
} };
/** /**
* Asynchronously re-fetches the events from the given calendar * Asynchronously re-fetches the events from the given calendar
@ -1126,7 +1121,7 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
growl.error(_t('app.admin.icalendar.sync_failed')); growl.error(_t('app.admin.icalendar.sync_failed'));
console.error(error); console.error(error);
} }
) );
} };
} }
]); ]);

View File

@ -279,7 +279,7 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
*/ */
$scope.newPriceCategory = function () { $scope.newPriceCategory = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/events/price_form.html" %>', templateUrl: '../../../../templates/admin/events/price_form.html',
size: 'md', size: 'md',
resolve: { resolve: {
category () { return {}; } category () { return {}; }
@ -307,7 +307,7 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
return growl.error(_t('app.admin.events.unexpected_error_occurred_please_refresh')); return growl.error(_t('app.admin.events.unexpected_error_occurred_please_refresh'));
} else { } else {
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "admin/events/price_form.html" %>', templateUrl: '../../../../templates/admin/events/price_form.html',
size: 'md', size: 'md',
resolve: { resolve: {
category () { return $scope.priceCategories[index]; } category () { return $scope.priceCategories[index]; }
@ -645,7 +645,7 @@ Application.Controllers.controller('EditEventController', ['$scope', '$state', '
// open a choice edit-mode dialog // open a choice edit-mode dialog
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "events/editRecurrent.html" %>', templateUrl: '../../../../templates/events/editRecurrent.html',
size: 'md', size: 'md',
controller: 'EditRecurrentEventController', controller: 'EditRecurrentEventController',
resolve: { resolve: {

View File

@ -58,8 +58,8 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
prefix: settings.invoice_prefix, prefix: settings.invoice_prefix,
nextId: 40, nextId: 40,
date: moment().format('DDMMYYYY'), date: moment().format('DDMMYYYY'),
templateUrl: 'editPrefix.html' templateUrl: '../../../../templates/admin/invoices/settings/editPrefix.html'
} };
// Invoices parameters // Invoices parameters
$scope.invoice = { $scope.invoice = {
@ -67,22 +67,22 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
reference: { reference: {
model: '', model: '',
help: null, help: null,
templateUrl: 'editReference.html' templateUrl: '../../../../templates/admin/invoices/settings/editReference.html'
}, },
code: { code: {
model: '', model: '',
active: true, active: true,
templateUrl: 'editCode.html' templateUrl: '../../../../templates/admin/invoices/settings/editCode.html'
}, },
number: { number: {
model: '', model: '',
help: null, help: null,
templateUrl: 'editNumber.html' templateUrl: '../../../../templates/admin/invoices/settings/editNumber.html'
}, },
VAT: { VAT: {
rate: 19.6, rate: 19.6,
active: false, active: false,
templateUrl: 'editVAT.html' templateUrl: '../../../../templates/admin/invoices/settings/editVAT.html'
}, },
text: { text: {
content: '' content: ''
@ -96,87 +96,87 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
$scope.settings = { $scope.settings = {
journalCode: { journalCode: {
name: 'accounting_journal_code', name: 'accounting_journal_code',
value: settings['accounting_journal_code'] value: settings.accounting_journal_code
}, },
cardClientCode: { cardClientCode: {
name: 'accounting_card_client_code', name: 'accounting_card_client_code',
value: settings['accounting_card_client_code'] value: settings.accounting_card_client_code
}, },
cardClientLabel: { cardClientLabel: {
name: 'accounting_card_client_label', name: 'accounting_card_client_label',
value: settings['accounting_card_client_label'] value: settings.accounting_card_client_label
}, },
walletClientCode: { walletClientCode: {
name: 'accounting_wallet_client_code', name: 'accounting_wallet_client_code',
value: settings['accounting_wallet_client_code'] value: settings.accounting_wallet_client_code
}, },
walletClientLabel: { walletClientLabel: {
name: 'accounting_wallet_client_label', name: 'accounting_wallet_client_label',
value: settings['accounting_wallet_client_label'] value: settings.accounting_wallet_client_label
}, },
otherClientCode: { otherClientCode: {
name: 'accounting_other_client_code', name: 'accounting_other_client_code',
value: settings['accounting_other_client_code'] value: settings.accounting_other_client_code
}, },
otherClientLabel: { otherClientLabel: {
name: 'accounting_other_client_label', name: 'accounting_other_client_label',
value: settings['accounting_other_client_label'] value: settings.accounting_other_client_label
}, },
walletCode: { walletCode: {
name: 'accounting_wallet_code', name: 'accounting_wallet_code',
value: settings['accounting_wallet_code'] value: settings.accounting_wallet_code
}, },
walletLabel: { walletLabel: {
name: 'accounting_wallet_label', name: 'accounting_wallet_label',
value: settings['accounting_wallet_label'] value: settings.accounting_wallet_label
}, },
vatCode: { vatCode: {
name: 'accounting_VAT_code', name: 'accounting_VAT_code',
value: settings['accounting_VAT_code'] value: settings.accounting_VAT_code
}, },
vatLabel: { vatLabel: {
name: 'accounting_VAT_label', name: 'accounting_VAT_label',
value: settings['accounting_VAT_label'] value: settings.accounting_VAT_label
}, },
subscriptionCode: { subscriptionCode: {
name: 'accounting_subscription_code', name: 'accounting_subscription_code',
value: settings['accounting_subscription_code'] value: settings.accounting_subscription_code
}, },
subscriptionLabel: { subscriptionLabel: {
name: 'accounting_subscription_label', name: 'accounting_subscription_label',
value: settings['accounting_subscription_label'] value: settings.accounting_subscription_label
}, },
machineCode: { machineCode: {
name: 'accounting_Machine_code', name: 'accounting_Machine_code',
value: settings['accounting_Machine_code'] value: settings.accounting_Machine_code
}, },
machineLabel: { machineLabel: {
name: 'accounting_Machine_label', name: 'accounting_Machine_label',
value: settings['accounting_Machine_label'] value: settings.accounting_Machine_label
}, },
trainingCode: { trainingCode: {
name: 'accounting_Training_code', name: 'accounting_Training_code',
value: settings['accounting_Training_code'] value: settings.accounting_Training_code
}, },
trainingLabel: { trainingLabel: {
name: 'accounting_Training_label', name: 'accounting_Training_label',
value: settings['accounting_Training_label'] value: settings.accounting_Training_label
}, },
eventCode: { eventCode: {
name: 'accounting_Event_code', name: 'accounting_Event_code',
value: settings['accounting_Event_code'] value: settings.accounting_Event_code
}, },
eventLabel: { eventLabel: {
name: 'accounting_Event_label', name: 'accounting_Event_label',
value: settings['accounting_Event_label'] value: settings.accounting_Event_label
}, },
spaceCode: { spaceCode: {
name: 'accounting_Space_code', name: 'accounting_Space_code',
value: settings['accounting_Space_code'] value: settings.accounting_Space_code
}, },
spaceLabel: { spaceLabel: {
name: 'accounting_Space_label', name: 'accounting_Space_label',
value: settings['accounting_Space_label'] value: settings.accounting_Space_label
} }
}; };
@ -220,12 +220,12 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
$scope.generateAvoirForInvoice = function (invoice) { $scope.generateAvoirForInvoice = function (invoice) {
// open modal // open modal
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
templateUrl: '<%= asset_path "admin/invoices/avoirModal.html" %>', templateUrl: '../../../../templates/admin/invoices/avoirModal.html',
controller: 'AvoirModalController', controller: 'AvoirModalController',
resolve: { resolve: {
invoice () { return invoice; }, invoice () { return invoice; },
closedPeriods() { return AccountingPeriod.query().$promise; }, closedPeriods () { return AccountingPeriod.query().$promise; },
lastClosingEnd() { return AccountingPeriod.lastClosingEnd().$promise; } lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; }
} }
}); });
@ -440,15 +440,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
$scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); }; $scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); };
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
const initialize = function () {
const initialize = function() {
rateHistory.setting.history.forEach(function (rate) { rateHistory.setting.history.forEach(function (rate) {
$scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user }) $scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user });
}); });
activeHistory.setting.history.forEach(function (v) { activeHistory.setting.history.forEach(function (v) {
$scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user }) $scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user });
}); });
} };
initialize(); initialize();
}] }]
@ -494,7 +493,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
templateUrl: $scope.file.templateUrl, templateUrl: $scope.file.templateUrl,
size: 'lg', size: 'lg',
resolve: { resolve: {
model () { return $scope.file.prefix;} model () { return $scope.file.prefix; }
}, },
controller: ['$scope', '$uibModalInstance', 'model', function ($scope, $uibModalInstance, model) { controller: ['$scope', '$uibModalInstance', 'model', function ($scope, $uibModalInstance, model) {
$scope.model = model; $scope.model = model;
@ -557,7 +556,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
*/ */
$scope.handleFilterChange = function () { $scope.handleFilterChange = function () {
if (searchTimeout) clearTimeout(searchTimeout); if (searchTimeout) clearTimeout(searchTimeout);
searchTimeout = setTimeout(function() { searchTimeout = setTimeout(function () {
resetSearchInvoice(); resetSearchInvoice();
invoiceSearch(); invoiceSearch();
}, 300); }, 300);
@ -576,47 +575,47 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
* Open a modal allowing the user to close an accounting period and to * Open a modal allowing the user to close an accounting period and to
* view all periods already closed. * view all periods already closed.
*/ */
$scope.closeAnAccountingPeriod = function() { $scope.closeAnAccountingPeriod = function () {
// open modal // open modal
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/invoices/closePeriodModal.html" %>', templateUrl: '../../../../templates/admin/invoices/closePeriodModal.html',
controller: 'ClosePeriodModalController', controller: 'ClosePeriodModalController',
backdrop: 'static', backdrop: 'static',
keyboard: false, keyboard: false,
size: 'lg', size: 'lg',
resolve: { resolve: {
periods() { return AccountingPeriod.query().$promise; }, periods () { return AccountingPeriod.query().$promise; },
lastClosingEnd() { return AccountingPeriod.lastClosingEnd().$promise; } lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; }
} }
}); });
} };
$scope.toggleExportModal = function() { $scope.toggleExportModal = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/invoices/accountingExportModal.html" %>', templateUrl: '../../../../templates/admin/invoices/accountingExportModal.html',
controller: 'AccountingExportModalController', controller: 'AccountingExportModalController',
size: 'xl' size: 'xl'
}); });
} };
/** /**
* Test if the given date is within a closed accounting period * Test if the given date is within a closed accounting period
* @param date {Date} date to test * @param date {Date} date to test
* @returns {boolean} true if closed, false otherwise * @returns {boolean} true if closed, false otherwise
*/ */
$scope.isDateClosed = function(date) { $scope.isDateClosed = function (date) {
for (const period of closedPeriods) { for (const period of closedPeriods) {
if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) { if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) {
return true; return true;
} }
} }
return false; return false;
} };
/** /**
* Callback to bulk save all settings in the page to the database with their values * Callback to bulk save all settings in the page to the database with their values
*/ */
$scope.save = function() { $scope.save = function () {
Setting.bulkUpdate( Setting.bulkUpdate(
{ settings: Object.values($scope.settings) }, { settings: Object.values($scope.settings) },
function () { growl.success(_t('app.admin.invoices.codes_customization_success')); }, function () { growl.success(_t('app.admin.invoices.codes_customization_success')); },
@ -625,29 +624,29 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
console.error(error); console.error(error);
} }
); );
} };
/** /**
* Return the name of the operator that creates the invoice * Return the name of the operator that creates the invoice
*/ */
$scope.operatorName = function(invoice) { $scope.operatorName = function (invoice) {
if (!invoice.operator) return ''; if (!invoice.operator) return '';
return `${invoice.operator.first_name} ${invoice.operator.last_name}`; return `${invoice.operator.first_name} ${invoice.operator.last_name}`;
} };
/** /**
* Open a modal dialog which ask for the stripe keys * Open a modal dialog which ask for the stripe keys
* @param onlinePaymentModule {{name: String, value: String}} setting that defines the next status of the online payment module * @param onlinePaymentModule {{name: String, value: String}} setting that defines the next status of the online payment module
* @return {boolean} false if the keys were not provided * @return {boolean} false if the keys were not provided
*/ */
$scope.requireStripeKeys = function(onlinePaymentModule) { $scope.requireStripeKeys = function (onlinePaymentModule) {
// if the online payment is about to be disabled, accept the change without any further question // if the online payment is about to be disabled, accept the change without any further question
if (onlinePaymentModule.value === false) return true; if (onlinePaymentModule.value === false) return true;
// otherwise, open a modal to ask for the stripe keys // otherwise, open a modal to ask for the stripe keys
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
templateUrl: 'stripeKeys.html', templateUrl: '../../../../templates/admin/invoices/settings/stripeKeys.html',
controller: 'StripeKeysModalController', controller: 'StripeKeysModalController',
resolve: { resolve: {
stripeKeys: ['Setting', function (Setting) { return Setting.query({ names: "['stripe_public_key', 'stripe_secret_key']" }).$promise; }] stripeKeys: ['Setting', function (Setting) { return Setting.query({ names: "['stripe_public_key', 'stripe_secret_key']" }).$promise; }]
@ -658,19 +657,19 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
if (success) { if (success) {
Setting.get({ name: 'stripe_public_key' }, function (res) { Setting.get({ name: 'stripe_public_key' }, function (res) {
$scope.allSettings.stripe_public_key = res.setting.value; $scope.allSettings.stripe_public_key = res.setting.value;
}) });
Setting.isPresent({ name: 'stripe_secret_key' }, function (res) { Setting.isPresent({ name: 'stripe_secret_key' }, function (res) {
$scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : ''); $scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : '');
}) });
Payment.onlinePaymentStatus(function (res) { Payment.onlinePaymentStatus(function (res) {
$scope.onlinePaymentStatus = res.status; $scope.onlinePaymentStatus = res.status;
}); });
} }
}) });
// return the promise // return the promise
return modalInstance.result; return modalInstance.result;
} };
/** /**
* Setup the feature-tour for the admin/invoices page. * Setup the feature-tour for the admin/invoices page.
@ -814,7 +813,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) { if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
uitour.start(); uitour.start();
} }
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -827,18 +826,18 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
} }
// retrieve settings from the DB through the API // retrieve settings from the DB through the API
$scope.invoice.legals.content = settings['invoice_legals']; $scope.invoice.legals.content = settings.invoice_legals;
$scope.invoice.text.content = settings['invoice_text']; $scope.invoice.text.content = settings.invoice_text;
$scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']); $scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']);
$scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true'); $scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true');
$scope.invoice.number.model = settings['invoice_order-nb']; $scope.invoice.number.model = settings['invoice_order-nb'];
$scope.invoice.code.model = settings['invoice_code-value']; $scope.invoice.code.model = settings['invoice_code-value'];
$scope.invoice.code.active = (settings['invoice_code-active'] === 'true'); $scope.invoice.code.active = (settings['invoice_code-active'] === 'true');
$scope.invoice.reference.model = settings['invoice_reference']; $scope.invoice.reference.model = settings.invoice_reference;
$scope.invoice.logo = { $scope.invoice.logo = {
filetype: 'image/png', filetype: 'image/png',
filename: 'logo.png', filename: 'logo.png',
base64: settings['invoice_logo'] base64: settings.invoice_logo
}; };
// Watch the logo, when a change occurs, save it // Watch the logo, when a change occurs, save it
@ -990,7 +989,7 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
$scope.ok = function () { $scope.ok = function () {
// check that at least 1 element of the invoice is refunded // check that at least 1 element of the invoice is refunded
$scope.avoir.invoice_items_ids = []; $scope.avoir.invoice_items_ids = [];
for (let itemId in $scope.partial) { for (const itemId in $scope.partial) {
if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) { if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) {
const refundItem = $scope.partial[itemId]; const refundItem = $scope.partial[itemId];
if (refundItem) { if (refundItem) {
@ -1024,14 +1023,14 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
* @param date {Date} date to test * @param date {Date} date to test
* @returns {boolean} true if closed, false otherwise * @returns {boolean} true if closed, false otherwise
*/ */
$scope.isDateClosed = function(date) { $scope.isDateClosed = function (date) {
for (const period of closedPeriods) { for (const period of closedPeriods) {
if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) { if (moment(date).isBetween(moment.utc(period.start_at).startOf('day'), moment.utc(period.end_at).endOf('day'), null, '[]')) {
return true; return true;
} }
} }
return false; return false;
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -1058,11 +1057,10 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
} }
]); ]);
/** /**
* Controller used in the modal window allowing an admin to close an accounting period * Controller used in the modal window allowing an admin to close an accounting period
*/ */
Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$uibModalInstance', '$window', '$sce', 'Invoice', 'AccountingPeriod', 'periods', 'lastClosingEnd','dialogs', 'growl', '_t', Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$uibModalInstance', '$window', '$sce', 'Invoice', 'AccountingPeriod', 'periods', 'lastClosingEnd', 'dialogs', 'growl', '_t',
function ($scope, $uibModalInstance, $window, $sce, Invoice, AccountingPeriod, periods, lastClosingEnd, dialogs, growl, _t) { function ($scope, $uibModalInstance, $window, $sce, Invoice, AccountingPeriod, periods, lastClosingEnd, dialogs, growl, _t) {
const YESTERDAY = moment.utc({ h: 0, m: 0, s: 0, ms: 0 }).subtract(1, 'day').toDate(); const YESTERDAY = moment.utc({ h: 0, m: 0, s: 0, ms: 0 }).subtract(1, 'day').toDate();
const LAST_CLOSING = moment.utc(lastClosingEnd.last_end_date).toDate(); const LAST_CLOSING = moment.utc(lastClosingEnd.last_end_date).toDate();
@ -1124,11 +1122,11 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
_t( _t(
'app.admin.invoices.confirm_close_START_END', 'app.admin.invoices.confirm_close_START_END',
{ START: moment.utc($scope.period.start_at).format('LL'), END: moment.utc($scope.period.end_at).format('LL') } { START: moment.utc($scope.period.start_at).format('LL'), END: moment.utc($scope.period.end_at).format('LL') }
) ) +
+ '<br/><br/><strong>' '<br/><br/><strong>' +
+ _t('app.admin.invoices.period_must_match_fiscal_year') _t('app.admin.invoices.period_must_match_fiscal_year') +
+ '</strong><br/><br/>' '</strong><br/><br/>' +
+ _t('app.admin.invoices.this_may_take_a_while') _t('app.admin.invoices.this_may_take_a_while')
) )
}; };
} }
@ -1151,7 +1149,7 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
)); ));
$uibModalInstance.close(resp); $uibModalInstance.close(resp);
}, },
function(error) { function (error) {
$scope.pendingCreation = false; $scope.pendingCreation = false;
growl.error(_t('app.admin.invoices.failed_to_close_period')); growl.error(_t('app.admin.invoices.failed_to_close_period'));
$scope.errors = error.data; $scope.errors = error.data;
@ -1159,7 +1157,6 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
); );
} }
); );
}; };
/** /**
@ -1170,9 +1167,9 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
/** /**
* Trigger the API call to download the JSON archive of the closed accounting period * Trigger the API call to download the JSON archive of the closed accounting period
*/ */
$scope.downloadArchive = function(period) { $scope.downloadArchive = function (period) {
$window.location.href = `/api/accounting_periods/${period.id}/archive`; $window.location.href = `/api/accounting_periods/${period.id}/archive`;
} };
} }
]); ]);
@ -1251,7 +1248,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
* @param event {Object} see https://docs.angularjs.org/guide/expression#-event- * @param event {Object} see https://docs.angularjs.org/guide/expression#-event-
* @param picker {string} start | end * @param picker {string} start | end
*/ */
$scope.toggleDatePicker = function(event, picker) { $scope.toggleDatePicker = function (event, picker) {
event.preventDefault(); event.preventDefault();
$scope.datePicker.opened[picker] = !$scope.datePicker.opened[picker]; $scope.datePicker.opened[picker] = !$scope.datePicker.opened[picker];
}; };
@ -1260,7 +1257,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
* Will fill the export settings, according to the selected software * Will fill the export settings, according to the selected software
* @param software {String} must be one of SETTINGS.* * @param software {String} must be one of SETTINGS.*
*/ */
$scope.fillSettings = function(software) { $scope.fillSettings = function (software) {
$scope.exportTarget.settings = SETTINGS[software]; $scope.exportTarget.settings = SETTINGS[software];
}; };
@ -1287,7 +1284,7 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
* Prepare the query for the export API * Prepare the query for the export API
* @returns {{extension: *, query: *, category: string, type: *, key: *}} * @returns {{extension: *, query: *, category: string, type: *, key: *}}
*/ */
const mkQuery = function() { const mkQuery = function () {
return { return {
category: 'accounting', category: 'accounting',
type: $scope.exportTarget.software, type: $scope.exportTarget.software,
@ -1304,13 +1301,11 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero
}) })
}; };
} };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller
return initialize(); return initialize();
}]); }]);
/** /**
* Controller used in the modal window allowing an admin to close an accounting period * Controller used in the modal window allowing an admin to close an accounting period
@ -1343,15 +1338,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
method: 'GET', method: 'GET',
url: 'https://api.stripe.com/v1/charges', url: 'https://api.stripe.com/v1/charges',
headers: { headers: {
Authorization: `Bearer ${$scope.secretKey}`, Authorization: `Bearer ${$scope.secretKey}`
} }
}).then(function () { }).then(function () {
$scope.secretKeyStatus = true; $scope.secretKeyStatus = true;
}, function (err) { }, function (err) {
if (err.status === 401) $scope.secretKeyStatus = false; if (err.status === 401) $scope.secretKeyStatus = false;
}); });
} };
/** /**
* Trigger the test of the secret key and set the result in $scope.secretKeyStatus * Trigger the test of the secret key and set the result in $scope.secretKeyStatus
@ -1370,14 +1364,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
data: $httpParamSerializerJQLike({ data: $httpParamSerializerJQLike({
'pii[id_number]': 'test', 'pii[id_number]': 'test'
}) })
}).then(function () { }).then(function () {
$scope.publicKeyStatus = true; $scope.publicKeyStatus = true;
}, function (err) { }, function (err) {
if (err.status === 401) $scope.publicKeyStatus = false; if (err.status === 401) $scope.publicKeyStatus = false;
}); });
} };
/** /**
* Validate the keys * Validate the keys
@ -1385,7 +1379,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
$scope.ok = function () { $scope.ok = function () {
if ($scope.secretKeyStatus && $scope.publicKeyStatus) { if ($scope.secretKeyStatus && $scope.publicKeyStatus) {
Setting.bulkUpdate( Setting.bulkUpdate(
{ settings: [ {
settings: [
{ {
name: 'stripe_public_key', name: 'stripe_public_key',
value: $scope.publicKey value: $scope.publicKey
@ -1394,7 +1389,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
name: 'stripe_secret_key', name: 'stripe_secret_key',
value: $scope.secretKey value: $scope.secretKey
} }
] }, ]
},
function () { function () {
growl.success(_t('app.admin.invoices.payment.stripe_keys_saved')); growl.success(_t('app.admin.invoices.payment.stripe_keys_saved'));
$uibModalInstance.close(true); $uibModalInstance.close(true);
@ -1405,7 +1401,7 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
} }
); );
} else { } else {
growl.error(_t('app.admin.invoices.payment.error_check_keys')) growl.error(_t('app.admin.invoices.payment.error_check_keys'));
} }
}; };

View File

@ -236,7 +236,7 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
$scope.openPartnerNewModal = function () { $scope.openPartnerNewModal = function () {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_partner_new_modal.html" %>', templateUrl: '../../../../templates/shared/_partner_new_modal.html',
size: 'lg', size: 'lg',
controller: ['$scope', '$uibModalInstance', 'User', function ($scope, $uibModalInstance, User) { controller: ['$scope', '$uibModalInstance', 'User', function ($scope, $uibModalInstance, User) {
$scope.partner = {}; $scope.partner = {};
@ -702,7 +702,7 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
$scope.changeUserRole = function() { $scope.changeUserRole = function() {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "admin/members/change_role_modal.html" %>', templateUrl: '../../../../templates/admin/members/change_role_modal.html',
size: 'lg', size: 'lg',
resolve: { resolve: {
user() { return $scope.user; } user() { return $scope.user; }
@ -750,7 +750,7 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
$scope.updateSubscriptionModal = function (subscription, free) { $scope.updateSubscriptionModal = function (subscription, free) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "admin/subscriptions/expired_at_modal.html" %>', templateUrl: '../../../../templates/admin/subscriptions/expired_at_modal.html',
size: 'lg', size: 'lg',
controller: ['$scope', '$uibModalInstance', 'Subscription', function ($scope, $uibModalInstance, Subscription) { controller: ['$scope', '$uibModalInstance', 'Subscription', function ($scope, $uibModalInstance, Subscription) {
$scope.new_expired_at = angular.copy(subscription.expired_at); $scope.new_expired_at = angular.copy(subscription.expired_at);
@ -797,7 +797,7 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
$scope.createSubscriptionModal = function (user, plans) { $scope.createSubscriptionModal = function (user, plans) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "admin/subscriptions/create_modal.html" %>', templateUrl: '../../../../templates/admin/subscriptions/create_modal.html',
size: 'lg', size: 'lg',
controller: ['$scope', '$uibModalInstance', 'Subscription', 'Group', function ($scope, $uibModalInstance, Subscription, Group) { controller: ['$scope', '$uibModalInstance', 'Subscription', 'Group', function ($scope, $uibModalInstance, Subscription, Group) {
// selected user // selected user
@ -845,7 +845,7 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state',
$scope.createWalletCreditModal = function (user, wallet) { $scope.createWalletCreditModal = function (user, wallet) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "wallet/credit_modal.html" %>', templateUrl: '../../../../templates/wallet/credit_modal.html',
controller: ['$scope', '$uibModalInstance', 'Wallet', function ($scope, $uibModalInstance, Wallet) { controller: ['$scope', '$uibModalInstance', 'Wallet', function ($scope, $uibModalInstance, Wallet) {
// default: do not generate a refund invoice // default: do not generate a refund invoice
$scope.generate_avoir = false; $scope.generate_avoir = false;

View File

@ -114,7 +114,7 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal',
$scope.openPartnerNewModal = function (subscription) { $scope.openPartnerNewModal = function (subscription) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_partner_new_modal.html" %>', templateUrl: '../../../../templates/shared/_partner_new_modal.html',
size: 'lg', size: 'lg',
controller: ['$scope', '$uibModalInstance', 'User', function ($scope, $uibModalInstance, User) { controller: ['$scope', '$uibModalInstance', 'User', function ($scope, $uibModalInstance, User) {
$scope.partner = {}; $scope.partner = {};

View File

@ -570,7 +570,7 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state',
*/ */
$scope.sendCouponToUser = function (coupon) { $scope.sendCouponToUser = function (coupon) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/pricing/sendCoupon.html" %>', templateUrl: '../../../../templates/admin/pricing/sendCoupon.html',
resolve: { resolve: {
coupon () { return coupon; } coupon () { return coupon; }
}, },

View File

@ -173,7 +173,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
$scope.savePrivacyPolicy = function () { $scope.savePrivacyPolicy = function () {
// open modal // open modal
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
templateUrl: '<%= asset_path "admin/settings/save_policy.html" %>', templateUrl: '../../../../templates/admin/settings/save_policy.html',
controller: 'SavePolicyController', controller: 'SavePolicyController',
resolve: { resolve: {
saveCb () { return $scope.save; }, saveCb () { return $scope.save; },
@ -274,7 +274,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
*/ */
$scope.analyticsModal = function() { $scope.analyticsModal = function() {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/settings/analyticsModal.html" %>', templateUrl: '../../../../templates/admin/settings/analyticsModal.html',
controller: 'AnalyticsModalController', controller: 'AnalyticsModalController',
size: 'lg', size: 'lg',
resolve: { resolve: {

View File

@ -311,7 +311,7 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
*/ */
$scope.exportToExcel = function () { $scope.exportToExcel = function () {
const options = { const options = {
templateUrl: '<%= asset_path "admin/statistics/export.html" %>', templateUrl: '../../../../templates/admin/statistics/export.html',
size: 'sm', size: 'sm',
controller: 'ExportStatisticsController', controller: 'ExportStatisticsController',
resolve: { resolve: {

View File

@ -221,7 +221,7 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
*/ */
$scope.showReservations = function (training, availability) { $scope.showReservations = function (training, availability) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/trainings/validTrainingModal.html" %>', templateUrl: '../../../../templates/admin/trainings/validTrainingModal.html',
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) { controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
$scope.availability = availability; $scope.availability = availability;

View File

@ -89,7 +89,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
<% else %> <% else %>
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "shared/signupModal.html" %>', templateUrl: '../../../templates/shared/signupModal.html',
size: 'md', size: 'md',
resolve: { resolve: {
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'recaptcha_site_key', 'confirmation_required']" }).$promise; }] settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'recaptcha_site_key', 'confirmation_required']" }).$promise; }]
@ -192,7 +192,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
*/ */
$scope.editPassword = function (token) { $scope.editPassword = function (token) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "shared/passwordEditModal.html" %>', templateUrl: '../../../templates/shared/passwordEditModal.html',
size: 'md', size: 'md',
controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
$scope.user = { reset_password_token: token }; $scope.user = { reset_password_token: token };
@ -282,7 +282,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
if ($rootScope.currentUser.role !== 'admin') return; if ($rootScope.currentUser.role !== 'admin') return;
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "admin/versions/upgradeModal.html" %>', templateUrl: '../../../templates/admin/versions/upgradeModal.html',
controller: 'VersionModalController', controller: 'VersionModalController',
resolve: { resolve: {
version() { return $scope.version; } version() { return $scope.version; }
@ -407,7 +407,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
$window.location.href = '/sso-redirect'; $window.location.href = '/sso-redirect';
<% else %> <% else %>
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "shared/deviseModal.html" %>', templateUrl: '../../../templates/shared/deviseModal.html',
size: 'sm', size: 'sm',
resolve: { resolve: {
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['confirmation_required']" }).$promise; }] settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['confirmation_required']" }).$promise; }]
@ -470,7 +470,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
} else if (reason === 'resetPassword') { } else if (reason === 'resetPassword') {
// open the 'reset password' modal // open the 'reset password' modal
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "shared/passwordNewModal.html" %>', templateUrl: '../../../templates/shared/passwordNewModal.html',
size: 'sm', size: 'sm',
controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
$scope.user = { email: '' }; $scope.user = { email: '' };
@ -488,7 +488,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
} else if (reason === 'confirmationNew') { } else if (reason === 'confirmationNew') {
// open the 'reset password' modal // open the 'reset password' modal
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "shared/ConfirmationNewModal.html" %>', templateUrl: '../../../templates/shared/ConfirmationNewModal.html',
size: 'sm', size: 'sm',
controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) {
$scope.user = { email: '' }; $scope.user = { email: '' };

View File

@ -55,7 +55,12 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
evt: filter.evt, evt: filter.evt,
dispo: filter.dispo dispo: filter.dispo
}); });
$scope.calendarConfig.events = availabilitySourceUrl(); // remove all
$scope.eventSources.splice(0, $scope.eventSources.length);
// recreate source for trainings/machines/events with new filters
$scope.eventSources.push({
url: availabilitySourceUrl()
});
// external iCalendar events sources // external iCalendar events sources
$scope.externals.forEach(e => { $scope.externals.forEach(e => {
if (e.checked) { if (e.checked) {
@ -74,7 +79,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
} }
} }
}); });
uiCalendarConfig.calendars.calendar.fullCalendar('refetchEventSources'); uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents');
}; };
/** /**
@ -84,7 +89,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
$scope.calendarStyle = function (calendar) { $scope.calendarStyle = function (calendar) {
return { return {
'border-color': calendar.color, 'border-color': calendar.color,
'color': calendar.text_color color: calendar.text_color
}; };
}; };
@ -101,12 +106,12 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
// toggle to select all formation/machine // toggle to select all formation/machine
$scope.toggleFilter = function (type, filter) { $scope.toggleFilter = function (type, filter) {
$scope[type].forEach(t => t.checked = filter[type]); $scope[type].forEach(t => t.checked = filter[type]);
return $scope.filterAvailabilities(filter, $scope); $scope.filterAvailabilities(filter, $scope);
}; };
$scope.openFilterAside = () => $scope.openFilterAside = () =>
$aside.open({ $aside.open({
templateUrl: 'filterAside.html', templateUrl: '../../../templates/calendar/filterAside.html',
placement: 'right', placement: 'right',
size: 'md', size: 'md',
backdrop: false, backdrop: false,
@ -148,8 +153,8 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
$uibModalInstance.dismiss(); $uibModalInstance.dismiss();
return e.stopPropagation(); return e.stopPropagation();
}; };
} }]
] }); });
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -159,7 +164,6 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
const initialize = () => { const initialize = () => {
// fullCalendar (v2) configuration // fullCalendar (v2) configuration
$scope.calendarConfig = CalendarConfig({ $scope.calendarConfig = CalendarConfig({
events: availabilitySourceUrl(),
slotEventOverlap: true, slotEventOverlap: true,
header: { header: {
left: 'month agendaWeek agendaDay', left: 'month agendaWeek agendaDay',
@ -175,10 +179,13 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
viewRender (view, element) { viewRender (view, element) {
return viewRenderCb(view, element); return viewRenderCb(view, element);
}, },
eventRender (event, element, view) { eventRender (event, element) {
return eventRenderCb(event, element); return eventRenderCb(event, element);
} }
}); });
$scope.eventSources = [{
url: availabilitySourceUrl()
}];
$scope.externals.forEach(e => { $scope.externals.forEach(e => {
if (e.checked) { if (e.checked) {
$scope.eventSources.push({ $scope.eventSources.push({
@ -194,7 +201,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
/** /**
* Callback triggered when an event object is clicked in the fullCalendar view * Callback triggered when an event object is clicked in the fullCalendar view
*/ */
const calendarEventClickCb = function (event, jsEvent, view) { const calendarEventClickCb = function (event) {
// current calendar object // current calendar object
const { calendar } = uiCalendarConfig.calendars; const { calendar } = uiCalendarConfig.calendars;
if (event.available_type === 'machines') { if (event.available_type === 'machines') {
@ -240,7 +247,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
* This function is called when calendar view is rendered or changed * This function is called when calendar view is rendered or changed
* @see https://fullcalendar.io/docs/v3/viewRender#v2 * @see https://fullcalendar.io/docs/v3/viewRender#v2
*/ */
const viewRenderCb = function (view, element) { const viewRenderCb = function (view) {
toggleSlotEventOverlap(view); toggleSlotEventOverlap(view);
if (view.type === 'agendaDay') { if (view.type === 'agendaDay') {
// get availabilties by 1 day for show machine slots // get availabilties by 1 day for show machine slots
@ -255,7 +262,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
const eventRenderCb = function (event, element) { const eventRenderCb = function (event, element) {
if (event.tags && event.tags.length > 0) { if (event.tags && event.tags.length > 0) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (const tag of Array.from(event.tags)) {
html += `<span class='label label-success text-white'>${tag.name}</span> `; html += `<span class='label label-success text-white'>${tag.name}</span> `;
} }
element.find('.fc-title').append(`<br/>${html}`); element.find('.fc-title').append(`<br/>${html}`);
@ -269,7 +276,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
return { t, m, s, evt: $scope.filter.evt, dispo: $scope.filter.dispo }; return { t, m, s, evt: $scope.filter.evt, dispo: $scope.filter.dispo };
}; };
var availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`; const availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`;
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller
return initialize(); return initialize();

View File

@ -42,7 +42,7 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
age_range_id: null age_range_id: null
}; };
$scope.monthNames = [<%= t('date.month_names')[1..-1].map { |m| "\"#{m}\"" }.join(', ') %>]; $scope.monthNames = [<%= I18n.t('date.month_names')[1..-1].map { |m| "\"#{m}\"" }.join(', ') %>];
/** /**
* Adds a resultset of events to the bottom of the page, grouped by month * Adds a resultset of events to the bottom of the page, grouped by month
@ -186,7 +186,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
// open a confirmation dialog // open a confirmation dialog
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "events/deleteRecurrent.html" %>', templateUrl: '../../../templates/events/deleteRecurrent.html',
size: 'md', size: 'md',
controller: 'DeleteRecurrentEventController', controller: 'DeleteRecurrentEventController',
resolve: { resolve: {
@ -416,7 +416,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
$scope.modifyReservation = function (reservation) { $scope.modifyReservation = function (reservation) {
const index = $scope.reservations.indexOf(reservation); const index = $scope.reservations.indexOf(reservation);
return $uibModal.open({ return $uibModal.open({
templateUrl: '<%= asset_path "events/modify_event_reservation_modal.html" %>', templateUrl: '../../../templates/events/modify_event_reservation_modal.html',
resolve: { resolve: {
event () { return $scope.event; }, event () { return $scope.event; },
reservation () { return reservation; } reservation () { return reservation; }
@ -671,7 +671,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
*/ */
const payByStripe = function (reservation) { const payByStripe = function (reservation) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "stripe/payment_modal.html" %>', templateUrl: '../../../templates/stripe/payment_modal.html',
size: 'md', size: 'md',
resolve: { resolve: {
reservation () { reservation () {
@ -739,7 +739,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
*/ */
const payOnSite = function (reservation) { const payOnSite = function (reservation) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "shared/valid_reservation_modal.html" %>', templateUrl: '../../../templates/shared/valid_reservation_modal.html',
size: 'sm', size: 'sm',
resolve: { resolve: {
reservation () { reservation () {
@ -858,7 +858,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
const showReserveSlotSameTimeModal = function(sameTimeReservations, callback) { const showReserveSlotSameTimeModal = function(sameTimeReservations, callback) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_reserve_slot_same_time.html" %>', templateUrl: '../../../templates/shared/_reserve_slot_same_time.html',
size: 'md', size: 'md',
controller: 'ReserveSlotSameTimeController', controller: 'ReserveSlotSameTimeController',
resolve: { resolve: {

View File

@ -121,7 +121,7 @@ const _reserveMachine = function (machine, e) {
// the training before he can book the reservation // the training before he can book the reservation
if (machine.current_user_training_reservation) { if (machine.current_user_training_reservation) {
return _this.$uibModal.open({ return _this.$uibModal.open({
templateUrl: '<%= asset_path "machines/training_reservation_modal.html" %>', templateUrl: '../../../templates/machines/training_reservation_modal.html',
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) { controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
$scope.machine = machine; $scope.machine = machine;
return $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; return $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
@ -136,7 +136,7 @@ const _reserveMachine = function (machine, e) {
// otherwise open the information modal // otherwise open the information modal
} else { } else {
return _this.$uibModal.open({ return _this.$uibModal.open({
templateUrl: '<%= asset_path "machines/request_training_modal.html" %>', templateUrl: '../../../templates/machines/request_training_modal.html',
controller: ['$scope', '$uibModalInstance', '$state', function ($scope, $uibModalInstance, $state) { controller: ['$scope', '$uibModalInstance', '$state', function ($scope, $uibModalInstance, $state) {
$scope.machine = machine; $scope.machine = machine;
$scope.member = _this.$scope.currentUser; $scope.member = _this.$scope.currentUser;
@ -495,7 +495,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
$scope.markSlotAsAdded = function () { $scope.markSlotAsAdded = function () {
$scope.selectedEvent.backgroundColor = FREE_SLOT_BORDER_COLOR; $scope.selectedEvent.backgroundColor = FREE_SLOT_BORDER_COLOR;
$scope.selectedEvent.title = _t('app.logged.machines_reserve.i_reserve'); $scope.selectedEvent.title = _t('app.logged.machines_reserve.i_reserve');
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
@ -506,11 +506,11 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
slot.borderColor = FREE_SLOT_BORDER_COLOR; slot.borderColor = FREE_SLOT_BORDER_COLOR;
slot.title = ''; slot.title = '';
slot.isValid = false; slot.isValid = false;
slot.id = null; slot.slot_id = null;
slot.is_reserved = false; slot.is_reserved = false;
slot.can_modify = false; slot.can_modify = false;
slot.offered = false; slot.offered = false;
return updateCalendar(); updateEvents(slot);
}; };
/** /**
@ -524,7 +524,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
$scope.markSlotAsModifying = function () { $scope.markSlotAsModifying = function () {
$scope.selectedEvent.backgroundColor = '#eee'; $scope.selectedEvent.backgroundColor = '#eee';
$scope.selectedEvent.title = _t('app.logged.machines_reserve.i_change'); $scope.selectedEvent.title = _t('app.logged.machines_reserve.i_change');
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
@ -534,34 +534,44 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
if ($scope.events.placable) { if ($scope.events.placable) {
$scope.events.placable.backgroundColor = 'white'; $scope.events.placable.backgroundColor = 'white';
$scope.events.placable.title = ''; $scope.events.placable.title = '';
updateEvents($scope.events.placable);
} }
if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) { if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) {
$scope.selectedEvent.backgroundColor = '#bbb'; $scope.selectedEvent.backgroundColor = '#bbb';
$scope.selectedEvent.title = _t('app.logged.machines_reserve.i_shift'); $scope.selectedEvent.title = _t('app.logged.machines_reserve.i_shift');
updateEvents($scope.selectedEvent);
} }
return updateCalendar();
}; };
/** /**
* When modifying an already booked reservation, callback when the modification was successfully done. * When modifying an already booked reservation, callback when the modification was successfully done.
*/ */
$scope.modifyMachineSlot = function () { $scope.modifyMachineSlot = function () {
$scope.events.placable.title = $scope.currentUser.id === $scope.events.modifiable.user.id ? _t('app.logged.machines_reserve.i_ve_reserved') : _t('app.logged.machines_reserve.not_available'); const save = {
$scope.events.placable.backgroundColor = 'white'; slotId: $scope.events.modifiable.slot_id,
$scope.events.placable.borderColor = $scope.events.modifiable.borderColor; borderColor: $scope.events.modifiable.borderColor,
$scope.events.placable.id = $scope.events.modifiable.id; user: angular.copy($scope.events.modifiable.user),
$scope.events.placable.is_reserved = true; title: $scope.currentUser.id === $scope.events.modifiable.user.id ? _t('app.logged.machines_reserve.i_ve_reserved') : _t('app.logged.machines_reserve.not_available')
$scope.events.placable.can_modify = true; };
$scope.events.placable.user = angular.copy($scope.events.modifiable.user);
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
$scope.events.modifiable.title = ''; $scope.events.modifiable.title = '';
$scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR; $scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR;
$scope.events.modifiable.id = null; $scope.events.modifiable.slot_id = null;
$scope.events.modifiable.is_reserved = false; $scope.events.modifiable.is_reserved = false;
$scope.events.modifiable.can_modify = false; $scope.events.modifiable.can_modify = false;
updateEvents($scope.events.modifiable);
return updateCalendar(); $scope.events.placable.title = save.title;
$scope.events.placable.backgroundColor = 'white';
$scope.events.placable.borderColor = save.borderColor;
$scope.events.placable.slot_id = save.slotId;
$scope.events.placable.is_reserved = true;
$scope.events.placable.can_modify = true;
$scope.events.placable.user = angular.copy(save.user);
updateEvents($scope.events.placable);
refetchCalendar();
}; };
/** /**
@ -575,7 +585,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
$scope.events.modifiable.title = $scope.currentUser.id === $scope.events.modifiable.user.id ? _t('app.logged.machines_reserve.i_ve_reserved') : _t('app.logged.machines_reserve.not_available'); $scope.events.modifiable.title = $scope.currentUser.id === $scope.events.modifiable.user.id ? _t('app.logged.machines_reserve.i_ve_reserved') : _t('app.logged.machines_reserve.not_available');
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
return updateCalendar(); updateEvents($scope.events.placable, $scope.events.modifiable);
}; };
/** /**
@ -648,7 +658,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
$scope.selectedPlan = null; $scope.selectedPlan = null;
} }
return refetchCalendar(); refetchCalendar();
}; };
/** /**
@ -662,11 +672,13 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
* Kind of constructor: these actions will be realized first when the controller is loaded * Kind of constructor: these actions will be realized first when the controller is loaded
*/ */
const initialize = function () { const initialize = function () {
Availability.machine({ machineId: $stateParams.id }, function (availabilities) {
$scope.eventSources.push({ $scope.eventSources.push({
events: availabilities, events: function (start, end, timezone, callback) {
textColor: 'black' Availability.machine({ machineId: $stateParams.id }, function (availabilities) {
callback(availabilities);
}); });
},
textColor: 'black'
}); });
if ($scope.currentUser.role !== 'admin') { if ($scope.currentUser.role !== 'admin') {
@ -680,7 +692,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
* the user's subscription (current or about to be took) and the time (the user cannot modify a booked reservation * the user's subscription (current or about to be took) and the time (the user cannot modify a booked reservation
* if it's too late). * if it's too late).
*/ */
var calendarEventClickCb = function (event, jsEvent, view) { const calendarEventClickCb = function (event, jsEvent, view) {
$scope.selectedEvent = event; $scope.selectedEvent = event;
return $scope.selectionTime = new Date(); return $scope.selectionTime = new Date();
}; };
@ -690,7 +702,7 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
* Append the event tag into the block, just after the event title. * Append the event tag into the block, just after the event title.
* @see http://fullcalendar.io/docs/event_rendering/eventRender/ * @see http://fullcalendar.io/docs/event_rendering/eventRender/
*/ */
var eventRenderCb = function (event, element) { const eventRenderCb = function (event, element) {
if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) { if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (let tag of Array.from(event.tags)) {
@ -708,28 +720,30 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$stat
* @param reservation {Object} * @param reservation {Object}
* @param user {Object} user associated with the slot * @param user {Object} user associated with the slot
*/ */
var updateMachineSlot = function (slot, reservation, user) { const updateMachineSlot = function (slot, reservation, user) {
angular.forEach(reservation.slots, function (s) { angular.forEach(reservation.slots, function (s) {
if (slot.start.isSame(s.start_at)) { if (slot.start.isSame(s.start_at)) {
slot.id = s.id; slot.slot_id = s.id;
return slot.user = user; slot.user = user;
} }
}); });
updateEvents(slot);
}; };
/** /**
* Update the calendar's display to render the new attributes of the events * Update the calendar's display to render the new attributes of the events
* @param events Object[] events to update in full-calendar
*/ */
var updateCalendar = function () { uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents'); }; const updateEvents = function (...events) {
const realEvents = events.filter(e => !_.isNil(e));
uiCalendarConfig.calendars.calendar.fullCalendar('updateEvents', realEvents);
};
/** /**
* Asynchronously fetch the events from the API and refresh the calendar's view with these new events * Asynchronously fetch the events from the API and refresh the calendar's view with these new events
*/ */
var refetchCalendar = function () { const refetchCalendar = function () {
$timeout(function () {
uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents'); uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents');
return uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents');
});
}; };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller

View File

@ -235,7 +235,7 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop
*/ */
const payByStripe = function () { const payByStripe = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "stripe/payment_modal.html" %>', templateUrl: '../../../templates/stripe/payment_modal.html',
size: 'md', size: 'md',
resolve: { resolve: {
selectedPlan () { return $scope.selectedPlan; }, selectedPlan () { return $scope.selectedPlan; },
@ -299,7 +299,7 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop
*/ */
const payOnSite = function () { const payOnSite = function () {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "plans/payment_modal.html" %>', templateUrl: '../../../templates/plans/payment_modal.html',
size: 'sm', size: 'sm',
resolve: { resolve: {
selectedPlan () { return $scope.selectedPlan; }, selectedPlan () { return $scope.selectedPlan; },

View File

@ -167,7 +167,7 @@ Application.Controllers.controller('CompleteProfileController', ['$scope', '$roo
event.stopPropagation(); event.stopPropagation();
dialogs.confirm( dialogs.confirm(
{ {
templateUrl: '<%= asset_path "profile/resend_code_modal.html" %>', templateUrl: '../../../templates/profile/resend_code_modal.html',
resolve: { resolve: {
object () { object () {
return { email: memberPromise.email }; return { email: memberPromise.email };

View File

@ -588,7 +588,7 @@ Application.Controllers.controller('ShowProjectController', ['$scope', '$state',
if (e) { e.preventDefault(); } if (e) { e.preventDefault(); }
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "shared/signalAbuseModal.html" %>', templateUrl: '../../../templates/shared/signalAbuseModal.html',
size: 'md', size: 'md',
resolve: { resolve: {
project () { return $scope.project; } project () { return $scope.project; }

View File

@ -307,8 +307,8 @@ Application.Controllers.controller('ShowSpaceController', ['$scope', '$state', '
* per slots. * per slots.
*/ */
Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateParams', 'Auth', '$timeout', 'Availability', 'Member', 'availabilitySpacesPromise', 'plansPromise', 'groupsPromise', 'settingsPromise', 'spacePromise', '_t', 'uiCalendarConfig', 'CalendarConfig', Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateParams', 'Auth', '$timeout', 'Availability', 'Member', 'plansPromise', 'groupsPromise', 'settingsPromise', 'spacePromise', '_t', 'uiCalendarConfig', 'CalendarConfig',
function ($scope, $stateParams, Auth, $timeout, Availability, Member, availabilitySpacesPromise, plansPromise, groupsPromise, settingsPromise, spacePromise, _t, uiCalendarConfig, CalendarConfig) { function ($scope, $stateParams, Auth, $timeout, Availability, Member, plansPromise, groupsPromise, settingsPromise, spacePromise, _t, uiCalendarConfig, CalendarConfig) {
/* PRIVATE STATIC CONSTANTS */ /* PRIVATE STATIC CONSTANTS */
// Color of the selected event backgound // Color of the selected event backgound
@ -323,7 +323,7 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
/* PUBLIC SCOPE */ /* PUBLIC SCOPE */
// bind the spaces availabilities with full-Calendar events // bind the spaces availabilities with full-Calendar events
$scope.eventSources = [ { events: availabilitySpacesPromise, textColor: 'black' } ]; $scope.eventSources = [];
// the user to deal with, ie. the current user for non-admins // the user to deal with, ie. the current user for non-admins
$scope.ctrl = $scope.ctrl =
@ -394,7 +394,7 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
*/ */
$scope.markSlotAsAdded = function () { $scope.markSlotAsAdded = function () {
$scope.selectedEvent.backgroundColor = SELECTED_EVENT_BG_COLOR; $scope.selectedEvent.backgroundColor = SELECTED_EVENT_BG_COLOR;
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
@ -404,13 +404,13 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
slot.backgroundColor = 'white'; slot.backgroundColor = 'white';
slot.title = ''; slot.title = '';
slot.borderColor = FREE_SLOT_BORDER_COLOR; slot.borderColor = FREE_SLOT_BORDER_COLOR;
slot.id = null; slot.slot_id = null;
slot.isValid = false; slot.isValid = false;
slot.is_reserved = false; slot.is_reserved = false;
slot.can_modify = false; slot.can_modify = false;
slot.offered = false; slot.offered = false;
if (slot.is_completed) { slot.is_completed = false; } if (slot.is_completed) { slot.is_completed = false; }
return updateCalendar(); updateEvents(slot);
}; };
/** /**
@ -424,50 +424,59 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
$scope.markSlotAsModifying = function () { $scope.markSlotAsModifying = function () {
$scope.selectedEvent.backgroundColor = '#eee'; $scope.selectedEvent.backgroundColor = '#eee';
$scope.selectedEvent.title = _t('app.logged.space_reserve.i_change'); $scope.selectedEvent.title = _t('app.logged.space_reserve.i_change');
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
* Change the last selected slot's appearence to looks like 'the slot being exchanged will take this place' * Change the last selected slot's appearence to looks like 'the slot being exchanged will take this place'
*/ */
$scope.changeModifyTrainingSlot = function () { $scope.changeModifySpaceSlot = function () {
if ($scope.events.placable) { if ($scope.events.placable) {
$scope.events.placable.backgroundColor = 'white'; $scope.events.placable.backgroundColor = 'white';
$scope.events.placable.title = ''; $scope.events.placable.title = '';
updateEvents($scope.events.placable);
} }
if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) { if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) {
$scope.selectedEvent.backgroundColor = '#bbb'; $scope.selectedEvent.backgroundColor = '#bbb';
$scope.selectedEvent.title = _t('app.logged.space_reserve.i_shift'); $scope.selectedEvent.title = _t('app.logged.space_reserve.i_shift');
updateEvents($scope.selectedEvent);
} }
return updateCalendar();
}; };
/** /**
* When modifying an already booked reservation, callback when the modification was successfully done. * When modifying an already booked reservation, callback when the modification was successfully done.
*/ */
$scope.modifyTrainingSlot = function () { $scope.modifySpaceSlot = function () {
$scope.events.placable.title = _t('app.logged.space_reserve.i_ve_reserved'); const save = {
$scope.events.placable.backgroundColor = 'white'; slotId: $scope.events.modifiable.slot_id,
$scope.events.placable.borderColor = $scope.events.modifiable.borderColor; borderColor: $scope.events.modifiable.borderColor,
$scope.events.placable.id = $scope.events.modifiable.id; title: _t('app.logged.space_reserve.i_ve_reserved')
$scope.events.placable.is_reserved = true; };
$scope.events.placable.can_modify = true;
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
$scope.events.modifiable.title = ''; $scope.events.modifiable.title = '';
$scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR; $scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR;
$scope.events.modifiable.id = null; $scope.events.modifiable.slot_id = null;
$scope.events.modifiable.is_reserved = false; $scope.events.modifiable.is_reserved = false;
$scope.events.modifiable.can_modify = false; $scope.events.modifiable.can_modify = false;
if ($scope.events.modifiable.is_completed) { $scope.events.modifiable.is_completed = false; } if ($scope.events.modifiable.is_completed) { $scope.events.modifiable.is_completed = false; }
updateEvents($scope.events.modifiable);
return updateCalendar(); $scope.events.placable.title = save.title;
$scope.events.placable.backgroundColor = 'white';
$scope.events.placable.borderColor = save.borderColor;
$scope.events.placable.slot_id = save.slotId;
$scope.events.placable.is_reserved = true;
$scope.events.placable.can_modify = true;
updateEvents($scope.events.placable);
refetchCalendar();
}; };
/** /**
* Cancel the current booking modification, reseting the whole process * Cancel the current booking modification, reseting the whole process
*/ */
$scope.cancelModifyTrainingSlot = function () { $scope.cancelModifySpaceSlot = function () {
if ($scope.events.placable) { if ($scope.events.placable) {
$scope.events.placable.backgroundColor = 'white'; $scope.events.placable.backgroundColor = 'white';
$scope.events.placable.title = ''; $scope.events.placable.title = '';
@ -475,7 +484,7 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
$scope.events.modifiable.title = _t('app.logged.space_reserve.i_ve_reserved'); $scope.events.modifiable.title = _t('app.logged.space_reserve.i_ve_reserved');
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
return updateCalendar(); updateEvents($scope.events.placable, $scope.events.modifiable);
}; };
/** /**
@ -544,7 +553,8 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
spaceSlot.title = _t('app.logged.space_reserve.i_ve_reserved'); spaceSlot.title = _t('app.logged.space_reserve.i_ve_reserved');
spaceSlot.backgroundColor = 'white'; spaceSlot.backgroundColor = 'white';
spaceSlot.borderColor = RESERVED_SLOT_BORDER_COLOR; spaceSlot.borderColor = RESERVED_SLOT_BORDER_COLOR;
return updateSpaceSlotId(spaceSlot, reservation); updateSpaceSlotId(spaceSlot, reservation);
updateEvents(spaceSlot);
}); });
if ($scope.selectedPlan) { if ($scope.selectedPlan) {
@ -558,7 +568,7 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
Auth._currentUser.training_credits = angular.copy(reservation.user.training_credits); Auth._currentUser.training_credits = angular.copy(reservation.user.training_credits);
Auth._currentUser.machine_credits = angular.copy(reservation.user.machine_credits); Auth._currentUser.machine_credits = angular.copy(reservation.user.machine_credits);
return refetchCalendar(); refetchCalendar();
}; };
/** /**
@ -573,8 +583,18 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
*/ */
const initialize = function () { const initialize = function () {
if ($scope.currentUser.role !== 'admin') { if ($scope.currentUser.role !== 'admin') {
return Member.get({ id: $scope.currentUser.id }, function (member) { $scope.ctrl.member = member; }); Member.get({ id: $scope.currentUser.id }, function (member) { $scope.ctrl.member = member; });
} }
// we load the availabilities from a callback function of the $scope.eventSources, instead of resolving a promise
// in the router because this allows to refetchEvents from fullCalendar API.
$scope.eventSources.push({
events: function (start, end, timezone, callback) {
Availability.spaces({ spaceId: $stateParams.id }, function (availabilities) {
callback(availabilities);
});
},
textColor: 'black'
});
}; };
/** /**
@ -584,12 +604,9 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
* if it's too late). * if it's too late).
* @see http://fullcalendar.io/docs/mouse/eventClick/ * @see http://fullcalendar.io/docs/mouse/eventClick/
*/ */
var calendarEventClickCb = function (event, jsEvent, view) { const calendarEventClickCb = function (event, jsEvent, view) {
$scope.selectedEvent = event; $scope.selectedEvent = event;
if ($stateParams.id === 'all') { $scope.selectionTime = new Date();
$scope.training = event.training;
}
return $scope.selectionTime = new Date();
}; };
/** /**
@ -597,7 +614,7 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
* Append the event tag into the block, just after the event title. * Append the event tag into the block, just after the event title.
* @see http://fullcalendar.io/docs/event_rendering/eventRender/ * @see http://fullcalendar.io/docs/event_rendering/eventRender/
*/ */
var eventRenderCb = function (event, element, view) { const eventRenderCb = function (event, element, view) {
if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) { if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (let tag of Array.from(event.tags)) {
@ -613,27 +630,29 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$stateP
* @param slot {Object} * @param slot {Object}
* @param reservation {Object} * @param reservation {Object}
*/ */
var updateSpaceSlotId = function (slot, reservation) { const updateSpaceSlotId = function (slot, reservation) {
angular.forEach(reservation.slots, function (s) { angular.forEach(reservation.slots, function (s) {
if (slot.start_at === slot.start_at) { if (slot.start.isSame(s.start_at)) {
return slot.id = s.id; slot.slot_id = s.id;
} }
}); });
}; };
/** /**
* Update the calendar's display to render the new attributes of the events * Update the calendar's display to render the new attributes of the events
* @param events Object[] events to update in full-calendar
*/ */
var updateCalendar = function () { uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents'); }; const updateEvents = function (...events) {
const realEvents = events.filter(e => !_.isNil(e));
uiCalendarConfig.calendars.calendar.fullCalendar('updateEvents', realEvents);
};
/** /**
* Asynchronously fetch the events from the API and refresh the calendar's view with these new events * Asynchronously fetch the events from the API and refresh the calendar's view with these new events
*/ */
var refetchCalendar = function () { const refetchCalendar = function () {
$timeout(function () {
uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents'); uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents');
return uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents');
});
}; };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller

View File

@ -91,8 +91,8 @@ Application.Controllers.controller('ShowTrainingController', ['$scope', '$state'
* training can be reserved during the reservation process (the shopping cart may contains only one training and a subscription). * training can be reserved during the reservation process (the shopping cart may contains only one training and a subscription).
*/ */
Application.Controllers.controller('ReserveTrainingController', ['$scope', '$stateParams', 'Auth', '$timeout', 'Availability', 'Member', 'availabilityTrainingsPromise', 'plansPromise', 'groupsPromise', 'settingsPromise', 'trainingPromise', '_t', 'uiCalendarConfig', 'CalendarConfig', Application.Controllers.controller('ReserveTrainingController', ['$scope', '$stateParams', 'Auth', 'AuthService', '$timeout', 'Availability', 'Member', 'plansPromise', 'groupsPromise', 'settingsPromise', 'trainingPromise', '_t', 'uiCalendarConfig', 'CalendarConfig',
function ($scope, $stateParams, Auth, $timeout, Availability, Member, availabilityTrainingsPromise, plansPromise, groupsPromise, settingsPromise, trainingPromise, _t, uiCalendarConfig, CalendarConfig) { function ($scope, $stateParams, Auth, AuthService, $timeout, Availability, Member, plansPromise, groupsPromise, settingsPromise, trainingPromise, _t, uiCalendarConfig, CalendarConfig) {
/* PRIVATE STATIC CONSTANTS */ /* PRIVATE STATIC CONSTANTS */
// Color of the selected event backgound // Color of the selected event backgound
@ -104,7 +104,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
/* PUBLIC SCOPE */ /* PUBLIC SCOPE */
// bind the trainings availabilities with full-Calendar events // bind the trainings availabilities with full-Calendar events
$scope.eventSources = [ { events: availabilityTrainingsPromise, textColor: 'black' } ]; $scope.eventSources = [];
// the user to deal with, ie. the current user for non-admins // the user to deal with, ie. the current user for non-admins
$scope.ctrl = $scope.ctrl =
@ -177,15 +177,15 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
$scope.trainingInformationMessage = settingsPromise.training_information_message; $scope.trainingInformationMessage = settingsPromise.training_information_message;
/** /**
* Change the last selected slot's appearence to looks like 'added to cart' * Change the last selected slot's appearance to looks like 'added to cart'
*/ */
$scope.markSlotAsAdded = function () { $scope.markSlotAsAdded = function () {
$scope.selectedEvent.backgroundColor = SELECTED_EVENT_BG_COLOR; $scope.selectedEvent.backgroundColor = SELECTED_EVENT_BG_COLOR;
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
* Change the last selected slot's appearence to looks like 'never added to cart' * Change the last selected slot's appearance to looks like 'never added to cart'
*/ */
$scope.markSlotAsRemoved = function (slot) { $scope.markSlotAsRemoved = function (slot) {
slot.backgroundColor = 'white'; slot.backgroundColor = 'white';
@ -197,7 +197,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
slot.can_modify = false; slot.can_modify = false;
slot.offered = false; slot.offered = false;
if (slot.is_completed) { slot.is_completed = false; } if (slot.is_completed) { slot.is_completed = false; }
return updateCalendar(); updateEvents(slot);
}; };
/** /**
@ -211,44 +211,56 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
$scope.markSlotAsModifying = function () { $scope.markSlotAsModifying = function () {
$scope.selectedEvent.backgroundColor = '#eee'; $scope.selectedEvent.backgroundColor = '#eee';
$scope.selectedEvent.title = $scope.selectedEvent.training.name + ' - ' + _t('app.logged.trainings_reserve.i_change'); $scope.selectedEvent.title = $scope.selectedEvent.training.name + ' - ' + _t('app.logged.trainings_reserve.i_change');
return updateCalendar(); updateEvents($scope.selectedEvent);
}; };
/** /**
* Change the last selected slot's appearence to looks like 'the slot being exchanged will take this place' * Change the last selected slot's appearence to looks like 'the slot being exchanged will take this place'
*/ */
$scope.changeModifyTrainingSlot = function () { $scope.changeModifyTrainingSlot = function () {
if ($scope.selectedEvent.training.id !== $scope.events.modifiable.training.id) return false;
if ($scope.events.placable) { if ($scope.events.placable) {
$scope.events.placable.backgroundColor = 'white'; $scope.events.placable.backgroundColor = 'white';
$scope.events.placable.title = $scope.events.placable.training.name; $scope.events.placable.title = $scope.events.placable.training.name;
updateEvents($scope.events.placable);
} }
if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) { if (!$scope.events.placable || ($scope.events.placable._id !== $scope.selectedEvent._id)) {
$scope.selectedEvent.backgroundColor = '#bbb'; $scope.selectedEvent.backgroundColor = '#bbb';
$scope.selectedEvent.title = $scope.selectedEvent.training.name + ' - ' + _t('app.logged.trainings_reserve.i_shift'); $scope.selectedEvent.title = $scope.selectedEvent.training.name + ' - ' + _t('app.logged.trainings_reserve.i_shift');
updateEvents($scope.selectedEvent);
} }
return updateCalendar(); return true;
}; };
/** /**
* When modifying an already booked reservation, callback when the modification was successfully done. * When modifying an already booked reservation, callback when the modification was successfully done.
*/ */
$scope.modifyTrainingSlot = function () { $scope.modifyTrainingSlot = function () {
$scope.events.placable.title = $scope.currentUser.role !== 'admin' ? $scope.events.placable.training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved') : $scope.events.placable.training.name; const save = {
$scope.events.placable.backgroundColor = 'white'; slotId: $scope.events.modifiable.slot_id,
$scope.events.placable.borderColor = $scope.events.modifiable.borderColor; borderColor: $scope.events.modifiable.borderColor,
$scope.events.placable.id = $scope.events.modifiable.id; title: !AuthService.isAuthorized(['admin', 'manager']) ? $scope.events.placable.training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved') : $scope.events.placable.training.name,
$scope.events.placable.is_reserved = true; };
$scope.events.placable.can_modify = true;
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
$scope.events.modifiable.title = $scope.events.modifiable.training.name; $scope.events.modifiable.title = $scope.events.modifiable.training.name;
$scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR; $scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR;
$scope.events.modifiable.id = null; $scope.events.modifiable.slot_id = null;
$scope.events.modifiable.is_reserved = false; $scope.events.modifiable.is_reserved = false;
$scope.events.modifiable.can_modify = false; $scope.events.modifiable.can_modify = false;
if ($scope.events.modifiable.is_completed) { $scope.events.modifiable.is_completed = false; } if ($scope.events.modifiable.is_completed) { $scope.events.modifiable.is_completed = false; }
updateEvents($scope.events.modifiable);
return updateCalendar(); $scope.events.placable.title = save.title;
$scope.events.placable.backgroundColor = 'white';
$scope.events.placable.borderColor = save.borderColor;
$scope.events.placable.slot_id = save.slotId;
$scope.events.placable.is_reserved = true;
$scope.events.placable.can_modify = true;
updateEvents($scope.events.placable);
refetchCalendar();
}; };
/** /**
@ -262,7 +274,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
$scope.events.modifiable.title = $scope.currentUser.role !== 'admin' ? $scope.events.modifiable.training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved') : $scope.events.modifiable.training.name; $scope.events.modifiable.title = $scope.currentUser.role !== 'admin' ? $scope.events.modifiable.training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved') : $scope.events.modifiable.training.name;
$scope.events.modifiable.backgroundColor = 'white'; $scope.events.modifiable.backgroundColor = 'white';
return updateCalendar(); updateEvents($scope.events.placable, $scope.events.modifiable);
}; };
/** /**
@ -326,12 +338,15 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
* @param reservation {Object} * @param reservation {Object}
*/ */
$scope.afterPayment = function (reservation) { $scope.afterPayment = function (reservation) {
$scope.events.paid[0].backgroundColor = 'white'; angular.forEach($scope.events.paid, function (trainingSlot, key) {
$scope.events.paid[0].is_reserved = true; trainingSlot.backgroundColor = 'white';
$scope.events.paid[0].can_modify = true; trainingSlot.is_reserved = true;
updateTrainingSlotId($scope.events.paid[0], reservation); trainingSlot.can_modify = true;
$scope.events.paid[0].borderColor = '#b2e774'; updateTrainingSlotId(trainingSlot, reservation);
$scope.events.paid[0].title = $scope.events.paid[0].training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved'); trainingSlot.borderColor = '#b2e774';
trainingSlot.title = trainingSlot.training.name + ' - ' + _t('app.logged.trainings_reserve.i_ve_reserved');
updateEvents(trainingSlot);
});
if ($scope.selectedPlan) { if ($scope.selectedPlan) {
$scope.ctrl.member.subscribed_plan = angular.copy($scope.selectedPlan); $scope.ctrl.member.subscribed_plan = angular.copy($scope.selectedPlan);
@ -344,7 +359,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
Auth._currentUser.training_credits = angular.copy(reservation.user.training_credits); Auth._currentUser.training_credits = angular.copy(reservation.user.training_credits);
Auth._currentUser.machine_credits = angular.copy(reservation.user.machine_credits); Auth._currentUser.machine_credits = angular.copy(reservation.user.machine_credits);
return refetchCalendar(); refetchCalendar();
}; };
/** /**
@ -361,6 +376,16 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
if ($scope.currentUser.role !== 'admin') { if ($scope.currentUser.role !== 'admin') {
return Member.get({ id: $scope.currentUser.id }, function (member) { $scope.ctrl.member = member; }); return Member.get({ id: $scope.currentUser.id }, function (member) { $scope.ctrl.member = member; });
} }
// we load the availabilities from a callback function of the $scope.eventSources, instead of resolving a promise
// in the router because this allows to refetchEvents from fullCalendar API.
$scope.eventSources.push({
events: function (start, end, timezone, callback) {
Availability.trainings({ trainingId: $stateParams.id }, function (availabilities) {
callback(availabilities);
});
},
textColor: 'black'
});
}; };
/** /**
@ -370,7 +395,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
* if it's too late). * if it's too late).
* @see http://fullcalendar.io/docs/mouse/eventClick/ * @see http://fullcalendar.io/docs/mouse/eventClick/
*/ */
var calendarEventClickCb = function (event, jsEvent, view) { const calendarEventClickCb = function (event, jsEvent, view) {
$scope.selectedEvent = event; $scope.selectedEvent = event;
if ($stateParams.id === 'all') { if ($stateParams.id === 'all') {
$scope.training = event.training; $scope.training = event.training;
@ -383,7 +408,7 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
* Append the event tag into the block, just after the event title. * Append the event tag into the block, just after the event title.
* @see http://fullcalendar.io/docs/event_rendering/eventRender/ * @see http://fullcalendar.io/docs/event_rendering/eventRender/
*/ */
var eventRenderCb = function (event, element, view) { const eventRenderCb = function (event, element, view) {
if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) { if (($scope.currentUser.role === 'admin') && (event.tags.length > 0)) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (let tag of Array.from(event.tags)) {
@ -399,27 +424,29 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$sta
* @param slot {Object} * @param slot {Object}
* @param reservation {Object} * @param reservation {Object}
*/ */
var updateTrainingSlotId = function (slot, reservation) { const updateTrainingSlotId = function (slot, reservation) {
angular.forEach(reservation.slots, function (s) { angular.forEach(reservation.slots, function (s) {
if (slot.start_at === slot.start_at) { if (slot.start.isSame(s.start_at)) {
return slot.id = s.id; return slot.slot_id = s.id;
} }
}); });
}; };
/** /**
* Update the calendar's display to render the new attributes of the events * Update the calendar's display to render the new attributes of the events
* @param events Object[] events to update in full-calendar
*/ */
var updateCalendar = function () { uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents'); }; const updateEvents = function (...events) {
const realEvents = events.filter(e => !_.isNil(e));
uiCalendarConfig.calendars.calendar.fullCalendar('updateEvents', realEvents);
};
/** /**
* Asynchronously fetch the events from the API and refresh the calendar's view with these new events * Asynchronously fetch the events from the API and refresh the calendar's view with these new events
*/ */
var refetchCalendar = function () { const refetchCalendar = function () {
$timeout(function () {
uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents'); uiCalendarConfig.calendars.calendar.fullCalendar('refetchEvents');
return uiCalendarConfig.calendars.calendar.fullCalendar('rerenderEvents');
});
}; };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller

View File

@ -10,7 +10,7 @@
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', 'growl', 'Auth', 'Price', 'Wallet', 'CustomAsset', 'Slot', 'AuthService', 'helpers', '_t', Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', 'growl', 'Auth', 'Price', 'Wallet', 'CustomAsset', 'Slot', 'AuthService', 'helpers', '_t',
function ($rootScope, $uibModal, dialogs, growl, Auth, Price, Wallet, CustomAsset, Slot, AuthService, helpers, _t) { function ($rootScope, $uibModal, dialogs, growl, Auth, Price, Wallet, CustomAsset, Slot, AuthService, helpers, _t) {
return ({ return ({
restrict: 'E', restrict: 'E',
@ -39,7 +39,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
reservableName: '@', reservableName: '@',
limitToOneSlot: '@' limitToOneSlot: '@'
}, },
templateUrl: '<%= asset_path "shared/_cart.html" %>', templateUrl: '../../../templates/shared/_cart.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// will store the user's plan if he choosed to buy one // will store the user's plan if he choosed to buy one
$scope.selectedPlan = null; $scope.selectedPlan = null;
@ -78,8 +78,8 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
validateSameTimeReservations(slot, function () { validateSameTimeReservations(slot, function () {
slot.isValid = true; slot.isValid = true;
updateCartPrice(); updateCartPrice();
}) });
}) });
}; };
/** /**
@ -121,15 +121,15 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
// first, we ensure that a user was selected (admin/manager) or logged (member) // first, we ensure that a user was selected (admin/manager) or logged (member)
const isSelectedUser = Object.keys($scope.user).length > 0; const isSelectedUser = Object.keys($scope.user).length > 0;
// all slots are in future // all slots are in future
const areFutureSlots = _.every($scope.events.reserved, function(s) { const areFutureSlots = _.every($scope.events.reserved, function (s) {
return s.start.isAfter(); return s.start.isAfter();
}); });
if (isSelectedUser && areFutureSlots) { if (isSelectedUser && areFutureSlots) {
return $scope.modePlans = true; return $scope.modePlans = true;
} else if (!isSelectedUser){ } else if (!isSelectedUser) {
// otherwise we alert, this error musn't occur when the current user hasn't the admin role // otherwise we alert, this error musn't occur when the current user hasn't the admin role
return growl.error(_t('app.shared.cart.please_select_a_member_first')); return growl.error(_t('app.shared.cart.please_select_a_member_first'));
} else if (!areFutureSlots){ } else if (!areFutureSlots) {
return growl.error(_t('app.shared.cart.unable_to_select_plan_if_slots_in_the_past')); return growl.error(_t('app.shared.cart.unable_to_select_plan_if_slots_in_the_past'));
} }
}; };
@ -140,7 +140,6 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.payCart = function () { $scope.payCart = function () {
// first, we check that a user was selected // first, we check that a user was selected
if (Object.keys($scope.user).length > 0) { if (Object.keys($scope.user).length > 0) {
// check selected user has a subscription, if any slot is restricted for subscriptions // check selected user has a subscription, if any slot is restricted for subscriptions
const slotValidations = []; const slotValidations = [];
let slotNotValid; let slotNotValid;
@ -148,16 +147,16 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.events.reserved.forEach(function (slot) { $scope.events.reserved.forEach(function (slot) {
if (slot.plan_ids.length > 0) { if (slot.plan_ids.length > 0) {
if ( if (
($scope.selectedPlan && _.include(slot.plan_ids, $scope.selectedPlan.id)) || ($scope.selectedPlan && _.includes(slot.plan_ids, $scope.selectedPlan.id)) ||
($scope.user.subscribed_plan && _.include(slot.plan_ids, $scope.user.subscribed_plan.id)) ($scope.user.subscribed_plan && _.includes(slot.plan_ids, $scope.user.subscribed_plan.id))
) { ) {
slotValidations.push(true); slotValidations.push(true);
} else { } else {
slotNotValid = slot; slotNotValid = slot;
if ($scope.selectedPlan && !_.include(slot.plan_ids, $scope.selectedPlan.id)) { if ($scope.selectedPlan && !_.includes(slot.plan_ids, $scope.selectedPlan.id)) {
slotNotValidError = 'selectedPlanError'; slotNotValidError = 'selectedPlanError';
} }
if ($scope.user.subscribed_plan && !_.include(slot.plan_ids, $scope.user.subscribed_plan.id)) { if ($scope.user.subscribed_plan && !_.includes(slot.plan_ids, $scope.user.subscribed_plan.id)) {
slotNotValidError = 'userPlanError'; slotNotValidError = 'userPlanError';
} }
if (!$scope.selectedPlan || !$scope.user.subscribed_plan) { if (!$scope.selectedPlan || !$scope.user.subscribed_plan) {
@ -174,15 +173,15 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} else { } else {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_reserve_slot_without_plan.html" %>', templateUrl: '../../../templates/shared/_reserve_slot_without_plan.html',
size: 'md', size: 'md',
controller: 'ReserveSlotWithoutPlanController', controller: 'ReserveSlotWithoutPlanController',
resolve: { resolve: {
slot: function() { return slotNotValid; }, slot: function () { return slotNotValid; },
slotNotValidError: function() { return slotNotValidError; }, slotNotValidError: function () { return slotNotValidError; }
} }
}); });
modalInstance.result.then(function(res) { modalInstance.result.then(function (res) {
return paySlots(); return paySlots();
}); });
} }
@ -199,7 +198,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
* When modifying an already booked reservation, confirm the modification. * When modifying an already booked reservation, confirm the modification.
*/ */
$scope.modifySlot = function () { $scope.modifySlot = function () {
Slot.update({ id: $scope.events.modifiable.id }, { Slot.update({ id: $scope.events.modifiable.slot_id }, {
slot: { slot: {
start_at: $scope.events.placable.start, start_at: $scope.events.placable.start,
end_at: $scope.events.placable.end, end_at: $scope.events.placable.end,
@ -216,23 +215,23 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
}; };
// -> reset the 'moving' status // -> reset the 'moving' status
$scope.events.placable = null; $scope.events.placable = null;
return $scope.events.modifiable = null; $scope.events.modifiable = null;
} }
, function (err) { // failure , function (err) { // failure
growl.error(_t('app.shared.cart.unable_to_change_the_reservation')); growl.error(_t('app.shared.cart.unable_to_change_the_reservation'));
return console.error(err); console.error(err);
}); });
}; };
/** /**
* Cancel the current booking modification, reseting the whole process * Cancel the current booking modification, reseting the whole process
* @param event {Object} see https://docs.angularjs.org/guide/expression#-event- * @param [event] {Object} see https://docs.angularjs.org/guide/expression#-event-
*/ */
$scope.cancelModifySlot = function (event) { $scope.cancelModifySlot = function (event) {
if (event) { event.preventDefault(); } if (event) { event.preventDefault(); }
if (typeof $scope.onSlotModifyCancel === 'function') { $scope.onSlotModifyCancel(); } if (typeof $scope.onSlotModifyCancel === 'function') { $scope.onSlotModifyCancel(); }
$scope.events.placable = null; $scope.events.placable = null;
return $scope.events.modifiable = null; $scope.events.modifiable = null;
}; };
/** /**
@ -242,7 +241,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.removeSlotToPlace = function (e) { $scope.removeSlotToPlace = function (e) {
e.preventDefault(); e.preventDefault();
if (typeof $scope.onSlotModifyUnselect === 'function') { $scope.onSlotModifyUnselect(); } if (typeof $scope.onSlotModifyUnselect === 'function') { $scope.onSlotModifyUnselect(); }
return $scope.events.placable = null; $scope.events.placable = null;
}; };
/** /**
@ -251,7 +250,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
*/ */
$scope.tagMissmatch = function () { $scope.tagMissmatch = function () {
if ($scope.events.placable.tag_ids.length === 0) { return false; } if ($scope.events.placable.tag_ids.length === 0) { return false; }
for (let tag of Array.from($scope.events.modifiable.tags)) { for (const tag of Array.from($scope.events.modifiable.tags)) {
if (!Array.from($scope.events.placable.tag_ids).includes(tag.id)) { if (!Array.from($scope.events.placable.tag_ids).includes(tag.id)) {
return true; return true;
} }
@ -271,7 +270,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} }
return false; return false;
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -318,20 +317,20 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
// ask confirmation // ask confirmation
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_reserve_slot_tags_mismatch.html" %>', templateUrl: '../../../templates/shared/_reserve_slot_tags_mismatch.html',
size: 'md', size: 'md',
controller: 'ReserveSlotTagsMismatchController', controller: 'ReserveSlotTagsMismatchController',
resolve: { resolve: {
slotTags: function() { return slot.tags; }, slotTags: function () { return slot.tags; },
userTags: function () { return $scope.user.tags; }, userTags: function () { return $scope.user.tags; },
userName: function () { return $scope.user.name; } userName: function () { return $scope.user.name; }
} }
}); });
modalInstance.result.then(function(res) { modalInstance.result.then(function (res) {
if (typeof callback === 'function') callback(res); if (typeof callback === 'function') callback(res);
}); });
} }
} };
/** /**
* Validates that no other reservations were made that conflict the current slot and alert the user about the conflict. * Validates that no other reservations were made that conflict the current slot and alert the user about the conflict.
@ -346,32 +345,32 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
'space_reservations', 'space_reservations',
'events_reservations' 'events_reservations'
].map(function (k) { ].map(function (k) {
return _.filter($scope.user[k], function(r) { return _.filter($scope.user[k], function (r) {
return slot.start.isSame(r.start_at) || return slot.start.isSame(r.start_at) ||
(slot.end.isAfter(r.start_at) && slot.end.isBefore(r.end_at)) || (slot.end.isAfter(r.start_at) && slot.end.isBefore(r.end_at)) ||
(slot.start.isAfter(r.start_at) && slot.start.isBefore(r.end_at)) || (slot.start.isAfter(r.start_at) && slot.start.isBefore(r.end_at)) ||
(slot.start.isBefore(r.start_at) && slot.end.isAfter(r.end_at)); (slot.start.isBefore(r.start_at) && slot.end.isAfter(r.end_at));
}) });
}); });
sameTimeReservations = _.union.apply(null, sameTimeReservations); sameTimeReservations = _.union.apply(null, sameTimeReservations);
if (sameTimeReservations.length > 0) { if (sameTimeReservations.length > 0) {
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
animation: true, animation: true,
templateUrl: '<%= asset_path "shared/_reserve_slot_same_time.html" %>', templateUrl: '../../../templates/shared/_reserve_slot_same_time.html',
size: 'md', size: 'md',
controller: 'ReserveSlotSameTimeController', controller: 'ReserveSlotSameTimeController',
resolve: { resolve: {
sameTimeReservations: function() { return sameTimeReservations; }, sameTimeReservations: function () { return sameTimeReservations; },
bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }] bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }]
} }
}); });
modalInstance.result.then(function(res) { modalInstance.result.then(function (res) {
if (typeof callback === 'function') callback(res); if (typeof callback === 'function') callback(res);
}); });
} else { } else {
if (typeof callback === 'function') callback(); if (typeof callback === 'function') callback();
} }
} };
/** /**
* Callback triggered when the selected slot changed * Callback triggered when the selected slot changed
@ -381,13 +380,13 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
// if this slot is restricted for subscribers... // if this slot is restricted for subscribers...
if ($scope.slot.plan_ids.length > 0) { if ($scope.slot.plan_ids.length > 0) {
// ... we select all the plans matching these restrictions... // ... we select all the plans matching these restrictions...
const _plans = _.filter($scope.plans, function (p) { return _.include($scope.slot.plan_ids, p.id) }); const _plans = _.filter($scope.plans, function (p) { return _.includes($scope.slot.plan_ids, p.id); });
// ... and we group these plans, by Group... // ... and we group these plans, by Group...
$scope.slot.plansGrouped = []; $scope.slot.plansGrouped = [];
$scope.slot.group_ids = []; $scope.slot.group_ids = [];
for (let group of Array.from($scope.groups)) { for (const group of Array.from($scope.groups)) {
const groupObj = { id: group.id, name: group.name, plans: [] }; const groupObj = { id: group.id, name: group.name, plans: [] };
for (let plan of Array.from(_plans)) { for (const plan of Array.from(_plans)) {
if (plan.group_id === group.id) { groupObj.plans.push(plan); } if (plan.group_id === group.id) { groupObj.plans.push(plan); }
} }
if (groupObj.plans.length > 0) { if (groupObj.plans.length > 0) {
@ -400,13 +399,13 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} }
} }
} }
$scope.slot.group_ids = $scope.slot.plansGrouped.map(function(g) { return g.id; }); $scope.slot.group_ids = $scope.slot.plansGrouped.map(function (g) { return g.id; });
} }
if (!$scope.slot.is_reserved && !$scope.events.modifiable && !$scope.slot.is_completed) { if (!$scope.slot.is_reserved && !$scope.events.modifiable && !$scope.slot.is_completed) {
// slot is not reserved and we are not currently modifying a slot // slot is not reserved and we are not currently modifying a slot
// -> can be added to cart or removed if already present // -> can be added to cart or removed if already present
const index = $scope.events.reserved.indexOf($scope.slot); const index = _.findIndex($scope.events.reserved, (e) => e._id === $scope.slot._id);
if (index === -1) { if (index === -1) {
if (($scope.limitToOneSlot === 'true') && $scope.events.reserved[0]) { if (($scope.limitToOneSlot === 'true') && $scope.events.reserved[0]) {
// if we limit the number of slots in the cart to 1, and there is already // if we limit the number of slots in the cart to 1, and there is already
@ -427,7 +426,11 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} else if (!$scope.slot.is_reserved && !$scope.slot.is_completed && $scope.events.modifiable) { } else if (!$scope.slot.is_reserved && !$scope.slot.is_completed && $scope.events.modifiable) {
// slot is not reserved but we are currently modifying a slot // slot is not reserved but we are currently modifying a slot
// -> we request the calender to change the rendering // -> we request the calender to change the rendering
if (typeof $scope.onSlotModifyUnselect === 'function') { $scope.onSlotModifyUnselect(); } if (typeof $scope.onSlotModifyUnselect === 'function') {
// if the callback return false, cancel the selection for the current modification
const res = $scope.onSlotModifyUnselect();
if (!res) return;
}
// -> then, we re-affect the destination slot // -> then, we re-affect the destination slot
if (!$scope.events.placable || ($scope.events.placable._id !== $scope.slot._id)) { if (!$scope.events.placable || ($scope.events.placable._id !== $scope.slot._id)) {
return $scope.events.placable = $scope.slot; return $scope.events.placable = $scope.slot;
@ -437,17 +440,17 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} else if ($scope.slot.is_reserved && $scope.events.modifiable && ($scope.slot.is_reserved._id === $scope.events.modifiable._id)) { } else if ($scope.slot.is_reserved && $scope.events.modifiable && ($scope.slot.is_reserved._id === $scope.events.modifiable._id)) {
// slot is reserved and currently modified // slot is reserved and currently modified
// -> we cancel the modification // -> we cancel the modification
return $scope.cancelModifySlot(); $scope.cancelModifySlot();
} else if ($scope.slot.is_reserved && (slotCanBeModified($scope.slot) || slotCanBeCanceled($scope.slot)) && !$scope.events.modifiable && ($scope.events.reserved.length === 0)) { } else if ($scope.slot.is_reserved && (slotCanBeModified($scope.slot) || slotCanBeCanceled($scope.slot)) && !$scope.events.modifiable && ($scope.events.reserved.length === 0)) {
// slot is reserved and is ok to be modified or cancelled // slot is reserved and is ok to be modified or cancelled
// but we are not currently running a modification or having any slots in the cart // but we are not currently running a modification or having any slots in the cart
// -> first the affect the modification/cancellation rights attributes to the current slot // -> first affect the modification/cancellation rights attributes to the current slot
resetCartState(); resetCartState();
$scope.slot.movable = slotCanBeModified($scope.slot); $scope.slot.movable = slotCanBeModified($scope.slot);
$scope.slot.cancelable = slotCanBeCanceled($scope.slot); $scope.slot.cancelable = slotCanBeCanceled($scope.slot);
// -> then, we open a dialog to ask to the user to choose an action // -> then, we open a dialog to ask to the user to choose an action
return dialogs.confirm({ return dialogs.confirm({
templateUrl: '<%= asset_path "shared/confirm_modify_slot_modal.html" %>', templateUrl: '../../../templates/shared/confirm_modify_slot_modal.html',
resolve: { resolve: {
object () { return $scope.slot; } object () { return $scope.slot; }
} }
@ -456,9 +459,9 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
// the user has chosen an action, so we proceed // the user has chosen an action, so we proceed
if (type === 'move') { if (type === 'move') {
if (typeof $scope.onSlotStartToModify === 'function') { $scope.onSlotStartToModify(); } if (typeof $scope.onSlotStartToModify === 'function') { $scope.onSlotStartToModify(); }
return $scope.events.modifiable = $scope.slot; $scope.events.modifiable = $scope.slot;
} else if (type === 'cancel') { } else if (type === 'cancel') {
return dialogs.confirm( dialogs.confirm(
{ {
resolve: { resolve: {
object () { object () {
@ -470,7 +473,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} }
}, },
function () { // cancel confirmed function () { // cancel confirmed
Slot.cancel({ id: $scope.slot.id }, function () { // successfully canceled Slot.cancel({ id: $scope.slot.slot_id }, function () { // successfully canceled
growl.success(_t('app.shared.cart.reservation_was_cancelled_successfully')); growl.success(_t('app.shared.cart.reservation_was_cancelled_successfully'));
if (typeof $scope.onSlotCancelSuccess === 'function') { return $scope.onSlotCancelSuccess(); } if (typeof $scope.onSlotCancelSuccess === 'function') { return $scope.onSlotCancelSuccess(); }
} }
@ -494,7 +497,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.events.moved = null; $scope.events.moved = null;
$scope.events.paid = []; $scope.events.paid = [];
$scope.events.modifiable = null; $scope.events.modifiable = null;
return $scope.events.placable = null; $scope.events.placable = null;
}; };
/** /**
@ -612,7 +615,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
*/ */
const payByStripe = function (reservation) { const payByStripe = function (reservation) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "stripe/payment_modal.html" %>', templateUrl: '../../../templates/stripe/payment_modal.html',
size: 'md', size: 'md',
resolve: { resolve: {
reservation () { reservation () {
@ -666,14 +669,14 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
}; };
} }
] ]
}).result['finally'](null).then(function (reservation) { afterPayment(reservation); }); }).result.finally(null).then(function (reservation) { afterPayment(reservation); });
}; };
/** /**
* Open a modal window that allows the user to process a local payment for his current shopping cart (admin only). * Open a modal window that allows the user to process a local payment for his current shopping cart (admin only).
*/ */
const payOnSite = function (reservation) { const payOnSite = function (reservation) {
$uibModal.open({ $uibModal.open({
templateUrl: '<%= asset_path "shared/valid_reservation_modal.html" %>', templateUrl: '../../../templates/shared/valid_reservation_modal.html',
size: 'sm', size: 'sm',
resolve: { resolve: {
reservation () { reservation () {
@ -735,7 +738,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
} }
] ]
}).result['finally'](null).then(function (reservation) { afterPayment(reservation); }); }).result.finally(null).then(function (reservation) { afterPayment(reservation); });
}; };
/** /**
* Actions to run after the payment was successful * Actions to run after the payment was successful
@ -756,22 +759,22 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
/** /**
* Actions to pay slots * Actions to pay slots
*/ */
const paySlots = function() { const paySlots = function () {
const reservation = mkReservation($scope.user, $scope.events.reserved, $scope.selectedPlan); const reservation = mkReservation($scope.user, $scope.events.reserved, $scope.selectedPlan);
return Wallet.getWalletByUser({ user_id: $scope.user.id }, function (wallet) { return Wallet.getWalletByUser({ user_id: $scope.user.id }, function (wallet) {
const amountToPay = helpers.getAmountToPay($scope.amountTotal, wallet.amount); const amountToPay = helpers.getAmountToPay($scope.amountTotal, wallet.amount);
if ((AuthService.isAuthorized(['member']) && amountToPay > 0) if ((AuthService.isAuthorized(['member']) && amountToPay > 0) ||
|| (AuthService.isAuthorized('manager') && $scope.user.id === $rootScope.currentUser.id && amountToPay > 0)) { (AuthService.isAuthorized('manager') && $scope.user.id === $rootScope.currentUser.id && amountToPay > 0)) {
if ($scope.settings.online_payment_module !== 'true') { if ($scope.settings.online_payment_module !== 'true') {
growl.error(_t('app.shared.cart.online_payment_disabled')); growl.error(_t('app.shared.cart.online_payment_disabled'));
} else { } else {
return payByStripe(reservation); return payByStripe(reservation);
} }
} else { } else {
if (AuthService.isAuthorized(['admin']) if (AuthService.isAuthorized(['admin']) ||
|| (AuthService.isAuthorized('manager') && $scope.user.id !== $rootScope.currentUser.id) (AuthService.isAuthorized('manager') && $scope.user.id !== $rootScope.currentUser.id) ||
|| amountToPay === 0) { amountToPay === 0) {
return payOnSite(reservation); return payOnSite(reservation);
} }
} }
@ -798,17 +801,16 @@ Application.Controllers.controller('ReserveSlotSameTimeController', ['$scope', '
*/ */
$scope.ok = function () { $scope.ok = function () {
$uibModalInstance.close({}); $uibModalInstance.close({});
} };
/** /**
* Cancellation callback * Cancellation callback
*/ */
$scope.cancel = function () { $scope.cancel = function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} };
} }
]); ]);
/** /**
* Controller of the modal showing the slot tags * Controller of the modal showing the slot tags
*/ */
@ -823,13 +825,13 @@ Application.Controllers.controller('ReserveSlotTagsMismatchController', ['$scope
*/ */
$scope.ok = function () { $scope.ok = function () {
$uibModalInstance.close({}); $uibModalInstance.close({});
} };
/** /**
* Cancellation callback * Cancellation callback
*/ */
$scope.cancel = function () { $scope.cancel = function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} };
} }
]); ]);
@ -845,12 +847,12 @@ Application.Controllers.controller('ReserveSlotWithoutPlanController', ['$scope'
*/ */
$scope.ok = function () { $scope.ok = function () {
$uibModalInstance.close({}); $uibModalInstance.close({});
} };
/** /**
* Cancellation callback * Cancellation callback
*/ */
$scope.cancel = function () { $scope.cancel = function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} };
} }
]); ]);

View File

@ -18,7 +18,7 @@ Application.Directives.directive('coupon', [ '$rootScope', 'Coupon', '_t', funct
total: '=', total: '=',
userId: '@' userId: '@'
}, },
templateUrl: '<%= asset_path "shared/_coupon.html" %>', templateUrl: '../../../templates/shared/_coupon.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// Whether code input is shown or not (ie. the link 'I have a coupon' is shown) // Whether code input is shown or not (ie. the link 'I have a coupon' is shown)
$scope.code = $scope.code =

View File

@ -15,6 +15,6 @@ Application.Directives.directive('fabUserAvatar', [ function () {
userAvatar: '=ngModel', userAvatar: '=ngModel',
avatarClass: '@' avatarClass: '@'
}, },
templateUrl: '<%= asset_path "shared/_user_avatar.html" %>' templateUrl: '../../../templates/shared/_user_avatar.html'
}); });
}]); }]);

View File

@ -2,7 +2,7 @@ Application.Directives.directive('events', [ 'Event',
function (Event) { function (Event) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "home/events.html" %>', templateUrl: '../../../../templates/home/events.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The closest upcoming events // The closest upcoming events
$scope.upcomingEvents = null; $scope.upcomingEvents = null;

View File

@ -2,7 +2,7 @@ Application.Directives.directive('news', [ 'Setting',
function (Setting) { function (Setting) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "home/news.html" %>', templateUrl: '../../../../templates/home/news.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The admin blogpost // The admin blogpost
$scope.homeBlogpost = null; $scope.homeBlogpost = null;

View File

@ -2,7 +2,7 @@ Application.Directives.directive('projects', [ 'Project',
function (Project) { function (Project) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "home/projects.html" %>', templateUrl: '../../../../templates/home/projects.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The last projects published/documented on the platform // The last projects published/documented on the platform
$scope.lastProjects = null; $scope.lastProjects = null;

View File

@ -8,7 +8,7 @@ Application.Directives.directive('twitter', ['Setting',
function (Setting) { function (Setting) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "home/twitter.html" %>', templateUrl: '../../../../templates/home/twitter.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// Twitter username // Twitter username
$scope.twitterName = null; $scope.twitterName = null;

View File

@ -2,7 +2,7 @@ Application.Directives.directive('members', [ 'Member',
function (Member) { function (Member) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "home/members.html" %>', templateUrl: '../../../templates/home/members.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The last registered members who confirmed their addresses // The last registered members who confirmed their addresses
$scope.lastMembers = null; $scope.lastMembers = null;

View File

@ -11,7 +11,7 @@
Application.Directives.directive('selectMember', [ 'Diacritics', 'Member', function (Diacritics, Member) { Application.Directives.directive('selectMember', [ 'Diacritics', 'Member', function (Diacritics, Member) {
return ({ return ({
restrict: 'E', restrict: 'E',
templateUrl: '<%= asset_path "shared/_member_select.html" %>', templateUrl: '../../../templates/shared/_member_select.html',
link (scope, element, attributes) { link (scope, element, attributes) {
return scope.autoCompleteName = function (nameLookup) { return scope.autoCompleteName = function (nameLookup) {
if (!nameLookup) { if (!nameLookup) {

View File

@ -11,7 +11,7 @@ Application.Directives.directive('booleanSetting', ['Setting', 'growl', '_t',
classes: '@', classes: '@',
onBeforeSave: '=' onBeforeSave: '='
}, },
templateUrl: '<%= asset_path "admin/settings/boolean.html" %>', templateUrl: '../../../../templates/admin/settings/boolean.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The setting // The setting
$scope.setting = { $scope.setting = {
@ -20,8 +20,8 @@ Application.Directives.directive('booleanSetting', ['Setting', 'growl', '_t',
}; };
// default values for the switch labels // default values for the switch labels
$scope.yesLabel = $scope.yesLabel || 'app.admin.settings.enabled'; $scope.yesLabel = $scope.yesLabel || 'app.shared.buttons.yes';
$scope.noLabel = $scope.noLabel || 'app.admin.settings.disabled'; $scope.noLabel = $scope.noLabel || 'app.shared.buttons.no';
/** /**
* Callback to save the setting value to the database * Callback to save the setting value to the database

View File

@ -12,7 +12,7 @@ Application.Directives.directive('numberSetting', ['Setting', 'growl', '_t',
min: '@', min: '@',
required: '<' required: '<'
}, },
templateUrl: '<%= asset_path "admin/settings/number.html" %>', templateUrl: '../../../../templates/admin/settings/number.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The setting // The setting
$scope.setting = { $scope.setting = {

View File

@ -12,7 +12,7 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
descriptionNew: '@', descriptionNew: '@',
beforeAdd: '=' beforeAdd: '='
}, },
templateUrl: '<%= asset_path "admin/settings/select-multiple.html" %>', templateUrl: '../../../../templates/admin/settings/select-multiple.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The setting // The setting
$scope.setting = { $scope.setting = {
@ -29,22 +29,22 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
/** /**
* Remove the items in the selection from the options and update setting.value * Remove the items in the selection from the options and update setting.value
*/ */
$scope.removeItem = function() { $scope.removeItem = function () {
const options = $scope.options.filter(function (opt) { const options = $scope.options.filter(function (opt) {
return $scope.selection.indexOf(opt) < 0; return $scope.selection.indexOf(opt) < 0;
}) });
$scope.options = options; $scope.options = options;
$scope.setting.value = options.join(' '); $scope.setting.value = options.join(' ');
growl.success(_t('app.admin.settings.COUNT_items_removed', { COUNT: $scope.selection.length })); growl.success(_t('app.admin.settings.COUNT_items_removed', { COUNT: $scope.selection.length }));
$scope.selection = []; $scope.selection = [];
} };
/** /**
* Open a modal dialog asking for the value of a new item to add * Open a modal dialog asking for the value of a new item to add
*/ */
$scope.addItem = function() { $scope.addItem = function () {
$uibModal.open({ $uibModal.open({
templateUrl: 'newSelectOption.html', templateUrl: '../../../../templates/admin/settings/newSelectOption.html',
resolve: { resolve: {
titleNew: function () { return $scope.titleNew; }, titleNew: function () { return $scope.titleNew; },
descriptionNew: function () { return $scope.descriptionNew; } descriptionNew: function () { return $scope.descriptionNew; }
@ -60,7 +60,7 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
}; };
} }
}).result['finally'](null).then(function(val) { }).result.finally(null).then(function (val) {
const options = Array.from($scope.options); const options = Array.from($scope.options);
if (typeof $scope.beforeAdd === 'function') { val = $scope.beforeAdd(val); } if (typeof $scope.beforeAdd === 'function') { val = $scope.beforeAdd(val); }
options.push(val); options.push(val);
@ -68,14 +68,14 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
$scope.setting.value = options.join(' '); $scope.setting.value = options.join(' ');
growl.success(_t('app.admin.settings.item_added')); growl.success(_t('app.admin.settings.item_added'));
}); });
} };
/** /**
* Callback to save the setting value to the database * Callback to save the setting value to the database
* @param setting {{value:*, name:string}} note that the value will be stringified * @param setting {{value:*, name:string}} note that the value will be stringified
*/ */
$scope.save = function (setting) { $scope.save = function (setting) {
let { value } = setting; const { value } = setting;
Setting.update( Setting.update(
{ name: setting.name }, { name: setting.name },

View File

@ -14,7 +14,7 @@ Application.Directives.directive('selectSetting', ['Setting', 'growl', '_t',
option4: '<', option4: '<',
option5: '<' option5: '<'
}, },
templateUrl: '<%= asset_path "admin/settings/select.html" %>', templateUrl: '../../../../templates/admin/settings/select.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// The setting // The setting
$scope.setting = { $scope.setting = {

View File

@ -15,7 +15,7 @@ Application.Directives.directive('textSetting', ['Setting', 'growl', '_t',
minLength: '@', minLength: '@',
readOnly: '<' readOnly: '<'
}, },
templateUrl: '<%= asset_path "admin/settings/text.html" %>', templateUrl: '../../../../templates/admin/settings/text.html',
link ($scope, element, attributes) { link ($scope, element, attributes) {
// if type is not specified, use text as default // if type is not specified, use text as default
if (typeof $scope.type === 'undefined') { if (typeof $scope.type === 'undefined') {

View File

@ -16,13 +16,13 @@ Application.Directives.directive('socialLink', [ function () {
network: '@?', network: '@?',
user: '=' user: '='
}, },
templateUrl: '<%= asset_path "shared/_social_link.html" %>', templateUrl: '../../../templates/shared/_social_link.html',
link (scope, element, attributes) { link (scope, element, attributes) {
if (scope.network === 'dailymotion') { if (scope.network === 'dailymotion') {
scope.image = "<%= asset_path('social/dailymotion.png') %>"; scope.image = "social/dailymotion.png";
return scope.altText = 'd'; return scope.altText = 'd';
} else if (scope.network === 'echosciences') { } else if (scope.network === 'echosciences') {
scope.image = "<%= asset_path('social/echosciences.png') %>"; scope.image = "social/echosciences.png";
return scope.altText = 'E)'; return scope.altText = 'E)';
} else { } else {
if (scope.network === 'website') { if (scope.network === 'website') {

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
// TODO remove unused? // TODO remove unused?
(function (angular) { (function (angular) {
var deviseModal = angular.module('DeviseModal', [ const deviseModal = angular.module('DeviseModal', [
'Devise', 'Devise',
'ui.bootstrap' 'ui.bootstrap'
]); ]);
@ -12,25 +12,25 @@
'$rootScope', '$rootScope',
function ($uibModal, $http, Auth, $rootScope) { function ($uibModal, $http, Auth, $rootScope) {
var promise = null; var promise = null;
function reset() { function reset () {
promise = null; promise = null;
} }
function partial(fn, arg) { function partial (fn, arg) {
return function () { return function () {
return fn.call(this, arg); return fn.call(this, arg);
}; };
} }
$rootScope.$on('devise:unauthorized', function (event, response, deferred) { $rootScope.$on('devise:unauthorized', function (event, response, deferred) {
function retryRequestAfterLogin() { function retryRequestAfterLogin () {
return promise.then(function () { return promise.then(function () {
return $http(response.config); return $http(response.config);
}).then(deferred.resolve, partial(deferred.reject, response)); }).then(deferred.resolve, partial(deferred.reject, response));
} }
if (!promise) { if (!promise) {
promise = $uibModal.open({ promise = $uibModal.open({
templateUrl: 'deviseModal.html', templateUrl: '../../../templates/shared/deviseModal.html',
controller: function ($scope, $uibModalInstance) { controller: function ($scope, $uibModalInstance) {
var user = $scope.user = {}; const user = $scope.user = {};
$scope.login = function () { $scope.login = function () {
$uibModalInstance.close(user); $uibModalInstance.close(user);
}; };
@ -38,7 +38,7 @@
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
}; };
} }
}).result['finally'](reset).then(Auth.login); }).result.finally(reset).then(Auth.login);
} }
retryRequestAfterLogin(); retryRequestAfterLogin();
}); });

View File

@ -1,7 +1,7 @@
if (typeof Object.assign !== 'function') { if (typeof Object.assign !== 'function') {
// Must be writable: true, enumerable: false, configurable: true // Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", { Object.defineProperty(Object, 'assign', {
value: function assign(target, varArgs) { // .length of function is 2 value: function assign (target, varArgs) { // .length of function is 2
'use strict'; 'use strict';
if (target == null) { // TypeError if undefined or null if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object'); throw new TypeError('Cannot convert undefined or null to object');
@ -28,7 +28,7 @@ if (typeof Object.assign !== 'function') {
}); });
} }
Number.isInteger = Number.isInteger || function(value) { Number.isInteger = Number.isInteger || function (value) {
return typeof value === 'number' && return typeof value === 'number' &&
isFinite(value) && isFinite(value) &&
Math.floor(value) === value; Math.floor(value) === value;

View File

@ -0,0 +1,3 @@
<%
PluginRegistry.javascripts.each { |js| require_asset(js) }
%>

View File

@ -20,18 +20,18 @@ angular.module('application.router', ['ui.router'])
.state('app', { .state('app', {
abstract: true, abstract: true,
views: { views: {
'header': { header: {
templateUrl: '<%= asset_path "shared/header.html" %>' templateUrl: '../../templates/shared/header.html.erb'
}, },
'leftnav': { leftnav: {
templateUrl: '<%= asset_path "shared/leftnav.html" %>', templateUrl: '../../templates/shared/leftnav.html',
controller: 'MainNavController' controller: 'MainNavController'
}, },
'cookies': { cookies: {
templateUrl: '<%= asset_path "shared/cookies.html" %>', templateUrl: '../../templates/shared/cookies.html',
controller: 'CookiesController' controller: 'CookiesController'
}, },
'main': {} main: {}
}, },
resolve: { resolve: {
logoFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-file' }).$promise; }], logoFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-file' }).$promise; }],
@ -92,7 +92,7 @@ angular.module('application.router', ['ui.router'])
url: '/about', url: '/about',
views: { views: {
'content@': { 'content@': {
templateUrl: '<%= asset_path "shared/about.html" %>', templateUrl: '../../templates/shared/about.html',
controller: 'AboutController' controller: 'AboutController'
} }
} }
@ -101,7 +101,7 @@ angular.module('application.router', ['ui.router'])
url: '/?reset_password_token', url: '/?reset_password_token',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "home.html" %>', templateUrl: '../../templates/home.html',
controller: 'HomeController' controller: 'HomeController'
} }
}, },
@ -113,7 +113,7 @@ angular.module('application.router', ['ui.router'])
url: '/privacy-policy', url: '/privacy-policy',
views: { views: {
'content@': { 'content@': {
templateUrl: '<%= asset_path "shared/privacy.html" %>', templateUrl: '../../templates/shared/privacy.html',
controller: 'PrivacyController' controller: 'PrivacyController'
} }
} }
@ -124,7 +124,7 @@ angular.module('application.router', ['ui.router'])
url: '/profile_completion', url: '/profile_completion',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "profile/complete.html"%>', templateUrl: '../../templates/profile/complete.html',
controller: 'CompleteProfileController' controller: 'CompleteProfileController'
} }
}, },
@ -150,7 +150,7 @@ angular.module('application.router', ['ui.router'])
url: '/profile', url: '/profile',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/profile.html" %>', templateUrl: '../../templates/dashboard/profile.html',
controller: 'DashboardController' controller: 'DashboardController'
} }
} }
@ -159,7 +159,7 @@ angular.module('application.router', ['ui.router'])
url: '/settings', url: '/settings',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/settings.html" %>', templateUrl: '../../templates/dashboard/settings.html',
controller: 'EditProfileController' controller: 'EditProfileController'
} }
}, },
@ -173,7 +173,7 @@ angular.module('application.router', ['ui.router'])
url: '/projects', url: '/projects',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/projects.html" %>', templateUrl: '../../templates/dashboard/projects.html',
controller: 'DashboardController' controller: 'DashboardController'
} }
} }
@ -182,7 +182,7 @@ angular.module('application.router', ['ui.router'])
url: '/trainings', url: '/trainings',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/trainings.html" %>', templateUrl: '../../templates/dashboard/trainings.html',
controller: 'DashboardController' controller: 'DashboardController'
} }
} }
@ -191,7 +191,7 @@ angular.module('application.router', ['ui.router'])
url: '/events', url: '/events',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/events.html" %>', templateUrl: '../../templates/dashboard/events.html',
controller: 'DashboardController' controller: 'DashboardController'
} }
} }
@ -200,7 +200,7 @@ angular.module('application.router', ['ui.router'])
url: '/invoices', url: '/invoices',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/invoices.html" %>', templateUrl: '../../templates/dashboard/invoices.html',
controller: 'DashboardController' controller: 'DashboardController'
} }
} }
@ -210,7 +210,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.walletModule, abstract: !Fablab.walletModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "dashboard/wallet.html" %>', templateUrl: '../../templates/dashboard/wallet.html',
controller: 'WalletController' controller: 'WalletController'
} }
}, },
@ -225,7 +225,7 @@ angular.module('application.router', ['ui.router'])
url: '/members/:id', url: '/members/:id',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "members/show.html" %>', templateUrl: '../../templates/members/show.html',
controller: 'ShowProfileController' controller: 'ShowProfileController'
} }
}, },
@ -237,7 +237,7 @@ angular.module('application.router', ['ui.router'])
url: '/members', url: '/members',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "members/index.html" %>', templateUrl: '../../templates/members/index.html',
controller: 'MembersController' controller: 'MembersController'
} }
}, },
@ -251,7 +251,7 @@ angular.module('application.router', ['ui.router'])
url: '/projects?q&page&theme_id&component_id&machine_id&from&whole_network', url: '/projects?q&page&theme_id&component_id&machine_id&from&whole_network',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "projects/index.html.erb" %>', templateUrl: '../../templates/projects/index.html',
controller: 'ProjectsController' controller: 'ProjectsController'
} }
}, },
@ -260,14 +260,14 @@ angular.module('application.router', ['ui.router'])
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }], componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }], machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['openlab_app_id', 'openlab_default']" }).$promise; }], settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['openlab_app_id', 'openlab_default']" }).$promise; }],
openLabActive: ['Setting', function (Setting) { return Setting.isPresent({ name: 'openlab_app_secret' }).$promise; }], openLabActive: ['Setting', function (Setting) { return Setting.isPresent({ name: 'openlab_app_secret' }).$promise; }]
} }
}) })
.state('app.logged.projects_new', { .state('app.logged.projects_new', {
url: '/projects/new', url: '/projects/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "projects/new.html" %>', templateUrl: '../../templates/projects/new.html',
controller: 'NewProjectController' controller: 'NewProjectController'
} }
}, },
@ -279,7 +279,7 @@ angular.module('application.router', ['ui.router'])
url: '/projects/:id', url: '/projects/:id',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "projects/show.html" %>', templateUrl: '../../templates/projects/show.html',
controller: 'ShowProjectController' controller: 'ShowProjectController'
} }
}, },
@ -292,7 +292,7 @@ angular.module('application.router', ['ui.router'])
url: '/projects/:id/edit', url: '/projects/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "projects/edit.html" %>', templateUrl: '../../templates/projects/edit.html',
controller: 'EditProjectController' controller: 'EditProjectController'
} }
}, },
@ -307,7 +307,7 @@ angular.module('application.router', ['ui.router'])
url: '/machines', url: '/machines',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "machines/index.html.erb" %>', templateUrl: '../../templates/machines/index.html',
controller: 'MachinesController' controller: 'MachinesController'
} }
}, },
@ -320,7 +320,7 @@ angular.module('application.router', ['ui.router'])
url: '/machines/new', url: '/machines/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "machines/new.html" %>', templateUrl: '../../templates/machines/new.html',
controller: 'NewMachineController' controller: 'NewMachineController'
} }
} }
@ -329,7 +329,7 @@ angular.module('application.router', ['ui.router'])
url: '/machines/:id', url: '/machines/:id',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "machines/show.html" %>', templateUrl: '../../templates/machines/show.html',
controller: 'ShowMachineController' controller: 'ShowMachineController'
} }
}, },
@ -341,7 +341,7 @@ angular.module('application.router', ['ui.router'])
url: '/machines/:id/reserve', url: '/machines/:id/reserve',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "machines/reserve.html" %>', templateUrl: '../../templates/machines/reserve.html',
controller: 'ReserveMachineController' controller: 'ReserveMachineController'
} }
}, },
@ -351,9 +351,9 @@ angular.module('application.router', ['ui.router'])
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }], machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
settingsPromise: ['Setting', function (Setting) { settingsPromise: ['Setting', function (Setting) {
return Setting.query({ return Setting.query({
names: `['machine_explications_alert', 'booking_window_start', 'booking_window_end', 'booking_move_enable', \ names: "['machine_explications_alert', 'booking_window_start', 'booking_window_end', 'booking_move_enable', " +
'booking_move_delay', 'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', \ "'booking_move_delay', 'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', " +
'online_payment_module']` "'online_payment_module']"
}).$promise; }).$promise;
}] }]
} }
@ -362,7 +362,7 @@ angular.module('application.router', ['ui.router'])
url: '/machines/:id/edit', url: '/machines/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "machines/edit.html" %>', templateUrl: '../../templates/machines/edit.html',
controller: 'EditMachineController' controller: 'EditMachineController'
} }
}, },
@ -377,7 +377,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.spacesModule, abstract: !Fablab.spacesModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "spaces/index.html" %>', templateUrl: '../../templates/spaces/index.html',
controller: 'SpacesController' controller: 'SpacesController'
} }
}, },
@ -391,7 +391,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.spacesModule, abstract: !Fablab.spacesModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "spaces/new.html" %>', templateUrl: '../../templates/spaces/new.html',
controller: 'NewSpaceController' controller: 'NewSpaceController'
} }
} }
@ -401,7 +401,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.spacesModule, abstract: !Fablab.spacesModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "spaces/show.html" %>', templateUrl: '../../templates/spaces/show.html',
controller: 'ShowSpaceController' controller: 'ShowSpaceController'
} }
}, },
@ -414,7 +414,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.spacesModule, abstract: !Fablab.spacesModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "spaces/edit.html" %>', templateUrl: '../../templates/spaces/edit.html',
controller: 'EditSpaceController' controller: 'EditSpaceController'
} }
}, },
@ -427,20 +427,20 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.spacesModule, abstract: !Fablab.spacesModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "spaces/reserve.html" %>', templateUrl: '../../templates/spaces/reserve.html',
controller: 'ReserveSpaceController' controller: 'ReserveSpaceController'
} }
}, },
resolve: { resolve: {
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }], spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
availabilitySpacesPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.spaces({ spaceId: $stateParams.id }).$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }], plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }], groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { settingsPromise: ['Setting', function (Setting) {
return Setting.query({ return Setting.query({
names: `['booking_window_start', 'booking_window_end', 'booking_move_enable', 'booking_move_delay', \ names: "['booking_window_start', 'booking_window_end', 'booking_move_enable', 'booking_move_delay', " +
'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', \ "'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', " +
'space_explications_alert', 'online_payment_module']` }).$promise; "'space_explications_alert', 'online_payment_module']"
}).$promise;
}] }]
} }
}) })
@ -450,7 +450,7 @@ angular.module('application.router', ['ui.router'])
url: '/trainings', url: '/trainings',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "trainings/index.html.erb" %>', templateUrl: '../../templates/trainings/index.html',
controller: 'TrainingsController' controller: 'TrainingsController'
} }
}, },
@ -462,7 +462,7 @@ angular.module('application.router', ['ui.router'])
url: '/trainings/:id', url: '/trainings/:id',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "trainings/show.html" %>', templateUrl: '../../templates/trainings/show.html',
controller: 'ShowTrainingController' controller: 'ShowTrainingController'
} }
}, },
@ -474,7 +474,7 @@ angular.module('application.router', ['ui.router'])
url: '/trainings/:id/reserve', url: '/trainings/:id/reserve',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "trainings/reserve.html" %>', templateUrl: '../../templates/trainings/reserve.html',
controller: 'ReserveTrainingController' controller: 'ReserveTrainingController'
} }
}, },
@ -482,15 +482,15 @@ angular.module('application.router', ['ui.router'])
explicationAlertPromise: ['Setting', function (Setting) { return Setting.get({ name: 'training_explications_alert' }).$promise; }], explicationAlertPromise: ['Setting', function (Setting) { return Setting.get({ name: 'training_explications_alert' }).$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }], plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }], groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
availabilityTrainingsPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.trainings({ trainingId: $stateParams.id }).$promise; }],
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) { trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) {
if ($stateParams.id !== 'all') { return Training.get({ id: $stateParams.id }).$promise; } if ($stateParams.id !== 'all') { return Training.get({ id: $stateParams.id }).$promise; }
}], }],
settingsPromise: ['Setting', function (Setting) { settingsPromise: ['Setting', function (Setting) {
return Setting.query({ return Setting.query({
names: `['booking_window_start', 'booking_window_end', 'booking_move_enable', 'booking_move_delay', \ names: "['booking_window_start', 'booking_window_end', 'booking_move_enable', 'booking_move_delay', " +
'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', \ "'booking_cancel_enable', 'booking_cancel_delay', 'subscription_explications_alert', " +
'training_explications_alert', 'training_information_message', 'online_payment_module']` }).$promise; "'training_explications_alert', 'training_information_message', 'online_payment_module']"
}).$promise;
}] }]
} }
}) })
@ -499,7 +499,7 @@ angular.module('application.router', ['ui.router'])
url: '/notifications', url: '/notifications',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "notifications/index.html.erb" %>', templateUrl: '../../templates/notifications/index.html',
controller: 'NotificationsController' controller: 'NotificationsController'
} }
} }
@ -511,7 +511,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.plansModule, abstract: !Fablab.plansModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "plans/index.html.erb" %>', templateUrl: '../../templates/plans/index.html',
controller: 'PlansIndexController' controller: 'PlansIndexController'
} }
}, },
@ -528,7 +528,7 @@ angular.module('application.router', ['ui.router'])
url: '/events', url: '/events',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "events/index.html.erb" %>', templateUrl: '../../templates/events/index.html',
controller: 'EventsController' controller: 'EventsController'
} }
}, },
@ -543,7 +543,7 @@ angular.module('application.router', ['ui.router'])
url: '/events/:id', url: '/events/:id',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "events/show.html" %>', templateUrl: '../../templates/events/show.html',
controller: 'ShowEventController' controller: 'ShowEventController'
} }
}, },
@ -559,7 +559,7 @@ angular.module('application.router', ['ui.router'])
url: '/calendar', url: '/calendar',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "calendar/calendar.html" %>', templateUrl: '../../templates/calendar/calendar.html',
controller: 'CalendarController' controller: 'CalendarController'
} }
}, },
@ -579,7 +579,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/calendar', url: '/admin/calendar',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/calendar/calendar.html" %>', templateUrl: '../../templates/admin/calendar/calendar.html',
controller: 'AdminCalendarController' controller: 'AdminCalendarController'
} }
}, },
@ -596,7 +596,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/calendar/icalendar', url: '/admin/calendar/icalendar',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/calendar/icalendar.html" %>', templateUrl: '../../templates/admin/calendar/icalendar.html',
controller: 'AdminICalendarController' controller: 'AdminICalendarController'
} }
}, },
@ -610,7 +610,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/projects', url: '/admin/projects',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/projects/index.html.erb" %>', templateUrl: '../../templates/admin/projects/index.html',
controller: 'AdminProjectsController' controller: 'AdminProjectsController'
} }
}, },
@ -619,8 +619,10 @@ angular.module('application.router', ['ui.router'])
licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }], licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }],
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }], themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { settingsPromise: ['Setting', function (Setting) {
return Setting.query({ names: "['feature_tour_display', 'disqus_shortname', 'allowed_cad_extensions', \ return Setting.query({
'allowed_cad_mime_types', 'openlab_app_id', 'openlab_app_secret', 'openlab_default']" }).$promise; names: "['feature_tour_display', 'disqus_shortname', 'allowed_cad_extensions', " +
"'allowed_cad_mime_types', 'openlab_app_id', 'openlab_app_secret', 'openlab_default']"
}).$promise;
}] }]
} }
}) })
@ -628,12 +630,12 @@ angular.module('application.router', ['ui.router'])
url: '/admin/abuses', url: '/admin/abuses',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/abuses/index.html" %>', templateUrl: '../../templates/admin/abuses/index.html',
controller: 'AbusesController' controller: 'AbusesController'
} }
}, },
resolve: { resolve: {
abusesPromise: ['Abuse', function(Abuse) { return Abuse.query().$promise; }] abusesPromise: ['Abuse', function (Abuse) { return Abuse.query().$promise; }]
} }
}) })
@ -642,7 +644,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/trainings', url: '/admin/trainings',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/trainings/index.html.erb" %>', templateUrl: '../../templates/admin/trainings/index.html',
controller: 'TrainingsAdminController' controller: 'TrainingsAdminController'
} }
}, },
@ -656,7 +658,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/trainings/new', url: '/admin/trainings/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/trainings/new.html" %>', templateUrl: '../../templates/admin/trainings/new.html',
controller: 'NewTrainingController' controller: 'NewTrainingController'
} }
}, },
@ -668,7 +670,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/trainings/:id/edit', url: '/admin/trainings/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/trainings/edit.html" %>', templateUrl: '../../templates/admin/trainings/edit.html',
controller: 'EditTrainingController' controller: 'EditTrainingController'
} }
}, },
@ -682,7 +684,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/events', url: '/admin/events',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/events/index.html.erb" %>', templateUrl: '../../templates/admin/events/index.html',
controller: 'AdminEventsController' controller: 'AdminEventsController'
} }
}, },
@ -699,7 +701,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/events/new', url: '/admin/events/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "events/new.html" %>', templateUrl: '../../templates/events/new.html',
controller: 'NewEventController' controller: 'NewEventController'
} }
}, },
@ -714,7 +716,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/events/:id/edit', url: '/admin/events/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "events/edit.html" %>', templateUrl: '../../templates/events/edit.html',
controller: 'EditEventController' controller: 'EditEventController'
} }
}, },
@ -730,7 +732,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/events/:id/reservations', url: '/admin/events/:id/reservations',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/events/reservations.html" %>', templateUrl: '../../templates/admin/events/reservations.html',
controller: 'ShowEventReservationsController' controller: 'ShowEventReservationsController'
} }
}, },
@ -745,7 +747,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/pricing', url: '/admin/pricing',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/pricing/index.html.erb" %>', templateUrl: '../../templates/admin/pricing/index.html',
controller: 'EditPricingController' controller: 'EditPricingController'
} }
}, },
@ -779,7 +781,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/plans/new', url: '/admin/plans/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/plans/new.html" %>', templateUrl: '../../templates/admin/plans/new.html',
controller: 'NewPlanController' controller: 'NewPlanController'
} }
} }
@ -788,7 +790,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/plans/:id/edit', url: '/admin/plans/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/plans/edit.html" %>', templateUrl: '../../templates/admin/plans/edit.html',
controller: 'EditPlanController' controller: 'EditPlanController'
} }
}, },
@ -805,7 +807,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/coupons/new', url: '/admin/coupons/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/coupons/new.html" %>', templateUrl: '../../templates/admin/coupons/new.html',
controller: 'NewCouponController' controller: 'NewCouponController'
} }
} }
@ -814,7 +816,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/coupons/:id/edit', url: '/admin/coupons/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/coupons/edit.html" %>', templateUrl: '../../templates/admin/coupons/edit.html',
controller: 'EditCouponController' controller: 'EditCouponController'
} }
}, },
@ -828,30 +830,31 @@ angular.module('application.router', ['ui.router'])
url: '/admin/invoices', url: '/admin/invoices',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/invoices/index.html.erb" %>', templateUrl: '../../templates/admin/invoices/index.html',
controller: 'InvoicesController' controller: 'InvoicesController'
} }
}, },
resolve: { resolve: {
settings: ['Setting', function (Setting) { settings: ['Setting', function (Setting) {
return Setting.query({ return Setting.query({
names: `['invoice_legals', 'invoice_text', 'invoice_VAT-rate', 'invoice_VAT-active', 'invoice_order-nb', 'invoice_code-value', \ names: "['invoice_legals', 'invoice_text', 'invoice_VAT-rate', 'invoice_VAT-active', 'invoice_order-nb', 'invoice_code-value', " +
'invoice_code-active', 'invoice_reference', 'invoice_logo', 'accounting_journal_code', 'accounting_card_client_code', \ "'invoice_code-active', 'invoice_reference', 'invoice_logo', 'accounting_journal_code', 'accounting_card_client_code', " +
'accounting_card_client_label', 'accounting_wallet_client_code', 'accounting_wallet_client_label', 'invoicing_module', \ "'accounting_card_client_label', 'accounting_wallet_client_code', 'accounting_wallet_client_label', 'invoicing_module', " +
'accounting_other_client_code', 'accounting_other_client_label', 'accounting_wallet_code', 'accounting_wallet_label', \ "'accounting_other_client_code', 'accounting_other_client_label', 'accounting_wallet_code', 'accounting_wallet_label', " +
'accounting_VAT_code', 'accounting_VAT_label', 'accounting_subscription_code', 'accounting_subscription_label', \ "'accounting_VAT_code', 'accounting_VAT_label', 'accounting_subscription_code', 'accounting_subscription_label', " +
'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', \ "'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', " +
'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', \ "'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', " +
'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency', 'invoice_prefix']` }).$promise; "'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency', 'invoice_prefix']"
}).$promise;
}], }],
stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_secret_key' }).$promise; }], stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_secret_key' }).$promise; }],
onlinePaymentStatus: ['Payment', function (Payment) { return Payment.onlinePaymentStatus().$promise; }], onlinePaymentStatus: ['Payment', function (Payment) { return Payment.onlinePaymentStatus().$promise; }],
invoices: [ 'Invoice', function (Invoice) { invoices: ['Invoice', function (Invoice) {
return Invoice.list({ return Invoice.list({
query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 } query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 }
}).$promise; }).$promise;
}], }],
closedPeriods: [ 'AccountingPeriod', function(AccountingPeriod) { return AccountingPeriod.query().$promise; }] closedPeriods: ['AccountingPeriod', function (AccountingPeriod) { return AccountingPeriod.query().$promise; }]
} }
}) })
@ -860,19 +863,19 @@ angular.module('application.router', ['ui.router'])
url: '/admin/members', url: '/admin/members',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/members/index.html.erb" %>', templateUrl: '../../templates/admin/members/index.html',
controller: 'AdminMembersController' controller: 'AdminMembersController'
}, },
'groups@app.admin.members': { 'groups@app.admin.members': {
templateUrl: '<%= asset_path "admin/groups/index.html.erb" %>', templateUrl: '../../templates/admin/groups/index.html',
controller: 'GroupsController' controller: 'GroupsController'
}, },
'tags@app.admin.members': { 'tags@app.admin.members': {
templateUrl: '<%= asset_path "admin/tags/index.html.erb" %>', templateUrl: '../../templates/admin/tags/index.html',
controller: 'TagsController' controller: 'TagsController'
}, },
'authentification@app.admin.members': { 'authentification@app.admin.members': {
templateUrl: '<%= asset_path "admin/authentications/index.html.erb" %>', templateUrl: '../../templates/admin/authentications/index.html',
controller: 'AuthentificationController' controller: 'AuthentificationController'
} }
}, },
@ -891,7 +894,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/members/new', url: '/admin/members/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/members/new.html" %>', templateUrl: '../../templates/admin/members/new.html',
controller: 'NewMemberController' controller: 'NewMemberController'
} }
}, },
@ -903,31 +906,31 @@ angular.module('application.router', ['ui.router'])
url: '/admin/members/import', url: '/admin/members/import',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/members/import.html" %>', templateUrl: '../../templates/admin/members/import.html',
controller: 'ImportMembersController' controller: 'ImportMembersController'
} }
}, },
resolve: { resolve: {
tags: ['Tag', function(Tag) { return Tag.query().$promise }] tags: ['Tag', function (Tag) { return Tag.query().$promise; }]
} }
}) })
.state('app.admin.members_import_result', { .state('app.admin.members_import_result', {
url: '/admin/members/import/:id/results', url: '/admin/members/import/:id/results',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/members/import_result.html" %>', templateUrl: '../../templates/admin/members/import_result.html',
controller: 'ImportMembersResultController' controller: 'ImportMembersResultController'
} }
}, },
resolve: { resolve: {
importItem: ['Import', '$stateParams', function(Import, $stateParams) { return Import.get({ id: $stateParams.id }).$promise }] importItem: ['Import', '$stateParams', function (Import, $stateParams) { return Import.get({ id: $stateParams.id }).$promise; }]
} }
}) })
.state('app.admin.members_edit', { .state('app.admin.members_edit', {
url: '/admin/members/:id/edit', url: '/admin/members/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/members/edit.html" %>', templateUrl: '../../templates/admin/members/edit.html',
controller: 'EditMemberController' controller: 'EditMemberController'
} }
}, },
@ -944,7 +947,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/admins/new', url: '/admin/admins/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/admins/new.html" %>', templateUrl: '../../templates/admin/admins/new.html',
controller: 'NewAdminController' controller: 'NewAdminController'
} }
}, },
@ -956,7 +959,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/managers/new', url: '/admin/managers/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/managers/new.html" %>', templateUrl: '../../templates/admin/managers/new.html',
controller: 'NewManagerController' controller: 'NewManagerController'
} }
}, },
@ -971,7 +974,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/authentications/new', url: '/admin/authentications/new',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/authentications/new.html" %>', templateUrl: '../../templates/admin/authentications/new.html',
controller: 'NewAuthenticationController' controller: 'NewAuthenticationController'
} }
}, },
@ -984,7 +987,7 @@ angular.module('application.router', ['ui.router'])
url: '/admin/authentications/:id/edit', url: '/admin/authentications/:id/edit',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/authentications/edit.html" %>', templateUrl: '../../templates/admin/authentications/edit.html',
controller: 'EditAuthenticationController' controller: 'EditAuthenticationController'
} }
}, },
@ -1000,7 +1003,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.statisticsModule, abstract: !Fablab.statisticsModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/statistics/index.html.erb" %>', templateUrl: '../../templates/admin/statistics/index.html',
controller: 'StatisticsController' controller: 'StatisticsController'
} }
}, },
@ -1015,7 +1018,7 @@ angular.module('application.router', ['ui.router'])
abstract: !Fablab.statisticsModule, abstract: !Fablab.statisticsModule,
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/statistics/graphs.html" %>', templateUrl: '../../templates/admin/statistics/graphs.html',
controller: 'GraphsController' controller: 'GraphsController'
} }
} }
@ -1026,24 +1029,25 @@ angular.module('application.router', ['ui.router'])
url: '/admin/settings', url: '/admin/settings',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/settings/index.html.erb" %>', templateUrl: '../../templates/admin/settings/index.html',
controller: 'SettingsController' controller: 'SettingsController'
} }
}, },
resolve: { resolve: {
settingsPromise: ['Setting', function (Setting) { settingsPromise: ['Setting', function (Setting) {
return Setting.query({ return Setting.query({
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', 'email_from', \ names: "['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', 'email_from', " +
'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', \ "'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', " +
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \ "'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', " +
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \ "'training_information_message', 'subscription_explications_alert', 'event_explications_alert', " +
'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', \ "'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', " +
'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', 'feature_tour_display', \ "'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', 'feature_tour_display', " +
'booking_cancel_delay', 'main_color', 'secondary_color', 'spaces_module', 'twitter_analytics', \ "'booking_cancel_delay', 'main_color', 'secondary_color', 'spaces_module', 'twitter_analytics', " +
'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'confirmation_required', \ "'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'confirmation_required', " +
'reminder_delay', 'visibility_yearly', 'visibility_others', 'wallet_module', \ "'reminder_delay', 'visibility_yearly', 'visibility_others', 'wallet_module', " +
'display_name_enable', 'machines_sort_by', 'fab_analytics', 'statistics_module', \ "'display_name_enable', 'machines_sort_by', 'fab_analytics', 'statistics_module', " +
'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown']` }).$promise; "'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown']"
}).$promise;
}], }],
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }], privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }], cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
@ -1058,7 +1062,7 @@ angular.module('application.router', ['ui.router'])
url: '/open_api_clients', url: '/open_api_clients',
views: { views: {
'main@': { 'main@': {
templateUrl: '<%= asset_path "admin/open_api_clients/index.html.erb" %>', templateUrl: '../../templates/admin/open_api_clients/index.html.erb',
controller: 'OpenAPIClientsController' controller: 'OpenAPIClientsController'
} }
}, },

Some files were not shown because too many files have changed in this diff Show More