Sha256: 026a186436d1a6bcf3f8d037a5f2bb1814d982ed1b7b12cc44244cb41067596e

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

module Knitkit
  module ErpApp
    module Desktop
      
      class ContentController < Knitkit::ErpApp::Desktop::AppController
        def update
          model = DesktopApplication.find_by_internal_identifier('knitkit')
          begin
            current_user.with_capability(model, 'edit_html', 'Article') do
              id      = params[:id]
              html    = params[:html]
              content = Content.find(id)
              content.body_html = html
    
              render :json => (content.save ? {:success => true} : {:success => false})
            end
          rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
            render :json => {:success => false, :message => ex.message}
          end
        end

        def save_excerpt
          model = DesktopApplication.find_by_internal_identifier('knitkit')
          begin
            current_user.with_capability(model, 'edit_excerpt', 'Article') do
              id      = params[:id]
              html    = params[:html]
              content = Content.find(id)
              content.excerpt_html = html
        
              render :json => (content.save ? {:success => true} : {:success => false})
            end
          rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
            render :json => {:success => false, :message => ex.message}
          end
        end

      end#ContentController
    end#Desktop
  end#ErpApp
end#Knitkit

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
knitkit-2.0.5 app/controllers/knitkit/erp_app/desktop/content_controller.rb
knitkit-2.0.4 app/controllers/knitkit/erp_app/desktop/content_controller.rb
knitkit-2.0.3 app/controllers/knitkit/erp_app/desktop/content_controller.rb
knitkit-2.0.2 app/controllers/knitkit/erp_app/desktop/content_controller.rb
knitkit-2.0.1 app/controllers/knitkit/erp_app/desktop/content_controller.rb