You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/04/03 17:19:02 UTC

[whimsy.git] [1/1] Commit 0bfdd82: editable github user id

Commit 0bfdd82dfb8258c776f20cba2b926ad1084994a2:
    editable github user id


Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>

------------------------------------------------------------
www/roster/views/actions/github.json.rb                      | +++++++++ 
www/roster/views/person/github.js.rb                         | ++++++++ --
------------------------------------------------------------
37 changes: 34 additions, 3 deletions.
------------------------------------------------------------


diff --git a/www/roster/views/actions/github.json.rb b/www/roster/views/actions/github.json.rb
new file mode 100644
index 0000000..559d962
--- /dev/null
+++ b/www/roster/views/actions/github.json.rb
@@ -0,0 +1,18 @@
+#
+# Update GitHub username attribute for a committer
+#
+
+# update LDAP
+_ldap.update do
+  person = ASF::Person.find(@userid)
+
+  # report the previous value in the response
+  _previous githubUsername: person.attrs['githubUsername']
+
+  if @githubuser and not @dryrun
+    person.modify 'githubUsername', @githubuser
+  end
+end
+
+# return updated committer info
+_committer Committer.serialize(@userid, env)
diff --git a/www/roster/views/person/github.js.rb b/www/roster/views/person/github.js.rb
index 038bc6f..c4fe051 100644
--- a/www/roster/views/person/github.js.rb
+++ b/www/roster/views/person/github.js.rb
@@ -6,11 +6,24 @@ class PersonGitHub < React
   def render
     committer = @@person.state.committer
 
-    _tr do
+    _tr data_edit: 'github' do
       _td 'GitHub username'
+
       _td do
-        _a committer.githubUsername, 
-          href: "https://github.com/" + committer.githubUsername
+
+        if @@person.state.edit_github
+
+          _form method: 'post' do
+            _input name: 'githubuser', defaultValue: committer.githubUsername
+            _input type: 'submit', value: 'submit'
+          end
+
+        else
+
+          _a committer.githubUsername, 
+            href: "https://github.com/" + committer.githubUsername
+        end
+
       end
     end
   end