mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
Merge branch 'dev' into alexcvcoelho-master
This commit is contained in:
commit
3a6af68b67
@ -1 +1 @@
|
||||
2.5.4
|
||||
2.5.6
|
||||
|
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,5 +1,18 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
## v2.5.6 2017 May 18
|
||||
|
||||
- Ability for admins to create users as organizations
|
||||
- Invoices object will contain the organization name if any (#64)
|
||||
- RSS feeds will return more data about events and projects, especially images
|
||||
- Improved Docker documentation (#65)
|
||||
|
||||
## v2.5.5 2017 May 15
|
||||
|
||||
- Fix a bug: New groups does not have their spaces prices initialized
|
||||
- Fix a bug: Unable to delete a group when its space prices are set
|
||||
- [TODO DEPLOY] `rake fablab:fix:new_group_space_prices` only if module 'Spaces' is/was enabled
|
||||
|
||||
## v2.5.4 2017 May 4
|
||||
|
||||
- Fix a bug: Unable to define application locale other than `fr` or `en`.
|
||||
|
@ -535,6 +535,15 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", "
|
||||
$scope.user =
|
||||
plan_interval: ''
|
||||
|
||||
## Callback when the admin check/unckeck the box telling that the new user is an organization.
|
||||
## Disable or enable the organization fields in the form, accordingly
|
||||
$scope.toggleOrganization = ->
|
||||
if $scope.user.organization
|
||||
$scope.user.profile = {} unless $scope.user.profile
|
||||
$scope.user.profile.organization = {}
|
||||
else
|
||||
$scope.user.profile.organization = undefined
|
||||
|
||||
|
||||
|
||||
## Using the MembersController
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div class="col-md-8 b-l b-r">
|
||||
<section class="heading-title">
|
||||
<h1 translate>{{ 'add_a_member' }}</h1>
|
||||
<h1 translate>{{ 'members_new.add_a_member' }}</h1>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
@ -33,8 +33,23 @@
|
||||
|
||||
<form role="form" name="userForm" class="form-horizontal" novalidate action="{{ actionUrl }}" ng-upload="submited(content)" upload-options-enable-rails-csrf="true">
|
||||
|
||||
<section class="panel panel-default bg-light m-lg">
|
||||
<div class="panel-body m-r">
|
||||
<section class="panel panel-default bg-light m-lg">
|
||||
<div class="panel-body m-r">
|
||||
|
||||
<div class="row m-t">
|
||||
<div class="col-sm-6 col-sm-offset-5">
|
||||
<div class="form-group checkbox-group">
|
||||
<input type="checkbox"
|
||||
name="organization"
|
||||
id="organization"
|
||||
ng-model="user.organization"
|
||||
ng-change="toggleOrganization()"
|
||||
value="false"/>
|
||||
<label for="organization" translate>{{ 'members_new.user_is_an_organization' }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-include src="'<%= asset_path 'shared/_member_form.html' %>'"></ng-include>
|
||||
|
||||
<ng-include src="'<%= asset_path 'admin/members/_form.html' %>'"></ng-include>
|
||||
|
@ -3,6 +3,7 @@ class Group < ActiveRecord::Base
|
||||
has_many :users
|
||||
has_many :trainings_pricings, dependent: :destroy
|
||||
has_many :machines_prices, ->{ where(priceable_type: 'Machine') }, class_name: 'Price', dependent: :destroy
|
||||
has_many :spaces_prices, ->{ where(priceable_type: 'Space') }, class_name: 'Price', dependent: :destroy
|
||||
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
@ -21,6 +22,7 @@ class Group < ActiveRecord::Base
|
||||
def create_prices
|
||||
create_trainings_pricings
|
||||
create_machines_prices
|
||||
create_spaces_prices
|
||||
end
|
||||
|
||||
def create_trainings_pricings
|
||||
@ -35,6 +37,12 @@ class Group < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def create_spaces_prices
|
||||
Space.all.each do |space|
|
||||
Price.create(priceable: space, group: self, amount: 0)
|
||||
end
|
||||
end
|
||||
|
||||
def create_statistic_subtype
|
||||
user_index = StatisticIndex.find_by(es_type_key: 'user')
|
||||
StatisticSubType.create!({statistic_types: user_index.statistic_types, key: self.slug, label: self.name})
|
||||
|
@ -53,8 +53,10 @@ module PDF
|
||||
# user/organization's information
|
||||
if invoice&.user&.profile&.organization
|
||||
name = invoice.user.profile.organization.name
|
||||
full_name = "#{name} (#{invoice.user.profile.full_name})"
|
||||
else
|
||||
name = invoice.user.profile.full_name
|
||||
full_name = name
|
||||
end
|
||||
|
||||
if invoice&.user&.profile&.organization&.address
|
||||
@ -66,6 +68,7 @@ module PDF
|
||||
end
|
||||
|
||||
text_box "<b>#{name}</b>\n#{invoice.user.email}\n#{address}", :at => [bounds.width - 130, bounds.top - 49], :width => 130, :align => :right, :inline_format => true
|
||||
name = full_name
|
||||
|
||||
# object
|
||||
move_down 25
|
||||
@ -78,18 +81,18 @@ module PDF
|
||||
else
|
||||
case invoice.invoiced_type
|
||||
when 'Reservation'
|
||||
object = I18n.t('invoices.reservation_of_USER_on_DATE_at_TIME', USER:invoice.user.profile.full_name, DATE:I18n.l(invoice.invoiced.slots[0].start_at.to_date), TIME:I18n.l(invoice.invoiced.slots[0].start_at, format: :hour_minute))
|
||||
object = I18n.t('invoices.reservation_of_USER_on_DATE_at_TIME', USER:name, DATE:I18n.l(invoice.invoiced.slots[0].start_at.to_date), TIME:I18n.l(invoice.invoiced.slots[0].start_at, format: :hour_minute))
|
||||
invoice.invoice_items.each do |item|
|
||||
if item.subscription_id
|
||||
subscription = Subscription.find item.subscription_id
|
||||
object = "\n- #{object}\n- #{(invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation')+' - ' : '') + subscription_verbose(subscription, invoice.user)}"
|
||||
object = "\n- #{object}\n- #{(invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation')+' - ' : '') + subscription_verbose(subscription, name)}"
|
||||
break
|
||||
end
|
||||
end
|
||||
when 'Subscription'
|
||||
object = subscription_verbose(invoice.invoiced, invoice.user)
|
||||
object = subscription_verbose(invoice.invoiced, name)
|
||||
when 'OfferDay'
|
||||
object = offer_day_verbose(invoice.invoiced, invoice.user)
|
||||
object = offer_day_verbose(invoice.invoiced, name)
|
||||
else
|
||||
puts "ERROR : specified invoiced type (#{invoice.invoiced_type}) is unknown"
|
||||
end
|
||||
@ -324,7 +327,7 @@ module PDF
|
||||
def subscription_verbose(subscription, user)
|
||||
subscription_start_at = subscription.expired_at - subscription.plan.duration
|
||||
duration_verbose = I18n.t("duration.#{subscription.plan.interval}", count: subscription.plan.interval_count)
|
||||
I18n.t('invoices.subscription_of_NAME_for_DURATION_starting_from_DATE', NAME: user.profile.full_name, DURATION: duration_verbose, DATE: I18n.l(subscription_start_at.to_date))
|
||||
I18n.t('invoices.subscription_of_NAME_for_DURATION_starting_from_DATE', NAME: user, DURATION: duration_verbose, DATE: I18n.l(subscription_start_at.to_date))
|
||||
end
|
||||
|
||||
def offer_day_verbose(offer_day, user)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#encoding: UTF-8
|
||||
|
||||
xml.instruct! :xml, version: '1.0'
|
||||
xml.rss version: '2.0' do
|
||||
xml.rss version: '2.0', 'xmlns:xCal' => 'urn:ietf:params:xml:ns:xcal' do
|
||||
xml.channel do
|
||||
xml.title "#{t('app.public.events_list.the_fablab_s_events')} - #{@fab_name}"
|
||||
xml.description t('app.public.home.fablab_s_next_events')
|
||||
@ -12,10 +12,18 @@ xml.rss version: '2.0' do
|
||||
@events.each do |event|
|
||||
xml.item do
|
||||
xml.guid event.id
|
||||
xml.pubDate event.created_at.strftime('%F %T')
|
||||
xml.pubDate event.created_at.strftime('%FT%T%:z')
|
||||
xml.title event.name
|
||||
xml.link root_url + '#!/events/' + event.id.to_s
|
||||
xml.description event.description
|
||||
xml.xCal :dtstart do
|
||||
xml.text! event.availability.start_at.strftime('%FT%T%:z')
|
||||
end
|
||||
xml.xCal :dtend do
|
||||
xml.text! event.availability.end_at.strftime('%FT%T%:z')
|
||||
end
|
||||
xml.enclosure url: root_url + event.event_image.attachment.large.url, length: event.event_image.attachment.large.size, type: event.event_image.attachment.content_type if event.event_image
|
||||
xml.category event.category.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -15,8 +15,9 @@ xml.rss version: '2.0' do
|
||||
xml.pubDate project.created_at.strftime('%F %T')
|
||||
xml.title project.name
|
||||
xml.link root_url + '#!/projects/' + project.slug
|
||||
xml.author project.author.first_name
|
||||
xml.author project.author.profile.full_name
|
||||
xml.description project.description
|
||||
xml.enclosure url: root_url + project.project_image.attachment.large.url, length: project.project_image.attachment.large.size, type: project.project_image.attachment.content_type if project.project_image
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -410,7 +410,9 @@ en:
|
||||
|
||||
members_new:
|
||||
# add a member
|
||||
add_a_member: "Add a member"
|
||||
members_new:
|
||||
add_a_member: "Add a member"
|
||||
user_is_an_organization: "User is an organization"
|
||||
|
||||
members_edit:
|
||||
# edit a member
|
||||
|
@ -410,7 +410,9 @@ fr:
|
||||
|
||||
members_new:
|
||||
# ajouter un membre
|
||||
add_a_member: "Ajouter un membre"
|
||||
members_new:
|
||||
add_a_member: "Ajouter un membre"
|
||||
user_is_an_organization: "L'utilisateur est une structure"
|
||||
|
||||
members_edit:
|
||||
# modifier un membre
|
||||
|
@ -332,7 +332,7 @@ OR
|
||||
Copy the previously customized `nginx.conf.example` as `/home/core/fabmanager/config/nginx/fabmanager.conf` if you do not want ssl support (not recommended !).
|
||||
|
||||
|
||||
#### copy docker-compose.yml to /home/core/
|
||||
#### copy docker-compose.yml to /home/core/fabmanager
|
||||
|
||||
#### pull images
|
||||
|
||||
@ -340,9 +340,11 @@ Copy the previously customized `nginx.conf.example` as `/home/core/fabmanager/co
|
||||
|
||||
#### create/migrate/seed db
|
||||
|
||||
`docker-compose run --rm fabmanager bundle exec rake db:create`
|
||||
`docker-compose run --rm fabmanager bundle exec rake db:migrate`
|
||||
`docker-compose run --rm fabmanager bundle exec rake db:seed`
|
||||
```bash
|
||||
docker-compose run --rm fabmanager bundle exec rake db:create
|
||||
docker-compose run --rm fabmanager bundle exec rake db:migrate
|
||||
docker-compose run --rm fabmanager bundle exec rake db:seed
|
||||
```
|
||||
|
||||
#### build assets
|
||||
|
||||
|
@ -35,5 +35,17 @@ namespace :fablab do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task new_group_space_prices: :environment do
|
||||
Space.all.each do |space|
|
||||
Group.all.each do |group|
|
||||
begin
|
||||
Price.find(priceable: space, group: group)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
Price.create(priceable: space, group: group, amount: 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user