Class: HomepageFeaturesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/homepage_features_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#advertise, #cache_action?, #footer_content, #homepage_features, #plaxo, #rss_site_index, #site_index

Methods included from BaseHelper

#add_friend_link, #ajax_spinner_for, #avatar_for, #block_to_partial, #box, #city_cloud, #clippings_link, #commentable_url, #container_title, #excerpt_with_jump, #flash_class, #forum_page?, #is_current_user_and_featured?, #jumbotron, #last_active, #more_comments_links, #page_title, #paginating_links, #possesive, #profile_completeness, #render_jumbotron, #render_widgets, #rounded, #search_posts_title, #search_user_posts_path, #show_footer_content?, #tag_auto_complete_field, #time_ago_in_words, #time_ago_in_words_or_date, #tiny_mce_init_if_needed, #tiny_mce_js, #topnav_tab, #truncate_words, #truncate_words_with_highlight, #widget

Methods included from LocalizedApplication

#get_matching_ui_locale, #get_sorted_langs_from_accept_header, #get_valid_lang_from_accept_header, #set_locale

Methods included from AuthenticatedSystem

#login_by_token, #update_last_seen_at

Instance Method Details

#createObject


34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/homepage_features_controller.rb', line 34

def create
  @homepage_feature = HomepageFeature.new(homepage_feature_params)
  
  respond_to do |format|
    if @homepage_feature.save
      flash[:notice] = :homepage_feature_created.l
      
      format.html { redirect_to homepage_feature_url(@homepage_feature) }
    else
      format.html { render :action => "new" }
    end
  end
end

#destroyObject


60
61
62
63
64
65
66
67
# File 'app/controllers/homepage_features_controller.rb', line 60

def destroy
  @homepage_feature = HomepageFeature.find(params[:id])
  @homepage_feature.destroy
  
  respond_to do |format|
    format.html { redirect_to homepage_features_url   }
  end
end

#editObject


30
31
32
# File 'app/controllers/homepage_features_controller.rb', line 30

def edit
  @homepage_feature = HomepageFeature.find(params[:id])
end

#indexObject


9
10
11
12
13
14
15
16
# File 'app/controllers/homepage_features_controller.rb', line 9

def index
  @search = HomepageFeature.search(params[:q])
  @homepage_features = @search.result
  @homepage_features = @homepage_features.order('created_at DESC').page(params[:page]).per(100)
  respond_to do |format|
    format.html
  end
end

#newObject


26
27
28
# File 'app/controllers/homepage_features_controller.rb', line 26

def new
  @homepage_feature = HomepageFeature.new
end

#showObject


18
19
20
21
22
23
24
# File 'app/controllers/homepage_features_controller.rb', line 18

def show
  @homepage_feature = HomepageFeature.find(params[:id])
  
  respond_to do |format|
    format.html 
  end
end

#updateObject


48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/homepage_features_controller.rb', line 48

def update
  @homepage_feature = HomepageFeature.find(params[:id])
  
  respond_to do |format|
    if @homepage_feature.update_attributes(homepage_feature_params)
      format.html { redirect_to homepage_feature_url(@homepage_feature) }
    else
      format.html { render :action => "edit" }
    end
  end
end