You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/08/02 17:39:24 UTC
[whimsy] branch master updated: rough in UI for updating auth groups
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new b313c38 rough in UI for updating auth groups
b313c38 is described below
commit b313c386cbc09fb48d5197f5856b31fcd763fef8
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Aug 2 13:39:03 2016 -0400
rough in UI for updating auth groups
---
www/roster/main.rb | 3 +-
www/roster/views/group.html.rb | 2 +-
www/roster/views/group.js.rb | 89 ++++++++++++++++++++++++++++++++++++++++--
3 files changed, 89 insertions(+), 5 deletions(-)
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 628827b..8c0efd1 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -97,8 +97,9 @@ get '/group/:name.json' do |name|
end
get '/group/:name' do |name|
+ @auth = Auth.info(env)
@group = Group.serialize(name)
- pass unless @group
+ pass unless @group and not @group.empty?
_html :group
end
diff --git a/www/roster/views/group.html.rb b/www/roster/views/group.html.rb
index 79146ff..c34ab13 100644
--- a/www/roster/views/group.html.rb
+++ b/www/roster/views/group.html.rb
@@ -17,6 +17,6 @@ _html do
_script src: 'app.js'
_.render '#main' do
- _Group group: @group
+ _Group group: @group, auth: @auth
end
end
diff --git a/www/roster/views/group.js.rb b/www/roster/views/group.js.rb
index 60ead74..85d86cc 100644
--- a/www/roster/views/group.js.rb
+++ b/www/roster/views/group.js.rb
@@ -3,16 +3,34 @@
#
class Group < React
+ def initialize
+ @state = :closed
+ end
+
def render
group = @@group
members = group.members.keys().sort_by {|id| group.members[id]}
+ if group.type == 'LDAP auth group'
+ auth = (members.include? @@auth.id or @@auth.secretary or @@auth.root)
+ else
+ auth = false
+ end
+
# header
_h1 do
_span group.id
_span.note " (#{group.type})"
end
+ # usage information for authenticated users (group members, etc.)
+ if auth
+ _div.alert.alert_success do
+ _span 'Double click on a row to edit.'
+ _span " Double click on \u2795 to add."
+ end
+ end
+
# list of members
_table.table.table_hover do
_thead do
@@ -24,12 +42,77 @@ class Group < React
_tbody do
members.each do |id|
- _tr do
- _td {_a id, href: "committer/#{id}"}
- _td group.members[id]
+ _GroupMember id: id, name: group.members[id], auth: auth
+ end
+
+ if auth
+ _tr onDoubleClick: self.select do
+ _td((@state == :open ? '' : "\u2795"), colspan: 4)
end
end
end
+
+ if @state == :open
+ _div.search_box do
+ _CommitterSearch add: self.add
+ end
+ end
end
end
+
+ # open search box
+ def select()
+ return unless @@auth
+ window.getSelection().removeAllRanges()
+ @state = ( @state == :open ? :closed : :open )
+ end
+
+ # add a person to the displayed list of group members
+ def add(person)
+ end
+end
+
+#
+# Show a member of the Group
+#
+
+class GroupMember < React
+ def initialize
+ @state = :closed
+ end
+
+ def render
+ _tr onDoubleClick: self.select do
+ _td {_a @@id, href: "committer/#{@@id}"}
+ _td @@name
+
+ if @state == :open
+ _td do
+ _button.btn.btn_warning 'Remove from Group',
+ data_action: 'remove group',
+ data_target: '#confirm', data_toggle: 'modal',
+ data_confirmation: "Remove #{@@name} from LDAP?"
+ end
+ else
+ _td ''
+ end
+ end
+ end
+
+ # update props on initial load
+ def componentWillMount()
+ self.componentWillReceiveProps()
+ end
+
+ # automatically close row when id changes
+ def componentWillReceiveProps(newprops)
+ @state = :closed if newprops.id != @@id
+ end
+
+ # toggle display of buttons
+ def select()
+ return unless @@auth
+ window.getSelection().removeAllRanges()
+ @state = ( @state == :open ? :closed : :open )
+ end
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].