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

[feature] display fab-manager's version, when logged as admin

This commit is contained in:
Sylvain 2016-09-22 16:46:14 +02:00
parent 270b279ffb
commit 6401b321ef
11 changed files with 51 additions and 5 deletions

1
.fabmanager-version Normal file
View File

@ -0,0 +1 @@
2.4.0-dev

View File

@ -1,8 +1,9 @@
# Changelog Fab Manager
## next release
- Add a checkbox "I accept to receive informations from the FabLab" on Sign up and Profil of user
- Share project by facebook/twitter
- Add a checkbox "I accept to receive informations from the FabLab" on Sign-up dialog and user's profile
- Share project with Facebook/Twitter
- Display fab-manager's version in "Powered by" label, when logged as admin
- Load translation locales from subdirectories
- Add wallet to user, client can pay total/partial reservation or subscription by wallet
- Public calendar for show all trainings/machines/events

View File

@ -1,7 +1,7 @@
'use strict'
Application.Controllers.controller 'ApplicationController', ["$rootScope", "$scope", "$window", "Session", "AuthService", "Auth", "$uibModal", "$state", 'growl', 'Notification', '$interval', "Setting", '_t'
, ($rootScope, $scope, $window, Session, AuthService, Auth, $uibModal, $state, growl, Notification, $interval, Setting, _t) ->
Application.Controllers.controller 'ApplicationController', ["$rootScope", "$scope", "$window", "Session", "AuthService", "Auth", "$uibModal", "$state", 'growl', 'Notification', '$interval', "Setting", '_t', 'Version'
, ($rootScope, $scope, $window, Session, AuthService, Auth, $uibModal, $state, growl, Notification, $interval, Setting, _t, Version) ->
@ -14,6 +14,10 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco
### PUBLIC SCOPE ###
## Fab-manager's version
$scope.version =
version: ''
##
# Set the current user to the provided value and initialize the session
# @param user {Object} Rails/Devise user
@ -207,6 +211,8 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco
$scope.setCurrentUser(user)
if user.need_completion
$state.transitionTo('app.logged.profileCompletion')
if user.role == 'admin'
$scope.version = Version.get()
, (error) ->
# Authentication failed...
$rootScope.toCheckNotifications = false

View File

@ -0,0 +1,5 @@
'use strict'
Application.Services.factory 'Version', ["$resource", ($resource)->
$resource "/api/version"
]

View File

@ -499,6 +499,11 @@ padding: 10px;
@media only screen and (max-width: 768px) {
display: none;
}
.app-version {
margin-right: 10px;
color: #999;
}
}
.disabling-overlay {

View File

@ -0,0 +1,10 @@
class API::VersionController < API::ApiController
before_action :authenticate_user!
def show
authorize :version
version = File.read('.fabmanager-version')
render json: {version: version}, status: :ok
end
end

View File

@ -0,0 +1,5 @@
class VersionPolicy < ApplicationPolicy
def show?
user.is_admin?
end
end

View File

@ -101,7 +101,12 @@
</section> <!-- /.vbox -->
<div class="app-generator"><span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab Manager</a></span></div>
<div class="app-generator">
<span class="app-version" ng-if="currentUser && currentUser.role == 'admin'" uib-tooltip="{{'version' | translate}} {{version.version}}">
<i class="fa fa-question-circle" aria-label="Version ?"></i>
</span>
<span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab Manager</a></span>
</div>
<%= javascript_include_tag 'application' %>

View File

@ -100,6 +100,9 @@ en:
your_email_address_is_unknown: "Your e-mail address is unknown."
you_will_receive_in_a_moment_an_email_with_instructions_to_reset_your_password: "You will receive in a moment, an e-mail with instructions to reset your password."
# Fab-manager's version
version: "Version:"
about:
# about page
read_the_fablab_policy: "Read the FabLab policy"

View File

@ -100,6 +100,8 @@ fr:
your_email_address_is_unknown: "Votre adresse de courriel est inconnue."
you_will_receive_in_a_moment_an_email_with_instructions_to_reset_your_password: "Vous allez recevoir sous quelques minutes un courriel vous indiquant comment réinitialiser votre mot de passe."
# Fab-manager's version
version: "Version :"
about:
# page à propos
read_the_fablab_policy: "Consulter les règles d'utilisation du Fab Lab"

View File

@ -126,6 +126,9 @@ Rails.application.routes.draw do
# XLSX exports
get 'exports/:id/download' => 'exports#download'
post 'exports/status' => 'exports#status'
# Fab-manager's version
get 'version' => 'version#show'
end
# open_api