From a77c8bf9c3635393064490e752aa99f10bf32722 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 29 Jan 2012 12:04:09 +0200 Subject: [PATCH] Bootstrap: Issues & MR --- app/assets/stylesheets/common.scss | 4 + app/assets/stylesheets/reset_bootstrap.scss | 28 ++++++- app/assets/stylesheets/tree.scss | 4 + app/models/commit.rb | 2 +- app/views/issues/_form.html.haml | 6 +- app/views/issues/_show.html.haml | 58 ++++++++------ app/views/issues/index.html.haml | 46 ++++++------ app/views/issues/show.html.haml | 75 +++++++++---------- app/views/merge_requests/_commits.html.haml | 24 +++--- .../merge_requests/_merge_request.html.haml | 19 +++-- app/views/merge_requests/index.html.haml | 39 ++++------ 11 files changed, 168 insertions(+), 137 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 936bc529..aa39063c 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -162,6 +162,10 @@ img.avatar { p { padding-top:5px;} } +.author_link { + color: $active_link_color; +} + @import "reset_bootstrap.scss"; @import "top_panel.scss"; @import "projects.css.scss"; diff --git a/app/assets/stylesheets/reset_bootstrap.scss b/app/assets/stylesheets/reset_bootstrap.scss index 4eb47443..a744040f 100644 --- a/app/assets/stylesheets/reset_bootstrap.scss +++ b/app/assets/stylesheets/reset_bootstrap.scss @@ -6,7 +6,33 @@ a { } } -.alert-message.entry { +.entry { + position: relative; + padding: 7px 15px; + margin-bottom: 18px; + color: #404040; + background-color: #eedc94; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94)); + background-image: -moz-linear-gradient(top, #fceec1, #eedc94); + background-image: -ms-linear-gradient(top, #fceec1, #eedc94); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94)); + background-image: -webkit-linear-gradient(top, #fceec1, #eedc94); + background-image: -o-linear-gradient(top, #fceec1, #eedc94); + background-image: linear-gradient(top, #fceec1, #eedc94); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFCEEC1', endColorstr='#FFEEDC94', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #eedc94 #eedc94 #e4c652; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) fadein(rgba(0, 0, 0, 0.1), 15%); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + border-width: 1px; + border-style: solid; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); background:#F1F1F1; border-color:#ccc; } diff --git a/app/assets/stylesheets/tree.scss b/app/assets/stylesheets/tree.scss index 854d75be..c86add61 100644 --- a/app/assets/stylesheets/tree.scss +++ b/app/assets/stylesheets/tree.scss @@ -119,4 +119,8 @@ table.highlighttable .linenodiv pre { background: #FFFFCF; cursor:pointer; } + + .tree-item-file-name { + font-weight:bold; + } } diff --git a/app/models/commit.rb b/app/models/commit.rb index 902ffbc6..01fac4a8 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -27,7 +27,7 @@ class Commit @head = head end - def safe_message() + def safe_message message end diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index 9f7fac1f..555a51a5 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -24,7 +24,7 @@ .clearfix = f.label :title .input= f.text_area :title, :maxlength => 255, :class => "xlarge" - .clearfix + .actions = f.submit 'Save', :class => "primary btn" - if request.xhr? @@ -36,6 +36,6 @@ = link_to "Cancel", project_issue_path(@project, @issue), :class => "btn" - -#- unless @issue.new_record? + - unless @issue.new_record? .right - = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "red-button" + = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "danger btn" diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index 4c0d11e6..d9f6933b 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -1,24 +1,34 @@ -%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) } - %td - = image_tag gravatar_icon(issue.assignee_email), :class => "left", :width => 40, :style => "padding-right:5px;" - %span - = truncate(html_escape(issue.title), :length => 50) - %div.note-author - %strong= issue.assignee.name - %cite.cgray - = time_ago_in_words(issue.created_at) - ago - - if issue.critical - %span.tag.high critical - - if issue.today? - %span.tag.today today - .right.action-links - - if can? current_user, :write_issue, issue - - if issue.closed - = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true - - else - = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true - - if can? current_user, :write_issue, issue - = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true - - if can?(current_user, :admin_issue, @project) || issue.author == current_user - = 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}" +%li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) } + = image_tag gravatar_icon(issue.author_email), :class => "avatar" + %span.update-author + %strong + = link_to project_team_member_path(@project, @project.team_member_by_id(issue.author_id)), :class => "author_link" do + = issue.author_name + authored + = time_ago_in_words(issue.created_at) + ago + - if issue.critical + %span.label.important critical + - if issue.today? + %span.label.success today + + .right + - if can? current_user, :write_issue, issue + - if issue.closed + = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true + - else + = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true + - if can? current_user, :write_issue, issue + = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true + -#- if can?(current_user, :admin_issue, @project) || issue.author == current_user + = 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}" + + + = link_to project_issue_path(issue.project, issue) do + %p + Issue ##{issue.id}: + = truncate(issue.title, :length => 50) + + + + diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index ddf55350..f7fdb883 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -13,25 +13,29 @@ New Issue %hr %div#issues-table-holder - %ul.pills.left - %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} - = link_to project_issues_path(@project, :f => 0) do - Open - %li{:class => ("active" if params[:f] == "2")} - = link_to project_issues_path(@project, :f => 2) do - Closed - %li{:class => ("active" if params[:f] == "3")} - = link_to project_issues_path(@project, :f => 3) do - To Me - %li{:class => ("active" if params[:f] == "1")} - = link_to project_issues_path(@project, :f => 1) do - All + .row + .span8 + %ul.pills.left + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} + = link_to project_issues_path(@project, :f => 0) do + Open + %li{:class => ("active" if params[:f] == "2")} + = link_to project_issues_path(@project, :f => 2) do + Closed + %li{:class => ("active" if params[:f] == "3")} + = link_to project_issues_path(@project, :f => 3) do + To Me + %li{:class => ("active" if params[:f] == "1")} + = link_to project_issues_path(@project, :f => 1) do + All - = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do - = hidden_field_tag :project_id, @project.id, { :id => 'project_id' } - = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } + .span2.right + = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do + = hidden_field_tag :project_id, @project.id, { :id => 'project_id' } + = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } - %table#issues-table= render "issues" + %hr + %ul#issues-table.unstyled= render "issues" :javascript var href = $('.issue_search').parent().attr('action'); @@ -46,7 +50,7 @@ if (terms.length >= 2 || terms.length == 0) { $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) { - $('#issues-table tbody').html(response); + $('#issues-table').html(response); setSortable(); }); } @@ -57,7 +61,7 @@ $(this).closest('tr').fadeOut(); updatePage();}); function setSortable(){ - $('#issues-table>tbody').sortable({ + $('#issues-table').sortable({ axis: 'y', dropOnEmpty: false, handle: '.handle', @@ -68,10 +72,10 @@ update: function(){ $.ajax({ type: 'post', - data: $('#issues-table>tbody').sortable('serialize'), + data: $('#issues-table').sortable('serialize'), dataType: 'script', complete: function(request){ - $('#issues-table>tbody').effect('highlight'); + $('#issues-table').effect('highlight'); }, url: "#{sort_project_issues_path(@project)}"}) } diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 48fca97d..34767251 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -1,49 +1,42 @@ -%div - %span.entity-info +%h3 + Issue ##{@issue.id} + + %span.right - if can?(current_user, :admin_project, @project) || @issue.author == current_user - = link_to edit_project_issue_path(@project, @issue) do - .entity-button - Edit Issue - %i - = image_tag gravatar_icon(@issue.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" - %span.commit-title - %strong - = "Issue ##{@issue.id}:" - %span.commit-author - %strong - = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.author.id)) do - %span.author= @issue.author_name - - if @issue.author != @issue.assignee + - if @issue.closed + = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn" + - else + = link_to 'Close', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "btn", :title => "Close merge request" + - if can?(current_user, :admin_project, @project) || @issue.author == current_user + = link_to edit_project_issue_path(@project, @issue), :class => "btn small" do + Edit + +%hr +- if @issue.closed + .alert-message.error Closed +- else + .alert-message.success Open + + +%div.well + %div + %span.entity-info + = image_tag gravatar_icon(@issue.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" + %span.commit-title + %strong + %span.commit-author + %strong + = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.author.id)) do + %span.author= @issue.author_name → = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.assignee.id)) do %span.author= @issue.assignee_name -   + %br + .cgray= @issue.created_at.stamp("Aug 21, 2011 9:23pm") + -   - = @issue.created_at.stamp("Aug 21, 2011 9:23pm") + %div= simple_format @issue.title - %hr - %br - %h3 - = simple_format @issue.title -.clear -%br -%br - -.merge-tabs - = link_to "#notes", :class => "merge-notes-tab active tab" do - %span - Notes - .right - - if @issue.closed - = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "red-button" - - else - = link_to 'Close', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "positive-button" - -.merge-request-notes - .issue_notes= render "notes/notes" - .loading{ :style => "display:none;"} - %center= image_tag "ajax-loader.gif" - .clear +.issue_notes= render "notes/notes" diff --git a/app/views/merge_requests/_commits.html.haml b/app/views/merge_requests/_commits.html.haml index af2bb411..ddc0ce19 100644 --- a/app/views/merge_requests/_commits.html.haml +++ b/app/views/merge_requests/_commits.html.haml @@ -1,19 +1,15 @@ - if @commits.size > 0 - .merge-request-commits.ui-box.width-100p + .merge-request-commits - @commits.each do |commit| - %a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) } - - if commit.author_email - = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" - - else - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" - %span.commit-title - = truncate commit.safe_message, :length => 60 - %span.commit-author - %strong= commit.author_name - authored - = time_ago_in_words(commit.created_at) - ago - .clear + .entry + = link_to project_commit_path(@project, :id => commit.id) do + %strong + = truncate(commit.id.to_s, :length => 10) + = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 + %span= truncate(commit.safe_message, :length => 40) + %span.right + = time_ago_in_words(commit.committed_date) + ago - if @commits.empty? %p.cgray Nothing to merge diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index 262aa661..33dd7e5d 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -1,14 +1,17 @@ -%a.update-item{:href => project_merge_request_path(merge_request.project, merge_request)} - = image_tag gravatar_icon(merge_request.author_email), :class => "left", :width => 40 - %span.update-title - = truncate(merge_request.title, :length => 60) +%li.wll + = image_tag gravatar_icon(merge_request.author_email), :class => "avatar" %span.update-author - %strong= merge_request.author_name + %strong + = link_to project_team_member_path(@project, @project.team_member_by_id(merge_request.author_id)), :class => "author_link" do + = merge_request.author_name authored = time_ago_in_words(merge_request.created_at) ago .right - %span.tag.commit= merge_request.source_branch + %span.label= merge_request.source_branch → - %span.tag.commit= merge_request.target_branch - + %span.label= merge_request.target_branch + = link_to project_merge_request_path(merge_request.project, merge_request) do + %p + Merge Request ##{merge_request.id}: + = truncate(merge_request.title, :length => 50) diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index 8ddb3021..ea2f2433 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -1,28 +1,19 @@ -.left.issues_filter - = form_tag project_merge_requests_path(@project), :method => :get do - .left - = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_merge_requests", :class => "status" - = label_tag "open_merge_requests" do - %span.tag.open Open - .left - = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_merge_requests", :class => "status" - = label_tag "closed_merge_requests" do - %span.tag.closed Closed +%h3 + Merge Requests + - if can? current_user, :write_issue, @project + = link_to new_project_merge_request_path(@project), :class => "right btn small", :title => "New Merge Request" do + New Merge Request -.clear %hr +%ul.pills + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} + = link_to project_merge_requests_path(@project, :f => 0) do + Open + %li{:class => ("active" if params[:f] == "2")} + = link_to project_merge_requests_path(@project, :f => 2) do + Closed + +%hr +%ul.unstyled= render @merge_requests -.row - .span10 - - if @merge_requests.count > 0 - %div{ :class => "update-data ui-box ui-box-small ui-box-big" } - .data - = render @merge_requests - .span4 - - if can? current_user, :write_merge_request, @project - .alert-message.block-message.info - %p You can open a new merge request. - - if current_page?(project_merge_requests_path(@project)) - = link_to new_project_merge_request_path(@project), :class => "btn small", :title => "New Merge request" do - Add new