Skip to content

Commit

Permalink
Merge branch 'dev' for release 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainbx committed Jun 16, 2016
2 parents f056c1e + 0466dd9 commit 6e7d550
Show file tree
Hide file tree
Showing 104 changed files with 2,249 additions and 545 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@
.DS_Store

.vagrant
.docker

/plugins/*
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog Fab Manager

## v2.2.0 2016 June 16
- Built-in support for extensions plug-ins
- User profile form: social networks links, personal website link, job and change profile visibility (public / private)
- User public profile: UI re-design with possible admin's customization
- Admin: Invoices list and users list are now loaded per 10 items to improve pages load time
- Admin: select member (eg. to buy a subscription for a member) is now loading the user's list dynamically when you type
- Project collaborators selection is now using a list dynamically loaded as you type
- Admin: select a training before monitoring its reservations -> improves page load time
- API: GET /api/trainings do not load nor send the associated availabilities until they are requested
- List of members is now loaded 10 members by 10, to improve page load time
- [TODO DEPLOY] Regenerate the theme stylesheet (easy way: Customization/General/Main colour -> "Save")
- [TODO DEPLOY] `bundle install` and `rake db:migrate`

## v2.1.2 2016 May 24
- Fix a bug: Google Analytics was not loaded and did not report any stats

Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ GEM
ffi (1.9.8)
figaro (1.1.0)
thor (~> 0.14)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
font-awesome-rails (4.6.3.0)
railties (>= 3.2, < 5.1)
foreman (0.78.0)
thor (~> 0.19.1)
forgery (0.6.0)
Expand Down Expand Up @@ -207,8 +207,8 @@ GEM
twitter_cldr (~> 3.1)
mime-types (2.99)
mini_magick (4.2.0)
mini_portile (0.6.2)
minitest (5.8.3)
mini_portile2 (2.0.0)
minitest (5.8.4)
minitest-reporters (1.1.8)
ansi
builder
Expand All @@ -226,8 +226,8 @@ GEM
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
netrc (0.10.3)
nokogiri (1.6.6.4)
mini_portile (~> 0.6.0)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
notify_with (0.0.2)
jbuilder (~> 2.0)
rails (>= 4.2.0)
Expand Down Expand Up @@ -283,7 +283,7 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-observers (0.1.2)
activemodel (~> 4.0)
Expand All @@ -298,7 +298,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.4.2)
rake (11.1.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
Expand Down
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ FabManager is the FabLab management solution. It is web-based, open-source and t
6. [ElasticSearch](#elasticsearch)<br/>
6.1. [Install ElasticSearch on Ubuntu/Debian](#elasticsearch-on-debian)<br/>
6.2. [Install ElasticSearch on MacOS X](#elasticsearch-on-macosx)<br/>
6.3. [Setup ElasticSearch for the FabManager](#setup-fabmanager-in-elasticsearch)
6.3. [Setup ElasticSearch for the FabManager](#setup-fabmanager-in-elasticsearch)<br/>
6.4. [Backup and Restore](#backup-and-restore-elasticsearch)
7. [Internationalization (i18n)](#i18n)<br/>
7.1. [Translation](#i18n-translation)<br/>
7.1.1. [Front-end translations](#i18n-translation-front)<br/>
Expand All @@ -26,8 +27,9 @@ FabManager is the FabLab management solution. It is web-based, open-source and t
7.2.1. [Settings](#i18n-settings)<br/>
7.2.2. [Applying changes](#i18n-apply)
8. [Open Projects](#open-projects)
9. [Known issues](#known-issues)
10. [Related Documentation](#related-documentation)
9. [Plugins](#plugins)
10. [Known issues](#known-issues)
11. [Related Documentation](#related-documentation)



Expand Down Expand Up @@ -398,6 +400,14 @@ brew install homebrew/versions/elasticsearch17
end
```

<a name="backup-and-restore-elasticsearch"></a>
### Backup and Restore

To backup and restore the ElasticSearch database, use the [elasticsearch-dump](https://github.com/taskrabbit/elasticsearch-dump) tool.

Dump the database with: `elasticdump --input=http://localhost:9200/stats --output=fablab_stats.json`.
Restore it with: `elasticdump --input=fablab_stats.json --output=http://localhost:9200/stats`.

<a name="i18n"></a>
## Internationalization (i18n)

Expand Down Expand Up @@ -541,8 +551,25 @@ To start using this awesome feature, there are a few steps:
- start your fab-manager app
- export your projects to open-projects (if you already have projects created on your fab-manager, unless you can skip that part) executing this command: `bundle exec rake fablab:openlab:bulk_export`

**IMPORTANT: please run your server in production mode.**

Go to your projects gallery and enjoy seeing your projects available from everywhere ! That's all.
<a name="plugins"></a>
## Plugins
Fab-manager has a system of plugins mainly inspired by [Discourse](https://github.com/discourse/discourse) architecture.
It enables you to write plugins which can:
- have its proper models and database tables
- have its proper assets (js & css)
- override existing behaviours of Fab-manager
- add features by adding views, controllers, ect...
To install a plugin, you just have to copy the plugin folder which contains its code into the folder `plugins` of Fab-manager.
You can see an example on the [repo of navinum gamification plugin](https://github.com/LaCasemate/navinum-gamification)
<a name="known-issues"></a>
## Known issues
Expand Down Expand Up @@ -581,6 +608,12 @@ Go to your projects gallery and enjoy seeing your projects available from everyw
DO NOT do this in a production environment, as this would lead to a serious security issue.
- Using another DBMS than PostgreSQL is not supported, because of some PostgreSQL specific instructions:
- `app/controllers/api/members_controllers.rb@list` is using `ILIKE`
- `app/controllers/api/invoices_controllers.rb@list` is using `ILIKE` and `date_trunc()`
- `db/migrate/20160613093842_create_unaccent_function.rb` is using [unaccent](https://www.postgresql.org/docs/current/static/unaccent.html) and [trigram](https://www.postgresql.org/docs/current/static/pgtrgm.html) modules and defines a PL/pgSQL function (`f_unaccent()`)
- `app/controllers/api/members_controllers.rb@search` is using `f_unaccent()` (see above) and `regexp_replace()`
<a name="related-documentation"></a>
## Related Documentation
Expand Down
Binary file added app/assets/images/social/dailymotion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/social/echosciences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@
//= require_tree ./services
//= require_tree ./directives
//= require_tree ./filters

<%
PluginRegistry.javascripts.each { |js| require_asset(js) }
%>
85 changes: 82 additions & 3 deletions app/assets/javascripts/controllers/admin/invoices.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,34 @@
##
# Controller used in the admin invoices listing page
##
Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'Invoice', '$uibModal', "growl", "$filter", 'Setting', 'settings', '_t'
, ($scope, $state, Invoice, $uibModal, growl, $filter, Setting, settings, _t) ->
Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'Invoice', 'invoices', '$uibModal', "growl", "$filter", 'Setting', 'settings', '_t'
, ($scope, $state, Invoice, invoices, $uibModal, growl, $filter, Setting, settings, _t) ->



### PRIVATE STATIC CONSTANTS ###

# number of invoices loaded each time we click on 'load more...'
INVOICES_PER_PAGE = 20



### PUBLIC SCOPE ###

## List of all users invoices
$scope.invoices = Invoice.query()
$scope.invoices = invoices

# Invoices filters
$scope.searchInvoice =
date: null
name: ''
reference: ''

# currently displayed page of invoices (search results)
$scope.page = 1

# true when all invoices are loaded
$scope.noMoreResults = false

## Default invoices ordering/sorting
$scope.orderInvoice = '-reference'
Expand Down Expand Up @@ -61,6 +80,9 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I
else
$scope.orderInvoice = orderBy

resetSearchInvoice()
invoiceSearch()



##
Expand Down Expand Up @@ -323,12 +345,35 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I



##
# Callback when any of the filters changes.
# Full reload the results list
##
$scope.handleFilterChange = ->
resetSearchInvoice()
invoiceSearch()



##
# Callback for the 'load more' button.
# Will load the next results of the current search, if any
##
$scope.showNextInvoices = ->
$scope.page += 1
invoiceSearch(true)



### PRIVATE SCOPE ###

##
# Kind of constructor: these actions will be realized first when the controller is loaded
##
initialize = ->
if (!invoices[0] || invoices[0].maxInvoices <= $scope.invoices.length)
$scope.noMoreResults = true

# retrieve settings from the DB through the API
$scope.invoice.legals.content = settings['invoice_legals']
$scope.invoice.text.content = settings['invoice_text']
Expand Down Expand Up @@ -381,6 +426,40 @@ Application.Controllers.controller "InvoicesController", ["$scope", "$state", 'I



##
# Reinitialize the context of invoices' search to display new results set
##
resetSearchInvoice = ->
$scope.page = 1
$scope.noMoreResults = false



##
# Run a search query with the current parameters set concerning invoices, then affect or concat the results
# to $scope.invoices
# @param concat {boolean} if true, the result will be append to $scope.invoices instead of being affected
##
invoiceSearch = (concat) ->
Invoice.list {
query:
number: $scope.searchInvoice.reference
customer: $scope.searchInvoice.name
date: $scope.searchInvoice.date
order_by: $scope.orderInvoice
page: $scope.page
size: INVOICES_PER_PAGE
}, (invoices) ->
if concat
$scope.invoices = $scope.invoices.concat(invoices)
else
$scope.invoices = invoices

if (!invoices[0] || invoices[0].maxInvoices <= $scope.invoices.length)
$scope.noMoreResults = true



## !!! MUST BE CALLED AT THE END of the controller
initialize()
]
Expand Down
Loading

0 comments on commit 6e7d550

Please sign in to comment.