Sha256: 21c3c1cf1831b8b1691008c624ed3bfbbdddced6c31571014aeb46c379268d9b

Contents?: true

Size: 1.39 KB

Versions: 55

Compression:

Stored size: 1.39 KB

Contents

class Muck::AggregationFeedsController < ApplicationController

  unloadable
  
  before_filter :login_required

  def destroy
    @aggregation_feed = AggregationFeed.find(params[:id]) rescue nil if params[:id] && params[:id].to_i > 0
    @aggregation_feed ||= AggregationFeed.find_by_feed_id_and_aggregation_id(params[:feed_id], params[:aggregation_id])
    @aggregation = @aggregation_feed.aggregation
    if has_aggregation_permission?
      @aggregation_feed.destroy
      respond_to do |format|
        message = I18n.t('muck.services.feed_remove')
        format.html do
          flash[:notice] = message
          redirect_to polymorphic_url([@aggregation.ownable, @aggregation])
        end
        format.json { render :json => { :success => true, :message => message }.as_json }
        format.xml  { head :ok }
      end
    end
  end

  protected
  
    def has_aggregation_permission?
      if !@aggregation.can_edit?(current_user)
        message = I18n.t('muck.services.cant_modify_aggregation')
        respond_to do |format|
          format.html do
            flash[:notice] = message
            redirect_to polymorphic_url([@aggregation.ownable, @aggregation])
          end
          format.js { render(:update) {|page| page.alert message} }
          format.json { render :json => { :success => false, :message => message }.as_json }
        end
      else
        true
      end
    end
  
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
muck-services-3.3.3 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.3.2 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.3.1 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.3.0 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.2.2 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.2.1 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.2.0 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.1.1 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.1.0 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.47 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-3.0.0 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.46 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.45 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.44 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.43 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.42 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.41 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.40 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.39 app/controllers/muck/aggregation_feeds_controller.rb
muck-services-0.1.38 app/controllers/muck/aggregation_feeds_controller.rb