Class: Knitkit::ErpApp::Desktop::PositionController

Inherits:
AppController
  • Object
show all
Defined in:
app/controllers/knitkit/erp_app/desktop/position_controller.rb

Constant Summary

Constants inherited from AppController

AppController::KNIT_KIT_ROOT

Instance Method Summary collapse

Methods inherited from AppController

#available_roles, #websites

Instance Method Details

#updateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/knitkit/erp_app/desktop/position_controller.rb', line 6

def update
  model = DesktopApplication.find_by_internal_identifier('knitkit')
  begin
    current_user.with_capability('drag_item', 'WebsiteTree') do

      params[:position_array].each do |position|
        model = position['klass'].constantize.find(position['id'])
        model.position = position['position'].to_i
        model.save
      end

      render :json => {:success => true}
      
    end
  rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
    render :json => {:success => false, :message => ex.message}
  end
end