From 24e172597a3e0c1b75e2d96fc8c7f1752f9a6c03 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Sat, 1 Dec 2012 03:19:16 -0800 Subject: [PATCH 1/3] remove length limit from notes --- app/models/note.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/note.rb b/app/models/note.rb index 60846e04..da15a173 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -32,11 +32,10 @@ class Note < ActiveRecord::Base delegate :name, to: :project, prefix: true delegate :name, :email, to: :author, prefix: true - validates :project, presence: true - validates :note, presence: true, length: { within: 0..5000 } + validates :note, :project, presence: true validates :attachment, file_size: { maximum: 10.megabytes.to_i } - mount_uploader :attachment, AttachmentUploader + mount_uploader :attachment, AttachmentUploader # Scopes scope :common, ->{ where(noteable_id: nil) } From a9a54979150f02690784cbea5d9b697b95249f7c Mon Sep 17 00:00:00 2001 From: Cyril Date: Thu, 29 Nov 2012 22:51:51 +0100 Subject: [PATCH 2/3] refactor flash * make unobtrusive js * convert js to coffee --- app/assets/javascripts/main.js.coffee | 5 +++++ app/assets/stylesheets/common.scss | 4 +++- app/views/layouts/_flash.html.haml | 20 +++----------------- app/views/layouts/devise.html.haml | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 3f4b0f61..bdb83f49 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -33,6 +33,11 @@ $ -> # Bottom tooltip $('.has_bottom_tooltip').tooltip(placement: 'bottom') + # Flash + if (flash = $("#flash-container")).length > 0 + flash.click -> $(@).slideUp("slow") + flash.slideDown "slow" + setTimeout (-> flash.slideUp("slow")), 3000 # Disable form buttons while a form is submitting $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) -> diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index c82ddc18..d79e97aa 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -68,7 +68,7 @@ table a code { } /** FLASH message **/ -#flash_container { +#flash-container { height: 50px; position: fixed; z-index: 10001; @@ -79,6 +79,8 @@ table a code { background: white; cursor: pointer; border-bottom: 1px solid #ccc; + text-align: center; + display: none; h4 { color: #666; diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index 86564ad7..9961ce8d 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -1,17 +1,3 @@ -- if alert || notice - - text = alert || notice - %div{style: "display:none", id: "flash_container"} - %center - %h4= text - :javascript - $(function(){ - $("#flash_container").slideDown("slow"); - $("#flash_container").click(function(){ - $(this).slideUp("slow"); - }); - setTimeout("hideFlash()",3000); - }); - - function hideFlash(){ - $("#flash_container").slideUp("slow"); - } +- if text = alert || notice + #flash-container + %h4= text diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index 70c4f007..36c6b4c6 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -2,5 +2,5 @@ %html{ lang: "en"} = render "layouts/head" %body.ui_basic.login-page - = render partial: "layouts/flash" + = render "layouts/flash" .container= yield From 0323610b72015c274c7292ee69992f75cdcd116c Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Sat, 1 Dec 2012 19:31:39 +0100 Subject: [PATCH 3/3] commit diff - check if prev_commit is not nil --- app/views/commits/_diffs.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index 53c2319f..e7733f05 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -43,7 +43,7 @@ - if file.text? = render "commits/text_file", diff: diff, index: i - elsif file.image? - - old_file = (@commit.prev_commit.tree / diff.old_path) + - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil? - if diff.renamed_file || diff.new_file || diff.deleted_file .diff_file_content_image .image{class: image_diff_class(diff)}