Module: MnoEnterprise::Concerns::Controllers::Jpi::V1::Impac::DashboardsController
- Extended by:
- ActiveSupport::Concern
- Included in:
- Jpi::V1::Impac::DashboardsController
- Defined in:
- lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /mnoe/jpi/v1/impac/dashboards -> POST /api/mnoe/v1/users/1/dashboards.
-
#destroy ⇒ Object
DELETE /mnoe/jpi/v1/impac/dashboards/1 -> DELETE /api/mnoe/v1/dashboards/1.
-
#index ⇒ Object
Instance methods ================================================================== GET /mnoe/jpi/v1/impac/dashboards.
-
#show ⇒ Object
GET /mnoe/jpi/v1/impac/dashboards/1 -> GET /api/mnoe/v1/users/1/dashboards.
-
#update ⇒ Object
PUT /mnoe/jpi/v1/impac/dashboards/1 -> PUT /api/mnoe/v1/dashboards/1.
Instance Method Details
#create ⇒ Object
POST /mnoe/jpi/v1/impac/dashboards
-> POST /api/mnoe/v1/users/1/dashboards
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb', line 30 def create # TODO: dashboards.build breaks as dashboard.organization_ids returns nil, instead of an # empty array. (see MnoEnterprise::Impac::Dashboard #organizations) # @dashboard = dashboards.build(dashboard_create_params) # TODO: enable authorization # authorize! :manage_dashboard, @dashboard # if @dashboard.save if @dashboard = dashboards.create(dashboard_create_params) MnoEnterprise::EventLogger.info('dashboard_create', current_user.id, 'Dashboard Creation', @dashboard) render 'show' else render_bad_request('create dashboard', @dashboard.errors) end end |
#destroy ⇒ Object
DELETE /mnoe/jpi/v1/impac/dashboards/1
-> DELETE /api/mnoe/v1/dashboards/1
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb', line 63 def destroy return render_not_found('dashboard') unless dashboard # TODO: enable authorization # authorize! :manage_dashboard, dashboard if dashboard.destroy MnoEnterprise::EventLogger.info('dashboard_delete', current_user.id, 'Dashboard Deletion', dashboard) head status: :ok else render_bad_request('destroy dashboard', 'Unable to destroy dashboard') end end |
#index ⇒ Object
Instance methods
GET /mnoe/jpi/v1/impac/dashboards
17 18 19 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb', line 17 def index dashboards end |
#show ⇒ Object
GET /mnoe/jpi/v1/impac/dashboards/1
-> GET /api/mnoe/v1/users/1/dashboards
23 24 25 26 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb', line 23 def show dashboard render_not_found('dashboard') unless @dashboard end |
#update ⇒ Object
PUT /mnoe/jpi/v1/impac/dashboards/1
-> PUT /api/mnoe/v1/dashboards/1
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb', line 48 def update return render_not_found('dashboard') unless dashboard # TODO: enable authorization # authorize! :manage_dashboard, dashboard if dashboard.update(dashboard_update_params) render 'show' else render_bad_request('update dashboard', dashboard.errors) end end |