OSDN Git Service

Merge branch 'master' into 6-0-dev
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 2 Jul 2013 08:47:09 +0000 (11:47 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 2 Jul 2013 08:47:09 +0000 (11:47 +0300)
Conflicts:
app/views/dashboard/projects.html.haml
app/views/layouts/_head_panel.html.haml
config/routes.rb

1  2 
app/assets/javascripts/notes.js
app/assets/stylesheets/sections/header.scss
app/controllers/projects/notes_controller.rb
app/views/layouts/_head_panel.html.haml
app/views/projects/notes/_note.html.haml
config/routes.rb
spec/factories.rb
spec/routing/project_routing_spec.rb

Simple merge
@@@ -36,5 -36,5 +36,5 @@@
            = link_to destroy_user_session_path, class: "logout", method: :delete, title: "Logout", class: 'has_bottom_tooltip', 'data-original-title' => 'Logout'  do
              %i.icon-signout
          %li
 -          = link_to current_user, class: "profile-pic" do
 -            = image_tag(gravatar_icon(current_user.email, 26), alt: '')
 +          = link_to current_user, class: "profile-pic", id: 'profile-pic' do
-             = image_tag gravatar_icon(current_user.email, 26)
++            = image_tag gravatar_icon(current_user.email, 26), alt: ''
@@@ -6,13 -6,14 +6,14 @@@
          Link here
        &nbsp;
        - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
-         = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove comment?', remote: true, class: "danger js-note-delete" do
+         = link_to "#", title: "Edit comment", class: "js-note-edit" do
+           %i.icon-edit
+         = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove this comment?', remote: true, class: "danger js-note-delete" do
            %i.icon-trash.cred
 -    = image_tag gravatar_icon(note.author.email), class: "avatar s32", alt: ''
 +    = image_tag gravatar_icon(note.author_email), class: "avatar s32"
      = link_to_member(@project, note.author, avatar: false)
      %span.note-last-update
-       = time_ago_in_words(note.updated_at)
-       ago
+       = note_timestamp(note)
  
      - if note.upvote?
        %span.vote.upvote.label.label-success
  
  
    .note-body
-     = preserve do
-       = markdown(note.note)
+     .note-text
+       = preserve do
+         = markdown(note.note)
+     .note-edit-form
+       = form_for note, url: project_note_path(@project, note), method: :put, remote: true do |f|
+         = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
+         .form-actions
+           = f.submit 'Save changes', class: "btn btn-primary btn-save"
+           .note-form-option
+             %a.choose-btn.btn.btn-small.js-choose-note-attachment-button
+               %i.icon-paper-clip
+               %span Choose File ...
+             &nbsp;
+             %span.file_name.js-attachment-filename File name...
+             = f.file_field :attachment, class: "js-note-attachment-input hide"
+           = link_to  'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
    - if note.attachment.url
-     - if note.attachment.image?
-       = image_tag note.attachment.url, class: 'note-image-attach'
-     .attachment.pull-right
-       = link_to note.attachment.secure_url, target: "_blank" do
-         %i.icon-paper-clip
-         = note.attachment_identifier
+     .note-attachment
+       - if note.attachment.image?
+         = image_tag note.attachment.url, class: 'note-image-attach'
+       .attachment.pull-right
+         = link_to note.attachment.secure_url, target: "_blank" do
+           %i.icon-paper-clip
+           = note.attachment_identifier
+           = link_to delete_attachment_project_note_path(@project, note),
+             title: "Delete this attachment", method: :delete, remote: true, confirm: 'Are you sure you want to remove the attachment?', class: "danger js-note-attachment-delete" do
+             %i.icon-trash.cred
 -  .clear
 +  .clear
@@@ -161,135 -183,150 +161,139 @@@ Gitlab::Application.routes.draw d
        get :autocomplete_sources
      end
  
 -    resources :blob,    only: [:show], constraints: {id: /.+/}
 -    resources :raw,    only: [:show], constraints: {id: /.+/}
 -    resources :tree,    only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
 -    resources :edit_tree,    only: [:show, :update], constraints: {id: /.+/}, path: 'edit'
 -    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
 -    resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}
 -    resources :compare, only: [:index, :create]
 -    resources :blame,   only: [:show], constraints: {id: /.+/}
 -    resources :network,   only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/}
 -    resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/}
 -    match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/}
 -
      scope module: :projects do
 -      resources :snippets do
 -        member do
 -          get "raw"
 +      resources :blob,    only: [:show], constraints: {id: /.+/}
 +      resources :raw,    only: [:show], constraints: {id: /.+/}
 +      resources :tree,    only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
 +      resources :edit_tree,    only: [:show, :update], constraints: {id: /.+/}, path: 'edit'
 +      resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
 +      resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}
 +      resources :compare, only: [:index, :create]
 +      resources :blame,   only: [:show], constraints: {id: /.+/}
 +      resources :network,   only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/}
 +      resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/}
 +      match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/}
 +
 +        resources :snippets do
 +          member do
 +            get "raw"
 +          end
          end
 -      end
 -    end
  
 -    resources :wikis, only: [:show, :edit, :destroy, :create] do
 -      collection do
 -        get :pages
 -        put ':id' => 'wikis#update'
 -        get :git_access
 -      end
 +      resources :wikis, only: [:show, :edit, :destroy, :create] do
 +        collection do
 +          get :pages
 +          put ':id' => 'wikis#update'
 +          get :git_access
 +        end
  
 -      member do
 -        get "history"
 +        member do
 +          get "history"
 +        end
        end
 -    end
  
 -    resource :wall, only: [:show] do
 -      member do
 -        get 'notes'
 +      resource :wall, only: [:show] do
 +        member do
 +          get 'notes'
 +        end
        end
 -    end
  
 -    resource :repository do
 -      member do
 -        get "branches"
 -        get "tags"
 -        get "stats"
 -        get "archive"
 +      resource :repository, only: [:show] do
 +        member do
 +          get "branches"
 +          get "tags"
 +          get "stats"
 +          get "archive"
 +        end
        end
 -    end
  
 -    resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
 -      member do
 -        get :test
 +      resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
 +        member do
 +          get :test
 +        end
        end
 -    end
  
 -    resources :deploy_keys do
 -      member do
 -        put :enable
 -        put :disable
 +      resources :deploy_keys do
 +        member do
 +          put :enable
 +          put :disable
 +        end
        end
 -    end
  
 -    resources :protected_branches, only: [:index, :create, :destroy]
 +      resources :protected_branches, only: [:index, :create, :destroy]
  
 -    resources :refs, only: [] do
 -      collection do
 -        get "switch"
 -      end
 +      resources :refs, only: [] do
 +        collection do
 +          get "switch"
 +        end
  
 -      member do
 -        # tree viewer logs
 -        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ }
 -        get "logs_tree/:path" => "refs#logs_tree",
 -          as: :logs_file,
 -          constraints: {
 -            id:   /[a-zA-Z.0-9\/_\-#%+]+/,
 -            path: /.*/
 -          }
 +        member do
 +          # tree viewer logs
 +          get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ }
 +          get "logs_tree/:path" => "refs#logs_tree",
 +            as: :logs_file,
 +            constraints: {
 +              id:   /[a-zA-Z.0-9\/_\-#%+]+/,
 +              path: /.*/
 +            }
 +        end
        end
 -    end
  
 -    resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
 -      member do
 -        get :diffs
 -        get :automerge
 -        get :automerge_check
 -        get :ci_status
 -      end
 +      resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
 +        member do
 +          get :diffs
 +          get :automerge
 +          get :automerge_check
 +          get :ci_status
 +        end
  
 -      collection do
 -        get :branch_from
 -        get :branch_to
 +        collection do
 +          get :branch_from
 +          get :branch_to
 +        end
        end
 -    end
  
 -    resources :hooks, only: [:index, :create, :destroy] do
 -      member do
 -        get :test
 +      resources :hooks, only: [:index, :create, :destroy] do
 +        member do
 +          get :test
 +        end
        end
 -    end
  
 -    resources :team, controller: 'team_members', only: [:index]
 -    resources :milestones, except: [:destroy]
 +      resources :team, controller: 'team_members', only: [:index]
 +      resources :milestones, except: [:destroy]
  
 -    resources :labels, only: [:index] do
 -      collection do
 -        post :generate
 +      resources :labels, only: [:index] do
 +        collection do
 +          post :generate
 +        end
        end
 -    end
  
 -    resources :issues, except: [:destroy] do
 -      collection do
 -        post  :bulk_update
 +      resources :issues, except: [:destroy] do
 +        collection do
 +          post  :bulk_update
 +        end
        end
 -    end
  
 -    resources :team_members, except: [:index, :edit] do
 -      collection do
 +      resources :team_members, except: [:index, :edit] do
 +        collection do
  
 -        # Used for import team
 -        # from another project
 -        get :import
 -        post :apply_import
 +          # Used for import team
 +          # from another project
 +          get :import
 +          post :apply_import
 +        end
        end
 -    end
  
-       resources :notes, only: [:index, :create, :destroy] do
 -    scope module: :projects do
 -      resources :teams, only: [] do
 -        collection do
 -          get :available
 -          post :assign
 -        end
++      resources :notes, only: [:index, :create, :destroy, :update] do
+         member do
 -          delete :resign
++          delete :delete_attachment
+         end
 -      end
 -    end
 -    resources :notes, only: [:index, :create, :destroy, :update] do
 -      member do
 -        delete :delete_attachment
 -      end
 -      collection do
 -        post :preview
 +        collection do
 +          post :preview
 +        end
        end
-       end
+     end
    end
  
    root to: "dashboard#show"
Simple merge
Simple merge