GitlabVersion
nwb 11 years ago
commit 1f5d792783

@ -50,14 +50,14 @@ class ForumsController < ApplicationController
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.all
@forums_all = Forum.where('1=1')
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@offset ||= @forums_pages.offset
# @forums = @forums_all.offset(@offset).limit(@limit).all
@forums = Forum.all
@forums = @forums_all.offset(@offset).limit(@limit).all
#@forums = Forum.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @forums }

@ -32,7 +32,9 @@ class WelcomeController < ApplicationController
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
where("#{Project.table_name}.project_type = ? and #{Project.table_name}.id in (?)", Project::ProjectType_project,@hot_projects_ids)
if @first_page.nil? || @first_page.sort_type.nil?
@projects = @projects_all.order("grade desc")
else
case @first_page.sort_type
when 0
@projects = @projects_all.order("created_on desc")
@ -53,6 +55,8 @@ class WelcomeController < ApplicationController
end
end
end
def robots
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'

@ -1,6 +1,6 @@
class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type
validates_presence_of :web_title, :title, :description,:page_type,:sort_type
attr_accessible :description, :title, :web_title,:page_type,:sort_type
validates_presence_of :web_title, :title, :description,:page_type
validates_length_of :web_title,:title, maximum: 30
validates_length_of :description, maximum: 100
end

Loading…
Cancel
Save