Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6648 from saraycp/bootstrap_project_index
Migrate project index page to bootstrap
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function renderProjectsTable(length) { // jshint ignore:line | ||
length = length || 25; | ||
var projects = mainProjects; | ||
if (!$('#excludefilter').is(":checked")) | ||
projects = projects.concat(exclProjects); | ||
var projecturl = $("#projects-table-wrapper").data("url"); | ||
$("#projects-table").DataTable({ | ||
"data": projects, | ||
"columns": [ | ||
{ | ||
"title": "Name", | ||
"width": "60%", | ||
"className": "text-word-break-all", | ||
"render": function (obj, type, dataRow) { | ||
var url = projecturl.replace(/REPLACEIT/, dataRow[0]); | ||
return '<a href="' + url + '">' + dataRow[0] + '</a>'; | ||
} | ||
}, | ||
{ | ||
"title": "Title", | ||
"width": "40%", | ||
"className": "text-nowrap" | ||
} | ||
], | ||
"pageLength": length, | ||
"stateSave": true, | ||
"language": { "search": '', "searchPlaceholder": "Search..." } | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
:ruby | ||
@pagetitle = 'Public Projects' | ||
.card | ||
- if @important_projects.present? | ||
.card-body | ||
%h3 Main Projects | ||
.table-responsive | ||
%table.table.table-sm.table-striped.table-bordered | ||
%thead | ||
%tr | ||
%th Name | ||
%th Title | ||
%tbody | ||
- @important_projects.each do |project| | ||
%tr | ||
%td | ||
= link_to(project.first, action: :show, project: project.first) | ||
%td | ||
#{project.second} | ||
.card-body | ||
%h3= @pagetitle | ||
%ul.list-inline | ||
- if @show_all | ||
%li.list-inline-item.mr-3 | ||
= link_to(projects_path) do | ||
%i.fas.fa-toggle-on.text-primary | ||
Exclude #{::Configuration.unlisted_projects_filter_description} | ||
- else | ||
%li.list-inline-item.mr-3 | ||
= link_to(projects_path(show_all: true)) do | ||
%i.fas.fa-toggle-off.text-primary | ||
Include #{::Configuration.unlisted_projects_filter_description} | ||
- unless User.current.is_nobody? | ||
%li.list-inline-item | ||
= link_to(new_project_path) do | ||
%i.fas.fa-plus-circle.text-primary | ||
Add New Project | ||
- cachekey = Digest::MD5.hexdigest(@projects.join) | ||
- projecturl = project_show_path('REPLACEIT') | ||
#project-list | ||
- if @projects.blank? | ||
%p | ||
%i No projects found | ||
- else | ||
#projects-table-wrapper{ 'data-url' => projecturl } | ||
%table.responsive.table.table-sm.table-striped.table-bordered.w-100#projects-table | ||
- content_for :head_javascript do | ||
- cache ['list_public_arrays', cachekey] do | ||
var mainProjects = [ #{escape_nested_list(@projects)} ]; | ||
var exclProjects = []; | ||
- content_for :ready_function do | ||
renderProjectsTable(); |