From 23a1ba7362a13dfcde05d158f2d2237351090730 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 Dec 2011 01:35:57 +0200 Subject: [PATCH] Fix different styles/button positions --- app/assets/stylesheets/projects.css.scss | 30 +++++++++++++++ app/models/snippet.rb | 4 ++ app/views/merge_requests/index.html.haml | 5 ++- app/views/projects/_team.html.haml | 5 ++- app/views/snippets/_form.html.haml | 2 + app/views/snippets/index.html.haml | 13 ++++--- app/views/snippets/show.html.haml | 48 ++++++++++++++---------- 7 files changed, 80 insertions(+), 27 deletions(-) diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index db011b36..adf46147 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -476,3 +476,33 @@ body.project-page table.no-borders td{ } #tree-content-holder { float:left; width:100%; } + + + +/* Commit Page */ +.entity-info {float: right;} +.entity-button{ + background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.192, #fff), to(#f4f4f4)); + background-image: -webkit-linear-gradient(#fff 19.2%, #f4f4f4); + background-image: -moz-linear-gradient(#fff 19.2%, #f4f4f4); + background-image: -o-linear-gradient(#fff 19.2%, #f4f4f4); + box-shadow: 0 -1px 0 white inset; + display: block; + border: 1px solid #eee; + border-radius: 5px; + margin-bottom: 2px; + position: relative; + padding: 4px 10px; + font-size: 11px; + padding-right: 20px; +} + +.entity-button i{ + background: url('images.png') no-repeat -138px -27px; + width: 6px; + height: 9px; + float: right; + position: absolute; + top: 6px; + right: 5px; +} diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 5c61cf1c..6db5e2dd 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -5,6 +5,10 @@ class Snippet < ActiveRecord::Base belongs_to :author, :class_name => "User" has_many :notes, :as => :noteable + delegate :name, + :email, + :to => :author, + :prefix => true attr_protected :author, :author_id, :project, :project_id validates_presence_of :project_id diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index c3f8d06a..edc223ba 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -1,3 +1,7 @@ +%h2.icon + %span> + Merge Requests +.right= link_to 'New Merge request', new_project_merge_request_path(@project), :class => "grey-button" - if @merge_requests.opened.count > 0 %div{ :class => "update-data ui-box ui-box-small ui-box-big" } %h3 @@ -17,4 +21,3 @@ .clear %br -= link_to 'New Merge request', new_project_merge_request_path(@project), :class => "grey-button" diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml index e3d36136..7c647e33 100644 --- a/app/views/projects/_team.html.haml +++ b/app/views/projects/_team.html.haml @@ -1,6 +1,9 @@ +%h2.icon + %span> + Team - if can? current_user, :admin_team_member, @project %div#new-member-holder - = link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" + .right= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "grey-button" %br %table.round-borders#team-table %thead diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index 77b0a96d..b7bebbee 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -32,3 +32,5 @@ .buttons = f.submit 'Save', :class => "grey-button" + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user + .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index f34a3617..677fe9de 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,9 +1,12 @@ -%div - - if can? current_user, :write_snippet, @project - = link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" +%h2.icon + %span> + Snippets +- if can? current_user, :write_snippet, @project + .right= link_to 'New Snippet', new_project_snippet_path(@project), :class => "grey-button append-bottom-10" + +%table#snippets-table + = render @snippets.fresh - %table#snippets-table - = render @snippets.fresh :javascript $('.delete-snippet').live('ajax:success', function() { $(this).closest('tr').fadeOut(); }); diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 9b379cf4..59f810a7 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -1,23 +1,31 @@ -- if !@snippet.expired? - .ui-box.width-100p - %h3 - = @snippet.title - .right= @snippet.file_name - .data.no-padding - :erb - <%= raw @snippet.colorize %> +%div + %span.entity-info + - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user + = link_to edit_project_snippet_path(@project, @snippet) do + .entity-button + Edit Snippet + %i + - if @snippet.author_email + = image_tag gravatar_icon(@snippet.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 + %strong + = truncate(@snippet.title, :length => 60) + %span.commit-author + %strong= @snippet.author_name + = @snippet.created_at.stamp("Aug 21, 2011 9:23pm") - .buttons - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "grey-button" - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" - .clear - %br - .snippet_notes= render "notes/notes" +%hr - .clear +.view_file + .view_file_header + %strong= @snippet.file_name + .data.no-padding + :erb + <%= raw @snippet.colorize %> +.clear +%br +.snippet_notes= render "notes/notes" -- else - %h2 - Sorry, this snippet is no longer exists +.clear