浏览代码

HUE-643 Modal dialog too small for complex object creation

Moved edit permissions to outside modal dialog
Added space before buttons
Removed unused mako templates
Enrico Berti 13 年之前
父节点
当前提交
f9f5487

+ 1 - 0
apps/useradmin/src/useradmin/templates/edit_group.mako

@@ -57,6 +57,7 @@ ${layout.menubar(section='groups')}
 			${render_field(field)}
 		% endfor
         </fieldset>
+		<br/>
 		<div class="form-actions">
 			% if name:
 				<input type="submit" class="btn btn-primary" value="Update group"/>

+ 0 - 27
apps/useradmin/src/useradmin/templates/edit_group_confirmation.mako

@@ -1,27 +0,0 @@
-## Licensed to Cloudera, Inc. under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  Cloudera, Inc. licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##     http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-<%!
-from desktop.views import commonheader_iframe, commonfooter_iframe
-import urllib
-%>
-${commonheader_iframe()}
-
-<script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-		window.parent.location.href = "/useradmin/groups";
-	});
-</script>
-${commonfooter_iframe()}

+ 40 - 25
apps/useradmin/src/useradmin/templates/edit_permissions.mako

@@ -14,33 +14,48 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 <%!
-from desktop.views import commonheader_iframe, commonfooter_iframe
+from desktop.views import commonheader, commonfooter
 import urllib %>
-${commonheader_iframe()}
-	<form id="editForm" action="${urllib.quote(action)}" method="POST">
-		<fieldset>
-	    <%def name="render_field(field)">
-			<div class="clearfix">
-				${field.label_tag() | n}
-				<div class="input">
-					${unicode(field) | n}
+<%namespace name="layout" file="layout.mako" />
+
+${commonheader("Hue Users", "useradmin", "100px")}
+${layout.menubar(section='permissions')}
 
-				% if len(field.errors):
-					${unicode(field.errors) | n}
-				% endif
-				</div>
-			</div>
-		</%def>
 
-		% for field in form:
-			${render_field(field)}
-		% endfor
-	    </fieldset>
+<%def name="render_field(field)">
+  %if not field.is_hidden:
+    <% group_class = len(field.errors) and "error" or "" %>
+    <div class="control-group ${group_class}">
+      <label class="control-label" for="id_${field.html_name}">${field.label}</label>
+      <div class="controls">
+		${unicode(field) | n}
+        % if len(field.errors):
+          <span class="help-inline">${unicode(field.errors) | n}</span>
+        % endif
+      </div>
+    </div>
+  %endif
+</%def>
+
+<div class="container-fluid">
+	<h1>Hue Permissions - Edit app: ${app}</h1>
+	<form id="editForm" action="${urllib.quote(action)}" method="POST" class="form form-horizontal">
+		<fieldset>
+			% for field in form:
+				${render_field(field)}
+			% endfor
+		</fieldset>
+		<br/>
+		<div class="form-actions">
+			<input type="submit" class="btn btn-primary" value="Update permission"/>
+			<a href="/useradmin/permissions" class="btn">Cancel</a>
+		</div>
 	</form>
+</div>
 
-	<script type="text/javascript" charset="utf-8">
-		$(document).ready(function(){
-			$("#id_groups").jHueSelector({width:520});
-		});
-	</script>
-${commonfooter_iframe()}
+<script type="text/javascript" charset="utf-8">
+	$(document).ready(function(){
+		$("#id_groups").jHueSelector({width:520});
+	});
+</script>
+${commonfooter()}

+ 0 - 27
apps/useradmin/src/useradmin/templates/edit_permissions_confirmation.mako

@@ -1,27 +0,0 @@
-## Licensed to Cloudera, Inc. under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  Cloudera, Inc. licenses this file
-## to you under the Apache License, Version 2.0 (the
-## "License"); you may not use this file except in compliance
-## with the License.  You may obtain a copy of the License at
-##
-##     http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-<%!
-from desktop.views import commonheader_iframe, commonfooter_iframe
-import urllib
-%>
-${commonheader_iframe()}
-
-<script type="text/javascript" charset="utf-8">
-	$(document).ready(function(){
-		window.parent.location.href = "/useradmin/permissions";
-	});
-</script>
-${commonfooter_iframe()}

+ 1 - 0
apps/useradmin/src/useradmin/templates/edit_user.mako

@@ -54,6 +54,7 @@ ${layout.menubar(section='users')}
 				${render_field(field)}
 			% endfor
 		</fieldset>
+		<br/>
 		<div class="form-actions">
 			% if username:
 				<input type="submit" class="btn btn-primary" value="Update user"/>

+ 1 - 24
apps/useradmin/src/useradmin/templates/list_permissions.mako

@@ -52,7 +52,7 @@ ${layout.menubar(section='permissions')}
             <td>${', '.join([group.name for group in Group.objects.filter(grouppermission__hue_permission=perm).order_by('name')])}</td>
 			%if user.is_superuser == True:
             <td class="right">
-              <a title="Edit permission" class="btn small editPermissionBtn" data-url="${ url('useradmin.views.edit_permission', app=urllib.quote(perm.app), priv=urllib.quote(perm.action)) }" data-name="${perm.app}" data-row-selector="true">Edit</a>
+              <a title="Edit permission" class="btn small editPermissionBtn" href="${ url('useradmin.views.edit_permission', app=urllib.quote(perm.app), priv=urllib.quote(perm.action)) }" data-name="${perm.app}" data-row-selector="true">Edit</a>
             </td>
 			%endif
           </tr>
@@ -63,19 +63,6 @@ ${layout.menubar(section='permissions')}
 </div>
 
 
-<div id="editPermission" class="modal hide fade">
-	<div class="modal-header">
-		<a href="#" class="close" data-dismiss="modal">&times;</a>
-		<h3>Edit permissions for <span class="applicationName"></span></h3>
-	</div>
-	<div id="editPermissionBody" class="modal-body">
-		<iframe id="editPermissionFrame" frameBorder="0"></iframe>
-	</div>
-	<div class="modal-footer">
-		<button id="editPermissionSaveBtn" class="btn primary">Save</button>
-	</div>
-</div>
-
 	<script type="text/javascript" charset="utf-8">
 		$(document).ready(function(){
 			$(".datatables").dataTable({
@@ -104,16 +91,6 @@ ${layout.menubar(section='permissions')}
 
 		    });
 
-			$(".editPermissionBtn").click(function(){
-				$("#editPermission").find(".applicationName").text($(this).data("name"));
-				$("#editPermissionFrame").css("height","260px").attr("src", $(this).data("url"));
-				$("#editPermission").modal("show");
-			});
-
-			$("#editPermissionSaveBtn").click(function(){
-				$("#editPermissionFrame").contents().find('form').submit();
-			});
-
 			$("a[data-row-selector='true']").jHueRowSelector();
 
 

+ 1 - 2
apps/useradmin/src/useradmin/views.py

@@ -275,8 +275,7 @@ def edit_permission(request, app=None, priv=None):
     if form.is_valid():
       form.save()
       request.flash.put('Permission information updated')
-      return render('edit_permissions_confirmation.mako', request,
-	    dict(form=form, action=request.path, app=app, priv=priv))
+      return render("list_permissions.mako", request, dict(permissions=HuePermission.objects.all()))
 
   else:
     form = PermissionsEditForm(instance=instance)