diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index d37caf8c6..22cf37d29 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -76,7 +76,10 @@ class Platforms::RepositoriesController < Platforms::BaseController @projects = Project.joins(owner_subquery).addable_to_repository(@repository.id) @projects = @projects.by_visibilities('open') if @repository.platform.platform_type == 'main' end - @projects = @projects.paginate(:page => (params[:iDisplayStart].to_i/params[:iDisplayLength].to_i).to_i + 1, :per_page => params[:iDisplayLength]) + @projects = @projects.paginate( + :page => (params[:iDisplayStart].to_i/(params[:iDisplayLength].present? ? params[:iDisplayLength] : 25).to_i).to_i + 1, + :per_page => params[:iDisplayLength].present? ? params[:iDisplayLength] : 25 + ) @total_projects = @projects.count @projects = @projects.search(params[:sSearch]).search_order if params[:sSearch].present? diff --git a/app/views/admin/users/_users_ajax.js.erb b/app/views/admin/users/_users_ajax.js.erb deleted file mode 100644 index 76db767ec..000000000 --- a/app/views/admin/users/_users_ajax.js.erb +++ /dev/null @@ -1,19 +0,0 @@ -{ - "sEcho": <%=h params[:sEcho].to_i || -1 %>, - "iTotalRecords": <%= @total_users %>, - "iTotalDisplayRecords": <%= @total_user %>, - "aaData": [ - <% @users.each do |user| %> - [ - "<%= user.name %>", - "<%= user.uname %>", - "<%= user.email %>", - "'><%= user.role %>", - "<%= j raw [(link_to t('layout.show'), user if can? :read, user), - (link_to t('layout.edit'), edit_admin_user_path(user) if can? :edit, user), - (link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user) - ].compact.join(' | ') %>" - ]<%= user == @users.last ? '' : ',' %> - <% end %> - ] -} diff --git a/app/views/admin/users/_users_ajax.json.jbuilder b/app/views/admin/users/_users_ajax.json.jbuilder new file mode 100644 index 000000000..62504692e --- /dev/null +++ b/app/views/admin/users/_users_ajax.json.jbuilder @@ -0,0 +1,21 @@ +users = @users.map do |user| + link_block = [ + (link_to t('layout.show'), user if can? :read, user), + (link_to t('layout.edit'), edit_admin_user_path(user) if can? :edit, user), + (link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user) + ].compact.join(' | ').html_safe + + [ + user.name, + user.uname, + user.email, + content_tag(:span, user.role, :style => user.access_locked? ? 'background: #FEDEDE' : ''), + link_block + ] +end + + +json.sEcho params[:sEcho].to_i || -1 +json.iTotalRecords @total_users +json.iTotalDisplayRecords @total_user +json.aaData users diff --git a/app/views/platforms/repositories/_proj_ajax.js.erb b/app/views/platforms/repositories/_proj_ajax.js.erb deleted file mode 100644 index 3058ffbb2..000000000 --- a/app/views/platforms/repositories/_proj_ajax.js.erb +++ /dev/null @@ -1,15 +0,0 @@ -{ - "sEcho": <%=h params[:sEcho].to_i || -1 %>, - "iTotalRecords": <%= @total_projects %>, - "iTotalDisplayRecords": <%= @total_project %>, - "aaData": [ - <% @projects.each do |project| %> - [ - "<%=j link_to(project.name_with_owner, project) %>", - "<%= truncate(project.description || '', :length => 60).gsub(/\n|\r|\t/, ' ') %>", - "<%=j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id) %>" - ]<%= project == @projects.last ? '' : ',' %> - <% end %> - ] -} - diff --git a/app/views/platforms/repositories/_proj_ajax.json.jbuilder b/app/views/platforms/repositories/_proj_ajax.json.jbuilder new file mode 100644 index 000000000..1676111c1 --- /dev/null +++ b/app/views/platforms/repositories/_proj_ajax.json.jbuilder @@ -0,0 +1,12 @@ +projs = @projects.map do |project| + [ + link_to(project.name_with_owner, project), + truncate(project.description || '', :length => 60).gsub(/\n|\r|\t/, ' '), + link_to(t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id)) + ] +end + +json.sEcho params[:sEcho] || -1 +json.iTotalRecords @total_projects +json.iTotalDisplayRecords @total_project +json.aaData projs diff --git a/app/views/platforms/repositories/_project.js.erb b/app/views/platforms/repositories/_project.js.erb deleted file mode 100644 index 2dd623397..000000000 --- a/app/views/platforms/repositories/_project.js.erb +++ /dev/null @@ -1,31 +0,0 @@ -{ - "sEcho": <%=h params[:sEcho].to_i || -1 %>, - "iTotalRecords": <%= @total_projects %>, - "iTotalDisplayRecords": <%= @total_project %>, - "aaData": [ - <% @projects.each do |project| %> - [ - "<%=( - "