whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: change default message to Reflow if only whitespace changes
Date Thu, 09 Nov 2017 14:06:12 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new f1d0021  change default message to Reflow if only whitespace changes
f1d0021 is described below

commit f1d0021473838affc4682a7c6549822499ed3ecb
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Thu Nov 9 09:05:44 2017 -0500

    change default message to Reflow if only whitespace changes
---
 www/board/agenda/views/buttons/post.js.rb | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index 1f5be63..d2f5151 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -34,7 +34,7 @@ class Post < Vue
       #input field: report text
       _textarea.post_report_text! label: @label, value: @report,
         placeholder: @label, rows: 17, disabled: @disabled, 
-        onChange: self.change_text
+        onInput: self.change_text
 
       # upload of spreadsheet from virtual
       if @@item.title == 'Treasurer'
@@ -123,6 +123,8 @@ class Post < Vue
       @alerted = true
     end
 
+    @base = @report
+
     if @@button.text == 'add resolution' or @@item.attach =~ /^[47]/
       @indent = '        '
     else
@@ -147,7 +149,21 @@ class Post < Vue
   # track changes to text value
   def change_text(event)
     @report = event.target.value
-    @edited = true
+    self.change_message()
+  end
+
+  # update default message to reflect whether only whitespace changes were
+  # made or if there is something more that was done
+  def change_message()
+    @edited = (@base != @report)
+
+    if @message =~ /(Edit|Reflow) #{@@item.title} Report/
+      if @edited and @base.gsub(/[ \t\n]+/, '') == @report.gsub(/[ \t\n]+/, '')
+         @message = "Reflow #{@@item.title} Report"
+      else
+         @message = "Edit #{@@item.title} Report"
+      end
+    end
   end
 
   # determine if reflow button should be default or danger color
@@ -176,6 +192,7 @@ class Post < Vue
     end
 
     @report = Flow.text(report, @indent)
+    self.change_message()
   end
 
   # determine if the form is ready to be submitted

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message