Commit 29b5aa2c76924ad9d307bd932bfd4e5674781dcd

Authored by Dmitriy Zaporozhets
1 parent 7f6e41fa

Bootstrap: Issues restyled

app/assets/javascripts/issues.js
1 1 function switchToNewIssue(form){
2   - $("#issues-table").hide("slide", { direction: "left" }, 150, function(){
3   - $("#issues-table").after(form);
  2 + $(".issues_content").hide("fade", { direction: "left" }, 150, function(){
  3 + $(".issues_content").after(form);
4 4 $('select#issue_assignee_id').chosen();
5   - $("#new_issue_dialog").show("slide", { direction: "right" }, 150);
  5 + $("#new_issue_dialog").show("fade", { direction: "right" }, 150);
6 6 $('.top-tabs .add_new').hide();
7 7 });
8 8 }
9 9  
10 10 function switchToEditIssue(form){
11   - $("#issues-table").hide("slide", { direction: "left" }, 150, function(){
12   - $("#issues-table").after(form);
  11 + $(".issues_content").hide("fade", { direction: "left" }, 150, function(){
  12 + $(".issues_content").after(form);
13 13 $('select#issue_assignee_id').chosen();
14   - $("#edit_issue_dialog").show("slide", { direction: "right" }, 150);
  14 + $("#edit_issue_dialog").show("fade", { direction: "right" }, 150);
15 15 $('.add_new').hide();
16 16 });
17 17 }
... ... @@ -25,8 +25,8 @@ function switchFromEditIssue(){
25 25 }
26 26  
27 27 function backToIssues(){
28   - $("#edit_issue_dialog, #new_issue_dialog").hide("slide", { direction: "right" }, 150, function(){
29   - $("#issues-table").show("slide", { direction: "left" }, 150, function() {
  28 + $("#edit_issue_dialog, #new_issue_dialog").hide("fade", { direction: "right" }, 150, function(){
  29 + $(".issues_content").show("fade", { direction: "left" }, 150, function() {
30 30 $("#edit_issue_dialog").remove();
31 31 $("#new_issue_dialog").remove();
32 32 $('.add_new').show();
... ...
app/assets/stylesheets/common.scss
... ... @@ -125,7 +125,9 @@ $blue_link: "#2fa0bb";
125 125 margin-top:20px;
126 126 }
127 127  
128   -aside.projects {
  128 +aside.projects,
  129 +aside.project-side
  130 +{
129 131 margin-left: 0;
130 132 padding-left: 20px;
131 133 }
... ...
app/assets/stylesheets/issues.css.scss
1   -.issue-number {
2   - float: left;
3   - border-radius: 5px;
4   - text-shadow: none;
5   - background: rgba(0, 0, 0, 0.12);
6   - text-align: center;
7   - padding: 14px 8px;
8   - width: 40px;
9   - margin-right: 10px;
10   - color: #444;
11   -}
12   -
13 1 #issue_assignee_id {
14 2 width:300px;
15 3 }
... ...
app/assets/stylesheets/top_panel.scss
1 1 .main_links {
2   - width:130px;
  2 + width:155px;
3 3 float:left;
4 4  
5 5 a {
... ... @@ -68,10 +68,7 @@ body header {
68 68 min-width:$min_app_width;
69 69 max-width:$max_app_width;
70 70 position:relative;
71   -
72   - .top_panel_content {
73   - padding:10px $app_padding;
74   - }
  71 + padding:10px $app_padding;
75 72 }
76 73  
77 74 .project_name {
... ...
app/controllers/application_controller.rb
... ... @@ -95,4 +95,8 @@ class ApplicationController < ActionController::Base
95 95 response.headers["Pragma"] = "no-cache"
96 96 response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
97 97 end
  98 +
  99 + def render_full_content
  100 + @full_content = true
  101 + end
98 102 end
... ...
app/controllers/refs_controller.rb
... ... @@ -8,6 +8,8 @@ class RefsController < ApplicationController
8 8  
9 9 before_filter :ref
10 10 before_filter :define_tree_vars, :only => [:tree, :blob]
  11 + before_filter :render_full_content
  12 +
11 13 layout "project"
12 14  
13 15 def switch
... ...
app/views/issues/_form.html.haml
1 1 %div.issue-form-holder
2 2 = form_for [@project, @issue], :remote => request.xhr? do |f|
3   - %div
4   - %span.entity-info
5   - - if request.xhr?
6   - = link_to "#back", :onclick => "backToIssues();" do
7   - .entity-button
8   - Issues
9   - %i
10   - - else
11   - - if @issue.new_record?
12   - = link_to project_issues_path(@project) do
13   - .entity-button
14   - Issues
15   - %i
16   - - else
17   - = link_to project_issue_path(@project, @issue) do
18   - .entity-button
19   - Show Issue
20   - %i
21   -
22   - %h2= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
23   - %hr
  3 + %h3= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
  4 + %hr
24 5 -if @issue.errors.any?
25   - %ul.errors_holder
26   - - @issue.errors.full_messages.each do |msg|
27   - %li= msg
  6 + .alert-message.block-message.error
  7 + %ul
  8 + - @issue.errors.full_messages.each do |msg|
  9 + %li= msg
28 10  
29   - %table.no-borders
30   - %tr
31   - %td= f.label :assignee_id
32   - %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
  11 + .clearfix
  12 + = f.label :assignee_id
  13 + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
33 14  
34   - %tr
35   - %td= f.label :critical, "Critical"
36   - %td= f.check_box :critical
37   -
38   - - unless @issue.new_record?
39   - %tr
40   - %td= f.label :closed
41   - %td= f.check_box :closed
  15 + .clearfix
  16 + = f.label :critical, "Critical"
  17 + .input= f.check_box :critical
42 18  
43   - = f.text_area :title, :style => "width:718px; height:100px", :maxlength => 255
44   - %br
45   - %br
46   - .merge-tabs
  19 + - unless @issue.new_record?
  20 + .clearfix
  21 + = f.label :closed
  22 + .input= f.check_box :closed
  23 +
  24 + .clearfix
  25 + = f.label :title
  26 + .input= f.text_area :title, :maxlength => 255, :class => "xlarge"
  27 + .clearfix
47 28 = f.submit 'Save', :class => "primary btn"
48   -  
49   - - unless @issue.new_record?
  29 +
  30 + - if request.xhr?
  31 + = link_to "Cancel", "#back", :onclick => "backToIssues();", :class => "btn"
  32 + - else
  33 + - if @issue.new_record?
  34 + = link_to "Cancel", project_issues_path(@project), :class => "btn"
  35 + - else
  36 + = link_to "Cancel", project_issue_path(@project, @issue), :class => "btn"
  37 +
  38 +
  39 + -#- unless @issue.new_record?
50 40 .right
51 41 = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "red-button"
... ...
app/views/issues/_head.html.haml
... ... @@ -2,14 +2,3 @@
2 2 %li{:class => "#{'active' if current_page?(project_issues_path(@project))}"}
3 3 = link_to project_issues_path(@project), :class => "tab" do
4 4 Issues
5   -
6   - -#= link_to project_issues_path(@project), :class => "tab" do
7   - %span
8   - Milestones
9   -
10   - - if current_page?(project_issues_path(@project))
11   - - if can? current_user, :write_issue, @project
12   - %li
13   - = link_to new_project_issue_path(@project), :class => "add_new", :title => "New Issue", :remote => true do
14   - Add new
15   -
... ...
app/views/issues/_show.html.haml
... ... @@ -2,7 +2,7 @@
2 2 %td
3 3 = image_tag gravatar_icon(issue.assignee_email), :class => "left", :width => 40, :style => "padding-right:5px;"
4 4 %span
5   - = truncate(html_escape(issue.title), :length => 100)
  5 + = truncate(html_escape(issue.title), :length => 50)
6 6 %div.note-author
7 7 %strong= issue.assignee.name
8 8 %cite.cgray
... ... @@ -15,10 +15,10 @@
15 15 .right.action-links
16 16 - if can? current_user, :write_issue, issue
17 17 - if issue.closed
18   - = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "cgray", :remote => true
  18 + = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true
19 19 - else
20   - = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "cgray", :remote => true
  20 + = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true
21 21 - if can? current_user, :write_issue, issue
22   - = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "cgray edit-issue-link", :remote => true
  22 + = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true
23 23 - if can?(current_user, :admin_issue, @project) || issue.author == current_user
24   - = link_to 'Remove', [issue.project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}"
  24 + = link_to 'Remove', [issue.project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "danger btn small delete-issue", :id => "destroy_issue_#{issue.id}"
... ...
app/views/issues/index.html.haml
1   -= render "issues/head"
  1 +- if can? current_user, :write_issue, @project
  2 + = content_for :sidebar_top_block do
  3 + - if current_user.can_create_project?
  4 + .alert-message.block-message.error
  5 + You are able to create an issue. Click on button to add a new one
  6 + = link_to new_project_issue_path(@project), :class => "btn small", :title => "New Issue", :remote => true do
  7 + New Issue
  8 +
2 9 - if current_user.private_token
3 10 = content_for :rss_icon do
4 11 .rss-icon
5 12 = link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do
6 13 = image_tag "Rss-UI.PNG", :width => 22, :title => "feed"
7 14  
8   -%div#issues-table-holder
9   - .well
10   - = form_tag project_issues_path(@project), :method => :get, :class => :left do
11   - = label_tag "open_issues" do
12   - = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "setIssueFilter(this.form, 0)", :id => "open_issues", :class => "status"
13   - %span.tag.open Open
14   - = label_tag "closed_issues" do
15   - = radio_button_tag :f, 2, params[:f] == "2", :onclick => "setIssueFilter(this.form, 2)", :id => "closed_issues", :class => "status"
16   - %span.tag.closed Closed
17   - = label_tag "my_issues" do
18   - = radio_button_tag :f, 3, params[:f] == "3", :onclick => "setIssueFilter(this.form, 3)", :id => "my_issues", :class => "status"
19   - %span To Me
20   - = label_tag "all_issues" do
21   - = radio_button_tag :f, 1, params[:f] == "1", :onclick => "setIssueFilter(this.form, 1)", :id => "all_issues", :class => "status"
22   - %span All
  15 +
  16 +.issues_content
  17 + %h3 Issues
  18 + %hr
  19 + %div#issues-table-holder
  20 + %ul.pills.left
  21 + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
  22 + = link_to project_issues_path(@project, :f => 0) do
  23 + Open
  24 + %li{:class => ("active" if params[:f] == "2")}
  25 + = link_to project_issues_path(@project, :f => 2) do
  26 + Closed
  27 + %li{:class => ("active" if params[:f] == "3")}
  28 + = link_to project_issues_path(@project, :f => 3) do
  29 + To Me
  30 + %li{:class => ("active" if params[:f] == "1")}
  31 + = link_to project_issues_path(@project, :f => 1) do
  32 + All
  33 +
23 34 = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do
24 35 = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
25 36 = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
26 37  
27   - %table#issues-table
28   - = render "issues"
29   - %br
  38 + %table#issues-table= render "issues"
  39 +
30 40 :javascript
31 41 var href = $('.issue_search').parent().attr('action');
32 42 var last_terms = '';
33 43  
34   - var setIssueFilter = function(form, value){
35   - $.cookie('issue_filter', value, { expires: 140 });
36   - form.submit();
37   - }
38   -
39 44 $('.issue_search').keyup(function() {
40 45 var terms = $(this).val();
41 46 var project_id = $('#project_id').val();
... ...
app/views/layouts/_project_side_right.html.haml 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +%aside.project-right
  2 + - if content_for? :sidebar_top_block
  3 + = yield :sidebar_top_block
  4 + - else
  5 + - if current_user.can_create_project?
  6 + .alert-message.block-message.info
  7 + You can create at least
  8 + = current_user.projects_limit
  9 + projects. Click on button to add a new one
  10 + = link_to new_project_path, :class => "btn small" do
  11 + New Project
  12 +
  13 + %h4
  14 + Recent Projects:
  15 + %ul
  16 + - current_user.projects.order("id DESC").limit(5).each do |project|
  17 + %li
  18 + = link_to project_path(project) do
  19 + = project.name
  20 +
  21 + %h4
  22 + Recent Issues:
  23 + %ul
  24 + - current_user.assigned_issues.order("id DESC").limit(5).each do |issue|
  25 + %li
  26 + = link_to project_issue_path(issue.project, issue) do
  27 + = truncate issue.title
  28 +
  29 +
  30 + %h4
  31 + Recent Requests:
  32 + %ul
  33 + - current_user.assigned_merge_requests.order("id DESC").limit(5).each do |issue|
  34 + %li
  35 + = link_to project_merge_request_path(issue.project, issue) do
  36 + = truncate issue.title
  37 +
  38 +
... ...
app/views/layouts/project.html.haml
... ... @@ -18,4 +18,11 @@
18 18 = render :partial => "layouts/head_panel"
19 19 .container-fluid
20 20 .sidebar= render :partial => "layouts/project_side"
21   - .content= yield
  21 + .content
  22 + - if @full_content
  23 + = yield
  24 + - else
  25 + .row
  26 + .span10= yield
  27 + .span4= render "layouts/project_side_right"
  28 +
... ...
app/views/notes/_form.html.haml
... ... @@ -10,7 +10,7 @@
10 10 = f.text_area :note, :size => 255
11 11  
12 12 .row
13   - .span6
  13 + .span4
14 14 %h5 Notify via email:
15 15 .clearfix
16 16 = label_tag :notify do
... ... @@ -21,7 +21,7 @@
21 21 = label_tag :notify_author do
22 22 = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
23 23 %span Commit author
24   - .span6
  24 + .span4.right
25 25 %h5 Attachment:
26 26 .clearfix
27 27 = f.label :attachment, "Any file, < 10 MB"
... ...
app/views/projects/_feed.html.haml
1 1 - if update.kind_of?(Note)
2 2 %a.project-update.titled{:href => dashboard_feed_path(project, update)}
3   - = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
4   - %span.update-title
  3 + = image_tag gravatar_icon(update.author_email), :class => "avatar", :width => 32
  4 + %div
5 5 = dashboard_feed_title(update)
6 6 %span.update-author
7 7 %strong= update.author_name
... ... @@ -10,7 +10,7 @@
10 10 - noteable = update.target
11 11 - if noteable.kind_of?(MergeRequest)
12 12 .title-block
13   - %span.update-title
  13 + %div
14 14 %span.commit.tag
15 15 Merge Request #
16 16 = noteable.id
... ... @@ -21,7 +21,7 @@
21 21  
22 22 - elsif noteable.kind_of?(Issue)
23 23 .title-block
24   - %span.update-title
  24 + %div
25 25 %span.commit.tag
26 26 Issue #
27 27 = noteable.id
... ... @@ -30,29 +30,29 @@
30 30  
31 31 - elsif noteable.kind_of?(Commit)
32 32 .title-block
33   - %span.update-title
  33 + %div
34 34 %span.commit.tag
35 35 commit
36 36 %span.update-author
37 37 .left= truncate noteable.id
38 38 - else
39 39 .title-block
40   - %span.update-title
  40 + %div
41 41 %span.commit.tag
42 42 Project Wall
43 43  
44 44  
45 45 - elsif update.kind_of?(MergeRequest)
46 46 %a.project-update.titled{:href => project_merge_request_path(project, update)}
47   - = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
48   - %span.update-title
  47 + = image_tag gravatar_icon(update.author_email), :class => "avatar", :width => 32
  48 + %div
49 49 Opened merge request
50 50 %span.update-author
51 51 %strong= update.author_name
52 52 = time_ago_in_words(update.created_at)
53 53 ago
54 54 .title-block
55   - %span.update-title
  55 + %div
56 56 %span.commit.tag
57 57 Merge Request #
58 58 = update.id
... ... @@ -63,15 +63,15 @@
63 63  
64 64 - elsif update.kind_of?(Issue)
65 65 %a.project-update.titled{:href => dashboard_feed_path(project, update)}
66   - = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
67   - %span.update-title
  66 + = image_tag gravatar_icon(update.author_email), :class => "avatar", :width => 32
  67 + %div
68 68 Created new Issue
69 69 %span.update-author
70 70 %strong= update.author_name
71 71 = time_ago_in_words(update.created_at)
72 72 ago
73 73 .title-block
74   - %span.update-title
  74 + %div
75 75 %span.commit.tag
76 76 Issue #
77 77 = update.id
... ...