From 1bd502cd0460c20fd307b88629319e2212532a82 Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Wed, 7 Sep 2016 12:27:14 +0200 Subject: [PATCH 001/289] Create ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..08f52b2da --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,8 @@ +This issue tracker is **reserved** for bug reports and feature requests. + +The place to ask a question or call for help is at Fab-manager forums at https://forum.fab-manager.com/. + +To report a bug, please describe: +- Expected behavior and actual behavior. +- Steps to reproduce the problem. +- Specifications like the version of the project, operating system, or hardware. From a5c6ba5f7da11e88a5478ccb3f8934a5f54d29d5 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 15 Sep 2016 21:50:08 +0200 Subject: [PATCH 002/289] add RSS feed to projects index --- app/views/api/projects/index.rss.builder | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/views/api/projects/index.rss.builder diff --git a/app/views/api/projects/index.rss.builder b/app/views/api/projects/index.rss.builder new file mode 100644 index 000000000..c9579e36b --- /dev/null +++ b/app/views/api/projects/index.rss.builder @@ -0,0 +1,23 @@ +#encoding: UTF-8 + +xml.instruct! :xml, version: "1.0" +xml.rss version: "2.0" do + xml.channel do + xml.title "#{t('app.public.projects_list.the_fablab_projects')} - #{Setting.find_by(name: 'fablab_name').value}" + xml.description t('app.public.projects_list.all_projects') + xml.author Setting.find_by(name: 'fablab_name').value + xml.link request.base_url + "/#!/projects" + xml.language I18n.locale.to_s + + @projects.each do |project| + xml.item do + xml.guid project.id + xml.pubDate project.created_at.strftime("%F %T") + xml.title project.name + xml.link request.base_url + "/#!/projects/" + project.slug + xml.author project.author.first_name + xml.description project.description + end + end + end +end From 6920793ce1efdf881ffef9a83546a5f2cff75e14 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 15 Sep 2016 22:22:35 +0200 Subject: [PATCH 003/289] add RSS feed to events index --- app/views/api/events/index.rss.builder | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/views/api/events/index.rss.builder diff --git a/app/views/api/events/index.rss.builder b/app/views/api/events/index.rss.builder new file mode 100644 index 000000000..b6dff9674 --- /dev/null +++ b/app/views/api/events/index.rss.builder @@ -0,0 +1,21 @@ +#encoding: UTF-8 + +xml.instruct! :xml, version: "1.0" +xml.rss version: "2.0" do + xml.channel do + xml.title "#{t('app.public.events_list.the_fablab_s_courses_and_workshops')} - #{Setting.find_by(name: 'fablab_name').value}" + xml.author Setting.find_by(name: 'fablab_name').value + xml.link request.base_url + "/#!/events" + xml.language I18n.locale.to_s + + @events.each do |event| + xml.item do + xml.guid event.id + xml.pubDate event.created_at.strftime("%F %T") + xml.title event.name + xml.link request.base_url + "/#!/events/" + event.id.to_s + xml.description event.description + end + end + end +end From 1a0e5519f6c5fe9b1d5b4b628e56ae4defc3c6d8 Mon Sep 17 00:00:00 2001 From: Peng DU Date: Tue, 20 Sep 2016 11:39:49 +0200 Subject: [PATCH 004/289] change groups cache key name --- app/views/api/groups/index.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/api/groups/index.json.jbuilder b/app/views/api/groups/index.json.jbuilder index fb5c92e77..6a8f3029e 100644 --- a/app/views/api/groups/index.json.jbuilder +++ b/app/views/api/groups/index.json.jbuilder @@ -1,3 +1,3 @@ -json.cache! @groups do +json.cache! ['v1', @groups] do json.partial! 'api/groups/group', collection: @groups, as: :group end From 838d9b9542a6bfee37a992d8d8bf6024c6b85f7f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 26 Sep 2016 11:21:25 +0200 Subject: [PATCH 005/289] Release 2.3.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e493ecec1..e02eb9107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog Fab Manager +## v2.3.1 2016 September 26 + +- Fix a bug: group cache filename too long + ## v2.3.0 2016 June 28 - Public API with access management and online documentation From 36524d4cd999e8cf252e628e8f9dcfc520e72088 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 14:08:04 +0200 Subject: [PATCH 006/289] display list of allowed extensions in project's CAD attachments --- CHANGELOG.md | 3 ++- README.md | 23 +++++++++++++++++++ .../controllers/projects.coffee.erb | 19 +++++++++------ app/assets/javascripts/router.coffee.erb | 6 +++++ .../javascripts/services/project.coffee | 4 ++++ app/assets/templates/projects/_form.html.erb | 22 ++++++++++-------- app/controllers/api/projects_controller.rb | 4 ++++ app/models/project_cao.rb | 10 +------- app/uploaders/project_cao_uploader.rb | 2 +- config/application.yml.default | 3 +++ config/locales/app.shared.en.yml | 1 + config/locales/app.shared.fr.yml | 1 + config/routes.rb | 3 ++- 13 files changed, 73 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1d758255..e5a3aa95e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - Admins can toggle reminders on/off and customize the delay - More file types allowed as project CAD attachements - Project CAD attachements are now checked by MIME type in addition of extension check +- Project CAD attachement allowed are now configured in environment variables - Display strategy's name in SSO providers list - SSO: documentation improved with an usage example - SSO: mapped fields display their data type. Integers, booleans and dates allow some transformations. @@ -56,7 +57,7 @@ - [TODO DEPLOY] `rake fablab:es_add_event_filters` - [TODO DEPLOY] `rake db:migrate` - [TODO DEPLOY] `bundle install` -- [TODO DEPLOY] add `EXCEL_DATE_FORMAT` environment variable in `application.yml` +- [TODO DEPLOY] add `EXCEL_DATE_FORMAT`, `ALLOWED_EXTENSIONS` and `ALLOWED_MIME_TYPES` environment variable in `application.yml` - [OPTIONAL] `rake fablab:fix:assign_category_to_uncategorized_events` (will put every non-categorized events into a new category called "No Category", to ease re-categorization) ## v2.3.1 2016 September 26 diff --git a/README.md b/README.md index 058494c52..743887833 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,29 @@ Retrieve them from https://apps.twitter.com This is optional. You can follow [this guide to get your personal App ID](https://developers.facebook.com/docs/apps/register). If you do so, you'll be able to customize and get statistics about project shares on Facebook. + LOG_LEVEL + +This parameter configures the logs verbosity. +Available log levels can be found [here](http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels). + + ALLOWED_EXTENSIONS + +Exhaustive list of file's extensions available for public upload as project's CAO attachements. +Each item in the list must be separated from the others by a space char. +You will probably want to check that this list match the `ALLOWED_MIME_TYPES` values below. +Please consider that allowing file archives (eg. ZIP) or binary executable (eg. EXE) may result in a **dangerous** security issue and must be avoided in any cases. + + ALLOWED_MIME_TYPES + +Exhaustive list of file's mime-types available for public upload as project's CAO attachements. +Each item in the list must be separated from the others by a space char. +You will probably want to check that this list match the `ALLOWED_EXTENSIONS` values above. +Please consider that allowing file archives (eg. application/zip) or binary executable (eg. application/exe) may result in a **dangerous** security issue and must be avoided in any cases. + + Settings related to Open Projects + +See the [Open Projects](#open-projects) section for a detailed description of these parameters. + Settings related to i18n See the [Settings](#i18n-settings) section of the [Internationalization (i18n)](#i18n) paragraph for a detailed description of these parameters. diff --git a/app/assets/javascripts/controllers/projects.coffee.erb b/app/assets/javascripts/controllers/projects.coffee.erb index a30a96d9a..c34e97e4d 100644 --- a/app/assets/javascripts/controllers/projects.coffee.erb +++ b/app/assets/javascripts/controllers/projects.coffee.erb @@ -12,6 +12,7 @@ # - $scope.components = [{Component}] # - $scope.themes = [{Theme}] # - $scope.licences = [{Licence}] +# - $scope.allowedExtensions = [{String}] # - $scope.submited(content) # - $scope.cancel() # - $scope.addFile() @@ -26,7 +27,7 @@ # - $state (Ui-Router) [ 'app.public.projects_show', 'app.public.projects_list' ] ## class ProjectsController - constructor: ($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, _t)-> + constructor: ($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t)-> ## Retrieve the list of machines from the server Machine.query().$promise.then (data)-> @@ -52,8 +53,12 @@ class ProjectsController id: d.id name: d.name + ## Total number of documentation steps for the current project $scope.totalSteps = $scope.project.project_steps_attributes.length + ## List of extensions allowed for CAD attachements upload + $scope.allowedExtensions = allowedExtensions + ## @@ -315,8 +320,8 @@ Application.Controllers.controller "ProjectsController", ["$scope", "$state", 'P ## # Controller used in the project creation page ## -Application.Controllers.controller "NewProjectController", ["$scope", "$state", 'Project', 'Machine', 'Member', 'Component', 'Theme', 'Licence', '$document', 'CSRF', 'Diacritics', 'dialogs', '_t' -, ($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, CSRF, Diacritics, dialogs, _t) -> +Application.Controllers.controller "NewProjectController", ["$scope", "$state", 'Project', 'Machine', 'Member', 'Component', 'Theme', 'Licence', '$document', 'CSRF', 'Diacritics', 'dialogs', 'allowedExtensions', '_t' +, ($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, CSRF, Diacritics, dialogs, allowedExtensions, _t) -> CSRF.setMetaTags() ## API URL where the form will be posted @@ -333,7 +338,7 @@ Application.Controllers.controller "NewProjectController", ["$scope", "$state", $scope.matchingMembers = [] ## Using the ProjectsController - new ProjectsController($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, _t) + new ProjectsController($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t) ] @@ -341,8 +346,8 @@ Application.Controllers.controller "NewProjectController", ["$scope", "$state", ## # Controller used in the project edition page ## -Application.Controllers.controller "EditProjectController", ["$scope", "$state", '$stateParams', 'Project', 'Machine', 'Member', 'Component', 'Theme', 'Licence', '$document', 'CSRF', 'projectPromise', 'Diacritics', 'dialogs', '_t' -, ($scope, $state, $stateParams, Project, Machine, Member, Component, Theme, Licence, $document, CSRF, projectPromise, Diacritics, dialogs, _t) -> +Application.Controllers.controller "EditProjectController", ["$scope", "$state", '$stateParams', 'Project', 'Machine', 'Member', 'Component', 'Theme', 'Licence', '$document', 'CSRF', 'projectPromise', 'Diacritics', 'dialogs', 'allowedExtensions', '_t' +, ($scope, $state, $stateParams, Project, Machine, Member, Component, Theme, Licence, $document, CSRF, projectPromise, Diacritics, dialogs, allowedExtensions, _t) -> CSRF.setMetaTags() ## API URL where the form will be posted @@ -359,7 +364,7 @@ Application.Controllers.controller "EditProjectController", ["$scope", "$state", name: u.full_name ## Using the ProjectsController - new ProjectsController($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, _t) + new ProjectsController($scope, $state, Project, Machine, Member, Component, Theme, Licence, $document, Diacritics, dialogs, allowedExtensions, _t) ] diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index 8d5984205..5d7f16cc0 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -270,6 +270,9 @@ angular.module('application.router', ['ui.router']). templateUrl: '<%= asset_path "projects/new.html" %>' controller: 'NewProjectController' resolve: + allowedExtensions: ['Project', (Project)-> + Project.allowedExtensions().$promise + ] translations: [ 'Translations', (Translations) -> Translations.query(['app.logged.projects_new', 'app.shared.project']).$promise ] @@ -296,6 +299,9 @@ angular.module('application.router', ['ui.router']). projectPromise: ['$stateParams', 'Project', ($stateParams, Project)-> Project.get(id: $stateParams.id).$promise ] + allowedExtensions: ['Project', (Project)-> + Project.allowedExtensions().$promise + ] translations: [ 'Translations', (Translations) -> Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise ] diff --git a/app/assets/javascripts/services/project.coffee b/app/assets/javascripts/services/project.coffee index 96c993506..7cfbaeab6 100644 --- a/app/assets/javascripts/services/project.coffee +++ b/app/assets/javascripts/services/project.coffee @@ -11,4 +11,8 @@ Application.Services.factory 'Project', ["$resource", ($resource)-> method: 'GET' url: '/api/projects/search' isArray: false + allowedExtensions: + method: 'GET' + url: '/api/projects/allowed_extensions' + isArray: true ] diff --git a/app/assets/templates/projects/_form.html.erb b/app/assets/templates/projects/_form.html.erb index e660e0501..8c75407e4 100644 --- a/app/assets/templates/projects/_form.html.erb +++ b/app/assets/templates/projects/_form.html.erb @@ -42,18 +42,22 @@
- - +
+ + -
-
- {{file.attachment}} +
+
+ {{file.attachment}} +
+ {{ 'browse' }} + {{ 'change' }} +
- {{ 'browse' }} - {{ 'change' }} -
- +
+ +
{{ 'add_a_new_file' | translate }}
diff --git a/app/controllers/api/projects_controller.rb b/app/controllers/api/projects_controller.rb index 2a6d4fffe..6dcc23b7b 100644 --- a/app/controllers/api/projects_controller.rb +++ b/app/controllers/api/projects_controller.rb @@ -57,6 +57,10 @@ class API::ProjectsController < API::ApiController render :index end + def allowed_extensions + render json: ENV['ALLOWED_EXTENSIONS'].split(' '), status: :ok + end + private def set_project @project = Project.find(params[:id]) diff --git a/app/models/project_cao.rb b/app/models/project_cao.rb index 49fe45248..a394a7811 100644 --- a/app/models/project_cao.rb +++ b/app/models/project_cao.rb @@ -2,13 +2,5 @@ class ProjectCao < Asset mount_uploader :attachment, ProjectCaoUploader validates :attachment, file_size: { maximum: 20.megabytes.to_i } - validates :attachment, :file_mime_type => { - :content_type => %w(application/pdf application/postscript application/illustrator - image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg - application/octet-stream application/step application/iges model/iges x-world/x-3dmf - application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document - image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp - application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex - application/x-latex) - } + validates :attachment, :file_mime_type => { :content_type => ENV['ALLOWED_MIME_TYPES'].split(' ') } end diff --git a/app/uploaders/project_cao_uploader.rb b/app/uploaders/project_cao_uploader.rb index 11777d649..fb5e4903e 100644 --- a/app/uploaders/project_cao_uploader.rb +++ b/app/uploaders/project_cao_uploader.rb @@ -39,7 +39,7 @@ class ProjectCaoUploader < CarrierWave::Uploader::Base # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_white_list - %w(pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps) + ENV['ALLOWED_EXTENSIONS'].split(' ') end # Override the filename of the uploaded files: diff --git a/config/application.yml.default b/config/application.yml.default index 723fb39b1..c46ee4815 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -56,3 +56,6 @@ OPENLAB_APP_ID: OPENLAB_BASE_URI: 'https://openprojects.fab-manager.com' LOG_LEVEL: 'debug' + +ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps +ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex diff --git a/config/locales/app.shared.en.yml b/config/locales/app.shared.en.yml index d76a8ffec..c8d06c2f5 100644 --- a/config/locales/app.shared.en.yml +++ b/config/locales/app.shared.en.yml @@ -128,6 +128,7 @@ en: illustration: "Illustration" add_an_illustration: "Add an illustration" CAD_file: "CAD file" + allowed_extensions: "Allowed extensions:" add_a_new_file: "Add a new file" steps: "Steps" step_title: "Step title" diff --git a/config/locales/app.shared.fr.yml b/config/locales/app.shared.fr.yml index a10871241..8e18fe73a 100644 --- a/config/locales/app.shared.fr.yml +++ b/config/locales/app.shared.fr.yml @@ -128,6 +128,7 @@ fr: illustration: "Illustration" add_an_illustration: "Ajouter un visuel" CAD_file: "Fichier CAO" + allowed_extensions: "Extensions autorisées :" add_a_new_file: "Ajouter un nouveau fichier" steps: "Étapes" step_title: "Titre de l'étape" diff --git a/config/routes.rb b/config/routes.rb index 66ac9ce89..bfcaac9f6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,10 +26,11 @@ Rails.application.routes.draw do root 'application#index' namespace :api, as: nil, defaults: { format: :json } do - resources :projects, only: [:index, :last_published, :show, :create, :update, :destroy] do + resources :projects, only: [:index, :show, :create, :update, :destroy] do collection do get :last_published get :search + get :allowed_extensions end end resources :openlab_projects, only: :index From d45ca7213f4454a7b28f2e7aa6378eebafa3fde1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 14:10:00 +0200 Subject: [PATCH 007/289] updated changelog --- CHANGELOG.md | 1 + app/assets/templates/projects/_form.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5a3aa95e..326391584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - More file types allowed as project CAD attachements - Project CAD attachements are now checked by MIME type in addition of extension check - Project CAD attachement allowed are now configured in environment variables +- Project CAD attachement extensions allowed are shown next to input field - Display strategy's name in SSO providers list - SSO: documentation improved with an usage example - SSO: mapped fields display their data type. Integers, booleans and dates allow some transformations. diff --git a/app/assets/templates/projects/_form.html.erb b/app/assets/templates/projects/_form.html.erb index 8c75407e4..94a88a8a8 100644 --- a/app/assets/templates/projects/_form.html.erb +++ b/app/assets/templates/projects/_form.html.erb @@ -56,7 +56,7 @@
- +
{{ 'add_a_new_file' | translate }} From 9a71dc5ea2aeffd124410ee426cb3b5148ca6512 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 14:56:57 +0200 Subject: [PATCH 008/289] trainings monitoring: open current year/month by default on training selection --- .../javascripts/controllers/admin/trainings.coffee.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/controllers/admin/trainings.coffee.erb b/app/assets/javascripts/controllers/admin/trainings.coffee.erb index 815bf8026..6ae3e12ab 100644 --- a/app/assets/javascripts/controllers/admin/trainings.coffee.erb +++ b/app/assets/javascripts/controllers/admin/trainings.coffee.erb @@ -298,6 +298,13 @@ Application.Controllers.controller "TrainingsAdminController", ["$scope", "$stat $scope.selectTrainingToMonitor = -> Training.availabilities {id: $scope.monitoring.training.id}, (training) -> $scope.groupedAvailabilities = groupAvailabilities([training]) + # we open current year/month by default + now = moment() + $scope.accordions[training.name] = {} + $scope.accordions[training.name][now.year()] = + isOpenFirst: true + $scope.accordions[training.name][now.year()][now.month()] = + isOpenFirst: true From b715078e83fac37fc018f5df348e2b06a02f9caa Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 15:32:49 +0200 Subject: [PATCH 009/289] [admin] button to delete training from view + confirmation on machine/training deletion from view --- .../controllers/machines.coffee.erb | 20 ++++++++----- .../controllers/trainings.coffee.erb | 28 ++++++++++++++++++- app/assets/templates/trainings/show.html.erb | 1 + config/locales/app.public.en.yml | 6 +++- config/locales/app.public.fr.yml | 4 +++ 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/controllers/machines.coffee.erb b/app/assets/javascripts/controllers/machines.coffee.erb index 12af6cb96..1144abe3f 100644 --- a/app/assets/javascripts/controllers/machines.coffee.erb +++ b/app/assets/javascripts/controllers/machines.coffee.erb @@ -231,8 +231,8 @@ Application.Controllers.controller "EditMachineController", ["$scope", '$state', ## # Controller used in the machine details page (public) ## -Application.Controllers.controller "ShowMachineController", ['$scope', '$state', '$uibModal', '$stateParams', '_t', 'Machine', 'growl', 'machinePromise' -, ($scope, $state, $uibModal, $stateParams, _t, Machine, growl, machinePromise) -> +Application.Controllers.controller "ShowMachineController", ['$scope', '$state', '$uibModal', '$stateParams', '_t', 'Machine', 'growl', 'machinePromise', 'dialogs' +, ($scope, $state, $uibModal, $stateParams, _t, Machine, growl, machinePromise, dialogs) -> ## Retrieve the details for the machine id in the URL, if an error occurs redirect the user to the machines list $scope.machine = machinePromise @@ -245,11 +245,17 @@ Application.Controllers.controller "ShowMachineController", ['$scope', '$state', if $scope.currentUser.role isnt 'admin' console.error _t('unauthorized_operation') else - # delete the machine then redirect to the machines listing - machine.$delete -> - $state.go('app.public.machines_list') - , (error)-> - growl.warning(_t('the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users')) + dialogs.confirm + resolve: + object: -> + title: _t('confirmation_required') + msg: _t('do_you_really_want_to_delete_this_machine') + , -> # deletion confirmed + # delete the machine then redirect to the machines listing + machine.$delete -> + $state.go('app.public.machines_list') + , (error)-> + growl.warning(_t('the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users')) ## # Callback to book a reservation for the current machine ## diff --git a/app/assets/javascripts/controllers/trainings.coffee.erb b/app/assets/javascripts/controllers/trainings.coffee.erb index e7e955351..c712583ad 100644 --- a/app/assets/javascripts/controllers/trainings.coffee.erb +++ b/app/assets/javascripts/controllers/trainings.coffee.erb @@ -26,17 +26,43 @@ Application.Controllers.controller "TrainingsController", ['$scope', '$state', ' ## # Public view of a specific training ## -Application.Controllers.controller "ShowTrainingController", ['$scope', '$state', 'trainingPromise', ($scope, $state, trainingPromise) -> +Application.Controllers.controller "ShowTrainingController", ['$scope', '$state', 'trainingPromise', 'growl', '_t', 'dialogs', ($scope, $state, trainingPromise, growl, _t, dialogs) -> ## Current training $scope.training = trainingPromise + + + ## + # Callback to delete the current training (admins only) + ## + $scope.delete = (training) -> + # check the permissions + if $scope.currentUser.role isnt 'admin' + console.error _t('unauthorized_operation') + else + dialogs.confirm + resolve: + object: -> + title: _t('confirmation_required') + msg: _t('do_you_really_want_to_delete_this_training') + , -> # deletion confirmed + # delete the training then redirect to the trainings listing + training.$delete -> + $state.go('app.public.trainings_list') + , (error)-> + growl.warning(_t('the_training_cant_be_deleted_because_it_is_already_reserved_by_some_users')) + + + ## # Callback for the 'reserve' button ## $scope.reserveTraining = (training, event) -> $state.go('app.logged.trainings_reserve', {id: training.id}) + + ## # Revert view to the full list of trainings ("<-" button) ## diff --git a/app/assets/templates/trainings/show.html.erb b/app/assets/templates/trainings/show.html.erb index 2c470c4ad..c1ef7f3bc 100644 --- a/app/assets/templates/trainings/show.html.erb +++ b/app/assets/templates/trainings/show.html.erb @@ -18,6 +18,7 @@ {{ 'book_this_training' }} {{ 'edit' | translate }} + diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index 411ff6589..296d8fa3d 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -179,7 +179,8 @@ en: files_to_download: "Files to download" projects_using_the_machine: "Projects using the machine" _or_the_: " or the " - unauthorized_operation: "Unauthoried operation" + do_you_really_want_to_delete_this_machine: "Do you really want to delete this machine?" + unauthorized_operation: "Unauthorized operation" the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users: "The machine can't be deleted because it's already reserved by some users." trainings_list: @@ -189,6 +190,9 @@ en: training_show: # details of a training book_this_training: "Book this training" + do_you_really_want_to_delete_this_training: "Do you really want to delete this training?" + unauthorized_operation: "Unauthorized operation" + the_training_cant_be_deleted_because_it_is_already_reserved_by_some_users: "The training can't be deleted because it's already reserved by some users." plans: # summary of the subscriptions diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index 10e227a3f..d1a4420b3 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -178,6 +178,7 @@ fr: files_to_download: "Fichiers à télécharger" projects_using_the_machine: "Projets utilisant la machine" _or_the_: " ou la " + do_you_really_want_to_delete_this_machine: "Êtes-vous sur de vouloir supprimer cette machine ?" unauthorized_operation: "Opération non autorisée" the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users: "La machine ne peut pas être supprimée car elle a déjà été réservée par des utilisateurs." @@ -189,6 +190,9 @@ fr: training_show: # détails d'une formation book_this_training: "Réserver cette formation" + do_you_really_want_to_delete_this_training: "Êtes-vous sur de vouloir supprimer cette formation ?" + unauthorized_operation: "Opération non autorisée" + the_training_cant_be_deleted_because_it_is_already_reserved_by_some_users: "La formation ne peut pas être supprimée car elle a déjà été réservée par des utilisateurs." plans: From c27c4372b0cdb755a0915ef216e53d8b176bbce8 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 15:34:30 +0200 Subject: [PATCH 010/289] updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 326391584..814b4bfb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog Fab Manager ## next release +- Ask for confirmation on machine deletion from the public view +- Ability to delete a training from the public view for an admin - Project images will show in full-size on a click - Add a checkbox "I accept to receive informations from the FabLab" on Sign-up dialog and user's profile - Share project with Facebook/Twitter From e48bb88f1f80371b56dadaafc78698d3cc6ba0ef Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 16:00:22 +0200 Subject: [PATCH 011/289] use slug in traning show url --- app/assets/javascripts/controllers/trainings.coffee.erb | 4 ++-- app/controllers/api/trainings_controller.rb | 2 +- app/views/api/trainings/index.json.jbuilder | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/controllers/trainings.coffee.erb b/app/assets/javascripts/controllers/trainings.coffee.erb index c712583ad..d4377c9ab 100644 --- a/app/assets/javascripts/controllers/trainings.coffee.erb +++ b/app/assets/javascripts/controllers/trainings.coffee.erb @@ -12,13 +12,13 @@ Application.Controllers.controller "TrainingsController", ['$scope', '$state', ' # Callback for the 'reserve' button ## $scope.reserveTraining = (training, event) -> - $state.go('app.logged.trainings_reserve', {id: training.id}) + $state.go('app.logged.trainings_reserve', {id: training.slug}) ## # Callback for the 'show' button ## $scope.showTraining = (training) -> - $state.go('app.public.training_show', {id: training.id}) + $state.go('app.public.training_show', {id: training.slug}) ] diff --git a/app/controllers/api/trainings_controller.rb b/app/controllers/api/trainings_controller.rb index a00d0fc4a..45ae39af5 100644 --- a/app/controllers/api/trainings_controller.rb +++ b/app/controllers/api/trainings_controller.rb @@ -17,7 +17,7 @@ class API::TrainingsController < API::ApiController end def show - @training = Training.find(params[:id]) + @training = Training.friendly.find(params[:id]) end def create diff --git a/app/views/api/trainings/index.json.jbuilder b/app/views/api/trainings/index.json.jbuilder index 0ca39d0e3..51550ce1b 100644 --- a/app/views/api/trainings/index.json.jbuilder +++ b/app/views/api/trainings/index.json.jbuilder @@ -2,7 +2,7 @@ role = (current_user and current_user.is_admin?) ? 'admin' : 'user' json.cache! [@trainings, role] do json.array!(@trainings) do |training| - json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places + json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places, :slug json.training_image training.training_image.attachment.large.url if training.training_image json.plan_ids training.plan_ids if role === 'admin' end From 60d60fdd650b9c126c95da2f3189119e22f69edf Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 27 Sep 2016 16:58:57 +0200 Subject: [PATCH 012/289] use slugs in projects URL opened from notifications --- CHANGELOG.md | 1 + .../_notify_admin_when_project_published.json.jbuilder | 2 +- ..._notify_project_author_when_collaborator_valid.json.jbuilder | 2 +- .../_notify_project_collaborator_to_valid.json.jbuilder | 2 +- .../notify_admin_when_project_published.html.erb | 2 +- .../notify_project_author_when_collaborator_valid.html.erb | 2 +- .../notify_project_collaborator_to_valid.html.erb | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 814b4bfb1..c60a1ce26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab Manager ## next release +- Use slugs in projects URL opened from notifications - Ask for confirmation on machine deletion from the public view - Ability to delete a training from the public view for an admin - Project images will show in full-size on a click diff --git a/app/views/api/notifications/_notify_admin_when_project_published.json.jbuilder b/app/views/api/notifications/_notify_admin_when_project_published.json.jbuilder index e90c6daf0..63bee71e1 100644 --- a/app/views/api/notifications/_notify_admin_when_project_published.json.jbuilder +++ b/app/views/api/notifications/_notify_admin_when_project_published.json.jbuilder @@ -1,5 +1,5 @@ json.title notification.notification_type json.description t('.project_NAME_has_been_published_html', - ID: notification.attached_object.id, + ID: notification.attached_object.slug, NAME: notification.attached_object.name) json.url notification_url(notification, format: :json) diff --git a/app/views/api/notifications/_notify_project_author_when_collaborator_valid.json.jbuilder b/app/views/api/notifications/_notify_project_author_when_collaborator_valid.json.jbuilder index 58209d776..d5dc45864 100644 --- a/app/views/api/notifications/_notify_project_author_when_collaborator_valid.json.jbuilder +++ b/app/views/api/notifications/_notify_project_author_when_collaborator_valid.json.jbuilder @@ -1,5 +1,5 @@ json.title notification.notification_type json.description t('.USER_became_collaborator_of_your_project', USER: notification.attached_object.user.profile.full_name) + - " #{notification.attached_object.project.name}." + " #{notification.attached_object.project.name}." json.url notification_url(notification, format: :json) diff --git a/app/views/api/notifications/_notify_project_collaborator_to_valid.json.jbuilder b/app/views/api/notifications/_notify_project_collaborator_to_valid.json.jbuilder index f656f668d..2615f16c6 100644 --- a/app/views/api/notifications/_notify_project_collaborator_to_valid.json.jbuilder +++ b/app/views/api/notifications/_notify_project_collaborator_to_valid.json.jbuilder @@ -1,4 +1,4 @@ json.title notification.notification_type json.description t('.you_are_invited_to_collaborate_on_the_project') + - "#{notification.attached_object.project.name}." + "#{notification.attached_object.project.name}." json.url notification_url(notification, format: :json) diff --git a/app/views/notifications_mailer/notify_admin_when_project_published.html.erb b/app/views/notifications_mailer/notify_admin_when_project_published.html.erb index 0c3486e53..add5528e8 100644 --- a/app/views/notifications_mailer/notify_admin_when_project_published.html.erb +++ b/app/views/notifications_mailer/notify_admin_when_project_published.html.erb @@ -1,3 +1,3 @@ <%= render 'notifications_mailer/shared/hello', recipient: @recipient %> -

<%= t('.body.new_project_published') %> "<%= link_to @attached_object.name, "#{root_url}#!/projects/#{@attached_object.id}" %>"

+

<%= t('.body.new_project_published') %> "<%= link_to @attached_object.name, "#{root_url}#!/projects/#{@attached_object.slug}" %>"

diff --git a/app/views/notifications_mailer/notify_project_author_when_collaborator_valid.html.erb b/app/views/notifications_mailer/notify_project_author_when_collaborator_valid.html.erb index c5141f2fc..1ea34bed0 100644 --- a/app/views/notifications_mailer/notify_project_author_when_collaborator_valid.html.erb +++ b/app/views/notifications_mailer/notify_project_author_when_collaborator_valid.html.erb @@ -1,3 +1,3 @@ <%= render 'notifications_mailer/shared/hello', recipient: @recipient %> -

<%= t('.body.the_member') %> <%= @attached_object.user.profile.full_name %> <%= t(".body.accepted_your_invitation_to_take_part_in_the_project" ) %> <%= link_to @attached_object.project.name, "#{root_url}#!/projects/#{@attached_object.project.id}" %>.

+

<%= t('.body.the_member') %> <%= @attached_object.user.profile.full_name %> <%= t(".body.accepted_your_invitation_to_take_part_in_the_project" ) %> <%= link_to @attached_object.project.name, "#{root_url}#!/projects/#{@attached_object.project.slug}" %>.

diff --git a/app/views/notifications_mailer/notify_project_collaborator_to_valid.html.erb b/app/views/notifications_mailer/notify_project_collaborator_to_valid.html.erb index 1bb99907c..26e5a72ce 100644 --- a/app/views/notifications_mailer/notify_project_collaborator_to_valid.html.erb +++ b/app/views/notifications_mailer/notify_project_collaborator_to_valid.html.erb @@ -1,5 +1,5 @@ <%= render 'notifications_mailer/shared/hello', recipient: @recipient %> -

<%= t(".body.your_are_invited_to_take_part_in_a_project") %> <%= link_to @attached_object.project.name, "#{root_url}#!/projects/#{@attached_object.project.id}" %>.

+

<%= t(".body.your_are_invited_to_take_part_in_a_project") %> <%= link_to @attached_object.project.name, "#{root_url}#!/projects/#{@attached_object.project.slug}" %>.

<%= t(".body.to_accept_the_invitation_click_on_following_link") %> <%= link_to "#{root_url}project_collaborator/#{@attached_object.valid_token}", "#{root_url}project_collaborator/#{@attached_object.valid_token}" %>

From 785e9a42f897ff5e505679b4049f7b694a8a38be Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 28 Sep 2016 10:52:25 +0200 Subject: [PATCH 013/289] test fix asset:precompile --- app/assets/javascripts/controllers/admin/invoices.coffee.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/controllers/admin/invoices.coffee.erb b/app/assets/javascripts/controllers/admin/invoices.coffee.erb index ba6dbdd13..044e8fd05 100644 --- a/app/assets/javascripts/controllers/admin/invoices.coffee.erb +++ b/app/assets/javascripts/controllers/admin/invoices.coffee.erb @@ -133,9 +133,8 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I sample = sample.replace(/X\[([^\]]+)\]/g, (match, p1, offset, string) -> p1 ) - # # information about wallet (W[text]) - does not apply here - # sample = sample.replace(/W\[([^\]]+)\]/g, "") - + # information about wallet (W[text]) - does not apply here + sample = sample.replace(/W\[([^\]]+)\]/g, "") # information about refunds (R[text]) - does not apply here sample = sample.replace(/R\[([^\]]+)\]/g, "") sample From acd6bdad34b275433f24fd7337709827469d02ff Mon Sep 17 00:00:00 2001 From: Peng DU Date: Wed, 28 Sep 2016 11:11:13 +0200 Subject: [PATCH 014/289] update gem coffee-rails --- Gemfile.lock | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b80aa12bb..6e602afad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,13 +94,13 @@ GEM cldr-plurals-runtime-rb (1.0.1) coercible (1.0.0) descendants_tracker (~> 0.0.1) - coffee-rails (4.1.0) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.3.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1) + coffee-script-source (1.10.0) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -157,7 +157,7 @@ GEM multi_json equalizer (0.0.11) erubis (2.7.0) - execjs (2.4.0) + execjs (2.7.0) faker (1.4.3) i18n (~> 0.5) faraday (0.9.1) @@ -222,8 +222,8 @@ GEM twitter_cldr (~> 3.1) mime-types (2.99) mini_magick (4.2.0) - mini_portile2 (2.0.0) - minitest (5.9.0) + mini_portile2 (2.1.0) + minitest (5.9.1) minitest-reporters (1.1.8) ansi builder @@ -241,8 +241,9 @@ GEM net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) netrc (0.10.3) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) notify_with (0.0.2) jbuilder (~> 2.0) rails (>= 4.2.0) @@ -265,6 +266,7 @@ GEM orm_adapter (0.5.0) pdf-core (0.5.1) pg (0.18.1) + pkg-config (1.1.7) prawn (2.0.1) pdf-core (~> 0.5.1) ttfunk (~> 1.4.0) @@ -313,7 +315,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.13.0) - rake (11.1.2) + rake (11.3.0) rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) From 5211880ed58ff5c46a6ce4a339c3becc91a66dd7 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 28 Sep 2016 11:37:36 +0200 Subject: [PATCH 015/289] updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c60a1ce26..4a369f517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ - Fix a bug: UI issues on small devices (dashboard + admin views) - Fix a bug: embedded video not working in training/machine description - Fix a bug: reordering project's steps trigger the unsaved-warning dialog +- Fix a bug: unable to compile assets in Docker with CoffeeScript error - [TODO DEPLOY] `rake fablab:es_build_availabilities_index` - [TODO DEPLOY] `rake fablab:es_add_event_filters` - [TODO DEPLOY] `rake db:migrate` From cd6b279af4499be33ef85d760f6e1ef504863fcc Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 28 Sep 2016 12:00:53 +0200 Subject: [PATCH 016/289] fix typo + updated docker ENV example --- doc/sso_with_github.md | 2 +- docker/env.example | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/sso_with_github.md b/doc/sso_with_github.md index dfe28c8dc..1e6a1555c 100644 --- a/doc/sso_with_github.md +++ b/doc/sso_with_github.md @@ -1,6 +1,6 @@ # How to configure Fab-manager to use a Single Sign-On authentication? -For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as an example authentication provider, because uses OAuth 2.0 which is currently implemented in fab-manager, it has a standard implementation of that protocol and it is free to use for everyone. +For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as an example authentication provider, because it uses OAuth 2.0 which is currently implemented in fab-manager, it has a standard implementation of the protocol and it is free to use for everyone. - First, you must have a GitHub account. This is free, so create one if you don't have any. Visit https://github.com/join?source=login to create an account. diff --git a/docker/env.example b/docker/env.example index 5498510ce..1b56819e4 100644 --- a/docker/env.example +++ b/docker/env.example @@ -55,4 +55,8 @@ OPENLAB_BASE_URI=https://openprojects.fab-manager.com NAVINUM_API_LOGIN: NAVINUM_API_PASSWORD: -LOG_LEVEL=debug \ No newline at end of file +LOG_LEVEL=debug + + +ALLOWED_EXTENSIONS=pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps +ALLOWED_MIME_TYPES=application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex From 99801bb02a752e631621d436a8a1a2ba4b5cae98 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 28 Sep 2016 12:14:21 +0200 Subject: [PATCH 017/289] improved explanation about rebuild assets --- doc/sso_with_github.md | 6 ++++-- lib/tasks/fablab.rake | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/sso_with_github.md b/doc/sso_with_github.md index 1e6a1555c..2e723592e 100644 --- a/doc/sso_with_github.md +++ b/doc/sso_with_github.md @@ -43,7 +43,7 @@ For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as Once you have completed and validated the mapping's line, an information button will be available. A click on it will show you the type of data expected from the API and, in some cases, you'll be able to configure a transformation. - For example, the `Profile.gender` field require a booleanrake diagram:all attribute but your API may return strings like `man / woman`. + For example, the `Profile.gender` field require a boolean attribute but your API may return strings like `man / woman`. In this case, you'll be able to configure a transformation for `man` <-> `true` and `woman` <-> `false`. Now, you are free to map more fields, like `Profile.github` to `html_url`, or `Profile.avatar` to `avatar_url`... @@ -56,7 +56,9 @@ For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as rake fablab:switch_auth_provider[GitHub] ``` -- As the command just prompted you, you have to re-compile the assets (with eg, `rake tmp:clear` - this vary with the method you used to deploy your instance) +- As the command just prompted you, you have to re-compile the assets + - In development, `rake tmp:clear` will do the job. + - In production with Docker, `rm -rf public/assets`, followed by `docker-compose run --rm fabmanager bundle exec rake assets:precompile` - Then restart the web-server or the container. - Finally, to notify all existing users about the change (and send them their migration code/link), run: ```bash diff --git a/lib/tasks/fablab.rake b/lib/tasks/fablab.rake index 907b61713..eaf947e89 100644 --- a/lib/tasks/fablab.rake +++ b/lib/tasks/fablab.rake @@ -207,8 +207,9 @@ namespace :fablab do puts "\n/!\\ WARNING: Please consider the following, otherwise the authentication will be bogus:" puts "\t1) CLEAN the cache with `rake tmp:clear`" - puts "\t2) RESTART the application" - puts "\t3) NOTIFY the current users with `rake fablab:notify_auth_changed`\n\n" + puts "\t2) REBUILD the assets with `rake assets:precompile`" + puts "\t3) RESTART the application" + puts "\t4) NOTIFY the current users with `rake fablab:notify_auth_changed`\n\n" end From a0fef8d046affaab2441cdbc80ed4bd05b6cc755 Mon Sep 17 00:00:00 2001 From: cyril Date: Wed, 28 Sep 2016 13:58:22 +0200 Subject: [PATCH 018/289] bug fix: not to force https in env production for root_url helper --- app/controllers/application_controller.rb | 2 +- .../notifications/_notify_admin_export_complete.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a333e4b71..8d8e8cc66 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base end def default_url_options - Rails.env.production? ? { protocol: 'https' } : {} + { :host => Rails.application.secrets.default_host, protocol: Rails.application.secrets.default_protocol } end def permission_denied diff --git a/app/views/api/notifications/_notify_admin_export_complete.json.jbuilder b/app/views/api/notifications/_notify_admin_export_complete.json.jbuilder index 7c219d70c..02f24df29 100644 --- a/app/views/api/notifications/_notify_admin_export_complete.json.jbuilder +++ b/app/views/api/notifications/_notify_admin_export_complete.json.jbuilder @@ -2,5 +2,5 @@ json.title notification.notification_type json.description t('.export')+' '+ t(".#{notification.attached_object.category}_#{notification.attached_object.export_type}")+' '+ t('.is_over')+' '+ - link_to( t('.download_here'), "#{root_url}api/exports/#{notification.attached_object.id}/download" )+'.' + link_to( t('.download_here'), "api/exports/#{notification.attached_object.id}/download" )+'.' json.url notification_url(notification, format: :json) \ No newline at end of file From 57cb6c4fbe19b0aed1faf1569e018c6eb15318c9 Mon Sep 17 00:00:00 2001 From: cyril Date: Wed, 28 Sep 2016 18:55:40 +0200 Subject: [PATCH 019/289] fix default level_log config --- config/environments/production.rb | 2 +- config/environments/staging.rb | 2 +- config/environments/test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 634bd4a48..5175c8719 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -46,7 +46,7 @@ Rails.application.configure do # config.force_ssl = true # Set to :debug to see everything in the log. - config.log_level = Rails.application.secrets.log_level || :debug + config.log_level = Rails.application.secrets.log_level.blank? ? :debug : Rails.application.secrets.log_level # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 71a8ceeb6..067ea2d1d 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -46,7 +46,7 @@ Rails.application.configure do # config.force_ssl = true # Set to :debug to see everything in the log. - config.log_level = Rails.application.secrets.log_level || :debug + config.log_level = Rails.application.secrets.log_level.blank? ? :debug : Rails.application.secrets.log_level # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] diff --git a/config/environments/test.rb b/config/environments/test.rb index c4634c92c..23135c381 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -41,5 +41,5 @@ Rails.application.configure do config.active_support.test_order = :random - config.log_level = Rails.application.secrets.log_level || :debug + config.log_level = Rails.application.secrets.log_level.blank? ? :debug : Rails.application.secrets.log_level end From c2d2786515b0754530f346f1b4ef4015c272e600 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Sep 2016 10:02:31 +0200 Subject: [PATCH 020/289] fix default_host for dev and test environments --- .../controllers/application.coffee.erb | 17 +++++++++-------- config/secrets.yml | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/controllers/application.coffee.erb b/app/assets/javascripts/controllers/application.coffee.erb index 043bfbab6..095c50892 100644 --- a/app/assets/javascripts/controllers/application.coffee.erb +++ b/app/assets/javascripts/controllers/application.coffee.erb @@ -23,14 +23,15 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco # @param user {Object} Rails/Devise user ## $scope.setCurrentUser = (user) -> - $rootScope.currentUser = user - Session.create(user); - getNotifications() - # fab-manager's app-version - if user.role == 'admin' - $scope.version = Version.get() - else - $scope.version = {version: ''} + unless angular.isUndefinedOrNull(user) + $rootScope.currentUser = user + Session.create(user); + getNotifications() + # fab-manager's app-version + if user.role == 'admin' + $scope.version = Version.get() + else + $scope.version = {version: ''} ## diff --git a/config/secrets.yml b/config/secrets.yml index 9a835c283..fc6fcaebe 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -17,6 +17,8 @@ development: stripe_currency: <%= ENV["STRIPE_CURRENCY"] %> disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %> fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %> + default_host: <%= ENV["DEFAULT_HOST"] %> + default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> 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 @@ -45,6 +47,8 @@ test: stripe_currency: usd disqus_shortname: fablab-sleede fablab_without_plans: false + default_host: <%= ENV["DEFAULT_HOST"] %> + default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> time_zone: Paris week_starting_day: monday d3_date_format: '%d/%m/%y' From c6cf40f7ccaf28842ab48c08b56af462f2c5e13a Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Sep 2016 10:04:37 +0200 Subject: [PATCH 021/289] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a369f517..703fbf4a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ - Fix a bug: embedded video not working in training/machine description - Fix a bug: reordering project's steps trigger the unsaved-warning dialog - Fix a bug: unable to compile assets in Docker with CoffeeScript error +- Fix a bug: do not force HTTPS for URLs in production environments - [TODO DEPLOY] `rake fablab:es_build_availabilities_index` - [TODO DEPLOY] `rake fablab:es_add_event_filters` - [TODO DEPLOY] `rake db:migrate` From 34ad1c905604368425cedc5c81fbe4dabfeb0f38 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Sep 2016 10:53:20 +0200 Subject: [PATCH 022/289] move RSS code into separate folders --- app/controllers/rss/events_controller.rb | 9 +++++++++ app/controllers/rss/projects_controller.rb | 7 +++++++ app/controllers/rss/rss_controller.rb | 4 ++++ app/views/api/events/index.rss.builder | 21 -------------------- app/views/api/projects/index.rss.builder | 23 ---------------------- app/views/rss/events/index.rss.builder | 22 +++++++++++++++++++++ app/views/rss/projects/index.rss.builder | 23 ++++++++++++++++++++++ config/routes.rb | 7 +++++++ 8 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 app/controllers/rss/events_controller.rb create mode 100644 app/controllers/rss/projects_controller.rb create mode 100644 app/controllers/rss/rss_controller.rb delete mode 100644 app/views/api/events/index.rss.builder delete mode 100644 app/views/api/projects/index.rss.builder create mode 100644 app/views/rss/events/index.rss.builder create mode 100644 app/views/rss/projects/index.rss.builder diff --git a/app/controllers/rss/events_controller.rb b/app/controllers/rss/events_controller.rb new file mode 100644 index 000000000..735a707ec --- /dev/null +++ b/app/controllers/rss/events_controller.rb @@ -0,0 +1,9 @@ +class Rss::EventsController < Rss::RssController + + def index + @events = Event.includes(:event_image, :event_files, :availability, :category) + .where('availabilities.start_at >= ?', Time.now) + .order('availabilities.start_at ASC').references(:availabilities).limit(10) + @fab_name = Setting.find_by(name: 'fablab_name').value + end +end diff --git a/app/controllers/rss/projects_controller.rb b/app/controllers/rss/projects_controller.rb new file mode 100644 index 000000000..75a9736ea --- /dev/null +++ b/app/controllers/rss/projects_controller.rb @@ -0,0 +1,7 @@ +class Rss::ProjectsController < Rss::RssController + + def index + @projects = Project.includes(:project_image, :users).published.order('created_at desc').limit(10) + @fab_name = Setting.find_by(name: 'fablab_name').value + end +end diff --git a/app/controllers/rss/rss_controller.rb b/app/controllers/rss/rss_controller.rb new file mode 100644 index 000000000..d9e32442a --- /dev/null +++ b/app/controllers/rss/rss_controller.rb @@ -0,0 +1,4 @@ +class Rss::RssController < ApplicationController + + +end diff --git a/app/views/api/events/index.rss.builder b/app/views/api/events/index.rss.builder deleted file mode 100644 index b6dff9674..000000000 --- a/app/views/api/events/index.rss.builder +++ /dev/null @@ -1,21 +0,0 @@ -#encoding: UTF-8 - -xml.instruct! :xml, version: "1.0" -xml.rss version: "2.0" do - xml.channel do - xml.title "#{t('app.public.events_list.the_fablab_s_courses_and_workshops')} - #{Setting.find_by(name: 'fablab_name').value}" - xml.author Setting.find_by(name: 'fablab_name').value - xml.link request.base_url + "/#!/events" - xml.language I18n.locale.to_s - - @events.each do |event| - xml.item do - xml.guid event.id - xml.pubDate event.created_at.strftime("%F %T") - xml.title event.name - xml.link request.base_url + "/#!/events/" + event.id.to_s - xml.description event.description - end - end - end -end diff --git a/app/views/api/projects/index.rss.builder b/app/views/api/projects/index.rss.builder deleted file mode 100644 index c9579e36b..000000000 --- a/app/views/api/projects/index.rss.builder +++ /dev/null @@ -1,23 +0,0 @@ -#encoding: UTF-8 - -xml.instruct! :xml, version: "1.0" -xml.rss version: "2.0" do - xml.channel do - xml.title "#{t('app.public.projects_list.the_fablab_projects')} - #{Setting.find_by(name: 'fablab_name').value}" - xml.description t('app.public.projects_list.all_projects') - xml.author Setting.find_by(name: 'fablab_name').value - xml.link request.base_url + "/#!/projects" - xml.language I18n.locale.to_s - - @projects.each do |project| - xml.item do - xml.guid project.id - xml.pubDate project.created_at.strftime("%F %T") - xml.title project.name - xml.link request.base_url + "/#!/projects/" + project.slug - xml.author project.author.first_name - xml.description project.description - end - end - end -end diff --git a/app/views/rss/events/index.rss.builder b/app/views/rss/events/index.rss.builder new file mode 100644 index 000000000..bb5653122 --- /dev/null +++ b/app/views/rss/events/index.rss.builder @@ -0,0 +1,22 @@ +#encoding: UTF-8 + +xml.instruct! :xml, version: '1.0' +xml.rss version: '2.0' 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') + xml.author @fab_name + xml.link root_url + '#!/events' + xml.language I18n.locale.to_s + + @events.each do |event| + xml.item do + xml.guid event.id + xml.pubDate event.created_at.strftime('%F %T') + xml.title event.name + xml.link root_url + '#!/events/' + event.id.to_s + xml.description event.description + end + end + end +end diff --git a/app/views/rss/projects/index.rss.builder b/app/views/rss/projects/index.rss.builder new file mode 100644 index 000000000..bc7ac0c92 --- /dev/null +++ b/app/views/rss/projects/index.rss.builder @@ -0,0 +1,23 @@ +#encoding: UTF-8 + +xml.instruct! :xml, version: '1.0' +xml.rss version: '2.0' do + xml.channel do + xml.title "#{t('app.public.projects_list.the_fablab_projects')} - #{@fab_name}" + xml.description t('app.public.home.latest_documented_projects') + xml.author @fab_name + xml.link root_url + '#!/projects' + xml.language I18n.locale.to_s + + @projects.each do |project| + xml.item do + xml.guid project.id + 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.description project.description + end + end + end +end diff --git a/config/routes.rb b/config/routes.rb index bfcaac9f6..60eeaad7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -132,6 +132,13 @@ Rails.application.routes.draw do get 'version' => 'version#show' end + # rss + + namespace :rss, as: nil, defaults: { format: :xml } do + resources :projects, only: [:index] + resources :events, only: [:index] + end + # open_api namespace :open_api do From 1ef2c113556077ed6e7bf8835e17d1a2fa1f5a2f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 29 Sep 2016 11:54:08 +0200 Subject: [PATCH 023/289] add links to RSS feeds into application header --- app/assets/templates/projects/index.html.erb | 2 +- app/views/application/index.html.erb | 3 +++ app/views/rss/events/{index.rss.builder => index.xml.builder} | 0 .../rss/projects/{index.rss.builder => index.xml.builder} | 0 config/routes.rb | 4 ++-- 5 files changed, 6 insertions(+), 3 deletions(-) rename app/views/rss/events/{index.rss.builder => index.xml.builder} (100%) rename app/views/rss/projects/{index.rss.builder => index.xml.builder} (100%) diff --git a/app/assets/templates/projects/index.html.erb b/app/assets/templates/projects/index.html.erb index 9e8ccf43a..5baef2d01 100644 --- a/app/assets/templates/projects/index.html.erb +++ b/app/assets/templates/projects/index.html.erb @@ -90,7 +90,7 @@
- +
diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb index 488a7734a..e505d194a 100644 --- a/app/views/application/index.html.erb +++ b/app/views/application/index.html.erb @@ -65,6 +65,9 @@ <% end %> + + + information Not sure if this helps but information does not require an `s`. :) Signed-off-by: Kenneth Lim --- LICENSE.md | 8 ++--- README.md | 32 +++++++++---------- app/assets/javascripts/app.js.erb | 2 +- .../controllers/admin/graphs.coffee | 2 +- .../controllers/admin/invoices.coffee.erb | 6 ++-- .../controllers/machines.coffee.erb | 2 +- .../javascripts/controllers/members.coffee | 12 +++---- .../javascripts/controllers/profile.coffee | 6 ++-- .../controllers/trainings.coffee.erb | 2 +- .../templates/admin/plans/_form.html.erb | 4 +-- app/assets/templates/events/show.html.erb | 2 +- app/assets/templates/plans/index.html.erb | 2 +- .../templates/shared/_member_form.html.erb | 2 +- app/models/user.rb | 2 +- app/pdfs/pdf/invoice.rb | 8 ++--- ...otify_admin_profile_complete.json.jbuilder | 4 +-- ...otify_admin_when_user_is_imported.html.erb | 2 +- config/locales/app.public.en.yml | 4 +-- config/locales/app.public.fr.yml | 6 ++-- config/locales/app.shared.en.yml | 4 +-- config/locales/en.yml | 4 +-- config/locales/mails.en.yml | 2 +- config/locales/mails.fr.yml | 2 +- doc/sso_with_github.md | 22 ++++++------- 24 files changed, 71 insertions(+), 71 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index f2d5d21c0..5cf8fc853 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -39,14 +39,14 @@ Some other used libraries/components are licenced under the terms of the Errors and omissions excepted, the other external libraries used in this project are licenced under the terms of the [MIT Licence](https://opensource.org/licenses/MIT). -Please refer to the libraries documentation for more informations about -their licences. +Please refer to the libraries documentation for more information about +their licences. Complete lists of used libraries are available in `bower.json` for the EcmaScript libraries and in `Gemfile` for Ruby libraries. - + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 @@ -666,4 +666,4 @@ an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md index 743887833..683e1bc60 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ This value is only used when deploying with Docker, otherwise this is configured POSTGRES_PASSWORD Password for the PostgreSQL user, as specified in `database.yml`. -Please see [Setup the FabManager database in PostgreSQL](#setup-fabmanager-in-postgresql) for informations on how to create a user and set his password. +Please see [Setup the FabManager database in PostgreSQL](#setup-fabmanager-in-postgresql) for information on how to create a user and set his password. This value is only used when deploying with Docker, otherwise this is configured in `config/database.yml`. REDIS_HOST @@ -222,11 +222,11 @@ Identifier of your Google Analytics account. Unique identifier of your [Disqus](http://www.disqus.com) forum. Disqus forums are used to allow visitors to comment on projects. -See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more informations. +See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more information. TWITTER_NAME -Identifier of the Twitter account, from witch the last tweet will be fetched and displayed on the home page. +Identifier of the Twitter account, from witch the last tweet will be fetched and displayed on the home page. It will also be used for [Twitter Card analytics](https://dev.twitter.com/cards/analytics). TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN & TWITTER_ACCESS_TOKEN_SECRET @@ -241,8 +241,8 @@ If you do so, you'll be able to customize and get statistics about project share LOG_LEVEL -This parameter configures the logs verbosity. -Available log levels can be found [here](http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels). +This parameter configures the logs verbosity. +Available log levels can be found [here](http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels). ALLOWED_EXTENSIONS @@ -361,7 +361,7 @@ To create it, please follow these instructions: ALTER USER sleede WITH ENCRYPTED PASSWORD 'sleede'; ``` 6. Finally, have a look at the [PostgreSQL Limitations](#postgresql-limitations) section or some errors will occurs preventing you from finishing the installation procedure. - + ### PostgreSQL Limitations @@ -370,14 +370,14 @@ To create it, please follow these instructions: So here's your choices, mainly depending on your security requirements: - Use the default PostgreSQL super-user (postgres) as the database user of fab-manager. - Set your user as _SUPERUSER_; run the following command in `psql` (after replacing `sleede` with you user name): - + ```sql ALTER USER sleede WITH SUPERUSER; ``` - - - Install and configure the PostgreSQL extension [pgextwlist](https://github.com/dimitri/pgextwlist). + + - Install and configure the PostgreSQL extension [pgextwlist](https://github.com/dimitri/pgextwlist). Please follow the instructions detailed on the extension website to whitelist `unaccent` and `trigram` for the user configured in `config/database.yml`. -- Some users may want to use another DBMS than PostgreSQL. +- Some users may want to use another DBMS than PostgreSQL. This is currently not supported, because of some PostgreSQL specific instructions that cannot be efficiently handled with the ActiveRecord ORM: - `app/controllers/api/members_controllers.rb@list` is using `ILIKE` - `app/controllers/api/invoices_controllers.rb@list` is using `ILIKE` and `date_trunc()` @@ -386,8 +386,8 @@ To create it, please follow these instructions: - `db/migrate/20150604131525_add_meta_data_to_notifications.rb` is using [jsonb](https://www.postgresql.org/docs/9.4/static/datatype-json.html), a PostgreSQL 9.4+ datatype. - `db/migrate/20160915105234_add_transformation_to_o_auth2_mapping.rb` is using [jsonb](https://www.postgresql.org/docs/9.4/static/datatype-json.html), a PostgreSQL 9.4+ datatype. - If you intend to contribute to the project code, you will need to run the test suite with `rake test`. - This also requires your user to have the _SUPERUSER_ role. - Please see the [known issues](#known-issues) section for more informations about this. + This also requires your user to have the _SUPERUSER_ role. + Please see the [known issues](#known-issues) section for more information about this. ## ElasticSearch @@ -518,7 +518,7 @@ Back-end translations uses the [Ruby on Rails syntax](http://guides.rubyonrails. In each cases, some inline comments are included in the localisation files. They can be recognized as they start with the sharp character (#). -These comments are not required to be translated, they are intended to help the translator to have some context informations about the sentence to translate. +These comments are not required to be translated, they are intended to help the translator to have some context information about the sentence to translate. @@ -652,7 +652,7 @@ Fab-manager can be connected to a [Single Sign-On](https://en.wikipedia.org/wiki Currently OAuth 2 is the only supported protocol for SSO authentication. For an example of how to use configure a SSO in Fab-manager, please read [sso_with_github.md](doc/sso_with_github.md). -Developers may find informations on how to implement their own authentication protocol in [sso_authentication.md](doc/sso_authentication.md). +Developers may find information on how to implement their own authentication protocol in [sso_authentication.md](doc/sso_authentication.md). ## Known issues @@ -692,10 +692,10 @@ Developers may find informations on how to implement their own authentication pr DO NOT do this in a production environment, unless you know what you're doing: this could lead to a serious security issue. -- With Ubuntu 16.04, ElasticSearch may refuse to start even after having configured the service with systemd. +- With Ubuntu 16.04, ElasticSearch may refuse to start even after having configured the service with systemd. To solve this issue, you may have to set `START_DAEMON` to `true` in `/etc/default/elasticsearch`. Then reload ElasticSearch with: - + ```bash sudo systemctl restart elasticsearch.service ``` diff --git a/app/assets/javascripts/app.js.erb b/app/assets/javascripts/app.js.erb index f68dbebb5..d363714d0 100644 --- a/app/assets/javascripts/app.js.erb +++ b/app/assets/javascripts/app.js.erb @@ -71,7 +71,7 @@ config(['$httpProvider', 'AuthProvider', "growlProvider", "unsavedWarningsConfig // Angular-xeditable (click-to-edit elements, used in admin backoffice) editableOptions.theme = 'bs3'; - // Alter the UI-Router's $state, registering into some informations concerning the previous $state. + // Alter the UI-Router's $state, registering into some information concerning the previous $state. // This is used to allow the user to navigate to the previous state $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){ $state.prevState = fromState; diff --git a/app/assets/javascripts/controllers/admin/graphs.coffee b/app/assets/javascripts/controllers/admin/graphs.coffee index 4e24d1318..b800ab1f9 100644 --- a/app/assets/javascripts/controllers/admin/graphs.coffee +++ b/app/assets/javascripts/controllers/admin/graphs.coffee @@ -217,7 +217,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro for it_st in [0.. cur_type.subtypes.length-1] by 1 # when we've found it, iterate over its subtypes ... cur_subtype = cur_type.subtypes[it_st] if subgroup.key == cur_subtype.key # ... which match $SUBTYPE - # then we construct NVD3 dataSource according to these informations + # then we construct NVD3 dataSource according to these information dataSource = values: [] key: cur_subtype.label diff --git a/app/assets/javascripts/controllers/admin/invoices.coffee.erb b/app/assets/javascripts/controllers/admin/invoices.coffee.erb index 044e8fd05..b87bb6c83 100644 --- a/app/assets/javascripts/controllers/admin/invoices.coffee.erb +++ b/app/assets/javascripts/controllers/admin/invoices.coffee.erb @@ -125,7 +125,7 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I sample = sample.replace(/y+(?![^\[]*])/g, (match, offset, string) -> padWithZeros(8, match.length) ) - # date informations + # date information sample = sample.replace(/[YMD]+(?![^\[]*])/g, (match, offset, string) -> $scope.today.format(match) ) @@ -163,7 +163,7 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I sample = sample.replace(/d+(?![^\[]*])/g, (match, offset, string) -> padWithZeros(2, match.length) ) - # date informations + # date information sample = sample.replace(/[YMD]+(?![^\[]*])/g, (match, offset, string) -> $scope.today.format(match) ) @@ -334,7 +334,7 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I ## - # Callback to save the value of the legal informations zone when editing is done + # Callback to save the value of the legal information zone when editing is done ## $scope.legalsEditEnd = (event) -> parsed = parseHtml($scope.invoice.legals.content) diff --git a/app/assets/javascripts/controllers/machines.coffee.erb b/app/assets/javascripts/controllers/machines.coffee.erb index 1144abe3f..775dd441a 100644 --- a/app/assets/javascripts/controllers/machines.coffee.erb +++ b/app/assets/javascripts/controllers/machines.coffee.erb @@ -303,7 +303,7 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", "$stat ## fullCalendar event. An already booked slot that the user want to modify $scope.slotToModify = null - ## indicates the state of the current view : calendar or plans informations + ## indicates the state of the current view : calendar or plans information $scope.plansAreShown = false ## will store the user's plan if he choosed to buy one diff --git a/app/assets/javascripts/controllers/members.coffee b/app/assets/javascripts/controllers/members.coffee index 440cf5e43..f71b8292c 100644 --- a/app/assets/javascripts/controllers/members.coffee +++ b/app/assets/javascripts/controllers/members.coffee @@ -14,10 +14,10 @@ Application.Controllers.controller "MembersController", ["$scope", 'Member', 'me ### PUBLIC SCOPE ### - + ## currently displayed page of members $scope.page = 1 - + ## members list $scope.members = membersPromise @@ -31,12 +31,12 @@ Application.Controllers.controller "MembersController", ["$scope", 'Member', 'me $scope.showNextMembers = -> $scope.page += 1 Member.query { - requested_attributes:'[profile]', - page: $scope.page, + requested_attributes:'[profile]', + page: $scope.page, size: MEMBERS_PER_PAGE }, (members) -> $scope.members = $scope.members.concat(members) - + if (!members[0] || members[0].maxMembers <= $scope.members.length) $scope.noMoreResults = true @@ -260,7 +260,7 @@ Application.Controllers.controller "EditProfileController", ["$scope", "$rootSco ## Application.Controllers.controller "ShowProfileController", ["$scope", 'memberPromise', 'SocialNetworks', ($scope, memberPromise, SocialNetworks) -> - ## Selected user's informations + ## Selected user's information $scope.user = memberPromise # DEPENDENCY WITH NAVINUM GAMIFICATION PLUGIN !!!! ## List of social networks associated with this user and toggle 'show all' state diff --git a/app/assets/javascripts/controllers/profile.coffee b/app/assets/javascripts/controllers/profile.coffee index c95848ef6..f2f542b31 100644 --- a/app/assets/javascripts/controllers/profile.coffee +++ b/app/assets/javascripts/controllers/profile.coffee @@ -20,13 +20,13 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo ## name of the current fablab application (eg. "Fablab de la Casemate") $scope.fablabName = settingsPromise.fablab_name - ## informations from the current SSO provider + ## information from the current SSO provider $scope.activeProvider = activeProviderPromise ## list of user's groups (student/standard/...) $scope.groups = groupsPromise - ## current user, contains informations retrieved from the SSO + ## current user, contains information retrieved from the SSO $scope.user = memberPromise ## disallow the user to change his password as he connect from SSO @@ -177,4 +177,4 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo ## !!! MUST BE CALLED AT THE END of the controller initialize() -] \ No newline at end of file +] diff --git a/app/assets/javascripts/controllers/trainings.coffee.erb b/app/assets/javascripts/controllers/trainings.coffee.erb index d4377c9ab..2c6cdfa39 100644 --- a/app/assets/javascripts/controllers/trainings.coffee.erb +++ b/app/assets/javascripts/controllers/trainings.coffee.erb @@ -109,7 +109,7 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta groupObj.plans.push(plan) if plan.group_id == group.id $scope.plansClassifiedByGroup.push(groupObj) - ## indicates the state of the current view : calendar or plans informations + ## indicates the state of the current view : calendar or plans information $scope.plansAreShown = false ## indicates if the selected training was validated (ie. added to the shopping cart) diff --git a/app/assets/templates/admin/plans/_form.html.erb b/app/assets/templates/admin/plans/_form.html.erb index 03d38582d..f68eced4c 100644 --- a/app/assets/templates/admin/plans/_form.html.erb +++ b/app/assets/templates/admin/plans/_form.html.erb @@ -1,4 +1,4 @@ -

{{ 'general_informations' }}

+

{{ 'general_information' }}

@@ -155,4 +155,4 @@ -
\ No newline at end of file +
diff --git a/app/assets/templates/events/show.html.erb b/app/assets/templates/events/show.html.erb index 9c3c81c8e..5e92b2839 100644 --- a/app/assets/templates/events/show.html.erb +++ b/app/assets/templates/events/show.html.erb @@ -68,7 +68,7 @@
-

{{ 'informations_and_booking' }}

+

{{ 'information_and_booking' }}

diff --git a/app/assets/templates/plans/index.html.erb b/app/assets/templates/plans/index.html.erb index 362fb93a3..fc7e37960 100644 --- a/app/assets/templates/plans/index.html.erb +++ b/app/assets/templates/plans/index.html.erb @@ -61,7 +61,7 @@

- {{ 'more_informations' }} + {{ 'more_information' }} diff --git a/app/assets/templates/shared/_member_form.html.erb b/app/assets/templates/shared/_member_form.html.erb index b6c6d278e..f1e4683c6 100644 --- a/app/assets/templates/shared/_member_form.html.erb +++ b/app/assets/templates/shared/_member_form.html.erb @@ -313,7 +313,7 @@
- + User#tap) - # this will init or update the user thanks to the informations retrieved from the SSO + # this will init or update the user thanks to the information retrieved from the SSO user.profile ||= Profile.new auth.info.mapping.each do |key, value| user.set_data_from_sso_mapping(key, value) diff --git a/app/pdfs/pdf/invoice.rb b/app/pdfs/pdf/invoice.rb index de9d6cdf4..db9b951a6 100644 --- a/app/pdfs/pdf/invoice.rb +++ b/app/pdfs/pdf/invoice.rb @@ -27,7 +27,7 @@ module PDF image StringIO.new( Base64.decode64(img_b64.value) ), :fit => [415,40] move_down 20 font('Open-Sans', :size => 10) do - # general informations + # general information if invoice.is_a?(Avoir) text I18n.t('invoices.refund_invoice_reference', REF:invoice.reference), :leading => 3 else @@ -47,7 +47,7 @@ module PDF text I18n.t('invoices.invoice_issued_on_DATE', DATE:I18n.l(invoice.created_at.to_date)) end - # user/organization's informations + # user/organization's information if invoice&.user&.profile&.organization name = invoice.user.profile.organization.name else @@ -261,7 +261,7 @@ module PDF end text payment_verbose - # important informations + # important information move_down 40 txt = parse_html(Setting.find_by({name: 'invoice_text'}).value) txt.each_line do |line| @@ -269,7 +269,7 @@ module PDF end - # address and legals informations + # address and legals information move_down 40 txt = parse_html(Setting.find_by({name: 'invoice_legals'}).value) txt.each_line do |line| diff --git a/app/views/api/notifications/_notify_admin_profile_complete.json.jbuilder b/app/views/api/notifications/_notify_admin_profile_complete.json.jbuilder index 203ffe3a6..d6ed89dc4 100644 --- a/app/views/api/notifications/_notify_admin_profile_complete.json.jbuilder +++ b/app/views/api/notifications/_notify_admin_profile_complete.json.jbuilder @@ -1,5 +1,5 @@ json.title notification.notification_type -json.description t('.account_imported_from_PROVIDER_(UID)_has_completed_its_informations_html', +json.description t('.account_imported_from_PROVIDER_(UID)_has_completed_its_information_html', PROVIDER: notification.attached_object.provider, UID: notification.attached_object.uid) -json.url notification_url(notification, format: :json) \ No newline at end of file +json.url notification_url(notification, format: :json) diff --git a/app/views/notifications_mailer/notify_admin_when_user_is_imported.html.erb b/app/views/notifications_mailer/notify_admin_when_user_is_imported.html.erb index 74e192d4c..eac0434bb 100644 --- a/app/views/notifications_mailer/notify_admin_when_user_is_imported.html.erb +++ b/app/views/notifications_mailer/notify_admin_when_user_is_imported.html.erb @@ -4,7 +4,7 @@

<%= t('.body.new_account_imported', ID: @attached_object.id, PROVIDER: provider.name) %>
<%= t('.body.provider_uid', UID:@attached_object.uid) %>

<% if provider.sso_fields.size > 1 %> -

<%= t('.body.known_informations') %>

+

<%= t('.body.known_information') %>

    <% for field in provider.sso_fields %> <% value = @attached_object.get_data_from_sso_mapping(field) %> diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index 296d8fa3d..e85c74001 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -80,7 +80,7 @@ en: phone_number: "Phone number" phone_number_is_required: "Phone number is required." i_authorize_Fablab_users_registered_on_the_site_to_contact_me: "I authorize FabLab users, registered on the site, to contact me" - i_accept_to_receive_informations_from_the_fablab: "I accept to receive informations from the FabLab" + i_accept_to_receive_information_from_the_fablab: "I accept to receive information from the FabLab" i_ve_read_and_i_accept_: "I've read and I accept" _the_fablab_policy: "the FabLab policy" @@ -200,7 +200,7 @@ en: i_choose_that_plan: "I choose that plan" i_subscribe_online: "I subscribe online" i_already_subscribed: "I already subscribed" - more_informations: "More informations" + more_information: "More information" your_subscription_expires_on_the_DATE: "Your subscription expires on the {{DATE}}" # angular interpolation my_group: "My group" his_group: "{GENDER, select, male{His} female{Her} other{Its}} group" # messageFormat interpolation diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index d1a4420b3..0a3d8b083 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -80,7 +80,7 @@ fr: phone_number: "Numéro de téléphone" phone_number_is_required: "Le numéro de téléphone est requis." i_authorize_Fablab_users_registered_on_the_site_to_contact_me: "J'autorise les utilisateurs du Fab Lab inscrits sur le site à me contacter" - i_accept_to_receive_informations_from_the_fablab: "J'accepte de recevoir des informations du Fab Lab" + i_accept_to_receive_information_from_the_fablab: "J'accepte de recevoir des informations du Fab Lab" i_ve_read_and_i_accept_: "J'ai lu et j'accepte" _the_fablab_policy: "la charte d'utilisation du Fab Lab" @@ -201,7 +201,7 @@ fr: i_choose_that_plan: "Je choisis cette formule" i_subscribe_online: "Je m'abonne en ligne" i_already_subscribed: "Je suis déjà abonné" - more_informations: "Plus d'infos" + more_information: "Plus d'infos" your_subscription_expires_on_the_DATE: "Votre abonnement expire au {{DATE}}" # angular interpolation my_group: "Mon groupe" his_group: "Son groupe" # messageFormat interpolation @@ -228,7 +228,7 @@ fr: # détails d'un événement et réservation event_description: "Description de l'évènement" downloadable_documents: "Documents à télécharger" - informations_and_booking: "Informations et réservation" + information_and_booking: "Informations et réservation" beginning: "Début :" ending: "Fin :" opening_hours: "Horaires :" diff --git a/config/locales/app.shared.en.yml b/config/locales/app.shared.en.yml index bcdbc8723..9fc367101 100644 --- a/config/locales/app.shared.en.yml +++ b/config/locales/app.shared.en.yml @@ -199,7 +199,7 @@ en: plan: # subscription plan edition form - general_informations: "General informations" + general_information: "General information" name_length_must_be_less_than_24_characters: "Name length must be less than 24 characters." type_is_required: "Type is required." group: "Group" @@ -368,4 +368,4 @@ en: unable_to_apply_the_coupon_because_expired: "Unable to apply the coupon: this code has expired." unable_to_apply_the_coupon_because_sold_out: "Unable to apply the coupon: this code reached its quota." unable_to_apply_the_coupon_because_already_used: "Unable to apply the coupon: you have already used this code once before." - unable_to_apply_the_coupon_because_rejected: "This code does not exists." \ No newline at end of file + unable_to_apply_the_coupon_because_rejected: "This code does not exists." diff --git a/config/locales/en.yml b/config/locales/en.yml index 87e55c020..f4dec8b83 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -186,7 +186,7 @@ en: notify_admin_member_create_reservation: a_RESERVABLE_reservation_was_made_by_USER_html: "A %{RESERVABLE} reservation was made by %{USER}." notify_admin_profile_complete: - account_imported_from_PROVIDER_(UID)_has_completed_its_informations_html: "Account imported from %{PROVIDER} (%{UID}) has completed its informations." + account_imported_from_PROVIDER_(UID)_has_completed_its_information_html: "Account imported from %{PROVIDER} (%{UID}) has completed its information." notify_admin_slot_is_canceled: USER_s_reservation_on_the_DATE_was_cancelled_remember_to_generate_a_refund_invoice_if_applicable_html: "%{USER}'s reservation, on the %{DATE}, was cancelled. Remember to generate a refund invoice if applicable." notify_admin_slot_is_modified: @@ -320,4 +320,4 @@ en: price_category: # initial price's category for events, created to replace the old "reduced amount" property reduced_fare: "Reduced fare" - reduced_fare_if_you_are_under_25_student_or_unemployed: "Reduced fare if you are under 25, student or unemployed." \ No newline at end of file + reduced_fare_if_you_are_under_25_student_or_unemployed: "Reduced fare if you are under 25, student or unemployed." diff --git a/config/locales/mails.en.yml b/config/locales/mails.en.yml index e9e2e6071..38140941f 100644 --- a/config/locales/mails.en.yml +++ b/config/locales/mails.en.yml @@ -198,7 +198,7 @@ en: body: new_account_imported: "A new user account (ID: %{ID}) has been imported to the website via %{PROVIDER}." provider_uid: "its provider ID is: " - known_informations: "Here is what we know about this provider:" + known_information: "Here is what we know about this provider:" address_already_used: "This address is already associated with another user" no_more_info_available: "No other info about this user can be provided before he completes his profile." diff --git a/config/locales/mails.fr.yml b/config/locales/mails.fr.yml index eda12e67d..3efa19f5d 100644 --- a/config/locales/mails.fr.yml +++ b/config/locales/mails.fr.yml @@ -198,7 +198,7 @@ fr: body: new_account_imported: "Un nouveau compte utilisateur (ID: %{ID}) vient d'être importé sur la plate-forme via %{PROVIDER}." provider_uid: "Son identifiant fournisseur est %{UID}." - known_informations: "Voici les informations connues à son propos :" + known_information: "Voici les informations connues à son propos :" address_already_used: "Cette adresse est déjà associée à un autre utilisateur" no_more_info_available: "Aucune autre information sur cet utilisateur n'est disponible tant que celui-ci n'aura pas complété son profil." diff --git a/doc/sso_with_github.md b/doc/sso_with_github.md index 2e723592e..0ba007fe7 100644 --- a/doc/sso_with_github.md +++ b/doc/sso_with_github.md @@ -9,13 +9,13 @@ For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as Visit https://github.com/settings/applications/new to register your instance. - In `Application name`, we advise you to set the same name as your fab-manager's instance title. - In `Homepage URL`, put the public URL where your fab-manager's instance is located (eg. https://example.com). - - In `Authorization callback URL`, you must specify an URL that will match this scheme: https://example.com/users/auth/oauth2-github/callback + - In `Authorization callback URL`, you must specify an URL that will match this scheme: https://example.com/users/auth/oauth2-github/callback - **example.com** is your own fab-manager's address - - **oauth2-github** match the provider's "strategy name" in the fab-manager. - It is composed of: **SSO's protocol**, _dash_, **slug of the provider's name**. + - **oauth2-github** match the provider's "strategy name" in the fab-manager. + It is composed of: **SSO's protocol**, _dash_, **slug of the provider's name**. If you have a doubt about what it will be, start by creating the authentication provider in your fab-manager (see below), then the strategy's name will be shown in the providers list. - -- You'll be redirected to a page displaying two important informations: your **Client ID** and your **Client Secret**. + +- You'll be redirected to a page displaying two important information: your **Client ID** and your **Client Secret**. - Now go to your fab-manager's instance, login as an administrator, go to `Users management` and `Authentication`. Click `Add a new authentication provider`, and select _OAuth 2.0_ in the `Authentication type` drop-down list. @@ -27,7 +27,7 @@ For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as - Fulfill the form with the following parameters: - **Common URL**: `https://github.com/login/oauth/` This is the common part in the URLs of the two following parameters. - **Authorization endpoint**: `authorize` This URL can be found [here](https://developer.github.com/v3/oauth/). - - **Token Acquisition Endpoint**: `access_token` This URL can be found [here](https://developer.github.com/v3/oauth/). + - **Token Acquisition Endpoint**: `access_token` This URL can be found [here](https://developer.github.com/v3/oauth/). - **Profile edition URL**: `https://github.com/settings/profile` This is the URL where you are directed when you click on `Edit profile` in your GitHub dashboard. - **Client identifier**: Your Client ID, collected just before. - **Client secret**: Your Client Secret, collected just before. @@ -40,23 +40,23 @@ For this guide, we will use [GitHub](https://developer.github.com/v3/oauth/) as - **API endpoint URL**: `https://api.github.com/user` Here you can set a complete URL **OR** only an endpoint referring to the previously set **Common URL**. - **API type**: `JSON` Only JSON API are currently supported - **API fields**: `id` According to the GitHub API documentation, this is the name of the JSON field which uniquely identify the user. - - Once you have completed and validated the mapping's line, an information button will be available. + + Once you have completed and validated the mapping's line, an information button will be available. A click on it will show you the type of data expected from the API and, in some cases, you'll be able to configure a transformation. For example, the `Profile.gender` field require a boolean attribute but your API may return strings like `man / woman`. In this case, you'll be able to configure a transformation for `man` <-> `true` and `woman` <-> `false`. - + Now, you are free to map more fields, like `Profile.github` to `html_url`, or `Profile.avatar` to `avatar_url`... - Once you are done, your newly created authentication provider, will be marked as **Pending** in the authentication providers list. To set it as the current active provider, you must open a terminal on the hosting server (and/or container) and run the following commands: - + ```bash # replace GitHub with the name of the provider you just created rake fablab:switch_auth_provider[GitHub] ``` -- As the command just prompted you, you have to re-compile the assets +- As the command just prompted you, you have to re-compile the assets - In development, `rake tmp:clear` will do the job. - In production with Docker, `rm -rf public/assets`, followed by `docker-compose run --rm fabmanager bundle exec rake assets:precompile` - Then restart the web-server or the container. From c500518c28f102c5f7dae039cbfbc6683900be50 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 11 Oct 2016 16:07:34 +0200 Subject: [PATCH 034/289] [bug] sharing project or event w/o image on social network render error 500 --- app/views/social_bot/event.html.erb | 20 ++++++++++++++------ app/views/social_bot/project.html.erb | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/views/social_bot/event.html.erb b/app/views/social_bot/event.html.erb index 8fdb64506..1e5e5dcfd 100644 --- a/app/views/social_bot/event.html.erb +++ b/app/views/social_bot/event.html.erb @@ -1,5 +1,9 @@ -<% image = @event.event_image.attachment.medium %> -<% width, height = image.dimensions %> +<% + if @event.event_image + image = @event.event_image.attachment.medium + width, height = image.dimensions + end +%> @@ -9,9 +13,11 @@ - - - + <% if @event.event_image %> + + + + <% end %> @@ -20,7 +26,9 @@ - + <% if @event.event_image %> + + <% end %> \ No newline at end of file diff --git a/app/views/social_bot/project.html.erb b/app/views/social_bot/project.html.erb index 9f94dcd46..15650f83c 100644 --- a/app/views/social_bot/project.html.erb +++ b/app/views/social_bot/project.html.erb @@ -1,5 +1,9 @@ -<% image = @project.project_image.attachment.medium %> -<% width, height = image.dimensions %> +<% + if @project.project_image + image = @project.project_image.attachment.medium + width, height = image.dimensions + end +%> @@ -9,9 +13,11 @@ - - - + <% if @project.project_image %> + + + + <% end %> @@ -20,7 +26,9 @@ - + <% if @project.project_image %> + + <% end %> \ No newline at end of file From e7b03599ce37688656b3d62a59da3d01b21de1f7 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 11 Oct 2016 16:09:04 +0200 Subject: [PATCH 035/289] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cc5ba4ca..0a15e7c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab Manager ## next release +- Fix a bug: unable to share a project/event without image on social networks - Fix a bug: after creating an element in the admin calendar, browsing through the calendar and coming back cause the element to appear duplicated - Fix a bug: after deleting an element in the admin calendar, the confirmation message is wrong and an error is logged in the console - Fix a bug: erroneous syntax in docker env example file From 1bb05da16afc4d9fd1d45e8fb4e60e5c26a4b777 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 11 Oct 2016 16:11:20 +0200 Subject: [PATCH 036/289] Version 2.4.1 --- .fabmanager-version | 2 +- CHANGELOG.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.fabmanager-version b/.fabmanager-version index 197c4d5c2..005119baa 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.0 +2.4.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a15e7c16..44580ae56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab Manager -## next release +## v2.4.1 2016 October 11 + - Fix a bug: unable to share a project/event without image on social networks - Fix a bug: after creating an element in the admin calendar, browsing through the calendar and coming back cause the element to appear duplicated - Fix a bug: after deleting an element in the admin calendar, the confirmation message is wrong and an error is logged in the console From 861980951c86ef5c6579295e68d542ec1eb26ada Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 11 Oct 2016 17:26:48 +0200 Subject: [PATCH 037/289] updated 3rd party libraries licence informations --- LICENSE.md | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 5cf8fc853..3deb50991 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -14,36 +14,39 @@ Copyright (C) 2015 La Casemate along with this program. If not, see . -FabManager uses some external components, which are licenced under the -terms of [Apache 2 license](http://www.apache.org/licenses/LICENSE-2.0): +Fab-Manager uses some external components, which are licenced under the +terms of the following licences: -- [jasny-bootstrap](https://github.com/jasny/bootstrap/) -- [elasticsearch](https://github.com/elasticsearch/bower-elasticsearch-js) -- [nvd3](https://github.com/novus/nvd3) -- [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch) -- [elasticsearch-rails](https://github.com/elastic/elasticsearch-rails) -- [elasticsearch-model](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model) -- [elasticsearch-persistence](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-persistence) -- font [Open Sans](http://www.fontsquirrel.com/fonts/open-sans) +- [Apache 2 license](http://www.apache.org/licenses/LICENSE-2.0): + - [jasny-bootstrap](https://github.com/jasny/bootstrap/) + - [elasticsearch](https://github.com/elasticsearch/bower-elasticsearch-js) + - [nvd3](https://github.com/novus/nvd3) + - [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch) + - [elasticsearch-rails](https://github.com/elastic/elasticsearch-rails) + - [elasticsearch-model](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model) + - [elasticsearch-persistence](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-persistence) + - font [Open Sans](http://www.fontsquirrel.com/fonts/open-sans) +- [General Public License version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.en.html): + - [railroady](https://github.com/preston/railroady) + - [unicorn](https://github.com/defunkt/unicorn) + - [prawn](https://github.com/prawnpdf/prawn) + - [prawn-table](https://github.com/prawnpdf/prawn-table) -Some other used libraries/components are licenced under the terms of the -[General Public License version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.en.html): +- [BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause) + - [ruby](https://www.ruby-lang.org) + - [rubyzip](https://github.com/rubyzip/rubyzip) + - [byebug](https://github.com/deivid-rodriguez/byebug) -- [ruby](https://www.ruby-lang.org) -- [railroady](https://github.com/preston/railroady) -- [unicorn](https://github.com/defunkt/unicorn) -- [prawn](https://github.com/prawnpdf/prawn) -- [prawn-table](https://github.com/prawnpdf/prawn-table) +- [MIT Licence](https://opensource.org/licenses/MIT) + - Errors and omissions excepted, all the other external libraries used + in this project. - -Errors and omissions excepted, the other external libraries used in this -project are licenced under the terms of the [MIT Licence](https://opensource.org/licenses/MIT). Please refer to the libraries documentation for more information about their licences. Complete lists of used libraries are available in `bower.json` for the -EcmaScript libraries and in `Gemfile` for Ruby libraries. +JS/EcmaScript libraries and in `Gemfile` for Ruby libraries. From 91f70e2c47fe5a6ce791810e9a6d9d0505d25560 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 24 Oct 2016 09:31:29 +0200 Subject: [PATCH 038/289] [bug] statistics graphs not working --- app/assets/javascripts/controllers/admin/graphs.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/controllers/admin/graphs.coffee b/app/assets/javascripts/controllers/admin/graphs.coffee index b800ab1f9..beadfd7c9 100644 --- a/app/assets/javascripts/controllers/admin/graphs.coffee +++ b/app/assets/javascripts/controllers/admin/graphs.coffee @@ -362,6 +362,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro "index": "stats" "type": esType "searchType": "count" + "stat-type": statType "body": buildElasticAggregationsQuery(statType, $scope.display.interval, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected)) , (error, response) -> if (error) From 1449ca2b82a80fe72d03b3c10fc4f0385706e69e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 24 Oct 2016 09:33:46 +0200 Subject: [PATCH 039/289] updated changelog --- .fabmanager-version | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.fabmanager-version b/.fabmanager-version index 005119baa..ad8f890b2 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.1 +2.4.2-dev diff --git a/CHANGELOG.md b/CHANGELOG.md index 44580ae56..a4fae451c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog Fab Manager +## next release + +- Fix a bug: statistics graphs were not showing + ## v2.4.1 2016 October 11 - Fix a bug: unable to share a project/event without image on social networks From 42f7b3c75c705779dc1c3aa4d3f40efbe9c56cc5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 26 Oct 2016 16:33:21 +0200 Subject: [PATCH 040/289] add HTML in event description --- CHANGELOG.md | 1 + app/assets/templates/events/_form.html.erb | 11 ++++++++++- app/assets/templates/events/show.html.erb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4fae451c..2bfda122c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next release +- Ability to use HTML in event's descriptions using a WYSIWYG editor - Fix a bug: statistics graphs were not showing ## v2.4.1 2016 October 11 diff --git a/app/assets/templates/events/_form.html.erb b/app/assets/templates/events/_form.html.erb index 9d4500b93..b146fffac 100644 --- a/app/assets/templates/events/_form.html.erb +++ b/app/assets/templates/events/_form.html.erb @@ -40,7 +40,16 @@
    - + + + {{ 'description_is_required' }}
    diff --git a/app/assets/templates/events/show.html.erb b/app/assets/templates/events/show.html.erb index 5e92b2839..6ccf877e7 100644 --- a/app/assets/templates/events/show.html.erb +++ b/app/assets/templates/events/show.html.erb @@ -36,7 +36,7 @@

{{ 'event_description' }}

-

+

From f9220d44a00dfe1c37e90b47728cca6e7fea158e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 26 Oct 2016 16:35:10 +0200 Subject: [PATCH 041/289] fix i_accept_to_receive_information_from_the_fablab in sign-up modal --- CHANGELOG.md | 3 ++- app/assets/templates/shared/signupModal.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfda122c..892226aca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## next release - Ability to use HTML in event's descriptions using a WYSIWYG editor -- Fix a bug: statistics graphs were not showing +- Fix a bug: statistics graphs were not showing +- In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded ## v2.4.1 2016 October 11 diff --git a/app/assets/templates/shared/signupModal.html.erb b/app/assets/templates/shared/signupModal.html.erb index a4345f123..778a50c72 100644 --- a/app/assets/templates/shared/signupModal.html.erb +++ b/app/assets/templates/shared/signupModal.html.erb @@ -217,7 +217,7 @@ id="is_allow_newsletter" ng-model="user.is_allow_newsletter" value="true"/> - + From 010fe372213bcace3b1ea9339eaf3a4fabeb16ab Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 27 Oct 2016 11:32:50 +0200 Subject: [PATCH 042/289] forum is preferred channel for feature requests --- CONTRIBUTING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 775c27bae..3b41e3d93 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,9 +13,8 @@ patches and features. ## Using the issue tracker -The [issue tracker](https://github.com/LaCasemate/fab-manager/issues) is the preferred channel for [bug reports](#bugs), -[features requests](#features) and [submitting pull requests](#pull-requests), but please respect the following -restrictions: +The [issue tracker](https://github.com/LaCasemate/fab-manager/issues) is the preferred channel for [bug reports](#bugs) +and [submitting pull requests](#pull-requests), but please respect the following restrictions: * Please **do not** use the issue tracker for personal support requests (use [the forum](https://forum.fab-manager.com)). @@ -70,6 +69,9 @@ Feature requests are welcome. But take a moment to find out whether your idea fi project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. +Please note also that [the forum](https://forum.fab-manager.com) is probably a better place for discussing about feature +requests. + ## Pull requests From 84c03a690b360ed0c8b14f3854a57a7aa037dced Mon Sep 17 00:00:00 2001 From: Peng DU Date: Wed, 2 Nov 2016 11:12:23 +0100 Subject: [PATCH 043/289] add padding for summernote editor modal --- app/assets/stylesheets/app.plugins.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/stylesheets/app.plugins.scss b/app/assets/stylesheets/app.plugins.scss index c4f57ebbf..3fde6cde4 100644 --- a/app/assets/stylesheets/app.plugins.scss +++ b/app/assets/stylesheets/app.plugins.scss @@ -15,6 +15,16 @@ .note-editor .note-editable { background-color: white; } +.note-editor { + .form-group { + margin-left: 0px; + margin-right: 0px; + } + + .modal-header { + padding: 15px; + } +} // Growl From ba5e5752a4beeb16fb85bce33295889cbe1f6a24 Mon Sep 17 00:00:00 2001 From: Peng DU Date: Wed, 2 Nov 2016 14:56:35 +0100 Subject: [PATCH 044/289] allow add more picture for project step --- CHANGELOG.md | 1 + .../controllers/projects.coffee.erb | 22 +++++++++++++- app/assets/stylesheets/app.plugins.scss | 4 +++ app/assets/templates/projects/_form.html.erb | 30 ++++++++++++++----- app/assets/templates/projects/show.html.erb | 6 ++-- app/controllers/api/projects_controller.rb | 2 +- app/models/project_step.rb | 4 +-- app/views/api/projects/show.json.jbuilder | 9 ++++-- 8 files changed, 61 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 892226aca..d8de98e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next release +- Allow add more picture for project step - Ability to use HTML in event's descriptions using a WYSIWYG editor - Fix a bug: statistics graphs were not showing - In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded diff --git a/app/assets/javascripts/controllers/projects.coffee.erb b/app/assets/javascripts/controllers/projects.coffee.erb index c34e97e4d..5e7979e74 100644 --- a/app/assets/javascripts/controllers/projects.coffee.erb +++ b/app/assets/javascripts/controllers/projects.coffee.erb @@ -124,7 +124,7 @@ class ProjectsController ## $scope.addStep = -> $scope.totalSteps += 1 - $scope.project.project_steps_attributes.push { step_nb: $scope.totalSteps } + $scope.project.project_steps_attributes.push { step_nb: $scope.totalSteps, project_step_images_attributes: [] } @@ -185,6 +185,26 @@ class ProjectsController console.error(error) + ## + # This will create a single new empty entry into the project's step image list. + ## + $scope.addProjectStepImage = (step)-> + step.project_step_images_attributes.push {} + + + + ## + # This will remove the given image from the project's step image list. + # @param step {Object} the project step has images + # @param image {Object} the image to delete + ## + $scope.deleteProjectStepImage = (step, image) -> + index = step.project_step_images_attributes.indexOf(image) + if image.id? + image._destroy = true + else + step.project_step_images_attributes.splice(index, 1) + ## # Controller used on projects listing page diff --git a/app/assets/stylesheets/app.plugins.scss b/app/assets/stylesheets/app.plugins.scss index 3fde6cde4..af46e9830 100644 --- a/app/assets/stylesheets/app.plugins.scss +++ b/app/assets/stylesheets/app.plugins.scss @@ -24,6 +24,10 @@ .modal-header { padding: 15px; } + + .note-group-select-from-files { + display: none; + } } diff --git a/app/assets/templates/projects/_form.html.erb b/app/assets/templates/projects/_form.html.erb index 94a88a8a8..c77bb0fdf 100644 --- a/app/assets/templates/projects/_form.html.erb +++ b/app/assets/templates/projects/_form.html.erb @@ -100,15 +100,31 @@ -
- {{ 'add_a_picture' | translate }} {{ 'change_the_picture' }} - - {{step.project_step_image}} - +
+
+ + + +
+
+ +
+
+ {{image.attachment}} +
+
+ {{ 'browse' | translate }} {{ 'change' }} + + {{ 'delete' }} +
+
+
+
+ - diff --git a/app/assets/templates/projects/show.html.erb b/app/assets/templates/projects/show.html.erb index 88343e8ed..a6b068803 100644 --- a/app/assets/templates/projects/show.html.erb +++ b/app/assets/templates/projects/show.html.erb @@ -42,10 +42,10 @@

{{ 'step_N' | translate:{INDEX:step.step_nb} }} : {{step.title}}

-
- {{step.title}} +
+ {{image.attachment}}
-
+

diff --git a/app/controllers/api/projects_controller.rb b/app/controllers/api/projects_controller.rb index 6dcc23b7b..aa21f08b8 100644 --- a/app/controllers/api/projects_controller.rb +++ b/app/controllers/api/projects_controller.rb @@ -71,6 +71,6 @@ class API::ProjectsController < API::ApiController user_ids: [], machine_ids: [], component_ids: [], theme_ids: [], project_image_attributes: [:attachment], project_caos_attributes: [:id, :attachment, :_destroy], project_steps_attributes: [:id, :description, :title, :_destroy, :step_nb, - :project_step_image_attributes => :attachment]) + :project_step_images_attributes => [:id, :attachment, :_destroy]]) end end diff --git a/app/models/project_step.rb b/app/models/project_step.rb index 7d12cf85a..eee123c0c 100644 --- a/app/models/project_step.rb +++ b/app/models/project_step.rb @@ -1,5 +1,5 @@ class ProjectStep < ActiveRecord::Base belongs_to :project - has_one :project_step_image, as: :viewable, dependent: :destroy - accepts_nested_attributes_for :project_step_image, allow_destroy: true + has_many :project_step_images, as: :viewable, dependent: :destroy + accepts_nested_attributes_for :project_step_images, allow_destroy: true, reject_if: :all_blank end diff --git a/app/views/api/projects/show.json.jbuilder b/app/views/api/projects/show.json.jbuilder index 3e9cb1d83..fa72c5857 100644 --- a/app/views/api/projects/show.json.jbuilder +++ b/app/views/api/projects/show.json.jbuilder @@ -51,9 +51,12 @@ json.project_steps_attributes @project.project_steps.order('project_steps.step_n json.id s.id json.description s.description json.title s.title - json.project_step_image s.project_step_image.attachment_identifier if s.project_step_image - json.project_step_image_url s.project_step_image.attachment.medium.url if s.project_step_image - json.project_step_full_image_url s.project_step_image.attachment.url if s.project_step_image + json.project_step_images_attributes s.project_step_images do |si| + json.id si.id + json.attachment si.attachment_identifier + json.attachment_url si.attachment.medium.url + json.attachment_full_url si.attachment.url + end json.step_nb s.step_nb end json.state @project.state From f1b749d5f23d07af4651abd086feeba56723090a Mon Sep 17 00:00:00 2001 From: Peng DU Date: Wed, 2 Nov 2016 15:36:22 +0100 Subject: [PATCH 045/289] Image max size is configutable, size by default is 2 megabytes --- CHANGELOG.md | 2 ++ app/models/concerns/image_validator_concern.rb | 7 +++++++ app/models/event_image.rb | 3 +-- app/models/plan_image.rb | 2 +- app/models/project_image.rb | 3 +-- app/models/project_step_image.rb | 3 +-- app/models/user_avatar.rb | 2 +- config/application.yml.default | 3 +++ config/secrets.yml | 4 ++++ docker/env.example | 3 +++ 10 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 app/models/concerns/image_validator_concern.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index d8de98e09..6253c1a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ ## next release +- Image max size is configutable, size by default is 2 megabytes - Allow add more picture for project step - Ability to use HTML in event's descriptions using a WYSIWYG editor - Fix a bug: statistics graphs were not showing - In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded +- [TODO DEPLOY] add `MAX_IMAGE_SIZE` environment variable in `application.yml` and docker env ## v2.4.1 2016 October 11 diff --git a/app/models/concerns/image_validator_concern.rb b/app/models/concerns/image_validator_concern.rb new file mode 100644 index 000000000..4ba1c56b5 --- /dev/null +++ b/app/models/concerns/image_validator_concern.rb @@ -0,0 +1,7 @@ +module ImageValidatorConcern + extend ActiveSupport::Concern + + included do + validates :attachment, file_size: { maximum: Rails.application.secrets.max_image_size ? Rails.application.secrets.max_image_size.to_i : 2.megabytes.to_i } + end +end diff --git a/app/models/event_image.rb b/app/models/event_image.rb index b76f3ba0d..cd658fed2 100644 --- a/app/models/event_image.rb +++ b/app/models/event_image.rb @@ -1,5 +1,4 @@ class EventImage < Asset + include ImageValidatorConcern mount_uploader :attachment, EventImageUploader - - validates :attachment, file_size: { maximum: 2.megabytes.to_i } end diff --git a/app/models/plan_image.rb b/app/models/plan_image.rb index ab76a0658..24962b1fb 100644 --- a/app/models/plan_image.rb +++ b/app/models/plan_image.rb @@ -1,4 +1,4 @@ class PlanImage < Asset + include ImageValidatorConcern mount_uploader :attachment, PlanImageUploader - validates :attachment, file_size: { maximum: 2.megabytes.to_i } end diff --git a/app/models/project_image.rb b/app/models/project_image.rb index 366b12c1d..7f69a93e0 100644 --- a/app/models/project_image.rb +++ b/app/models/project_image.rb @@ -1,5 +1,4 @@ class ProjectImage < Asset + include ImageValidatorConcern mount_uploader :attachment, ProjectImageUploader - - validates :attachment, file_size: { maximum: 2.megabytes.to_i } end diff --git a/app/models/project_step_image.rb b/app/models/project_step_image.rb index 3e92d49fe..3caabb3c5 100644 --- a/app/models/project_step_image.rb +++ b/app/models/project_step_image.rb @@ -1,5 +1,4 @@ class ProjectStepImage < Asset + include ImageValidatorConcern mount_uploader :attachment, ProjectImageUploader - - validates :attachment, file_size: { maximum: 2.megabytes.to_i } end diff --git a/app/models/user_avatar.rb b/app/models/user_avatar.rb index 876433b68..0e172a01c 100644 --- a/app/models/user_avatar.rb +++ b/app/models/user_avatar.rb @@ -1,4 +1,4 @@ class UserAvatar < Asset - + include ImageValidatorConcern mount_uploader :attachment, ProfilImageUploader end diff --git a/config/application.yml.default b/config/application.yml.default index c46ee4815..c3a4d9aff 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -59,3 +59,6 @@ LOG_LEVEL: 'debug' ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex + +# 10485760 = 10 megabytes +MAX_IMAGE_SIZE: 10485760 diff --git a/config/secrets.yml b/config/secrets.yml index fc6fcaebe..506a5f190 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -39,6 +39,7 @@ development: log_level: <%= ENV["LOG_LEVEL"] %> facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %> elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %> + max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %> test: secret_key_base: 83daf5e7b80d990f037407bab78dff9904aaf3c195a50f84fa8695a22287e707dfbd9524b403b1dcf116ae1d8c06844c3d7ed942564e5b46be6ae3ead93a9d30 @@ -69,6 +70,7 @@ test: log_level: <%= ENV["LOG_LEVEL"] %> facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %> elaticsearch_host: localhost + max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %> staging: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> @@ -104,6 +106,7 @@ staging: log_level: <%= ENV["LOG_LEVEL"] %> facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %> elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %> + max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %> # Do not keep production secrets in the repository, # instead read values from the environment. @@ -142,3 +145,4 @@ production: log_level: <%= ENV["LOG_LEVEL"] %> facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %> elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %> + max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %> diff --git a/docker/env.example b/docker/env.example index ff6493372..36eecc4a1 100644 --- a/docker/env.example +++ b/docker/env.example @@ -60,3 +60,6 @@ LOG_LEVEL=debug ALLOWED_EXTENSIONS=pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps ALLOWED_MIME_TYPES=application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex + +# 10485760 = 10 megabytes +MAX_IMAGE_SIZE=10485760 From 9dca65786ace49dda890d6b7d5ea3a8f0369257d Mon Sep 17 00:00:00 2001 From: Peng DU Date: Thu, 3 Nov 2016 11:26:01 +0100 Subject: [PATCH 046/289] fix project step images height bug --- app/assets/templates/projects/_form.html.erb | 3 ++- app/assets/templates/projects/show.html.erb | 3 ++- app/views/api/projects/show.json.jbuilder | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/templates/projects/_form.html.erb b/app/assets/templates/projects/_form.html.erb index c77bb0fdf..6d49016e2 100644 --- a/app/assets/templates/projects/_form.html.erb +++ b/app/assets/templates/projects/_form.html.erb @@ -101,7 +101,8 @@
-
+
+
diff --git a/app/assets/templates/projects/show.html.erb b/app/assets/templates/projects/show.html.erb index a6b068803..d93942e04 100644 --- a/app/assets/templates/projects/show.html.erb +++ b/app/assets/templates/projects/show.html.erb @@ -42,7 +42,8 @@

{{ 'step_N' | translate:{INDEX:step.step_nb} }} : {{step.title}}

-
+
+
{{image.attachment}}
diff --git a/app/views/api/projects/show.json.jbuilder b/app/views/api/projects/show.json.jbuilder index fa72c5857..a5fe8fe8f 100644 --- a/app/views/api/projects/show.json.jbuilder +++ b/app/views/api/projects/show.json.jbuilder @@ -51,7 +51,7 @@ json.project_steps_attributes @project.project_steps.order('project_steps.step_n json.id s.id json.description s.description json.title s.title - json.project_step_images_attributes s.project_step_images do |si| + json.project_step_images_attributes s.project_step_images.order('created_at ASC') do |si| json.id si.id json.attachment si.attachment_identifier json.attachment_url si.attachment.medium.url From 99cca406d513bc340a4dc2534ffef7368304d93f Mon Sep 17 00:00:00 2001 From: Peng DU Date: Thu, 3 Nov 2016 12:17:19 +0100 Subject: [PATCH 047/289] fix bug: event date period dant show correct in invoice --- CHANGELOG.md | 1 + app/models/reservation.rb | 6 +++++- .../notify_admin_member_create_reservation.html.erb | 8 +++++++- .../notify_member_create_reservation.html.erb | 8 +++++++- config/locales/rails.fr.yml | 4 ++-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6253c1a3b..c15ed4cd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next release +- Fix bug: Event date period dont show correct in invoice - Image max size is configutable, size by default is 2 megabytes - Allow add more picture for project step - Ability to use HTML in event's descriptions using a WYSIWYG editor diff --git a/app/models/reservation.rb b/app/models/reservation.rb index d17a2b98b..61f0713b6 100644 --- a/app/models/reservation.rb +++ b/app/models/reservation.rb @@ -107,7 +107,11 @@ class Reservation < ActiveRecord::Base amount += ticket.booked * ticket.event_price_category.amount end slots.each do |slot| - description = reservable.name + " #{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" + description = "#{reservable.name} " + (slot.start_at.to_date..slot.end_at.to_date).each do |d| + description += "\n" if slot.start_at.to_date != slot.end_at.to_date + description += "#{I18n.l d, format: :long} #{I18n.l slot.start_at, format: :hour_minute} - #{I18n.l slot.end_at, format: :hour_minute}" + end ii_amount = amount ii_amount = 0 if (slot.offered and on_site) unless on_site diff --git a/app/views/notifications_mailer/notify_admin_member_create_reservation.html.erb b/app/views/notifications_mailer/notify_admin_member_create_reservation.html.erb index f16bc570c..7e1a931f1 100644 --- a/app/views/notifications_mailer/notify_admin_member_create_reservation.html.erb +++ b/app/views/notifications_mailer/notify_admin_member_create_reservation.html.erb @@ -8,6 +8,12 @@

<%= t('.body.reserved_slots') %>

    <% @attached_object.slots.each do |slot| %> -
  • <%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% if @attached_object.reservable_type == 'Event' %> + <% (slot.start_at.to_date..slot.end_at.to_date).each do |d| %> +
  • <%= "#{I18n.l d, format: :long} #{I18n.l slot.start_at, format: :hour_minute} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% end %> + <% else %> +
  • <%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% end %> <% end %>
diff --git a/app/views/notifications_mailer/notify_member_create_reservation.html.erb b/app/views/notifications_mailer/notify_member_create_reservation.html.erb index 793fc5a37..ff507953e 100644 --- a/app/views/notifications_mailer/notify_member_create_reservation.html.erb +++ b/app/views/notifications_mailer/notify_member_create_reservation.html.erb @@ -5,6 +5,12 @@

<%= t('.body.your_reserved_slots') %>

    <% @attached_object.slots.each do |slot| %> -
  • <%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% if @attached_object.reservable_type == 'Event' %> + <% (slot.start_at.to_date..slot.end_at.to_date).each do |d| %> +
  • <%= "#{I18n.l d, format: :long} #{I18n.l slot.start_at, format: :hour_minute} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% end %> + <% else %> +
  • <%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %>
  • + <% end %> <% end %>
diff --git a/config/locales/rails.fr.yml b/config/locales/rails.fr.yml index a2952b5f3..802a0e86a 100644 --- a/config/locales/rails.fr.yml +++ b/config/locales/rails.fr.yml @@ -33,7 +33,7 @@ fr: formats: default: "%d/%m/%Y" short: "%e %b" - long: "%e %B %Y" + long: "%A%e %B %Y" month_names: - - janvier @@ -204,4 +204,4 @@ fr: default: "%d %B %Y %Hh %Mmin %Ss" long: "%A %d %B %Y %Hh%M" short: "%d %b %Hh%M" - pm: pm \ No newline at end of file + pm: pm From 7c328af3578eef888cf1ccee32dc5c8380be6ee8 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 8 Nov 2016 16:24:34 +0100 Subject: [PATCH 048/289] Version 2.4.2 --- .fabmanager-version | 2 +- CHANGELOG.md | 10 +++++----- README.md | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.fabmanager-version b/.fabmanager-version index ad8f890b2..8e8299dcc 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.2-dev +2.4.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index c15ed4cd6..f846aa178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ # Changelog Fab Manager -## next release +## v2.4.2 2016 November 8 -- Fix bug: Event date period dont show correct in invoice -- Image max size is configutable, size by default is 2 megabytes -- Allow add more picture for project step +- Image max size is configurable, default size is 2 megabytes +- Allow add more pictures for project step - Ability to use HTML in event's descriptions using a WYSIWYG editor - Fix a bug: statistics graphs were not showing -- In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded +- Fix a bug: On invoices, only starting date is shown for multi-days events +- Fix a bug: In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded - [TODO DEPLOY] add `MAX_IMAGE_SIZE` environment variable in `application.yml` and docker env ## v2.4.1 2016 October 11 diff --git a/README.md b/README.md index 683e1bc60..da7d6562d 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,12 @@ Each item in the list must be separated from the others by a space char. You will probably want to check that this list match the `ALLOWED_EXTENSIONS` values above. Please consider that allowing file archives (eg. application/zip) or binary executable (eg. application/exe) may result in a **dangerous** security issue and must be avoided in any cases. + MAX_IMAGE_SIZE + +Maximum size (in bytes) allowed for image uploaded on the platform. +This parameter concerns events, plans, user's avatars, projects and steps of projects. +If this parameter is not specified the maximum size allowed will be 2MB. + Settings related to Open Projects See the [Open Projects](#open-projects) section for a detailed description of these parameters. From db280ce6d81d5ce23c962765adc1b32bb77ad22e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 13:05:26 +0100 Subject: [PATCH 049/289] fix application startup warnings: Use strings for Figaro configuration --- config/application.yml.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.yml.default b/config/application.yml.default index c3a4d9aff..4aed18a73 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -20,7 +20,7 @@ DEFAULT_HOST: fab-manager.com DEFAULT_PROTOCOL: https DELIVERY_METHOD: smtp SMTP_ADDRESS: -SMTP_PORT: 587 +SMTP_PORT: '587' SMTP_USER_NAME: SMTP_PASSWORD: GA_ID: '' @@ -61,4 +61,4 @@ ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3d ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex # 10485760 = 10 megabytes -MAX_IMAGE_SIZE: 10485760 +MAX_IMAGE_SIZE: '10485760' From 2dcd980be303fc1a2c6aff3c6683360ee7c5cbaf Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 13:12:30 +0100 Subject: [PATCH 050/289] [bug] recurrent events doesn't have the configured theme and age range --- app/models/event.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/event.rb b/app/models/event.rb index 95181599b..8a87b360e 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -108,6 +108,8 @@ class Event < ActiveRecord::Base availability: Availability.new(start_at: start_at, end_at: end_at, available_type: 'event'), availability_id: nil, category_id: category_id, + age_range_id: age_range_id, + event_themes: event_themes, amount: amount, event_price_categories: event_price_cats, nb_total_places: nb_total_places, From d5a5b6dd29763e5e0bb92d33f30de4b3fc50fe8a Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 13:14:53 +0100 Subject: [PATCH 051/289] updated changelog --- .fabmanager-version | 2 +- CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.fabmanager-version b/.fabmanager-version index 8e8299dcc..6cdfe8db7 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.2 +2.4.3-dev diff --git a/CHANGELOG.md b/CHANGELOG.md index f846aa178..a6324d331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog Fab Manager +## next release + +- Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range + ## v2.4.2 2016 November 8 - Image max size is configurable, default size is 2 megabytes From c04ed51f857fa780be705f1c547540c5388a3653 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 14:35:02 +0100 Subject: [PATCH 052/289] [bug] translation conflict --- app/assets/templates/admin/events/reservations.html.erb | 2 +- config/locales/app.admin.en.yml | 2 +- config/locales/app.admin.fr.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/templates/admin/events/reservations.html.erb b/app/assets/templates/admin/events/reservations.html.erb index 45d4c47a8..a4867fee9 100644 --- a/app/assets/templates/admin/events/reservations.html.erb +++ b/app/assets/templates/admin/events/reservations.html.erb @@ -7,7 +7,7 @@
-

{{ 'reservations' | translate }} {{event.title}}

+

{{ 'the_reservations' | translate }} {{event.title}}

diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 570833c41..d99c75287 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -123,7 +123,7 @@ en: event_reservations: # event reservations list - reservations: "Reservations :" + the_reservations: "Reservations :" payment_date: "Payment date" reserved_tickets: "Reserved tickets" show_the_event: "Show the event" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 8200c6990..d054fb385 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -123,7 +123,7 @@ fr: event_reservations: # liste des réservations sur un évènement - reservations: "Les réservations :" + the_reservations: "Les réservations :" payment_date: "Date de paiement" reserved_tickets: "Places réservées" show_the_event: "Afficher l'évènement" From a80df7f993b83a59549120d7b43d2113efc5a3e5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 14:36:28 +0100 Subject: [PATCH 053/289] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6324d331..8ff7531a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next release +- Fix a bug: conflict between similar translations around "reservations" - Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range ## v2.4.2 2016 November 8 From da71ba783c6b2ab35d6d5fc4ea7afe76450079c3 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 9 Nov 2016 15:01:41 +0100 Subject: [PATCH 054/289] [bug] exports for events reservation always have seats=1 (fixes #54) --- CHANGELOG.md | 2 ++ app/controllers/api/exports_controller.rb | 6 +++++- app/views/exports/users_reservations.xlsx.axlsx | 2 +- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff7531a5..b87e5a735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,10 @@ ## next release +- Fix a bug: number of reserved seats for an event is always of 1 in the excel export of reservations - Fix a bug: conflict between similar translations around "reservations" - Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range +- [TODO DEPLOY] delete the `exports/users/reservations` folder to prevent the usage of old invalid exports ## v2.4.2 2016 November 8 diff --git a/app/controllers/api/exports_controller.rb b/app/controllers/api/exports_controller.rb index 0ec8dff1c..69a204d99 100644 --- a/app/controllers/api/exports_controller.rb +++ b/app/controllers/api/exports_controller.rb @@ -5,7 +5,11 @@ class API::ExportsController < API::ApiController def download authorize @export - send_file File.join(Rails.root, @export.file), :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :disposition => 'attachment' + if FileTest.exist?(@export.file) + send_file File.join(Rails.root, @export.file), :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :disposition => 'attachment' + else + render text: I18n.t('errors.messages.export_not_found'), status: :not_found + end end def status diff --git a/app/views/exports/users_reservations.xlsx.axlsx b/app/views/exports/users_reservations.xlsx.axlsx index 54bbb0e90..98a56b8c4 100644 --- a/app/views/exports/users_reservations.xlsx.axlsx +++ b/app/views/exports/users_reservations.xlsx.axlsx @@ -21,7 +21,7 @@ wb.add_worksheet(name: t('export_reservations.reservations')) do |sheet| resrv.created_at.to_date, resrv.reservable_type, (resrv.reservable.nil? ? '' : resrv.reservable.name), - resrv.slots.count, + (resrv.reservable_type == 'Event') ? resrv.total_booked_seats: resrv.slots.count, (resrv.stp_invoice_id.nil?)? t('export_reservations.local_payment') : t('export_reservations.online_payment') ] styles = [nil, nil, nil, date, nil, nil, nil, nil] diff --git a/config/locales/en.yml b/config/locales/en.yml index f4dec8b83..557404a50 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -31,6 +31,7 @@ en: wrong_size: "is the wrong size (should be %{file_size})" size_too_small: "is too small (should be at least %{file_size})" size_too_big: "is too big (should be at most %{file_size})" + export_not_found: "Requested export was not found. It was probably deleted, please generate a new export." activemodel: errors: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 1b6629cc1..cd3fb70bb 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -31,6 +31,7 @@ fr: wrong_size: "ne fait pas la taille du fichier (doit comporter %{file_size})" size_too_small: "est trop petite (au moins %{file_size})" size_too_big: "est trop grande (pas plus de %{file_size})" + export_not_found: "L'export demandé n'a pas été trouvé. Il a probablement été supprimé, veuillez lancer la génération d'un nouvel export." activemodel: errors: From d46e6cf9c9aecc8aff2335c4bf648e7f9f8442d7 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 16 Nov 2016 15:08:24 +0100 Subject: [PATCH 055/289] [members excel export] invoicing disabled --- CHANGELOG.md | 1 + app/views/exports/users_members.xlsx.axlsx | 89 +++++++++++++--------- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b87e5a735..6d4da1cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next release +- Export user's invoicing status in members' excel export - Fix a bug: number of reserved seats for an event is always of 1 in the excel export of reservations - Fix a bug: conflict between similar translations around "reservations" - Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range diff --git a/app/views/exports/users_members.xlsx.axlsx b/app/views/exports/users_members.xlsx.axlsx index 3888a9b5d..374b5c79f 100644 --- a/app/views/exports/users_members.xlsx.axlsx +++ b/app/views/exports/users_members.xlsx.axlsx @@ -7,51 +7,68 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet| ## data table # heading labels - columns = [t('export_members.id'), t('export_members.surname'), t('export_members.first_name'), t('export_members.email'), - t('export_members.newsletter'), t('export_members.gender'), t('export_members.age'), t('export_members.address'), t('export_members.phone'), - t('export_members.website'), t('export_members.job'), t('export_members.interests'), - t('export_members.cad_software_mastered'), t('export_members.group'), t('export_members.subscription'), - t('export_members.subscription_end_date'), t('export_members.validated_trainings'), t('export_members.tags'), - t('export_members.number_of_invoices'), t('export_members.projects'), t('export_members.facebook'), - t('export_members.twitter'), t('export_members.echo_sciences'), - t('export_members.organization'), t('export_members.organization_address')] + columns = [t('export_members.id'), + t('export_members.surname'), + t('export_members.first_name'), + t('export_members.email'), + t('export_members.newsletter'), + t('export_members.gender'), + t('export_members.age'), + t('export_members.address'), + t('export_members.phone'), + t('export_members.website'), + t('export_members.job'), + t('export_members.interests'), + t('export_members.cad_software_mastered'), + t('export_members.group'), + t('export_members.subscription'), + t('export_members.subscription_end_date'), + t('export_members.validated_trainings'), + t('export_members.tags'), + t('export_members.number_of_invoices'), + t('export_members.invoicing_disabled'), + t('export_members.projects'), + t('export_members.facebook'), + t('export_members.twitter'), + t('export_members.echo_sciences'), + t('export_members.organization'), + t('export_members.organization_address')] sheet.add_row columns, :style => header # data rows @members.each do |member| data = [ - member.id, member.profile.last_name, member.profile.first_name, - member.email, member.is_allow_newsletter, member.profile.gender ? t('export_members.man') : t('export_members.woman'), member.profile.age, - member.profile.address ? member.profile.address.address : '', member.profile.phone, member.profile.website, - member.profile.job, member.profile.interest, member.profile.software_mastered, member.group.name, + member.id, + member.profile.last_name, + member.profile.first_name, + member.email, + member.is_allow_newsletter, + member.profile.gender ? t('export_members.man') : t('export_members.woman'), + member.profile.age, + member.profile.address ? member.profile.address.address : '', + member.profile.phone, + member.profile.website, + member.profile.job, + member.profile.interest, + member.profile.software_mastered, + member.group.name, (member.subscription and member.subscription.expired_at > Time.now) ? member.subscription.plan.name : t('export_members.without_subscriptions'), (member.subscription and member.subscription.expired_at > Time.now) ? member.subscription.expired_at.to_date : nil, - member.trainings.map(&:name).join("\n"), member.tags.map(&:name).join("\n"), member.invoices.size, - member.projects.map(&:name).join("\n"), member.profile.facebook || '', member.profile.twitter || '', + member.trainings.map(&:name).join("\n"), + member.tags.map(&:name).join("\n"), + member.invoices.size, + member.invoicing_disabled, + member.projects.map(&:name).join("\n"), + member.profile.facebook || '', + member.profile.twitter || '', member.profile.echosciences || '', - member.profile.organization ? member.profile.organization.name : '', member.profile.organization ? member.profile.organization.address.address : '' + member.profile.organization ? member.profile.organization.name : '', + member.profile.organization ? member.profile.organization.address.address : '' ] - styles = [nil, nil, nil, - nil, nil, nil, nil, - nil, nil, nil, - nil, nil, nil, nil, - nil, - date, - nil, nil, nil, - nil, nil, nil, - nil, - nil, nil - ] - types = [:integer, :string, :string, - :string, :boolean, :string, :integer, - :string, :string, :string, - :string, :string, :string, :string, - :string, - :date, - :string, :string, :integer, - :string, :string, :string, - :string, - :string, :string] + styles = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, date, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil] + + types = [:integer, :string, :string, :string, :boolean, :string, :integer, :string, :string, :string, :string, :string, + :string, :string, :string, :date, :string, :string, :integer, :boolean, :string, :string, :string, :string, :string, :string] sheet.add_row data, :style => styles, :types => types end diff --git a/config/locales/en.yml b/config/locales/en.yml index 557404a50..cb4689a00 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -138,6 +138,7 @@ en: validated_trainings: "Validated trainings" tags: "Tags" number_of_invoices: "Number of invoices" + invoicing_disabled: "Invoicing disabled" projects: "Projects" facebook: "Facebook" twitter: "Twitter" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cd3fb70bb..bef046965 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -138,6 +138,7 @@ fr: validated_trainings: "Formations validées" tags: "Étiquettes" number_of_invoices: "Nombre de factures" + invoicing_disabled: "Facturation désactivée" projects: "Projets" facebook: "Facebook" twitter: "Twitter" From 38653d22d1a17c5ca113a8f922b2f9aaf5a20158 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 16 Nov 2016 16:55:56 +0100 Subject: [PATCH 056/289] fix events description on the home page --- CHANGELOG.md | 1 + app/assets/templates/home.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d4da1cee..332b5be09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## next release - Export user's invoicing status in members' excel export +- Fix a bug: Next events descriptions, shown on the home page, display raw html - Fix a bug: number of reserved seats for an event is always of 1 in the excel export of reservations - Fix a bug: conflict between similar translations around "reservations" - Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range diff --git a/app/assets/templates/home.html.erb b/app/assets/templates/home.html.erb index 1e08bdcfd..d851693ab 100644 --- a/app/assets/templates/home.html.erb +++ b/app/assets/templates/home.html.erb @@ -100,7 +100,7 @@ {{event.category.name}}
-

{{event.description | humanize : 500 }}

+


From 6c9fdaaf8344a0196f516c4914ba9aec77e5e360 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 21 Nov 2016 11:35:56 +0100 Subject: [PATCH 057/289] [bug] fix machine hours stats graph --- app/assets/javascripts/controllers/admin/graphs.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/controllers/admin/graphs.coffee b/app/assets/javascripts/controllers/admin/graphs.coffee index beadfd7c9..8c23e69c7 100644 --- a/app/assets/javascripts/controllers/admin/graphs.coffee +++ b/app/assets/javascripts/controllers/admin/graphs.coffee @@ -363,6 +363,8 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro "type": esType "searchType": "count" "stat-type": statType + "start-date": moment($scope.datePickerStart.selected).format() + "end-date": moment($scope.datePickerEnd.selected).format() "body": buildElasticAggregationsQuery(statType, $scope.display.interval, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected)) , (error, response) -> if (error) From 52ad1b2c13b291d5d5757916b556a18055474392 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 21 Nov 2016 11:45:48 +0100 Subject: [PATCH 058/289] fix trainings, users, events graphs --- app/controllers/api/statistics_controller.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/statistics_controller.rb b/app/controllers/api/statistics_controller.rb index 147d2c181..b22e6caf7 100644 --- a/app/controllers/api/statistics_controller.rb +++ b/app/controllers/api/statistics_controller.rb @@ -15,19 +15,20 @@ class API::StatisticsController < API::ApiController statistic_type = request.query_parameters.delete('stat-type') start_date = request.query_parameters.delete('start-date') end_date = request.query_parameters.delete('end-date') - puts start_date, end_date # run main query in elasticSearch query = MultiJson.load(request.body.read) results = Stats::#{path.classify}.search(query, request.query_parameters.symbolize_keys).response # run additional custom aggregations, if any - stat_index = StatisticIndex.find_by_es_type_key("#{path}") - stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first - client = Elasticsearch::Model.client - stat_type.statistic_custom_aggregations.each do |custom| - c_res = client.search index: custom.es_index, type:custom.es_type, body:sprintf(custom.query, {aggs_name: custom.field, start_date: start_date, end_date: end_date}) - results['aggregations'][custom.field] = c_res['aggregations'][custom.field] + if statistic_type and start_date and end_date + stat_index = StatisticIndex.find_by_es_type_key("#{path}") + stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first + client = Elasticsearch::Model.client + stat_type.statistic_custom_aggregations.each do |custom| + c_res = client.search index: custom.es_index, type:custom.es_type, body:sprintf(custom.query, {aggs_name: custom.field, start_date: start_date, end_date: end_date}) + results['aggregations'][custom.field] = c_res['aggregations'][custom.field] + end end # return result From e38afc0d4b51890526516bc6d79082b691eea4ba Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 21 Nov 2016 12:00:03 +0100 Subject: [PATCH 059/289] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 332b5be09..c394cba2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix a bug: number of reserved seats for an event is always of 1 in the excel export of reservations - Fix a bug: conflict between similar translations around "reservations" - Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range +- Fix a bug: some graphs do not display: events, users, trainings and machine hours - [TODO DEPLOY] delete the `exports/users/reservations` folder to prevent the usage of old invalid exports ## v2.4.2 2016 November 8 From 1747157c6b3391ef9f089082815d2c7565873714 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 21 Nov 2016 14:16:55 +0100 Subject: [PATCH 060/289] Version 2.4.3 --- .fabmanager-version | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.fabmanager-version b/.fabmanager-version index 6cdfe8db7..35cee72dc 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.3-dev +2.4.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index c394cba2c..8b2a2d826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog Fab Manager -## next release +## v2.4.3 2016 November 21 - Export user's invoicing status in members' excel export - Fix a bug: Next events descriptions, shown on the home page, display raw html From 327a6eab1181141a047dad80f95238e15f416dd6 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 21 Nov 2016 15:00:34 +0100 Subject: [PATCH 061/289] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da7d6562d..fb6d7023c 100644 --- a/README.md +++ b/README.md @@ -677,7 +677,7 @@ Developers may find information on how to implement their own authentication pro To solve this issue copy `config/application.yml.default` to `config/application.yml`. This is required before the first start. -- Due to a stripe limitation, you won't be ble to create plans longer than one year. +- Due to a stripe limitation, you won't be able to create plans longer than one year. - When running the tests suite with `rake test`, all tests may fail with errors similar to the following: From 42f1213af73b56de18d07bf0e94cf73a8390140b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 23 Nov 2016 11:32:22 +0100 Subject: [PATCH 062/289] update documentation schemas --- doc/controllers_brief.svg | 120 ++-- doc/controllers_complete.svg | 1154 ++++++++++++++++++---------------- doc/models_brief.svg | 700 ++++++++++----------- doc/models_complete.svg | 991 ++++++++++++++--------------- 4 files changed, 1513 insertions(+), 1452 deletions(-) diff --git a/doc/controllers_brief.svg b/doc/controllers_brief.svg index 433767080..096ed4773 100644 --- a/doc/controllers_brief.svg +++ b/doc/controllers_brief.svg @@ -4,23 +4,23 @@ - - + + controllers_diagram - + _diagram_info Controllers diagram -Date: Sep 15 2016 - 17:48 -Migration version: 20160915105234 +Date: Nov 23 2016 - 10:21 +Migration version: 20160922155555 Generated by RailRoady 1.4.0 http://railroady.prestonlee.com SessionsController - -SessionsController + +SessionsController OpenAPI::V1::BookableMachinesController @@ -74,8 +74,8 @@ API::TagsController - -API::TagsController + +API::TagsController API::StatisticsController @@ -89,8 +89,8 @@ API::PlansController - -API::PlansController + +API::PlansController API::AuthProvidersController @@ -144,8 +144,8 @@ API::FeedsController - -API::FeedsController + +API::FeedsController API::MembersController @@ -154,8 +154,8 @@ API::PricesController - -API::PricesController + +API::PricesController API::TranslationsController @@ -209,96 +209,116 @@ API::SlotsController - -API::SlotsController + +API::SlotsController + + +API::VersionController + +API::VersionController -API::AdminsController +API::AdminsController API::AdminsController -API::GroupsController - -API::GroupsController +API::GroupsController + +API::GroupsController -API::AvailabilitiesController +API::AvailabilitiesController API::AvailabilitiesController -API::UsersController - -API::UsersController +API::UsersController + +API::UsersController -API::ProjectsController +API::ProjectsController API::ProjectsController -API::WalletController - -API::WalletController +API::WalletController + +API::WalletController -API::NotificationsController +API::NotificationsController API::NotificationsController -API::TrainingsController +API::TrainingsController API::TrainingsController -API::SettingsController +API::SettingsController API::SettingsController -API::OpenAPIClientsController +API::OpenAPIClientsController API::OpenAPIClientsController -API::InvoicesController +API::InvoicesController API::InvoicesController -API::LicencesController +API::LicencesController API::LicencesController -SocialBotController - -SocialBotController +SocialBotController + +SocialBotController -PasswordsController - -PasswordsController +PasswordsController + +PasswordsController -ApplicationController - -ApplicationController +ApplicationController + +ApplicationController -Users::OmniauthCallbacksController +Users::OmniauthCallbacksController Users::OmniauthCallbacksController -WebhooksController - -WebhooksController +WebhooksController + +WebhooksController + + +Rss::RssController + +Rss::RssController + + +Rss::EventsController + +Rss::EventsController + + +Rss::ProjectsController + +Rss::ProjectsController -ConfirmationsController +ConfirmationsController ConfirmationsController diff --git a/doc/controllers_complete.svg b/doc/controllers_complete.svg index 0421faae8..c6d866231 100644 --- a/doc/controllers_complete.svg +++ b/doc/controllers_complete.svg @@ -4,158 +4,158 @@ - - + + controllers_diagram - + _diagram_info -Controllers diagram -Date: Sep 15 2016 - 17:48 -Migration version: 20160915105234 -Generated by RailRoady 1.4.0 -http://railroady.prestonlee.com +Controllers diagram +Date: Nov 23 2016 - 10:21 +Migration version: 20160922155555 +Generated by RailRoady 1.4.0 +http://railroady.prestonlee.com SessionsController - -SessionsController - -new - -set_csrf_headers - -_layout + +SessionsController + +new + +set_csrf_headers + +_layout OpenAPI::V1::BookableMachinesController - -OpenAPI::V1::BookableMachinesController - -index - - -_layout + +OpenAPI::V1::BookableMachinesController + +index + + +_layout OpenAPI::V1::ReservationsController - -OpenAPI::V1::ReservationsController - -index - - -_layout -format_type -per_page + +OpenAPI::V1::ReservationsController + +index + + +_layout +format_type +per_page OpenAPI::V1::EventsController - -OpenAPI::V1::EventsController - -index - - -_layout -per_page + +OpenAPI::V1::EventsController + +index + + +_layout +per_page OpenAPI::V1::MachinesController - -OpenAPI::V1::MachinesController - -index - - -_layout + +OpenAPI::V1::MachinesController + +index + + +_layout OpenAPI::V1::UserTrainingsController - -OpenAPI::V1::UserTrainingsController - -index - - -_layout -per_page + +OpenAPI::V1::UserTrainingsController + +index + + +_layout +per_page OpenAPI::V1::BaseController - -OpenAPI::V1::BaseController - - -authenticate -authenticate_token -bad_request -current_api_client -not_found -render_unauthorized - -_layout -increment_calls_count + +OpenAPI::V1::BaseController + + +authenticate +authenticate_token +bad_request +current_api_client +not_found +render_unauthorized + +_layout +increment_calls_count OpenAPI::V1::UsersController - -OpenAPI::V1::UsersController - -index - - -_layout -per_page + +OpenAPI::V1::UsersController + +index + + +_layout +per_page OpenAPI::V1::TrainingsController - -OpenAPI::V1::TrainingsController - -index - - -_layout + +OpenAPI::V1::TrainingsController + +index + + +_layout OpenAPI::V1::InvoicesController - -OpenAPI::V1::InvoicesController - -download -index - - -_layout -per_page + +OpenAPI::V1::InvoicesController + +download +index + + +_layout +per_page RegistrationsController - -RegistrationsController - -create - - -_layout + +RegistrationsController + +create + + +_layout API::TagsController - -API::TagsController - -create -destroy -index -show -update - - -_layout -set_tag -tag_params + +API::TagsController + +create +destroy +index +show +update + + +_layout +set_tag +tag_params API::StatisticsController @@ -185,30 +185,30 @@ API::TrainingsPricingsController - -API::TrainingsPricingsController - -index -trainings_pricing_params -update - - -_layout + +API::TrainingsPricingsController + +index +trainings_pricing_params +update + + +_layout API::PlansController - -API::PlansController - -create -destroy -index -show -update - - -_layout -plan_params + +API::PlansController + +create +destroy +index +show +update + + +_layout +plan_params API::AuthProvidersController @@ -230,144 +230,144 @@ API::CouponsController - -API::CouponsController - -create -destroy -index -send_to -show -update -validate - - -_layout -coupon_editable_params -coupon_params -set_coupon + +API::CouponsController + +create +destroy +index +send_to +show +update +validate + + +_layout +coupon_editable_params +coupon_params +set_coupon API::AgeRangesController - -API::AgeRangesController - -create -destroy -index -show -update - - -_layout -age_range_params -set_age_range + +API::AgeRangesController + +create +destroy +index +show +update + + +_layout +age_range_params +set_age_range API::CreditsController - -API::CreditsController - -create -destroy -index -update - - -_layout -credit_params -set_credit + +API::CreditsController + +create +destroy +index +update + + +_layout +credit_params +set_credit API::OpenlabProjectsController - -API::OpenlabProjectsController - -index - - -_layout + +API::OpenlabProjectsController + +index + + +_layout API::ComponentsController - -API::ComponentsController - -create -destroy -index -show -update - - -_layout -component_params -set_component + +API::ComponentsController + +create +destroy +index +show +update + + +_layout +component_params +set_component API::CustomAssetsController - -API::CustomAssetsController - -create -destroy -index -show -update - - -_layout -custom_asset_params -set_custom_asset + +API::CustomAssetsController + +create +destroy +index +show +update + + +_layout +custom_asset_params +set_custom_asset API::PricingController - -API::PricingController - -index -update - - -_layout + +API::PricingController + +index +update + + +_layout API::AbusesController - -API::AbusesController - -create -index - - -_layout -abuse_params + +API::AbusesController + +create +index + + +_layout +abuse_params API::PriceCategoriesController - -API::PriceCategoriesController - -create -destroy -index -show -update - - -_layout -price_category_params -set_price_category + +API::PriceCategoriesController + +create +destroy +index +show +update + + +_layout +price_category_params +set_price_category API::FeedsController - -API::FeedsController - -twitter_timelines - - -_layout + +API::FeedsController + +twitter_timelines + + +_layout API::MembersController @@ -395,139 +395,139 @@ API::PricesController - -API::PricesController - -compute -index -update - - -_layout -compute_price_params -coupon_params -price_params + +API::PricesController + +compute +index +update + + +_layout +compute_price_params +coupon_params +price_params API::TranslationsController - -API::TranslationsController - -set_locale -show - - -_layout + +API::TranslationsController + +set_locale +show + + +_layout API::ExportsController - -API::ExportsController - -download -status - - -_layout -set_export + +API::ExportsController + +download +status + + +_layout +set_export API::ReservationsController - -API::ReservationsController - -create -index -show -update - - -_layout -coupon_params -reservation_params -set_reservation + +API::ReservationsController + +create +index +show +update + + +_layout +coupon_params +reservation_params +set_reservation API::EventsController - -API::EventsController - -create -destroy -index -show -upcoming -update - - -_layout -event_params -set_event + +API::EventsController + +create +destroy +index +show +upcoming +update + + +_layout +event_params +set_event API::MachinesController - -API::MachinesController - -create -destroy -index -show -update - - -_layout -is_reserved -machine_params -set_machine + +API::MachinesController + +create +destroy +index +show +update + + +_layout +is_reserved +machine_params +set_machine API::EventThemesController - -API::EventThemesController - -create -destroy -index -show -update - - -_layout -event_theme_params -set_event_theme + +API::EventThemesController + +create +destroy +index +show +update + + +_layout +event_theme_params +set_event_theme API::ThemesController - -API::ThemesController - -create -destroy -index -show -update - - -_layout -set_theme -theme_params + +API::ThemesController + +create +destroy +index +show +update + + +_layout +set_theme +theme_params API::CategoriesController - -API::CategoriesController - -create -destroy -index -show -update - - -_layout -category_params -set_category + +API::CategoriesController + +create +destroy +index +show +update + + +_layout +category_params +set_category API::SubscriptionsController @@ -548,42 +548,52 @@ API::StylesheetsController - -API::StylesheetsController - -show - - -_layout + +API::StylesheetsController + +show + + +_layout API::SlotsController - -API::SlotsController - -cancel -update - - -_layout -set_slot -slot_params + +API::SlotsController + +cancel +update + + +_layout +set_slot +slot_params + + +API::VersionController + +API::VersionController + +show + + +_layout -API::AdminsController - -API::AdminsController - -create -destroy -index - - -_layout -admin_params +API::AdminsController + +API::AdminsController + +create +destroy +index + + +_layout +admin_params -API::GroupsController +API::GroupsController API::GroupsController @@ -597,7 +607,7 @@ group_params -API::AvailabilitiesController +API::AvailabilitiesController API::AvailabilitiesController @@ -624,207 +634,237 @@ verify_training_event_is_reserved -API::UsersController - -API::UsersController - -create -index - - -_layout -partner_params +API::UsersController + +API::UsersController + +create +index + + +_layout +partner_params -API::ProjectsController - -API::ProjectsController - -collaborator_valid -create -destroy -index -last_published -search -show -update - - -_layout -project_params -set_project +API::ProjectsController + +API::ProjectsController + +allowed_extensions +collaborator_valid +create +destroy +index +last_published +search +show +update + + +_layout +project_params +set_project -API::WalletController - -API::WalletController - -by_user -credit -transactions - - -_layout +API::WalletController + +API::WalletController + +by_user +credit +transactions + + +_layout -API::NotificationsController - -API::NotificationsController - -index -show -update -update_all - - -_layout -set_notification +API::NotificationsController + +API::NotificationsController + +index +show +update +update_all + + +_layout +set_notification -API::TrainingsController - -API::TrainingsController - -availabilities -create -destroy -index -show -update - - -_layout -set_training -training_params -valid_training_params +API::TrainingsController + +API::TrainingsController + +availabilities +create +destroy +index +show +update + + +_layout +set_training +training_params +valid_training_params -API::SettingsController - -API::SettingsController - -index -show -update - - -_layout -names_as_string_to_array -setting_params +API::SettingsController + +API::SettingsController + +index +show +update + + +_layout +names_as_string_to_array +setting_params -API::OpenAPIClientsController - -API::OpenAPIClientsController - -create -destroy -index -reset_token -update - - -_layout -client_params +API::OpenAPIClientsController + +API::OpenAPIClientsController + +create +destroy +index +reset_token +update + + +_layout +client_params -API::InvoicesController - -API::InvoicesController - -create -download -index -list - - -_layout -avoir_params -set_invoice +API::InvoicesController + +API::InvoicesController + +create +download +index +list + + +_layout +avoir_params +set_invoice -API::LicencesController - -API::LicencesController - -create -destroy -index -show -update - - -_layout -licence_params -set_licence +API::LicencesController + +API::LicencesController + +create +destroy +index +show +update + + +_layout +licence_params +set_licence -SocialBotController - -SocialBotController - -share - - -_layout +SocialBotController + +SocialBotController + +share + + +_layout -PasswordsController - -PasswordsController - -create - - -_layout +PasswordsController + +PasswordsController + +create + + +_layout -ApplicationController - -ApplicationController - -index - -configure_permitted_parameters -default_url_options -permission_denied -set_csrf_cookie -verified_request? - -_layout +ApplicationController + +ApplicationController + +index + +configure_permitted_parameters +default_url_options +permission_denied +set_csrf_cookie +verified_request? + +_layout -Users::OmniauthCallbacksController - -Users::OmniauthCallbacksController - -database-fablab - - -_layout -email_exists? -generate_unique_username -username_exists? +Users::OmniauthCallbacksController + +Users::OmniauthCallbacksController + +database-fablab + + +_layout +email_exists? +generate_unique_username +username_exists? -WebhooksController - -WebhooksController - -create - - -_layout +WebhooksController + +WebhooksController + +create + + +_layout + + +Rss::RssController + +Rss::RssController + + + +_layout + + +Rss::EventsController + +Rss::EventsController + +index + + +_layout + + +Rss::ProjectsController + +Rss::ProjectsController + +index + + +_layout -ConfirmationsController - -ConfirmationsController - -after_confirmation_path_for - - -_layout +ConfirmationsController + +ConfirmationsController + +after_confirmation_path_for + + +_layout diff --git a/doc/models_brief.svg b/doc/models_brief.svg index bca030210..2ed4ad308 100644 --- a/doc/models_brief.svg +++ b/doc/models_brief.svg @@ -12,8 +12,8 @@ _diagram_info Models diagram -Date: Sep 15 2016 - 17:48 -Migration version: 20160915105234 +Date: Nov 23 2016 - 10:21 +Migration version: 20160922155555 Generated by RailRoady 1.4.0 http://railroady.prestonlee.com @@ -29,9 +29,9 @@ Group->Price - - - + + + machines_prices @@ -41,9 +41,9 @@ Group->TrainingsPricing - - - + + + Plan @@ -52,9 +52,9 @@ Group->Plan - - - + + + User @@ -63,9 +63,9 @@ Group->User - - - + + + InvoiceItem @@ -74,9 +74,9 @@ InvoiceItem->InvoiceItem - - - + + + AvailabilityTag @@ -105,9 +105,9 @@ OpenAPI::Client->OpenAPI::CallsCountTracing - - - + + + OpenAPI::ParameterError @@ -131,15 +131,15 @@ Tag->AvailabilityTag - - - + + + Tag->User - - - + + + Availability @@ -148,9 +148,9 @@ Tag->Availability - - - + + + UserTag @@ -159,9 +159,9 @@ Tag->UserTag - - - + + + Event @@ -175,9 +175,9 @@ Event->PriceCategory - - - + + + EventTheme @@ -186,9 +186,9 @@ Event->EventTheme - - - + + + EventImage @@ -197,9 +197,9 @@ Event->EventImage - - - + + + Reservation @@ -208,9 +208,9 @@ Event->Reservation - - - + + + EventPriceCategory @@ -219,9 +219,9 @@ Event->EventPriceCategory - - - + + + EventFile @@ -230,9 +230,9 @@ Event->EventFile - - - + + + StatisticSubType @@ -246,9 +246,9 @@ StatisticSubType->StatisticType - - - + + + StatisticTypeSubType @@ -257,9 +257,9 @@ StatisticSubType->StatisticTypeSubType - - - + + + Project @@ -268,15 +268,15 @@ Project->ProjectImage - - - + + + Project->User - - - + + + Theme @@ -285,9 +285,9 @@ Project->Theme - - - + + + ProjectCao @@ -296,9 +296,9 @@ Project->ProjectCao - - - + + + ProjectStep @@ -307,9 +307,9 @@ Project->ProjectStep - - - + + + ProjectUser @@ -318,9 +318,9 @@ Project->ProjectUser - - - + + + Machine @@ -329,9 +329,9 @@ Project->Machine - - - + + + Component @@ -340,9 +340,9 @@ Project->Component - - - + + + CustomAsset @@ -356,9 +356,9 @@ CustomAsset->CustomAssetFile - - - + + + AgeRange @@ -367,9 +367,9 @@ AgeRange->Event - - - + + + Wallet @@ -383,9 +383,9 @@ Wallet->WalletTransaction - - - + + + Stats::Event @@ -424,9 +424,9 @@ PriceCategory->EventPriceCategory - - - + + + Invoice @@ -435,15 +435,15 @@ Invoice->InvoiceItem - - - + + + Invoice->Invoice - - - + + + avoir @@ -458,9 +458,9 @@ OfferDay->Invoice - - - + + + StatisticIndex @@ -469,15 +469,15 @@ StatisticType->StatisticIndex - - - + + + StatisticType->StatisticTypeSubType - - - + + + StatisticCustomAggregation @@ -486,9 +486,9 @@ StatisticType->StatisticCustomAggregation - - - + + + Address @@ -497,15 +497,15 @@ Plan->Price - - - + + + Plan->PlanFile - - - + + + Credit @@ -514,22 +514,22 @@ Plan->Credit - - - + + + Plan->Credit - - - + + + training_credits Plan->Credit - - - + + + machine_credits @@ -539,9 +539,9 @@ Plan->Subscription - - - + + + PlanImage @@ -550,9 +550,9 @@ Plan->PlanImage - - - + + + MachineFile @@ -566,9 +566,9 @@ Organization->Address - - - + + + StatisticGraph @@ -587,47 +587,47 @@ Licence->Project - - - + + + User->Project - - - + + + my_projects User->Wallet - - - + + + User->Invoice - - - + + + User->Credit - - - + + + User->Credit - - - + + + training_credits User->Credit - - - + + + machine_credits @@ -637,9 +637,9 @@ User->Role - - - + + + Notification @@ -648,15 +648,15 @@ User->Notification - - - + + + User->Subscription - - - + + + Training @@ -665,15 +665,15 @@ User->Training - - - + + + User->Reservation - - - + + + UsersCredit @@ -682,15 +682,15 @@ User->UsersCredit - - - + + + User->UserTag - - - + + + Export @@ -699,9 +699,9 @@ User->Export - - - + + + UserTraining @@ -710,15 +710,15 @@ User->UserTraining - - - + + + User->ProjectUser - - - + + + Profile @@ -727,9 +727,9 @@ User->Profile - - - + + + ProjectStepImage @@ -738,9 +738,9 @@ Credit->UsersCredit - - - + + + PartnerPlan @@ -749,53 +749,53 @@ PartnerPlan->Price - - - + + + PartnerPlan->PlanFile - - - + + + PartnerPlan->Credit - - - + + + PartnerPlan->Credit - - - + + + training_credits PartnerPlan->Credit - - - + + + machine_credits PartnerPlan->Role - - - + + + PartnerPlan->Subscription - - - + + + PartnerPlan->PlanImage - - - + + + OAuth2Provider @@ -804,9 +804,9 @@ OAuth2Provider->OAuth2Mapping - - - + + + AuthProvider @@ -815,9 +815,9 @@ OAuth2Provider->AuthProvider - - - + + + Asset @@ -836,33 +836,33 @@ DatabaseProvider->AuthProvider - - - + + + Availability->AvailabilityTag - - - + + + Availability->Event - - - + + + Availability->Training - - - + + + Availability->Reservation - - - + + + Slot @@ -871,9 +871,9 @@ Availability->Slot - - - + + + MachinesAvailability @@ -882,9 +882,9 @@ Availability->MachinesAvailability - - - + + + TrainingsAvailability @@ -893,93 +893,93 @@ Availability->TrainingsAvailability - - - + + + Availability->Machine - - - + + + Subscription->Invoice - - - + + + Subscription->OfferDay - - - + + + Training->TrainingImage - - - + + + Training->TrainingsPricing - - - + + + Training->Plan - - - + + + Training->Credit - - - + + + Training->Reservation - - - + + + Training->UserTraining - - - + + + Training->TrainingsAvailability - - - + + + Training->Machine - - - + + + ProjectStep->ProjectStepImage - - - + + + Reservation->Invoice - - - + + + Reservation->Slot - - - + + + Ticket @@ -988,21 +988,21 @@ Reservation->Ticket - - - + + + StatisticIndex->StatisticType - - - + + + StatisticIndex->StatisticGraph - - - + + + StatisticField @@ -1011,27 +1011,27 @@ StatisticIndex->StatisticField - - - + + + StatisticField->StatisticIndex - - - + + + WalletTransaction->Invoice - - - + + + EventPriceCategory->Ticket - - - + + + Avoir @@ -1040,15 +1040,15 @@ Avoir->InvoiceItem - - - + + + Avoir->Invoice - - - + + + avoir @@ -1068,9 +1068,9 @@ Coupon->Invoice - - - + + + Category @@ -1079,9 +1079,9 @@ Category->Event - - - + + + MachineImage @@ -1095,45 +1095,45 @@ Machine->Price - - - + + + Machine->Plan - - - + + + Machine->MachineFile - - - + + + Machine->Credit - - - + + + Machine->Reservation - - - + + + Machine->MachinesAvailability - - - + + + Machine->MachineImage - - - + + + Abuse @@ -1142,21 +1142,21 @@ Profile->UserAvatar - - - + + + Profile->Address - - - + + + Profile->Organization - - - + + + Setting diff --git a/doc/models_complete.svg b/doc/models_complete.svg index dd4b1aa9c..e686ad63d 100644 --- a/doc/models_complete.svg +++ b/doc/models_complete.svg @@ -4,29 +4,29 @@ - - + + models_diagram - + _diagram_info -Models diagram -Date: Sep 15 2016 - 17:48 -Migration version: 20160915105234 -Generated by RailRoady 1.4.0 -http://railroady.prestonlee.com +Models diagram +Date: Nov 23 2016 - 10:20 +Migration version: 20160922155555 +Generated by RailRoady 1.4.0 +http://railroady.prestonlee.com Group - -Group - -id :integer -name :character varying(255) -created_at :timestamp without time zone -updated_at :timestamp without time zone -slug :character varying(255) + +Group + +id :integer +name :character varying(255) +created_at :timestamp without time zone +updated_at :timestamp without time zone +slug :character varying(255) Price @@ -44,9 +44,9 @@ Group->Price - - - + + + machines_prices @@ -63,9 +63,9 @@ Group->TrainingsPricing - - - + + + Plan @@ -90,9 +90,9 @@ Group->Plan - - - + + + User @@ -134,9 +134,9 @@ Group->User - - - + + + InvoiceItem @@ -155,9 +155,9 @@ InvoiceItem->InvoiceItem - - - + + + AvailabilityTag @@ -172,8 +172,8 @@ OpenAPI - -OpenAPI + +OpenAPI TrainingImage @@ -190,15 +190,15 @@ OpenAPI::Client - -OpenAPI::Client - -id :integer -name :character varying -calls_count :integer -token :character varying -created_at :timestamp without time zone -updated_at :timestamp without time zone + +OpenAPI::Client + +id :integer +name :character varying +calls_count :integer +token :character varying +created_at :timestamp without time zone +updated_at :timestamp without time zone OpenAPI::CallsCountTracing @@ -214,16 +214,16 @@ OpenAPI::Client->OpenAPI::CallsCountTracing - - - + + + OpenAPI::ParameterError - -OpenAPI::ParameterError - - + +OpenAPI::ParameterError + + UserAvatar @@ -253,25 +253,25 @@ Tag - -Tag - -id :integer -name :character varying -created_at :timestamp without time zone -updated_at :timestamp without time zone + +Tag + +id :integer +name :character varying +created_at :timestamp without time zone +updated_at :timestamp without time zone Tag->AvailabilityTag - - - + + + Tag->User - - - + + + Availability @@ -289,9 +289,9 @@ Tag->Availability - - - + + + UserTag @@ -306,9 +306,9 @@ Tag->UserTag - - - + + + Event @@ -341,9 +341,9 @@ Event->PriceCategory - - - + + + EventTheme @@ -358,9 +358,9 @@ Event->EventTheme - - - + + + EventImage @@ -377,9 +377,9 @@ Event->EventImage - - - + + + Reservation @@ -398,9 +398,9 @@ Event->Reservation - - - + + + EventPriceCategory @@ -416,9 +416,9 @@ Event->EventPriceCategory - - - + + + EventFile @@ -435,20 +435,20 @@ Event->EventFile - - - + + + StatisticSubType - -StatisticSubType - -id :integer -key :character varying(255) -label :character varying(255) -created_at :timestamp without time zone -updated_at :timestamp without time zone + +StatisticSubType + +id :integer +key :character varying(255) +label :character varying(255) +created_at :timestamp without time zone +updated_at :timestamp without time zone StatisticType @@ -466,9 +466,9 @@ StatisticSubType->StatisticType - - - + + + StatisticTypeSubType @@ -483,9 +483,9 @@ StatisticSubType->StatisticTypeSubType - - - + + + Project @@ -506,15 +506,15 @@ Project->ProjectImage - - - + + + Project->User - - - + + + Theme @@ -526,9 +526,9 @@ Project->Theme - - - + + + ProjectCao @@ -545,9 +545,9 @@ Project->ProjectCao - - - + + + ProjectStep @@ -564,9 +564,9 @@ Project->ProjectStep - - - + + + ProjectUser @@ -583,9 +583,9 @@ Project->ProjectUser - - - + + + Machine @@ -602,9 +602,9 @@ Project->Machine - - - + + + Component @@ -616,19 +616,19 @@ Project->Component - - - + + + CustomAsset - -CustomAsset - -id :integer -name :character varying -created_at :timestamp without time zone -updated_at :timestamp without time zone + +CustomAsset + +id :integer +name :character varying +created_at :timestamp without time zone +updated_at :timestamp without time zone CustomAssetFile @@ -645,9 +645,9 @@ CustomAsset->CustomAssetFile - - - + + + AgeRange @@ -662,9 +662,9 @@ AgeRange->Event - - - + + + Wallet @@ -694,64 +694,64 @@ Wallet->WalletTransaction - - - + + + Stats::Event - -Stats::Event - - + +Stats::Event + + Stats::Project - -Stats::Project - - + +Stats::Project + + Stats::User - -Stats::User - - + +Stats::User + + Stats::Subscription - -Stats::Subscription - - + +Stats::Subscription + + Stats::Training - -Stats::Training - - + +Stats::Training + + Stats::Account - -Stats::Account - - + +Stats::Account + + Stats::Machine - -Stats::Machine - - + +Stats::Machine + + PriceCategory->EventPriceCategory - - - + + + Invoice @@ -779,15 +779,15 @@ Invoice->InvoiceItem - - - + + + Invoice->Invoice - - - + + + avoir @@ -817,9 +817,9 @@ OfferDay->Invoice - - - + + + StatisticIndex @@ -836,15 +836,15 @@ StatisticType->StatisticIndex - - - + + + StatisticType->StatisticTypeSubType - - - + + + StatisticCustomAggregation @@ -862,9 +862,9 @@ StatisticType->StatisticCustomAggregation - - - + + + Address @@ -885,15 +885,15 @@ Plan->Price - - - + + + Plan->PlanFile - - - + + + Credit @@ -910,22 +910,22 @@ Plan->Credit - - - + + + Plan->Credit - - - + + + training_credits Plan->Credit - - - + + + machine_credits @@ -944,9 +944,9 @@ Plan->Subscription - - - + + + PlanImage @@ -963,9 +963,9 @@ Plan->PlanImage - - - + + + MachineFile @@ -993,9 +993,9 @@ Organization->Address - - - + + + StatisticGraph @@ -1036,47 +1036,47 @@ Licence->Project - - - + + + User->Project - - - + + + my_projects User->Wallet - - - + + + User->Invoice - - - + + + User->Credit - - - + + + User->Credit - - - + + + training_credits User->Credit - - - + + + machine_credits @@ -1093,9 +1093,9 @@ User->Role - - - + + + Notification @@ -1116,15 +1116,15 @@ User->Notification - - - + + + User->Subscription - - - + + + Training @@ -1142,15 +1142,15 @@ User->Training - - - + + + User->Reservation - - - + + + UsersCredit @@ -1166,15 +1166,15 @@ User->UsersCredit - - - + + + User->UserTag - - - + + + Export @@ -1192,9 +1192,9 @@ User->Export - - - + + + UserTraining @@ -1209,15 +1209,15 @@ User->UserTraining - - - + + + User->ProjectUser - - - + + + Profile @@ -1254,9 +1254,9 @@ User->Profile - - - + + + ProjectStepImage @@ -1273,9 +1273,9 @@ Credit->UsersCredit - - - + + + PartnerPlan @@ -1300,74 +1300,75 @@ PartnerPlan->Price - - - + + + PartnerPlan->PlanFile - - - + + + PartnerPlan->Credit - - - + + + PartnerPlan->Credit - - - + + + training_credits PartnerPlan->Credit - - - + + + machine_credits PartnerPlan->Role - - - + + + PartnerPlan->Subscription - - - + + + PartnerPlan->PlanImage - - - + + + OAuth2Provider - -OAuth2Provider - -id :integer -base_url :character varying -token_endpoint :character varying -authorization_endpoint :character varying -client_id :character varying -client_secret :character varying -created_at :timestamp without time zone -updated_at :timestamp without time zone -profile_url :character varying + +OAuth2Provider + +id :integer +base_url :character varying +token_endpoint :character varying +authorization_endpoint :character varying +client_id :character varying +client_secret :character varying +created_at :timestamp without time zone +updated_at :timestamp without time zone +profile_url :character varying +logout_endpoint :character varying OAuth2Provider->OAuth2Mapping - - - + + + AuthProvider @@ -1384,66 +1385,66 @@ OAuth2Provider->AuthProvider - - - + + + Asset - -Asset - -id :integer -viewable_id :integer -viewable_type :character varying(255) -attachment :character varying(255) -type :character varying(255) -created_at :timestamp without time zone -updated_at :timestamp without time zone + +Asset + +id :integer +viewable_id :integer +viewable_type :character varying(255) +attachment :character varying(255) +type :character varying(255) +created_at :timestamp without time zone +updated_at :timestamp without time zone Project::OpenlabSync - -Project::OpenlabSync + +Project::OpenlabSync DatabaseProvider - -DatabaseProvider - -id :integer -created_at :timestamp without time zone -updated_at :timestamp without time zone + +DatabaseProvider + +id :integer +created_at :timestamp without time zone +updated_at :timestamp without time zone DatabaseProvider->AuthProvider - - - + + + Availability->AvailabilityTag - - - + + + Availability->Event - - - + + + Availability->Training - - - + + + Availability->Reservation - - - + + + Slot @@ -1464,9 +1465,9 @@ Availability->Slot - - - + + + MachinesAvailability @@ -1479,9 +1480,9 @@ Availability->MachinesAvailability - - - + + + TrainingsAvailability @@ -1496,93 +1497,93 @@ Availability->TrainingsAvailability - - - + + + Availability->Machine - - - + + + Subscription->Invoice - - - + + + Subscription->OfferDay - - - + + + Training->TrainingImage - - - + + + Training->TrainingsPricing - - - + + + Training->Plan - - - + + + Training->Credit - - - + + + Training->Reservation - - - + + + Training->UserTraining - - - + + + Training->TrainingsAvailability - - - + + + Training->Machine - - - + + + ProjectStep->ProjectStepImage - - - + + + Reservation->Invoice - - - + + + Reservation->Slot - - - + + + Ticket @@ -1598,21 +1599,21 @@ Reservation->Ticket - - - + + + StatisticIndex->StatisticType - - - + + + StatisticIndex->StatisticGraph - - - + + + StatisticField @@ -1629,27 +1630,27 @@ StatisticIndex->StatisticField - - - + + + StatisticField->StatisticIndex - - - + + + WalletTransaction->Invoice - - - + + + EventPriceCategory->Ticket - - - + + + Avoir @@ -1677,33 +1678,33 @@ Avoir->InvoiceItem - - - + + + Avoir->Invoice - - - + + + avoir NotificationType - -NotificationType - - + +NotificationType + + Stylesheet - -Stylesheet - -id :integer -contents :text -created_at :timestamp without time zone -updated_at :timestamp without time zone + +Stylesheet + +id :integer +contents :text +created_at :timestamp without time zone +updated_at :timestamp without time zone Coupon @@ -1723,9 +1724,9 @@ Coupon->Invoice - - - + + + Category @@ -1740,9 +1741,9 @@ Category->Event - - - + + + MachineImage @@ -1759,96 +1760,96 @@ Feed - -Feed - - + +Feed + + Machine->Price - - - + + + Machine->Plan - - - + + + Machine->MachineFile - - - + + + Machine->Credit - - - + + + Machine->Reservation - - - + + + Machine->MachinesAvailability - - - + + + Machine->MachineImage - - - + + + Abuse - -Abuse - -id :integer -signaled_id :integer -signaled_type :character varying -first_name :character varying -last_name :character varying -email :character varying -message :text -created_at :timestamp without time zone -updated_at :timestamp without time zone + +Abuse + +id :integer +signaled_id :integer +signaled_type :character varying +first_name :character varying +last_name :character varying +email :character varying +message :text +created_at :timestamp without time zone +updated_at :timestamp without time zone Profile->UserAvatar - - - + + + Profile->Address - - - + + + Profile->Organization - - - + + + Setting - -Setting - -id :integer -name :character varying -value :text -created_at :timestamp without time zone -updated_at :timestamp without time zone + +Setting + +id :integer +name :character varying +value :text +created_at :timestamp without time zone +updated_at :timestamp without time zone From b7737be6f31dba4bb997c8db849b710de053836d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 23 Nov 2016 11:44:48 +0100 Subject: [PATCH 063/289] fix migration rollback --- .../20160906145713_insert_custom_aggregations.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/db/migrate/20160906145713_insert_custom_aggregations.rb b/db/migrate/20160906145713_insert_custom_aggregations.rb index 90c95e456..1b23072c1 100644 --- a/db/migrate/20160906145713_insert_custom_aggregations.rb +++ b/db/migrate/20160906145713_insert_custom_aggregations.rb @@ -1,5 +1,5 @@ class InsertCustomAggregations < ActiveRecord::Migration - def change + def up # available reservations hours for machines machine = StatisticIndex.find_by_es_type_key('machine') machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id) @@ -26,4 +26,17 @@ class InsertCustomAggregations < ActiveRecord::Migration }) available_tickets.save! end + + def down + + machine = StatisticIndex.find_by_es_type_key('machine') + machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id) + + StatisticCustomAggregation.where(field: 'available_hours', statistic_type_id: machine_hours.id).first.destroy! + + training = StatisticIndex.find_by_es_type_key('training') + training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id) + + StatisticCustomAggregation.where(field: 'available_tickets', statistic_type_id: training_bookings.id).first.destroy! + end end From ad2911529c9cb4bec2901f442d360c0a16dd04d4 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 23 Nov 2016 12:43:42 +0100 Subject: [PATCH 064/289] db model, api and interface for cash coupons --- .../controllers/admin/coupons.coffee | 16 ++++++--- .../controllers/admin/pricing.coffee.erb | 7 ++-- .../templates/admin/coupons/_form.html.erb | 34 +++++++++++++++++-- .../templates/admin/pricing/coupons.html.erb | 7 ++-- app/controllers/api/coupons_controller.rb | 2 +- app/models/coupon.rb | 11 ++++-- app/validators/coupon_discount_validator.rb | 15 ++++++++ app/views/api/coupons/_coupon.json.jbuilder | 2 +- app/workers/stripe_worker.rb | 2 ++ config/locales/app.admin.en.yml | 2 +- config/locales/app.admin.fr.yml | 2 +- config/locales/app.shared.en.yml | 4 +++ config/locales/app.shared.fr.yml | 4 +++ ...0161123104604_add_amount_off_to_coupons.rb | 5 +++ db/schema.rb | 4 ++- 15 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 app/validators/coupon_discount_validator.rb create mode 100644 db/migrate/20161123104604_add_amount_off_to_coupons.rb diff --git a/app/assets/javascripts/controllers/admin/coupons.coffee b/app/assets/javascripts/controllers/admin/coupons.coffee index eef8f658c..32a49bef3 100644 --- a/app/assets/javascripts/controllers/admin/coupons.coffee +++ b/app/assets/javascripts/controllers/admin/coupons.coffee @@ -8,12 +8,17 @@ userValidities = ['once', 'forever'] ## # Controller used in the coupon creation page ## -Application.Controllers.controller "NewCouponController", ["$scope", "$state",'Coupon', 'growl', '_t' -, ($scope, $state, Coupon, growl, _t) -> +Application.Controllers.controller "NewCouponController", ["$scope", "$state", '$locale', 'Coupon', 'growl', '_t' +, ($scope, $state, $locale, Coupon, growl, _t) -> ## Values for the coupon currently created $scope.coupon = active: true + type: 'percent_off' + + + ## currency symbol for the current locale (cf. angular-i18n) + $scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM; ## Options for the validity per user $scope.validities = userValidities @@ -57,8 +62,8 @@ Application.Controllers.controller "NewCouponController", ["$scope", "$state",'C ## # Controller used in the coupon edition page ## -Application.Controllers.controller "EditCouponController", ["$scope", "$state", 'Coupon', 'couponPromise', '_t' -, ($scope, $state, Coupon, couponPromise, _t) -> +Application.Controllers.controller "EditCouponController", ["$scope", "$state", '$locale', 'Coupon', 'couponPromise', '_t' +, ($scope, $state, $locale, Coupon, couponPromise, _t) -> ### PUBLIC SCOPE ### @@ -72,6 +77,9 @@ Application.Controllers.controller "EditCouponController", ["$scope", "$state", ## Options for the validity per user $scope.validities = userValidities + ## currency symbol for the current locale (cf. angular-i18n) + $scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM; + ## Default parameters for AngularUI-Bootstrap datepicker (used for coupon validity limit selection) $scope.datePicker = format: Fablab.uibDateFormat diff --git a/app/assets/javascripts/controllers/admin/pricing.coffee.erb b/app/assets/javascripts/controllers/admin/pricing.coffee.erb index 4d69bfae7..54bcaeb0f 100644 --- a/app/assets/javascripts/controllers/admin/pricing.coffee.erb +++ b/app/assets/javascripts/controllers/admin/pricing.coffee.erb @@ -3,8 +3,8 @@ ## # Controller used in the prices edition page ## -Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', 'TrainingsPricing', '$filter', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t' -, ($scope, $state, $uibModal, TrainingsPricing, $filter, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) -> +Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', '$locale', '$filter', 'TrainingsPricing', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t' +, ($scope, $state, $uibModal, $locale, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) -> ### PUBLIC SCOPE ### ## List of machines prices (not considering any plan) @@ -44,6 +44,9 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state", $scope.status = isopen: false + ## currency symbol for the current locale (cf. angular-i18n) + $scope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM; + $scope.findTrainingsPricing = (trainingsPricings, trainingId, groupId)-> diff --git a/app/assets/templates/admin/coupons/_form.html.erb b/app/assets/templates/admin/coupons/_form.html.erb index 81274bcc2..4cc92c9f6 100644 --- a/app/assets/templates/admin/coupons/_form.html.erb +++ b/app/assets/templates/admin/coupons/_form.html.erb @@ -21,7 +21,20 @@ {{ 'code_must_be_composed_of_capital_letters_digits_and_or_dashes' }}
-
+
+ + +
+ +
+ ng-required="coupon.type == 'percent_off'"/>
{{ 'percent_off_is_required' }} {{ 'percentage_must_be_between_0_and_100' }}
+ +
+ +
+ {{currencySymbol}} + +
+ {{ 'percent_off_is_required' }} + {{ 'percentage_must_be_between_0_and_100' }} +
+
+ + {{msg.message}}
diff --git a/app/controllers/api/prices_controller.rb b/app/controllers/api/prices_controller.rb index 2c9dacd10..19acd769e 100644 --- a/app/controllers/api/prices_controller.rb +++ b/app/controllers/api/prices_controller.rb @@ -41,7 +41,7 @@ class API::PricesController < API::ApiController _user = User.find(_price_params[:user_id]) # reservable if _price_params[:reservable_id].nil? - @amount = {elements: nil, total: 0} + @amount = {elements: nil, total: 0, before_coupon: 0} else _reservable = _price_params[:reservable_type].constantize.find(_price_params[:reservable_id]) @amount = Price.compute(current_user.is_admin?, _user, _reservable, _price_params[:slots_attributes], _price_params[:plan_id], _price_params[:nb_reserve_places], _price_params[:tickets_attributes], coupon_params[:coupon_code]) From 3fad06c886c9f4b8587337adbad4096a0b75d115 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 30 Nov 2016 17:28:51 +0100 Subject: [PATCH 123/289] Version 2.4.6 --- .fabmanager-version | 2 +- CHANGELOG.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.fabmanager-version b/.fabmanager-version index 26f8b8bcd..62e64205b 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.5 \ No newline at end of file +2.4.6 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d256af89b..ed68f9cc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog Fab Manager +## v2.4.6 2016 Novembre 30 + +- Change display of message about coupon application status +- Fix a bug: compute price API return error 500 if reservable_id is not provided + ## v2.4.5 2016 November 29 - Ability to create coupons with cash amounts (previously only percentages were allowed) From bb4c3bdd3546ceadc29fe38bb33b11491aab9a4f Mon Sep 17 00:00:00 2001 From: cyril Date: Wed, 30 Nov 2016 21:48:46 +0100 Subject: [PATCH 124/289] update docker Readme --- docker/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index ad53b0587..a5921c83a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -124,8 +124,8 @@ Requires=docker.service [Service] Type=oneshot -ExecStart=/usr/bin/docker run --rm --name letsencrypt -v "/home/core/fabmanager/log:/var/log/letsencrypt" -v "/home/core/fabmanager/letsencrypt/etc:/etc/letsencrypt" -v "/home/core/fabmanager/letsencrypt/config:/letsencrypt-config" quay.io/letsencrypt/letsencrypt:latest -c "/letsencrypt-config/webroot.ini" certonly -ExecStartPost=-/usr/bin/docker restart fabmanager +ExecStart=/usr/bin/docker run --rm --name letsencrypt -v "/apps/recreanglais/log:/var/log/letsencrypt" -v "/apps/recreanglais/letsencrypt/etc:/etc/letsencrypt" -v "/apps/recreanglais/letsencrypt/config:/letsencrypt-config" quay.io/letsencrypt/letsencrypt:latest -c "/letsencrypt-config/webroot.ini" certonly +ExecStartPost=-/usr/bin/docker restart fabmanager_nginx_1 ``` Create file (with sudo) /etc/systemd/system/letsencrypt.timer with @@ -138,6 +138,9 @@ Requires=docker.service OnCalendar=*-*-1 06:00:00 Persistent=true Unit=letsencrypt.service + +[Install] +WantedBy=timers.target ``` Then deploy your app and read the "Generate SSL certificate by Letsencrypt" section to complete the installation of the letsencrypt certificate. @@ -277,7 +280,9 @@ Remove your app and Run your app to apply changes Finally, if everything is ok, start letsencrypt timer to update the certificate every 1st of the month : ```bash +sudo systemctl enable letsencrypt.timer sudo systemctl start letsencrypt.timer +(check) sudo systemctl list-timers ``` From 5067ecd3ac85efb40ea48890a63c57e5a7da5bc5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 11:36:35 +0100 Subject: [PATCH 125/289] prevent elasticsearch from logging during tests (clearer output) --- config/initializers/elasticsearch.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/initializers/elasticsearch.rb b/config/initializers/elasticsearch.rb index 5f8f7d446..1e6b9966e 100644 --- a/config/initializers/elasticsearch.rb +++ b/config/initializers/elasticsearch.rb @@ -1,3 +1,8 @@ -client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: true +if Rails.env.test? + client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: false +else + client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: true +end + Elasticsearch::Model.client = client Elasticsearch::Persistence.client = client From cf1c8685464ea8c8c56c5cb82733be592bbf46c6 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 11:37:09 +0100 Subject: [PATCH 126/289] test suite is now testing pdf files content --- Gemfile | 1 + Gemfile.lock | 13 ++++++++++++- test/test_helper.rb | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index b0250b9a7..f0f5a271f 100644 --- a/Gemfile +++ b/Gemfile @@ -62,6 +62,7 @@ group :test do gem 'webmock' gem 'vcr' gem 'byebug' + gem 'pdf-reader' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 6e602afad..694325a16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: https://rubygems.org/ specs: + Ascii85 (1.0.2) aasm (4.1.0) actionmailer (4.2.5) actionpack (= 4.2.5) @@ -41,6 +42,7 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) + afm (0.2.2) ansi (1.5.0) api-pagination (4.3.0) apipie-rails (0.3.6) @@ -177,6 +179,7 @@ GEM has_secure_token (1.0.0) activerecord (>= 3.0) hashdiff (0.3.0) + hashery (2.1.2) hashie (3.4.2) highline (1.7.1) hike (1.2.3) @@ -265,6 +268,12 @@ GEM httparty (~> 0.13) orm_adapter (0.5.0) pdf-core (0.5.1) + pdf-reader (1.4.0) + Ascii85 (~> 1.0.0) + afm (~> 0.2.1) + hashery (~> 2.0) + ruby-rc4 + ttfunk pg (0.18.1) pkg-config (1.1.7) prawn (2.0.1) @@ -335,6 +344,7 @@ GEM netrc (~> 0.7) rolify (4.0.0) ruby-progressbar (1.7.5) + ruby-rc4 (0.1.5) rubyzip (1.1.7) rufus-scheduler (3.0.9) tzinfo @@ -488,6 +498,7 @@ DEPENDENCIES omniauth omniauth-oauth2 openlab_ruby + pdf-reader pg prawn prawn-table @@ -522,4 +533,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.12.5 + 1.13.1 diff --git a/test/test_helper.rb b/test/test_helper.rb index 792006eac..484055c31 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -68,6 +68,31 @@ class ActiveSupport::TestCase assert File.exist?(invoice.file), 'Invoice PDF was not generated' + # now we check the file content + reader = PDF::Reader.new(invoice.file) + assert_equal 1, reader.page_count # single page invoice + + ht_amount = invoice.total + page = reader.pages.first + lines = page.text.scan(/^.+/) + lines.each do |line| + # check that the numbers printed into the PDF file match the total stored in DB + if line.include? I18n.t('invoices.total_amount') + assert_equal invoice.total / 100.0, parse_amount_from_invoice_line(line), 'Invoice total rendered in the PDF file does not match' + end + + # check that the VAT was correctly applied if it was configured + if line.include? I18n.t('invoices.including_total_excluding_taxes') + ht_amount = parse_amount_from_invoice_line(line) + end + end + + if Setting.find_by(name: 'invoice_VAT-active').value == 'true' + vat_rate = Setting.find_by({name: 'invoice_VAT-rate'}).value.to_f + assert_equal (invoice.total / (vat_rate / 100 + 1)), ht_amount, 'Total excluding taxes rendered in the PDF file is not computed correct' + else + assert_equal invoice.total, ht_amount, 'VAT information was rendered in the PDF file despite that VAT was disabled' + end File.delete(invoice.file) end @@ -89,6 +114,15 @@ class ActiveSupport::TestCase skip('Unable to test export which is not of the category "statistics"') end end + + private + + # Parse a line of text read from a PDF file and return the price included inside + # Line of text should be of form 'Label $10.00' + # @returns {float} + def parse_amount_from_invoice_line line + line[line.rindex(' ')+1..-1].tr(I18n.t('number.currency.format.unit'), '').to_f + end end class ActionDispatch::IntegrationTest From 33566b551db886ec545b280d909151697e4224a2 Mon Sep 17 00:00:00 2001 From: cyril Date: Thu, 1 Dec 2016 12:01:44 +0100 Subject: [PATCH 127/289] update docker doc --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index a5921c83a..1d1855bd3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -124,7 +124,7 @@ Requires=docker.service [Service] Type=oneshot -ExecStart=/usr/bin/docker run --rm --name letsencrypt -v "/apps/recreanglais/log:/var/log/letsencrypt" -v "/apps/recreanglais/letsencrypt/etc:/etc/letsencrypt" -v "/apps/recreanglais/letsencrypt/config:/letsencrypt-config" quay.io/letsencrypt/letsencrypt:latest -c "/letsencrypt-config/webroot.ini" certonly +ExecStart=/usr/bin/docker run --rm --name letsencrypt -v "/home/core/fabmanager/log:/var/log/letsencrypt" -v "/home/core/fabmanager/letsencrypt/etc:/etc/letsencrypt" -v "/home/core/fabmanager/letsencrypt/config:/letsencrypt-config" quay.io/letsencrypt/letsencrypt:latest -c "/letsencrypt-config/webroot.ini" certonly ExecStartPost=-/usr/bin/docker restart fabmanager_nginx_1 ``` From 2a92b06ef6db6ce56e51f92e14a12a254abefc5b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 12:12:44 +0100 Subject: [PATCH 128/289] test invoice with VAT --- test/integration/events/as_user_test.rb | 11 ++++++++++- test/test_helper.rb | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/integration/events/as_user_test.rb b/test/integration/events/as_user_test.rb index 8b32e4fca..cf1239cba 100644 --- a/test/integration/events/as_user_test.rb +++ b/test/integration/events/as_user_test.rb @@ -1,7 +1,7 @@ module Events class AsUserTest < ActionDispatch::IntegrationTest - test 'reserve event with many prices and payment means' do + test 'reserve event with many prices and payment means and VAT' do vlonchamp = User.find_by(username: 'vlonchamp') login_as(vlonchamp, scope: :user) @@ -15,6 +15,15 @@ module Events users_credit_count = UsersCredit.count wallet_transactions_count = WalletTransaction.count + # Enable the VAT at 19.6% + vat_active = Setting.find_by(name: 'invoice_VAT-active') + vat_active.value = 'true' + vat_active.save! + + vat_rate = Setting.find_by(name: 'invoice_VAT-rate') + vat_rate.value = '19.6' + vat_rate.save! + # Reserve the 'radio' event VCR.use_cassette('reserve_event_with_many_prices_and_payment_means') do post reservations_path, { diff --git a/test/test_helper.rb b/test/test_helper.rb index 484055c31..2c15f2b0f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -89,7 +89,9 @@ class ActiveSupport::TestCase if Setting.find_by(name: 'invoice_VAT-active').value == 'true' vat_rate = Setting.find_by({name: 'invoice_VAT-rate'}).value.to_f - assert_equal (invoice.total / (vat_rate / 100 + 1)), ht_amount, 'Total excluding taxes rendered in the PDF file is not computed correct' + computed_ht = sprintf('%.2f', (invoice.total / (vat_rate / 100 + 1)) / 100.0).to_f + + assert_equal computed_ht, ht_amount, 'Total excluding taxes rendered in the PDF file is not computed correctly' else assert_equal invoice.total, ht_amount, 'VAT information was rendered in the PDF file despite that VAT was disabled' end From a738cfa650c96c5bb064e648a29a20c7a17c6e60 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 12:22:01 +0100 Subject: [PATCH 129/289] do not versionate coverall config --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ee0e0fc32..14be73a99 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,8 @@ .vagrant .docker +# Do not versionate coveralls token +.coveralls.yml # Plugins are versioned is their own repository /plugins/* From 4c68f815e7c5b4690d9e40b3e4b81d8b03718803 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 13:08:41 +0100 Subject: [PATCH 130/289] added coveralls --- .gitignore | 2 ++ Gemfile | 2 ++ Gemfile.lock | 16 ++++++++++++++++ test/test_helper.rb | 3 +++ 4 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index 14be73a99..9a35a3571 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ # Ignore all logfiles and tempfiles. /log/*.log /tmp +/coverage /public/uploads /public/assets @@ -38,6 +39,7 @@ .vagrant .docker + # Do not versionate coveralls token .coveralls.yml diff --git a/Gemfile b/Gemfile index f0f5a271f..a2394f4fc 100644 --- a/Gemfile +++ b/Gemfile @@ -52,6 +52,8 @@ group :development do gem 'capistrano-maintenance', '0.0.5', require: false gem 'active_record_query_trace' + + gem 'coveralls', require: false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 694325a16..0eab18efc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -120,6 +120,12 @@ GEM sass-rails (<= 5.0.1) sprockets (< 2.13) connection_pool (2.2.0) + coveralls (0.8.16) + json (>= 1.8, < 3) + simplecov (~> 0.12.0) + term-ansicolor (~> 1.3.0) + thor (~> 0.19.1) + tins (>= 1.6.0, < 2) crack (0.4.3) safe_yaml (~> 1.0.0) database_cleaner (1.4.1) @@ -135,6 +141,7 @@ GEM warden (~> 1.2.3) devise-async (0.9.0) devise (~> 3.2) + docile (1.1.5) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) elasticsearch (1.0.12) @@ -375,6 +382,11 @@ GEM sidekiq (>= 2.17.3) tilt (< 2.0.0) simple_oauth (0.3.1) + simplecov (0.12.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) sinatra (1.4.6) rack (~> 1.4) rack-protection (~> 1.4) @@ -392,6 +404,8 @@ GEM stripe (1.30.2) json (~> 1.8.1) rest-client (~> 1.4) + term-ansicolor (1.3.2) + tins (~> 1.0) test_after_commit (1.0.0) activerecord (>= 3.2) therubyracer (0.12.0) @@ -402,6 +416,7 @@ GEM tilt (1.4.1) timers (4.0.1) hitimes + tins (1.13.0) ttfunk (1.4.0) twitter (5.14.0) addressable (~> 2.3) @@ -472,6 +487,7 @@ DEPENDENCIES chroma coffee-rails (~> 4.1.0) compass-rails (= 2.0.4) + coveralls database_cleaner devise devise-async diff --git a/test/test_helper.rb b/test/test_helper.rb index 2c15f2b0f..4b7c20e5e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,6 @@ +require 'coveralls' +Coveralls.wear!('rails') + ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' From db8cf69771061776f7bb0d916342be7d6d14fe2d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 8 Dec 2016 12:09:04 +0100 Subject: [PATCH 131/289] [bug #55] unable to run rake db:migrate on first install --- ...160906145713_insert_custom_aggregations.rb | 42 ------------------- db/seeds.rb | 26 ++++++++++++ 2 files changed, 26 insertions(+), 42 deletions(-) delete mode 100644 db/migrate/20160906145713_insert_custom_aggregations.rb diff --git a/db/migrate/20160906145713_insert_custom_aggregations.rb b/db/migrate/20160906145713_insert_custom_aggregations.rb deleted file mode 100644 index 2e28fd5f1..000000000 --- a/db/migrate/20160906145713_insert_custom_aggregations.rb +++ /dev/null @@ -1,42 +0,0 @@ -class InsertCustomAggregations < ActiveRecord::Migration - def up - # available reservations hours for machines - machine = StatisticIndex.find_by(es_type_key: 'machine') - machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id) - - available_hours = StatisticCustomAggregation.new({ - statistic_type_id: machine_hours.id, - es_index: 'fablab', - es_type: 'availabilities', - field: 'available_hours', - query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"hours_duration"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}' - }) - available_hours.save! - - # available training tickets - training = StatisticIndex.find_by(es_type_key: 'training') - training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id) - - available_tickets = StatisticCustomAggregation.new({ - statistic_type_id: training_bookings.id, - es_index: 'fablab', - es_type: 'availabilities', - field: 'available_tickets', - query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"nb_total_places"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"training"}}]}}}' - }) - available_tickets.save! - end - - def down - - machine = StatisticIndex.find_by(es_type_key: 'machine') - machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: machine.id) - - StatisticCustomAggregation.where(field: 'available_hours', statistic_type_id: machine_hours.id).first.destroy! - - training = StatisticIndex.find_by(es_type_key: 'training') - training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: training.id) - - StatisticCustomAggregation.where(field: 'available_tickets', statistic_type_id: training_bookings.id).first.destroy! - end -end diff --git a/db/seeds.rb b/db/seeds.rb index 33ee91648..c10636074 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -396,4 +396,30 @@ unless Setting.find_by(name: 'reminder_delay').try(:value) setting = Setting.find_or_initialize_by(name: 'reminder_delay') setting.value = '24' setting.save +end + +if StatisticCustomAggregation.count == 0 + # available reservations hours for machines + machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2) + + available_hours = StatisticCustomAggregation.new({ + statistic_type_id: machine_hours.id, + es_index: 'fablab', + es_type: 'availabilities', + field: 'available_hours', + query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"hours_duration"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}' + }) + available_hours.save! + + # available training tickets + training_bookings = StatisticType.find_by(key: 'booking', statistic_index_id: 3) + + available_tickets = StatisticCustomAggregation.new({ + statistic_type_id: training_bookings.id, + es_index: 'fablab', + es_type: 'availabilities', + field: 'available_tickets', + query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"nb_total_places"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"training"}}]}}}' + }) + available_tickets.save! end \ No newline at end of file From c2f638934eb7610a3db091227c127090da07487c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 12 Dec 2016 11:18:24 +0100 Subject: [PATCH 132/289] added info notice about operation's time of admin delete --- app/assets/javascripts/controllers/admin/members.coffee.erb | 6 +++--- app/assets/templates/shared/confirm_modal.html.erb | 2 +- config/locales/app.admin.en.yml | 1 + config/locales/app.admin.fr.yml | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/controllers/admin/members.coffee.erb b/app/assets/javascripts/controllers/admin/members.coffee.erb index 9c37206d8..55d79c0ec 100644 --- a/app/assets/javascripts/controllers/admin/members.coffee.erb +++ b/app/assets/javascripts/controllers/admin/members.coffee.erb @@ -105,8 +105,8 @@ class MembersController ## # Controller used in the members/groups management page ## -Application.Controllers.controller "AdminMembersController", ["$scope", 'membersPromise', 'adminsPromise', 'growl', 'Admin', 'dialogs', '_t', 'Member', 'Export' -, ($scope, membersPromise, adminsPromise, growl, Admin, dialogs, _t, Member, Export) -> +Application.Controllers.controller "AdminMembersController", ["$scope","$sce", 'membersPromise', 'adminsPromise', 'growl', 'Admin', 'dialogs', '_t', 'Member', 'Export' +, ($scope, $sce, membersPromise, adminsPromise, growl, Admin, dialogs, _t, Member, Export) -> @@ -177,7 +177,7 @@ Application.Controllers.controller "AdminMembersController", ["$scope", 'members resolve: object: -> title: _t('confirmation_required') - msg: _t('do_you_really_want_to_delete_this_administrator_this_cannot_be_undone') + msg: $sce.trustAsHtml(_t('do_you_really_want_to_delete_this_administrator_this_cannot_be_undone') + '

' +_t('this_may_take_a_while_please_wait')) , -> # cancel confirmed Admin.delete id: admin.id, -> admins.splice(findAdminIdxById(admins, admin.id), 1) diff --git a/app/assets/templates/shared/confirm_modal.html.erb b/app/assets/templates/shared/confirm_modal.html.erb index 250bb78c1..b32db0943 100644 --- a/app/assets/templates/shared/confirm_modal.html.erb +++ b/app/assets/templates/shared/confirm_modal.html.erb @@ -3,7 +3,7 @@

{{object.title}}

diff --git a/config/locales/app.logged.en.yml b/config/locales/app.logged.en.yml index b0195a92f..533e1bbe7 100644 --- a/config/locales/app.logged.en.yml +++ b/config/locales/app.logged.en.yml @@ -5,8 +5,8 @@ en: # user's profile completion page when logging from an SSO provider confirm_your_new_account: "Confirm your new account" you_ve_just_created_a_new_account_on_the_fablab_by_logging_from: "You've just created a new account on the {NAME}, by logging from" # messageFormat interpolation - before_letting_you_use_the_application_we_need_some_more_details: "Before letting you use the application, we need some more details" - your_email_is_already_used_by_another_account_on_the_platform: "But wait, there is a problem! Your email is already used by another account on the platform." + we_need_some_more_details: "To finalize the platform setup, we need some more details" + your_email_is_already_used_by_another_account_on_the_platform: "It looks like your email address is already used by another user. Check your email address and please input below the code sent to you." please_fill_the_following_form: "Please fill the following form" some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified: "Some data may have already been provided by {{NAME}} and cannot be modified" # angular interpolation then_click_on_: "Then click on" diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index 84420ce1c..ea0e901dc 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -5,8 +5,8 @@ fr: # page de complétion du profil utilisateur, à la première connexion depuis un SSO confirm_your_new_account: "Confirmez votre nouveau compte" you_ve_just_created_a_new_account_on_the_fablab_by_logging_from: "Vous venez de créer un nouveau compte sur {GENDER, select, male{le} female{la} other{les}} {NAME}, en vous connectant depuis" # messageFormat interpolation - before_letting_you_use_the_application_we_need_some_more_details: "Avant de vous laisser utiliser l'application, nous avons besoin de quelques renseignements supplémentaires" - your_email_is_already_used_by_another_account_on_the_platform: "Mais attendez, il y a un problème ! Votre adresse de courriel est déjà utilisée par un autre compte sur cette plate-forme." + we_need_some_more_details: "Afin de finaliser le paramétrage de la plate-forme, nous avons besoin de quelques renseignements supplémentaires" + your_email_is_already_used_by_another_account_on_the_platform: "Il semblerait que votre adresse de courriel soit déjà utilisée par un autre utilisateur. Vérifiez votre adresse électronique et veuillez saisir ci-dessous le code qui vient de vous être envoyé." please_fill_the_following_form: "Merci de compléter le formulaire suivant" some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified: "Certaines informations peuvent nous avoir été déjà fournies par {{NAME}} et ne sont pas modifiables" # angular interpolation then_click_on_: "Cliquez ensuite sur" From a7fdc4d7414f2468d175687a89b76782b676eb9b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 14 Dec 2016 15:55:12 +0100 Subject: [PATCH 147/289] fix potentital issue with sso + enterprise profile --- app/views/api/members/show.json.jbuilder | 2 +- db/schema.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/api/members/show.json.jbuilder b/app/views/api/members/show.json.jbuilder index 8f061f96a..7f417dffe 100644 --- a/app/views/api/members/show.json.jbuilder +++ b/app/views/api/members/show.json.jbuilder @@ -30,7 +30,7 @@ json.profile do json.address do json.id @member.profile.organization.address.id json.address @member.profile.organization.address.address - end + end if @member.profile.organization.address end if @member.profile.organization end diff --git a/db/schema.rb b/db/schema.rb index f42f20eb9..1b7f84d7f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -289,7 +289,7 @@ ActiveRecord::Schema.define(version: 20161123104604) do t.boolean "is_read", default: false t.datetime "created_at" t.datetime "updated_at" - t.string "receiver_type" + t.string "receiver_type", limit: 255 t.boolean "is_send", default: false t.jsonb "meta_data", default: {} end @@ -320,7 +320,6 @@ ActiveRecord::Schema.define(version: 20161123104604) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "profile_url" - t.string "logout_endpoint" end create_table "offer_days", force: :cascade do |t| @@ -467,7 +466,7 @@ ActiveRecord::Schema.define(version: 20161123104604) do t.datetime "published_at" end - add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree + add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree create_table "projects_components", force: :cascade do |t| t.integer "project_id" @@ -536,8 +535,8 @@ ActiveRecord::Schema.define(version: 20161123104604) do t.datetime "updated_at" t.integer "availability_id" t.datetime "ex_start_at" - t.datetime "ex_end_at" t.datetime "canceled_at" + t.datetime "ex_end_at" t.boolean "offered", default: false end @@ -719,6 +718,7 @@ ActiveRecord::Schema.define(version: 20161123104604) do add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree create_table "users", force: :cascade do |t| + t.string "username", limit: 255 t.string "email", limit: 255, default: "", null: false t.string "encrypted_password", limit: 255, default: "", null: false t.string "reset_password_token", limit: 255 @@ -741,7 +741,6 @@ ActiveRecord::Schema.define(version: 20161123104604) do t.boolean "is_allow_contact", default: true t.integer "group_id" t.string "stp_customer_id", limit: 255 - t.string "username", limit: 255 t.string "slug", limit: 255 t.boolean "is_active", default: true t.boolean "invoicing_disabled", default: false From 5e1b85832c0f5361d418cc790b66c29b26c645bb Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 14 Dec 2016 17:14:53 +0100 Subject: [PATCH 148/289] [ongoing] resend sso fusion token --- .../{profile.coffee => profile.coffee.erb} | 26 +++++++++++++++++-- app/assets/templates/profile/_token.html.erb | 1 + .../templates/profile/resend_code_modal.html | 26 +++++++++++++++++++ config/locales/app.logged.en.yml | 3 +++ config/locales/app.logged.fr.yml | 3 +++ 5 files changed, 57 insertions(+), 2 deletions(-) rename app/assets/javascripts/controllers/{profile.coffee => profile.coffee.erb} (87%) create mode 100644 app/assets/templates/profile/resend_code_modal.html diff --git a/app/assets/javascripts/controllers/profile.coffee b/app/assets/javascripts/controllers/profile.coffee.erb similarity index 87% rename from app/assets/javascripts/controllers/profile.coffee rename to app/assets/javascripts/controllers/profile.coffee.erb index f2f542b31..e883d8dfb 100644 --- a/app/assets/javascripts/controllers/profile.coffee +++ b/app/assets/javascripts/controllers/profile.coffee.erb @@ -1,8 +1,8 @@ 'use strict' -Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session" -, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session) -> +Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs" +, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs) -> @@ -141,6 +141,28 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo + ## + # Ask for email confirmation and send the SSO merging token again + # @param $event {Object} jQuery event object + ## + $scope.resendCode = (event) -> + event.preventDefault() + event.stopPropagation() + # TODO show modal only IF email is not mapped to sso OR email = null + dialogs.confirm + templateUrl: '<%= asset_path "profile/resend_code_modal.html" %>' + resolve: + object: -> + email: memberPromise.email + , (email) -> + console.log(email) + # TODO update email + # TODO in every cases, resend email + # TODO growl result + + + + ## # Disconnect and re-connect the user to the SSO to force the synchronisation of the profile's data ## diff --git a/app/assets/templates/profile/_token.html.erb b/app/assets/templates/profile/_token.html.erb index f4a8b0404..3017b18ed 100644 --- a/app/assets/templates/profile/_token.html.erb +++ b/app/assets/templates/profile/_token.html.erb @@ -3,6 +3,7 @@

{{ 'do_you_already_have_an_account' }}

{{ 'do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access' }}

{{ 'just_specify_code_here_to_recover_access' }}

+

{{ 'i_did_not_receive_the_code' }}

diff --git a/app/assets/templates/profile/resend_code_modal.html b/app/assets/templates/profile/resend_code_modal.html new file mode 100644 index 000000000..427d381ae --- /dev/null +++ b/app/assets/templates/profile/resend_code_modal.html @@ -0,0 +1,26 @@ + + + diff --git a/config/locales/app.logged.en.yml b/config/locales/app.logged.en.yml index 533e1bbe7..8a5e26a31 100644 --- a/config/locales/app.logged.en.yml +++ b/config/locales/app.logged.en.yml @@ -18,9 +18,12 @@ en: do_you_already_have_an_account: "Do you already have an account?" do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access: "Do not fill the form beside but specify here the code you've received by email, to recover your access." just_specify_code_here_to_recover_access: "Just specify here the code you've received by email to recover your access." + i_did_not_receive_the_code: "I didn't receive the code" authentification_code: "Authentification code" confirm_my_code: "Confirm my code" an_unexpected_error_occurred_check_your_authentication_code: "An unexpected error occurred, please check your authentication code." + send_code_again: "Send the code again" + email_format_is_incorrect: "Email format is incorrect" dashboard: # dashboard: public profile diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index ea0e901dc..b3e8aeab5 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -18,9 +18,12 @@ fr: do_you_already_have_an_account: "Vous possédez déjà un compte ?" do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access: "Ne remplissez pas le formulaire à gauche mais indiquez ici le code qui vous a été fourni par e-mail, cela vous permettra de récupérer l'accès à votre compte." just_specify_code_here_to_recover_access: "Indiquez simplement ici le code que vous avez reçu par e-mail, cela vous permettra de récupérer l'accès à votre compte." + i_did_not_receive_the_code: "Je n'ai pas reçu le code" authentification_code: "Code d'authentification" confirm_my_code: "Valider mon code" an_unexpected_error_occurred_check_your_authentication_code: "Une erreur inattendue est survenue, vérifiez votre code d'authentification." + send_code_again: "Renvoyer le code" + email_format_is_incorrect: "Le format de l'adresse email est incorrect" dashboard: # tableau de bord: profile publique From 102eecdc8a4d8239a57e92d12e8c259b4ebad304 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 15 Dec 2016 14:16:24 +0100 Subject: [PATCH 149/289] ability to send again auth migration code --- .../controllers/profile.coffee.erb | 15 +++++++------- .../javascripts/services/authProvider.coffee | 3 +++ .../templates/profile/resend_code_modal.html | 2 +- .../api/auth_providers_controller.rb | 20 ++++++++++++++++++- app/policies/auth_provider_policy.rb | 3 +++ config/locales/app.logged.en.yml | 2 ++ config/locales/app.logged.fr.yml | 2 ++ config/locales/en.yml | 2 ++ config/locales/fr.yml | 2 ++ config/routes.rb | 1 + 10 files changed, 42 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/controllers/profile.coffee.erb b/app/assets/javascripts/controllers/profile.coffee.erb index e883d8dfb..781f12995 100644 --- a/app/assets/javascripts/controllers/profile.coffee.erb +++ b/app/assets/javascripts/controllers/profile.coffee.erb @@ -1,8 +1,8 @@ 'use strict' -Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs" -, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs) -> +Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs", "AuthProvider" +, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs, AuthProvider) -> @@ -148,18 +148,17 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo $scope.resendCode = (event) -> event.preventDefault() event.stopPropagation() - # TODO show modal only IF email is not mapped to sso OR email = null dialogs.confirm templateUrl: '<%= asset_path "profile/resend_code_modal.html" %>' resolve: object: -> email: memberPromise.email , (email) -> - console.log(email) - # TODO update email - # TODO in every cases, resend email - # TODO growl result - + # Request the server to send an auth-migration email to the current user + AuthProvider.send_code {email: email}, (res) -> + growl.info(_t('code_successfully_sent_again')) + , (err) -> + growl.error(err.data.error) diff --git a/app/assets/javascripts/services/authProvider.coffee b/app/assets/javascripts/services/authProvider.coffee index 4acb0b731..e9928ba8f 100644 --- a/app/assets/javascripts/services/authProvider.coffee +++ b/app/assets/javascripts/services/authProvider.coffee @@ -11,4 +11,7 @@ Application.Services.factory 'AuthProvider', ["$resource", ($resource)-> active: method: 'GET' url: '/api/auth_providers/active' + send_code: + method: 'POST' + url: '/api/auth_providers/send_code' ] diff --git a/app/assets/templates/profile/resend_code_modal.html b/app/assets/templates/profile/resend_code_modal.html index 427d381ae..b3e04dd02 100644 --- a/app/assets/templates/profile/resend_code_modal.html +++ b/app/assets/templates/profile/resend_code_modal.html @@ -5,7 +5,7 @@