Class: Admin::Atreides::FeaturesController
- Inherits:
-
Atreides::AdminController
- Object
- Atreides::AdminController
- Admin::Atreides::FeaturesController
- Includes:
- Atreides::Extendable
- Defined in:
- app/controllers/admin/atreides/features_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 26 def create super do |wants| wants.html { redirect_to admin_features_path } end end |
#index ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 5 def index @show_as_dash = true @collection = {} Settings..posts.features.map do |tag| @collection[tag] = end_of_association_chain.live.tagged_with(tag) end end |
#new ⇒ Object
13 14 15 16 17 18 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 13 def new # Create feature! @feature = end_of_association_chain.new(:state => "pending", :published_at => nil) @feature.save! super end |
#reorder ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 38 def reorder key = params.keys.detect{|k| k.to_s.starts_with?('feature') } if params[key].is_a?(Array) i = 0 params[key].each do |id| end_of_association_chain.update_all({:display_order => (i+=1)}, {:id => id}) end render :nothing => true, :status => :ok else render :nothing => true, :status => :error end end |
#show ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 20 def show super do |wants| wants.html { redirect_to edit_admin_feature_path(resource) } end end |
#update ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/admin/atreides/features_controller.rb', line 32 def update super do |success, failure| success.html { redirect_to admin_features_path } end end |