Commit 2be5e6d44347dfb6374b4b2c87a953da06d6167d

Authored by Dmitriy Zaporozhets
2 parents 35f0566e f2e1c8b7

Merge branch 'master' of github.com:gitlabhq/gitlabhq

app/assets/javascripts/main.js.coffee
... ... @@ -33,6 +33,11 @@ $ ->
33 33 # Bottom tooltip
34 34 $('.has_bottom_tooltip').tooltip(placement: 'bottom')
35 35  
  36 + # Flash
  37 + if (flash = $("#flash-container")).length > 0
  38 + flash.click -> $(@).slideUp("slow")
  39 + flash.slideDown "slow"
  40 + setTimeout (-> flash.slideUp("slow")), 3000
36 41  
37 42 # Disable form buttons while a form is submitting
38 43 $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
... ...
app/assets/stylesheets/common.scss
... ... @@ -68,7 +68,7 @@ table a code {
68 68 }
69 69  
70 70 /** FLASH message **/
71   -#flash_container {
  71 +#flash-container {
72 72 height: 50px;
73 73 position: fixed;
74 74 z-index: 10001;
... ... @@ -79,6 +79,8 @@ table a code {
79 79 background: white;
80 80 cursor: pointer;
81 81 border-bottom: 1px solid #ccc;
  82 + text-align: center;
  83 + display: none;
82 84  
83 85 h4 {
84 86 color: #666;
... ...
app/models/note.rb
... ... @@ -32,11 +32,10 @@ class Note < ActiveRecord::Base
32 32 delegate :name, to: :project, prefix: true
33 33 delegate :name, :email, to: :author, prefix: true
34 34  
35   - validates :project, presence: true
36   - validates :note, presence: true, length: { within: 0..5000 }
  35 + validates :note, :project, presence: true
37 36 validates :attachment, file_size: { maximum: 10.megabytes.to_i }
38 37  
39   - mount_uploader :attachment, AttachmentUploader
  38 + mount_uploader :attachment, AttachmentUploader
40 39  
41 40 # Scopes
42 41 scope :common, ->{ where(noteable_id: nil) }
... ...
app/views/commits/_diffs.html.haml
... ... @@ -43,7 +43,7 @@
43 43 - if file.text?
44 44 = render "commits/text_file", diff: diff, index: i
45 45 - elsif file.image?
46   - - old_file = (@commit.prev_commit.tree / diff.old_path)
  46 + - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil?
47 47 - if diff.renamed_file || diff.new_file || diff.deleted_file
48 48 .diff_file_content_image
49 49 .image{class: image_diff_class(diff)}
... ...
app/views/layouts/_flash.html.haml
1   -- if alert || notice
2   - - text = alert || notice
3   - %div{style: "display:none", id: "flash_container"}
4   - %center
5   - %h4= text
6   - :javascript
7   - $(function(){
8   - $("#flash_container").slideDown("slow");
9   - $("#flash_container").click(function(){
10   - $(this).slideUp("slow");
11   - });
12   - setTimeout("hideFlash()",3000);
13   - });
14   -
15   - function hideFlash(){
16   - $("#flash_container").slideUp("slow");
17   - }
  1 +- if text = alert || notice
  2 + #flash-container
  3 + %h4= text
... ...
app/views/layouts/devise.html.haml
... ... @@ -2,5 +2,5 @@
2 2 %html{ lang: "en"}
3 3 = render "layouts/head"
4 4 %body.ui_basic.login-page
5   - = render partial: "layouts/flash"
  5 + = render "layouts/flash"
6 6 .container= yield
... ...