Skip to content

Commit

Permalink
Cria variável de configuração para a quantidade de comentários exibid…
Browse files Browse the repository at this point in the history
…os por página (que antes estava hardcoded).
  • Loading branch information
embs committed Jan 11, 2013
1 parent 1166495 commit 0edf4e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/controllers/apps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def show
@app.update_attribute(:views, @app.views + 1) unless params[:page]
@app_categories = Category.get_names_by_kind @app
@comments = Kaminari::paginate_array(@app.comments.common.order('created_at DESC')).
page(params[:page]).per(10)
@favorite = UserAppAssociation.find_by_user_id_and_app_id(current_user,
@app)
page(params[:page]).per(comments_per_page)
@favorite = UserAppAssociation.find_by_user_id_and_app_id(current_user, @app)
@app_rating = @app.reputation_for(:rating)
@evaluations = @app.evaluators_for(:rating).count
if current_user
Expand Down Expand Up @@ -84,4 +83,8 @@ def assign_searching_variables
@filters_counter = Category.count_filters_on @categories
@categories = @categories.uniq # Remove categorias duplicadas
end

def comments_per_page
ReduApps::Application.config.comments_per_page
end
end
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ class Application < Rails::Application
name: "Portal de Aplicativos",
secret: 'xxx'
}

# Quantidade de comentários exibidos por página
config.comments_per_page = 10
end
end

0 comments on commit 0edf4e4

Please sign in to comment.