Skip to content

Commit

Permalink
Merge branch 'develop' into f_mapper
Browse files Browse the repository at this point in the history
Resolved by deleting sprockets manifesto and precompiling production
assets
  • Loading branch information
wpoynter committed Mar 29, 2017
2 parents da567bc + ea6660f commit 54b95eb
Show file tree
Hide file tree
Showing 1,172 changed files with 57,633 additions and 40,578 deletions.
10 changes: 5 additions & 5 deletions Bowerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
asset 'angular', "1.4.10"
asset 'angular-route', "1.4.10"
asset 'angular-resource', "1.4.10"
asset 'angular-messages', "1.4.10"
asset 'angular-animate', "1.4.10"
asset 'angular', "1.4.14"
asset 'angular-route', "1.4.14"
asset 'angular-resource', "1.4.14"
asset 'angular-messages', "1.4.14"
asset 'angular-animate', "1.4.14"
asset 'bootstrap-sass-official'
asset 'angular-bootstrap'
asset 'angular-ui-sortable'
Expand Down
5 changes: 5 additions & 0 deletions app/assets/javascripts/lib/data_manager/auth/users.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ users.factory(
'users/admin/:id.json',
{
id: '@id'
},
{
save: {method: 'PUT'},
create: {method: 'POST'}
reset_password: {method: 'POST', url: 'users/admin/:id/password.json'}
}
)
])
2 changes: 2 additions & 0 deletions app/assets/javascripts/lib/realtime.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ realtime.factory('RealTimeConnection',

service.socket.on 'rt-update', (message)->
$rootScope.$emit('rt-update', message)

console.log service
service
]
)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/lib/resource.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ resource.factory('WrappedResource', [ '$resource', ($resource)->
)

@resource::save = (params, success, error)->
console.trace()
if @id?
@$save(params, success, error)
else
Expand Down
22 changes: 18 additions & 4 deletions app/assets/javascripts/sections/admin/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ admin.controller('AdminDashController',
admin.controller('AdminUsersController',
[
'$scope',
'DataManager'
($scope, DataManager)->
'DataManager',
'Flash'
($scope, DataManager, Flash)->
DataManager.getUsers()
$scope.groups = DataManager.Data.Groups
$scope.users = []
Expand Down Expand Up @@ -76,6 +77,7 @@ admin.controller('AdminUsersController',
$scope.original = null
$scope.current = new DataManager.Auth.Users.resource()
$scope.mode = 'user'
$scope.users = []
$scope.editing = true

$scope.addStudy = ->
Expand All @@ -100,14 +102,26 @@ admin.controller('AdminUsersController',
if $scope.original?
angular.copy $scope.current, $scope.original
else
(if $scope.mode == 'group' then $scope.groups else DataManager.Data.Users).push $scope.current
if $scope.mode == 'group'
$scope.groups.push $scope.current
else
DataManager.Data.Users.push $scope.current
DataManager.GroupResolver.resolve()

$scope.original = $scope.current
$scope.original.save(
{},
->
(a, b, c, d, e)->
$scope.editing = false
,->
$scope.original = null
Flash.add 'danger', 'Could not save '+ $scope.mode + '.'
)

$scope.reset_password = ->
console.log $scope
$scope.current.$reset_password()

$scope.delete = ->
arr = if $scope.mode = 'group' then $scope.groups else DataManager.Data.Users
index = arr.indexOf $scope.current
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/templates/partials/admin/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ <h1 class="page-header">
>
{{current.status == 'locked' ? 'Unlock' : 'Lock'}}
</button>
<button class="btn btn-danger" data-ng-show="!editing" data-ng-click="reset_password()">Reset Password</button>
<button class="btn btn-warning" data-ng-show="!editing && current.status == 'unconfirmed'" data-ng-click="edit()">Confirm</button>
<button class="btn btn-default" data-ng-show="editing" data-ng-click="cancel()">Cancel</button>
<button class="btn btn-primary" data-ng-show="editing" data-ng-click="save()">Save</button>
Expand Down
25 changes: 18 additions & 7 deletions app/controllers/users/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,39 @@ def show
end

def create
@user = User.new safe_params
logger.debug @user.to_json
if @user.save!
@object = User.new safe_params
logger.debug @object.to_json
if @object.save!
render :show, status: :created
else
render json: user.errors, status: :unprocessable_entity
end
end

def update
@user = User.find safe_params['id']
if @user.update safe_params.select {|k,v| ['first_name', 'last_name', 'role'].include?(k)}
@object = User.find safe_params['id']
if @object.update safe_params.select {|k,v| %w(first_name last_name role).include?(k)}
render :show, status: :ok
else
render json: user.errors, status: :unprocessable_entity
end
end

def reset_password
@object = User.find safe_params['id']
@object.send_reset_password_instructions

if @object.errors.empty?
head :ok
else
render json: @object.errors, status: :unprocessable_entity
end
end

def destroy
begin
@user = User.find safe_params['id']
@user.destroy
@object = User.find safe_params['id']
@object.destroy
head :ok
rescue
head :bad_request
Expand Down
3 changes: 1 addition & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)

config.enable_dependency_loading = true

config.action_mailer.delivery_method = (ENV['mailer'] || '').to_sym
config.action_mailer.delivery_method = (ENV['MAILER'] || '').to_sym
config.action_mailer.postmark_settings = { api_token: ENV['POSTMARK_API_KEY'] }
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
Expand Down
6 changes: 5 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
unlocks: 'users/unlocks',
}
namespace :users do
resources :admin, constraints: -> (r) { (r.format == :json) }
resources :admin, constraints: -> (r) { (r.format == :json) } do
member do
post 'password', to: 'admin#reset_password'
end
end
end
root 'main#index'

Expand Down

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

0 comments on commit 54b95eb

Please sign in to comment.