diff --git a/.fabmanager-version b/.fabmanager-version index 0cadbc1e3..da6b0a8f1 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.5.5 +2.5.6 diff --git a/CHANGELOG.md b/CHANGELOG.md index c00b1b210..d8c2c8ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # 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 diff --git a/app/assets/javascripts/controllers/admin/members.coffee.erb b/app/assets/javascripts/controllers/admin/members.coffee.erb index 14b2c42a9..6e0d2f016 100644 --- a/app/assets/javascripts/controllers/admin/members.coffee.erb +++ b/app/assets/javascripts/controllers/admin/members.coffee.erb @@ -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 diff --git a/app/assets/templates/admin/members/new.html.erb b/app/assets/templates/admin/members/new.html.erb index 30c049de1..a4b233c19 100644 --- a/app/assets/templates/admin/members/new.html.erb +++ b/app/assets/templates/admin/members/new.html.erb @@ -9,7 +9,7 @@
-

{{ 'add_a_member' }}

+

{{ 'members_new.add_a_member' }}

@@ -33,8 +33,23 @@
-
-
+
+
+ +
+
+
+ + +
+
+
+ diff --git a/app/pdfs/pdf/invoice.rb b/app/pdfs/pdf/invoice.rb index 9913d0b4c..0c6323985 100644 --- a/app/pdfs/pdf/invoice.rb +++ b/app/pdfs/pdf/invoice.rb @@ -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 "#{name}\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) diff --git a/app/views/rss/events/index.xml.builder b/app/views/rss/events/index.xml.builder index bb5653122..b0a1942c6 100644 --- a/app/views/rss/events/index.xml.builder +++ b/app/views/rss/events/index.xml.builder @@ -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 diff --git a/app/views/rss/projects/index.xml.builder b/app/views/rss/projects/index.xml.builder index bc7ac0c92..2854c4d5e 100644 --- a/app/views/rss/projects/index.xml.builder +++ b/app/views/rss/projects/index.xml.builder @@ -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 diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 9619e9aa7..5d797a7f2 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -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 diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index fe99bd355..7a12737db 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -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 diff --git a/docker/README.md b/docker/README.md index d4f8ec1d4..0454ab43e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -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