Sha256: 78ce93ef458ac7cfcdd8ed9baf651c37203acf4b178d3245d31ea10069148437

Contents?: true

Size: 1.38 KB

Versions: 22

Compression:

Stored size: 1.38 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.raker.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.raker.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

22 entries across 22 versions & 1 rubygems

Version Path
muck-raker-0.2.11 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.10 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.9 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.8 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.7 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.6 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.5 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.4 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.3 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.2 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.2.0 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.49 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.48 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.47 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.46 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.45 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.43 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.42 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.41 app/controllers/muck/aggregation_feeds_controller.rb
muck-raker-0.1.40 app/controllers/muck/aggregation_feeds_controller.rb