Commit eefe826f83bbbb9f0bc213aea4eae851dd116655
1 parent
94cdafe7
Exists in
master
and in
4 other branches
project tile view
Showing
13 changed files
with
131 additions
and
27 deletions
Show diff stats
357 Bytes
... | ... | @@ -0,0 +1,41 @@ |
1 | +/** | |
2 | + * jQuery Cookie plugin | |
3 | + * | |
4 | + * Copyright (c) 2010 Klaus Hartl (stilbuero.de) | |
5 | + * Dual licensed under the MIT and GPL licenses: | |
6 | + * http://www.opensource.org/licenses/mit-license.php | |
7 | + * http://www.gnu.org/licenses/gpl.html | |
8 | + * | |
9 | + */ | |
10 | +jQuery.cookie = function (key, value, options) { | |
11 | + | |
12 | + // key and at least value given, set cookie... | |
13 | + if (arguments.length > 1 && String(value) !== "[object Object]") { | |
14 | + options = jQuery.extend({}, options); | |
15 | + | |
16 | + if (value === null || value === undefined) { | |
17 | + options.expires = -1; | |
18 | + } | |
19 | + | |
20 | + if (typeof options.expires === 'number') { | |
21 | + var days = options.expires, t = options.expires = new Date(); | |
22 | + t.setDate(t.getDate() + days); | |
23 | + } | |
24 | + | |
25 | + value = String(value); | |
26 | + | |
27 | + return (document.cookie = [ | |
28 | + encodeURIComponent(key), '=', | |
29 | + options.raw ? value : encodeURIComponent(value), | |
30 | + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE | |
31 | + options.path ? '; path=' + options.path : '', | |
32 | + options.domain ? '; domain=' + options.domain : '', | |
33 | + options.secure ? '; secure' : '' | |
34 | + ].join('')); | |
35 | + } | |
36 | + | |
37 | + // key and possibly options given, get cookie... | |
38 | + options = value || {}; | |
39 | + var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; | |
40 | + return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; | |
41 | +}; | ... | ... |
app/assets/stylesheets/projects.css.scss
... | ... | @@ -525,3 +525,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td { |
525 | 525 | #user_projects_limit{ |
526 | 526 | width: 60px; |
527 | 527 | } |
528 | + | |
529 | +.project_thumb { | |
530 | + margin:20px 0; | |
531 | + width: 250px; | |
532 | + float:left; | |
533 | + padding:20px; | |
534 | + text-align:center; | |
535 | + p, h4 { | |
536 | + text-align:left; | |
537 | + } | |
538 | + .lbutton { | |
539 | + float:left; | |
540 | + } | |
541 | +} | ... | ... |
app/controllers/dashboard_controller.rb
app/helpers/projects_helper.rb
app/models/user.rb
app/views/dashboard/index.html.haml
... | ... | @@ -0,0 +1 @@ |
1 | +timeline | ... | ... |
app/views/layouts/application.html.haml
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | = render :partial => "layouts/head_panel" |
22 | 22 | .top_bar.container |
23 | 23 | = render :partial => "projects/top_menu" if @project && !@project.new_record? |
24 | + = render :partial => "projects/projects_top_menu" if (controller.controller_name == "projects" && ["index", "new", "create"].include?(controller.action_name)) && !admin_namespace? | |
24 | 25 | = render :partial => "profile/top_menu" if ["keys", "profile"].include?(controller.controller_name) |
25 | 26 | = render :partial => "admin/top_menu" if admin_namespace? |
26 | 27 | #content-container.container | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +-#- if current_user.can_create_project? | |
2 | + = link_to 'New Project', new_project_path, :class => "lbutton vm" | |
3 | + | |
4 | +%table.round-borders#projects-list | |
5 | + %tr | |
6 | + %th Name | |
7 | + %th Path | |
8 | + %th Code | |
9 | + %th Web | |
10 | + %th Git | |
11 | + %th Admin | |
12 | + %th Actions | |
13 | + | |
14 | + - @projects.each do |project| | |
15 | + %tr{ :class => "project", :url => project_path(project) } | |
16 | + %td= project.name | |
17 | + %td= truncate project.url_to_repo | |
18 | + %td= project.code | |
19 | + %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled | |
20 | + %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled | |
21 | + %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled | |
22 | + %td | |
23 | + -if can? current_user, :admin_project, project | |
24 | + = link_to 'Edit', edit_project_path(project), :class => "lbutton positive" | |
25 | +%br | |
26 | + | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +%div.top_project_menu | |
2 | + %span= link_to 'All', projects_path, :class => current_page?(projects_path) ? "current" : nil | |
3 | + %span= link_to "New Project", new_project_path, :class => current_page?(:controller => "projects", :action => "new") ? "current" : nil | |
4 | + %span.right | |
5 | + = link_to_function(image_tag("list_view_icon.jpg"), "switchProjectView()", :style => "border:none;box-shadow:none;") | |
6 | + | |
7 | +:javascript | |
8 | + function switchProjectView(){ | |
9 | + $(".tile").toggle(); | |
10 | + $(".list").toggle(); | |
11 | + if($(".tile").is(":visible")){ | |
12 | + $.cookie('project_view', 'tile', { expires: 14 }); | |
13 | + } else { | |
14 | + $.cookie('project_view', 'list', { expires: 14 }); | |
15 | + } | |
16 | + } | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +- @projects.in_groups_of(3, false) do |projects| | |
2 | + - projects.each_with_index do |project, i| | |
3 | + %div{ :class => "project_thumb round-borders", :style => i == 2 ? "" : "margin-right:30px;" } | |
4 | + %div{ :class => "project", :url => project_path(project) } | |
5 | + %h2 | |
6 | + = image_tag gravatar_icon(project.name), :class => "left", :width => 40, :style => "padding-right:5px;" | |
7 | + = "/" + project.code | |
8 | + %p= project.name | |
9 | + %p= project.url_to_repo | |
10 | + -#%p | |
11 | + Commit – | |
12 | + = last_commit(project) | |
13 | + %hr | |
14 | + = link_to "Browse Code", tree_project_path(project), :class => "lbutton" | |
15 | + = link_to "Commits", project_commits_path(project), :class => "lbutton", :style => "float:right;width:80px;" | |
16 | + .clear | ... | ... |
app/views/projects/_tree_item.html.haml
1 | 1 | - file = params[:path] ? File.join(params[:path], content.name) : content.name |
2 | -- content_commit = @repo.log(@branch, file, :max_count => 1).last | |
2 | +- content_commit = @project.repo.log(@branch, file, :max_count => 1).last | |
3 | 3 | - return unless content_commit |
4 | 4 | %tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) } |
5 | 5 | %td.tree-item-file-name | ... | ... |
app/views/projects/index.html.haml
1 | -- if current_user.can_create_project? | |
2 | - = link_to 'New Project', new_project_path, :class => "lbutton vm" | |
3 | - | |
4 | -%table.round-borders#projects-list | |
5 | - %tr | |
6 | - %th Name | |
7 | - %th Path | |
8 | - %th Code | |
9 | - %th Web | |
10 | - %th Git | |
11 | - %th Admin | |
12 | - %th Actions | |
13 | - | |
14 | - - @projects.each do |project| | |
15 | - %tr{ :class => "project", :url => project_path(project) } | |
16 | - %td= project.name | |
17 | - %td= truncate project.url_to_repo | |
18 | - %td= project.code | |
19 | - %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled | |
20 | - %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled | |
21 | - %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled | |
22 | - %td | |
23 | - -if can? current_user, :admin_project, project | |
24 | - = link_to 'Edit', edit_project_path(project), :class => "lbutton positive" | |
25 | -%br | |
26 | - | |
1 | +%div{:class => "tile", :style => view_mode_style("tile")} | |
2 | + = render "tile" | |
3 | +%div{:class => "list", :style => view_mode_style("list")} | |
4 | + = render "list" | ... | ... |