[issue #76] Fixed bug with JSON generation.

This commit is contained in:
George Vinogradov 2012-01-12 01:12:56 +04:00
parent 7c50b2c3f5
commit 49082c2a8d
4 changed files with 22 additions and 23 deletions

View File

@ -68,7 +68,7 @@ class RepositoriesController < ApplicationController
# else
# @projects = Project.addable_to_repository(@repository.id).paginate(:page => params[:project_page])
# end
render 'projects_list'
render :projects_list
end
end

View File

@ -1,12 +1,15 @@
{"sEcho": <%= params[:sEcho] || -1 %>,
"iTotalRecords": <%= @total_projects %>,
"iTotalDisplayRecords": <%= @total_project %>,
"aaData":[
<% @projects.each do |project| %>
['<%= link_to(project.owner.uname, project.owner) %>',
'<%= link_to(project.name, project) %>',
'<%= link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>'
],
<% end %>
]}
{
"sEcho": <%=h params[:sEcho].to_i || -1 %>,
"iTotalRecords": <%= @total_projects %>,
"iTotalDisplayRecords": <%= @total_project %>,
"aaData": [
<% @projects.each do |project| %>
[
"<%=j link_to project.owner.uname, project.owner %>",
"<%=j link_to project.name, project %>",
"<%=j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>"
]<%= project == @projects.last ? '' : ',' %>
<% end %>
]
}

View File

@ -2,16 +2,12 @@
= raw datatable(columns, {:sort_by => "[1, 'asc']", :ajax_source => "#{url_for :controller => :repositories, :action => :projects_list, :id => @repository.id}" })
%table.table.datatable
%tr
%th.first= t("activerecord.attributes.user.uname")
%th= t("activerecord.attributes.project.name")
%th.last &nbsp;
-# @projects.each do |project|
%tr{:class => cycle("odd", "even")}
%td
= link_to project.owner.uname + '/' + project.name, project_path(project)
%td.last
#{link_to t("layout.show"), project_path(project)} | #{link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id)}
%thead
%tr
%th.first= t("activerecord.attributes.user.uname")
%th= t("activerecord.attributes.project.name")
%th.last &nbsp;
%tbody
= content_for :javascripts do
= javascript_include_tag 'jquery.dataTables.min.js'

View File

@ -39,7 +39,7 @@
%h2.title
= t("layout.projects.list_header")
.inner
= render :partial => 'shared/search_form'
-#= render :partial => 'shared/search_form'
= render :partial => 'proj_list', :object => @projects
-#.actions-bar.wat-cf
.actions