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

Merge branch 'dev'

This commit is contained in:
Sylvain 2016-03-30 09:20:11 +02:00
commit b5dfcdb3b5
20 changed files with 72 additions and 49 deletions

View File

@ -499,9 +499,16 @@ Default is **UTC**.
Configure the first day of the week in your locale zone (generally monday or sunday).
D3_DATE_FORMAT
Date format for dates displayed in statistics charts.
See https://github.com/mbostock/d3/wiki/Time-Formatting#format for available formats.
UIB_DATE_FORMAT
Date format for dates displayed and parsed in date pickers.
See https://angular-ui.github.io/bootstrap/#uibdateparser-s-format-codes for a list available formats.
**BEWARE**: years format with less than 4 digits will result in problems because the system won't be able to distinct dates with the same less significant digits, eg. 50 could mean 1950 or 2050.
<a name="i18n-apply"></a>
#### Applying changes

View File

@ -23,7 +23,7 @@
# - $state (Ui-Router) [ 'app.public.events_list' ]
##
class EventsController
constructor: ($scope, $state, $locale, Event, Category) ->
constructor: ($scope, $state, Event, Category) ->
## Retrieve the list of categories from the server (stage, atelier, ...)
Category.query().$promise.then (data)->
@ -33,7 +33,7 @@ class EventsController
## default parameters for AngularUI-Bootstrap datepicker
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
startOpened: false # default: datePicker is not shown
endOpened: false
recurrenceEndOpened: false
@ -242,7 +242,7 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
$scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM;
## Using the EventsController
new EventsController($scope, $state, $locale, Event, Category)
new EventsController($scope, $state, Event, Category)
]
@ -286,7 +286,7 @@ Application.Controllers.controller "EditEventController", ["$scope", "$state", "
$scope.event.end_date = moment($scope.event.end_date).toDate()
## Using the EventsController
new EventsController($scope, $state, $locale, Event, Category)
new EventsController($scope, $state, Event, Category)

View File

@ -1,7 +1,7 @@
'use strict'
Application.Controllers.controller "GraphsController", ["$scope", "$state", '$locale', "$rootScope", 'es', 'Statistics', '_t'
, ($scope, $state, $locale, $rootScope, es, Statistics, _t) ->
Application.Controllers.controller "GraphsController", ["$scope", "$state", "$rootScope", 'es', 'Statistics', '_t'
, ($scope, $state, $rootScope, es, Statistics, _t) ->
@ -50,7 +50,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", '$lo
## datePicker parameters for interval beginning
$scope.datePickerStart =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
minDate: null
maxDate: moment().subtract(1, 'day').toDate()
@ -60,7 +60,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", '$lo
## datePicker parameters for interval ending
$scope.datePickerEnd =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
minDate: null
maxDate: moment().subtract(1, 'day').toDate()

View File

@ -390,8 +390,8 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I
##
# Controller used in the invoice refunding modal window
##
Application.Controllers.controller 'AvoirModalController', ["$scope", "$uibModalInstance", '$locale', "invoice", "Invoice", "growl", '_t'
, ($scope, $uibModalInstance, $locale, invoice, Invoice, growl, _t) ->
Application.Controllers.controller 'AvoirModalController', ["$scope", "$uibModalInstance", "invoice", "Invoice", "growl", '_t'
, ($scope, $uibModalInstance, invoice, Invoice, growl, _t) ->
@ -424,7 +424,7 @@ Application.Controllers.controller 'AvoirModalController', ["$scope", "$uibModal
## AngularUI-Bootstrap datepicker parameters to define when to refund
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
options:
startingDay: Fablab.weekStartingDay

View File

@ -21,7 +21,7 @@
# - $state (Ui-Router) [ 'app.admin.members' ]
##
class MembersController
constructor: ($scope, $state, $locale, Group, Training) ->
constructor: ($scope, $state, Group, Training) ->
## Retrieve the profiles groups (eg. students ...)
Group.query (groups) ->
@ -35,7 +35,7 @@ class MembersController
## Default parameters for AngularUI-Bootstrap datepicker
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
subscription_date_opened: false
options:
@ -188,8 +188,8 @@ Application.Controllers.controller "AdminMembersController", ["$scope", 'members
##
# Controller used in the member edition page
##
Application.Controllers.controller "EditMemberController", ["$scope", "$state", "$stateParams", '$locale', "Member", 'Training', 'dialogs', 'growl', 'Group', 'Subscription', 'CSRF', 'memberPromise', 'tagsPromise', '$uibModal', 'Plan', '$filter', '_t'
, ($scope, $state, $stateParams, $locale, Member, Training, dialogs, growl, Group, Subscription, CSRF, memberPromise, tagsPromise, $uibModal, Plan, $filter, _t) ->
Application.Controllers.controller "EditMemberController", ["$scope", "$state", "$stateParams", "Member", 'Training', 'dialogs', 'growl', 'Group', 'Subscription', 'CSRF', 'memberPromise', 'tagsPromise', '$uibModal', 'Plan', '$filter', '_t'
, ($scope, $state, $stateParams, Member, Training, dialogs, growl, Group, Subscription, CSRF, memberPromise, tagsPromise, $uibModal, Plan, $filter, _t) ->
@ -245,7 +245,7 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state",
$scope.free = free
$scope.datePicker =
opened: false
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
options:
startingDay: Fablab.weekStartingDay
minDate: new Date
@ -349,7 +349,7 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state",
plan.nameToDisplay = "#{plan.base_name} - #{plan.interval}"
# Using the MembersController
new MembersController($scope, $state, $locale, Group, Training)
new MembersController($scope, $state, Group, Training)
@ -362,8 +362,8 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state",
##
# Controller used in the member's creation page (admin view)
##
Application.Controllers.controller "NewMemberController", ["$scope", "$state", "$locale", "$stateParams", "Member", 'Training', 'Group', 'CSRF'
, ($scope, $state, $locale, $stateParams, Member, Training, Group, CSRF) ->
Application.Controllers.controller "NewMemberController", ["$scope", "$state", "$stateParams", "Member", 'Training', 'Group', 'CSRF'
, ($scope, $state, $stateParams, Member, Training, Group, CSRF) ->
CSRF.setMetaTags()
@ -386,7 +386,7 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", "
## Using the MembersController
new MembersController($scope, $state, $locale, Group, Training)
new MembersController($scope, $state, Group, Training)
]
@ -394,7 +394,7 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", "
##
# Controller used in the admin's creation page (admin view)
##
Application.Controllers.controller 'NewAdminController', ['$state', '$scope', '$locale', 'Admin', 'growl', ($state, $scope, $locale, Admin, growl)->
Application.Controllers.controller 'NewAdminController', ['$state', '$scope', 'Admin', 'growl', ($state, $scope, Admin, growl)->
## default admin profile
$scope.admin =
@ -403,7 +403,7 @@ Application.Controllers.controller 'NewAdminController', ['$state', '$scope', '$
## Default parameters for AngularUI-Bootstrap datepicker
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false
options:
startingDay: Fablab.weekStartingDay

View File

@ -1,7 +1,7 @@
'use strict'
Application.Controllers.controller "StatisticsController", ["$scope", "$state", "$rootScope", "$locale", "Statistics", "es", "Member", '_t'
, ($scope, $state, $rootScope, $locale, Statistics, es, Member, _t) ->
Application.Controllers.controller "StatisticsController", ["$scope", "$state", "$rootScope", "Statistics", "es", "Member", '_t'
, ($scope, $state, $rootScope, Statistics, es, Member, _t) ->
@ -53,7 +53,7 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
value : null
exclude: false
datePicker:
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
minDate: null
maxDate: moment().toDate()
@ -69,7 +69,7 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
## datePicker parameters for interval beginning
$scope.datePickerStart =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
minDate: null
maxDate: moment().subtract(1, 'day').toDate()
@ -79,7 +79,7 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
## datePicker parameters for interval ending
$scope.datePickerEnd =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
minDate: null
maxDate: moment().subtract(1, 'day').toDate()

View File

@ -1,7 +1,7 @@
'use strict'
Application.Controllers.controller 'ApplicationController', ["$rootScope", "$scope", "$window", "Session", "AuthService", "Auth", "$uibModal", "$state", 'growl', 'Notification', '$interval', "Setting", '$locale', '_t'
, ($rootScope, $scope, $window, Session, AuthService, Auth, $uibModal, $state, growl, Notification, $interval, Setting, $locale, _t) ->
Application.Controllers.controller 'ApplicationController', ["$rootScope", "$scope", "$window", "Session", "AuthService", "Auth", "$uibModal", "$state", 'growl', 'Notification', '$interval', "Setting", '_t'
, ($rootScope, $scope, $window, Session, AuthService, Auth, $uibModal, $state, growl, Notification, $interval, Setting, _t) ->
@ -66,7 +66,7 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco
controller: ['$scope', '$uibModalInstance', 'Group', 'CustomAsset', ($scope, $uibModalInstance, Group, CustomAsset) ->
# default parameters for the date picker in the account creation modal
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false
options:
startingDay: Fablab.weekStartingDay

View File

@ -15,8 +15,8 @@ Application.Controllers.controller "MembersController", ["$scope", 'membersPromi
##
# Controller used when editing the current user's profile
##
Application.Controllers.controller "EditProfileController", ["$scope", "$rootScope", "$state", "$window", '$locale', "Member", "Auth", "Session", "activeProviderPromise", 'growl', 'dialogs', 'CSRF', 'memberPromise', 'groups', '_t'
, ($scope, $rootScope, $state, $window, $locale, Member, Auth, Session, activeProviderPromise, growl, dialogs, CSRF, memberPromise, groups, _t) ->
Application.Controllers.controller "EditProfileController", ["$scope", "$rootScope", "$state", "$window", "Member", "Auth", "Session", "activeProviderPromise", 'growl', 'dialogs', 'CSRF', 'memberPromise', 'groups', '_t'
, ($scope, $rootScope, $state, $window, Member, Auth, Session, activeProviderPromise, growl, dialogs, CSRF, memberPromise, groups, _t) ->
@ -56,7 +56,7 @@ Application.Controllers.controller "EditProfileController", ["$scope", "$rootSco
## Angular-Bootstrap datepicker configuration for birthday
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
options:
startingDay: Fablab.weekStartingDay

View File

@ -1,8 +1,8 @@
'use strict'
Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "_t", "$locale", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise"
, ($scope, $rootScope, $state, _t, $locale, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise) ->
Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise"
, ($scope, $rootScope, $state, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise) ->
@ -40,7 +40,7 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo
## Angular-Bootstrap datepicker configuration for birthday
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate
format: Fablab.uibDateFormat
opened: false # default: datePicker is not shown
options:
startingDay: Fablab.weekStartingDay

View File

@ -447,7 +447,6 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
element.attr(
'uib-popover': event.training.description
'popover-trigger': 'mouseenter'
'popover-append-to-body': true
)
$compile(element)($scope)

View File

@ -210,4 +210,11 @@ Application.Filters.filter 'toArray', [ ->
if angular.isObject(val)
Object.defineProperty(val, '$key', {__proto__: null, value: key})
]
Application.Filters.filter 'toIsoDate', [ ->
(date) ->
return date unless (date instanceof Date || moment.isMoment(date))
moment(date).format('YYYY-MM-DD')
]

View File

@ -30,7 +30,7 @@
<span class="fileinput-new">{{ 'add_an_illustration' | translate }} <i class="fa fa-upload fa-fw"></i></span>
<span class="fileinput-exists" translate>{{ 'change' }}</span>
<input type="file"
ng-model="machine.machine_image_file"
ng-model="machine.machine_image"
name="machine[machine_image_attributes][attachment]"
accept="image/*"
required

View File

@ -79,7 +79,6 @@
<input type="text"
id="user_birthday"
class="form-control"
name="admin[profile_attributes][birthday]"
ng-model="admin.profile_attributes.birthday"
uib-datepicker-popup="{{datePicker.format}}"
datepicker-options="datePicker.options"
@ -87,6 +86,9 @@
placeholder="{{ 'birth_date' | translate }}"
ng-click="openDatePicker($event)"
/>
<input type="hidden"
name="admin[profile_attributes][birthday]"
value="{{admin.profile_attributes.birthday | toIsoDate}}" />
</div>
</div>

View File

@ -168,7 +168,6 @@
<input type="text"
id="user_birthday"
class="form-control"
name="user[profile_attributes][birthday]"
ng-model="user.profile.birthday"
uib-datepicker-popup="{{datePicker.format}}"
datepicker-options="datePicker.options"
@ -177,6 +176,9 @@
ng-click="openDatePicker($event)"
ng-disabled="preventField['profile.birthday'] && user.profile.birthday && !userForm['user[profile_attributes][birthday]'].$dirty"
required/>
<input type="hidden"
name="user[profile_attributes][birthday]"
value="{{user.profile.birthday | toIsoDate}}" />
</div>
<span class="help-block" ng-show="userForm['user[profile_attributes][birthday]'].$dirty && userForm['user[profile_attributes][birthday]'].$error.required" translate>{{ 'date_of_birth_is_required' }}</span>
</div>

View File

@ -28,12 +28,12 @@ class NotificationsMailer < NotifyWith::NotificationsMailer
end
def notify_user_when_invoice_ready
attachments['facture.pdf'] = File.read(@attached_object.file)
attachments[@attached_object.filename] = File.read(@attached_object.file)
mail(to: @recipient.email, subject: t('notifications_mailer.notify_member_invoice_ready.subject'), template_name: 'notify_member_invoice_ready')
end
def notify_user_when_avoir_ready
attachments['avoir.pdf'] = File.read(@attached_object.file)
attachments[@attached_object.filename] = File.read(@attached_object.file)
mail(to: @recipient.email, subject: t('notifications_mailer.notify_member_avoir_ready.subject'), template_name: 'notify_member_avoir_ready')
end
end

View File

@ -18,7 +18,11 @@ class Invoice < ActiveRecord::Base
# create directories if they doesn't exists (invoice & user_id)
FileUtils::mkdir_p dir
"#{dir}/#{ENV['INVOICE_PREFIX']}-#{self.id}_#{self.created_at.strftime('%d%m%Y')}.pdf"
"#{dir}/#{self.filename}"
end
def filename
"#{ENV['INVOICE_PREFIX']}-#{self.id}_#{self.created_at.strftime('%d%m%Y')}.pdf"
end

View File

@ -23,11 +23,7 @@
var Fablab = Fablab || {};
if ('<%= Rails.application.secrets.fablab_without_plans %>' == 'true'){
Fablab.withoutPlans = true;
} else {
Fablab.withoutPlans = false;
}
Fablab.withoutPlans = ('<%= Rails.application.secrets.fablab_without_plans %>' == 'true');
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
Fablab.defaultHost = "<%= ENV['DEFAULT_HOST'] %>";
Fablab.gaId = "<%= ENV['GA_ID'] %>";
@ -48,6 +44,7 @@
};
Fablab.weekStartingDay = <%= Date.parse(Rails.application.secrets.week_starting_day).strftime('%w') %>;
Fablab.d3DateFormat = "<%= Rails.application.secrets.d3_date_format %>";
Fablab.uibDateFormat = "<%= Rails.application.secrets.uib_date_format %>";
</script>
<%= stylesheet_link_tag 'application', media: 'all' %>

View File

@ -46,3 +46,4 @@ ELASTICSEARCH_LANGUAGE_ANALYZER: 'french'
TIME_ZONE: 'Paris'
WEEK_STARTING_DAY: 'monday'
D3_DATE_FORMAT: '%d/%m/%y'
UIB_DATE_FORMAT: 'dd/MM/yyyy'

View File

@ -53,7 +53,7 @@ en:
_subscription: "subscription"
confirm_and_pay: "Confirm and pay"
your_invoice_will_be_available_soon_from_your_: "Your invoice will be available soon form your"
add_an_event: "Add ane event"
add_an_event: "Add an event"
load_the_next_courses_and_workshops: "Load the next courses and workshops..."
dates: "Dates:"
thank_you_your_payment_has_been_successfully_registered: "Thank you. Your payment has been successfully registered !"

View File

@ -20,6 +20,7 @@ development:
time_zone: <%= ENV["TIME_ZONE"] %>
week_starting_day: <%= ENV["WEEK_STARTING_DAY"] %>
d3_date_format: <%= ENV["D3_DATE_FORMAT"].dump %> # .dump is needed as the value may start by a '%', see https://github.com/tenderlove/psych/issues/75
uib_date_format: <%= ENV["UIB_DATE_FORMAT"] %>
rails_locale: <%= ENV["RAILS_LOCALE"] %>
moment_locale: <%= ENV["MOMENT_LOCALE"] %>
summernote_locale: <%= ENV["SUMMERNOTE_LOCALE"] %>
@ -38,6 +39,7 @@ test:
time_zone: <%= ENV["TIME_ZONE"] %>
week_starting_day: <%= ENV["WEEK_STARTING_DAY"] %>
d3_date_format: <%= ENV["D3_DATE_FORMAT"].dump %>
uib_date_format: <%= ENV["UIB_DATE_FORMAT"] %>
rails_locale: <%= ENV["RAILS_LOCALE"] %>
moment_locale: <%= ENV["MOMENT_LOCALE"] %>
summernote_locale: <%= ENV["SUMMERNOTE_LOCALE"] %>
@ -64,6 +66,7 @@ staging:
time_zone: <%= ENV["TIME_ZONE"] %>
week_starting_day: <%= ENV["WEEK_STARTING_DAY"] %>
d3_date_format: <%= ENV["D3_DATE_FORMAT"].dump %>
uib_date_format: <%= ENV["UIB_DATE_FORMAT"] %>
rails_locale: <%= ENV["RAILS_LOCALE"] %>
moment_locale: <%= ENV["MOMENT_LOCALE"] %>
summernote_locale: <%= ENV["SUMMERNOTE_LOCALE"] %>
@ -91,6 +94,7 @@ production:
time_zone: <%= ENV["TIME_ZONE"] %>
week_starting_day: <%= ENV["WEEK_STARTING_DAY"] %>
d3_date_format: <%= ENV["D3_DATE_FORMAT"].dump %>
uib_date_format: <%= ENV["UIB_DATE_FORMAT"] %>
rails_locale: <%= ENV["RAILS_LOCALE"] %>
moment_locale: <%= ENV["MOMENT_LOCALE"] %>
summernote_locale: <%= ENV["SUMMERNOTE_LOCALE"] %>