Browse Source

HUE-665 Changed filebrowser option context menu to use bootstrap button dropdown

Enrico Berti 13 years ago
parent
commit
3bd1ad8409

+ 13 - 14
apps/filebrowser/src/filebrowser/templates/chmod.mako

@@ -16,15 +16,14 @@
 <%namespace name="edit" file="editor_components.mako" />
 
 <form action="/filebrowser/chmod?next=${next|u}" method="POST" enctype="multipart/form-data"
-      class="form-stacked form-padding-fix">
+      class="form-inline form-padding-fix">
     <div class="modal-header">
-        <a href="#" class="close">&times;</a>
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>Change Permissions: ${path}</h3>
     </div>
     <div class="change-owner-modal-body clearfix" >
         ${edit.render_field(form["path"], hidden=True)}
-        <table class="zebra-striped"
-               style="background-color: #ffffff;">
+        <table class="table table-striped">
             <thead>
             <tr>
                 <th></th>
@@ -36,21 +35,21 @@
             <tbody>
             <tr>
                 <td>Read</td>
-                <td>${edit.render_field(form["user_read"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["group_read"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["other_read"], tag="checkbox", button_text=" ", notitle=True)}</td>
+                <td>${edit.render_field(form["user_read"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["group_read"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["other_read"], tag="checkbox", button_text=" ", nolabel=True)}</td>
             </tr>
             <tr>
                 <td>Write</td>
-                <td>${edit.render_field(form["user_write"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["group_write"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["other_write"], tag="checkbox", button_text=" ", notitle=True)}</td>
+                <td>${edit.render_field(form["user_write"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["group_write"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["other_write"], tag="checkbox", button_text=" ", nolabel=True)}</td>
             </tr>
             <tr>
                 <td>Execute</td>
-                <td>${edit.render_field(form["user_execute"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["group_execute"], tag="checkbox", button_text=" ", notitle=True)}</td>
-                <td>${edit.render_field(form["other_execute"], tag="checkbox", button_text=" ", notitle=True)}</td>
+                <td>${edit.render_field(form["user_execute"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["group_execute"], tag="checkbox", button_text=" ", nolabel=True)}</td>
+                <td>${edit.render_field(form["other_execute"], tag="checkbox", button_text=" ", nolabel=True)}</td>
             </tr>
             </tbody>
         </table>
@@ -59,4 +58,4 @@
         <input class="btn primary" type="submit" value="Submit"/>
         <a class="btn" onclick="$('#changePermissionModal').modal('hide');">Cancel</a>
     </div>
-</form>
+</form>

+ 8 - 4
apps/filebrowser/src/filebrowser/templates/chown.mako

@@ -54,14 +54,13 @@
       % endif
     % endif
 </%def>
-
 <form action="/filebrowser/chown?next=${next|u}" method="POST" enctype="multipart/form-data" class="form-stacked form-padding-fix">
     <div class="modal-header">
-        <a href="#" class="close">&times;</a>
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>Change Owner / Group: ${path}</h3>
     </div>
-    <div class="change-owner-modal-body clearfix" >
-        <div class="alert-message block-message info">Note: Only the Hadoop superuser, on this FS "${extra_params['superuser']}", may change the owner of a file.</div>
+    <div class="modal-body change-owner-modal-body clearfix" >
+        <div class="alert alert-message block-message info">Note: Only the Hadoop superuser, on this FS "${extra_params['superuser']}", may change the owner of a file.</div>
         <div style="padding-left: 15px; padding-bottom: 10px;">
             ${edit.render_field(form["path"], hidden=True)}
 
@@ -81,9 +80,14 @@
             ${ selection("group", [group for group in form.all_groups if group in extra_params['current_user'].get_groups()], extract_field_data(form["group"])) }
             % endif
         </div>
+
+
     </div>
     <div class="modal-footer" style="padding-top: 10px;">
         <input class="btn primary" type="submit" value="Submit" />
         <a class="btn" onclick="$('#changeOwnerModal').modal('hide');">Cancel</a>
     </div>
 </form>
+
+
+<!--<div class="alert-message info modal-footer">Note: Only the Hadoop superuser, on this FS "${extra_params['superuser']}", may change the owner of a file.</div>-->

+ 21 - 26
apps/filebrowser/src/filebrowser/templates/editor_components.mako

@@ -18,21 +18,22 @@
 %>
 
 <%def name="render_field(
-  field, 
-  render_default=False, 
+  field,
+  render_default=False,
   data_filters=None,
-  hidden=False, 
-  notitle=False, 
-  tag='input', 
-  klass=None, 
-  attrs=None, 
-  value=None, 
-  help=False, 
-  help_attrs=None, 
-  dd_attrs=None, 
-  dt_attrs=None, 
+  hidden=False,
+  notitle=False,
+  tag='input',
+  klass=None,
+  attrs=None,
+  value=None,
+  help=False,
+  help_attrs=None,
+  dd_attrs=None,
+  dt_attrs=None,
   title_klass=None,
-  button_text=False
+  button_text=False,
+  nolabel=False
   )">
 <%
   if value is None:
@@ -55,11 +56,11 @@
 
   if data_filters:
     attrs.data_filters = data_filters
-  
+
   classes = []
   if klass:
     classes.append(klass)
-  if hidden: 
+  if hidden:
     classes.append("jframe-hidden")
   cls = ' '.join(classes)
 
@@ -72,11 +73,9 @@
 %>
 
     % if not hidden:
-    <div class="clearfix">
-
-        ${field.label_tag() | n}
-
-    <div class="input">
+		%if nolabel == False:
+			${field.label_tag() | n}
+		%endif
     % endif
       % if render_default:
         ${unicode(field) | n}
@@ -94,15 +93,11 @@
         % endif
       % endif
       % if help:
-        <p class="jframe-inline" data-filters="HelpTip" ${make_attr_str(help_attrs) | n}>${help}</p>
+        <p data-filters="HelpTip" ${make_attr_str(help_attrs) | n}>${help}</p>
       % endif
 
-    % if not hidden:
-    </div>
-    </div>
-    % endif
     % if len(field.errors):
-      <div class="beeswax_error jframe-error">
+      <div class="beeswax_error">
          ${unicode(field.errors) | n}
       </div>
     % endif

+ 28 - 36
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -101,22 +101,27 @@ from django.utils.encoding import smart_str
 					<%
 					path_digest = urlencode(md5.md5(smart_str(path)).hexdigest())
 					%>
-					<a class="btn small contextEnabler" data-menuid="${path_digest}">Options</a>
-					<ul class="contextMenu" id="menu${path_digest}">
-						% if "dir" == file['type']:
-						<li><a class="contextItem delete" delete-type="rmdir" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
-						<li><a class="contextItem delete" delete-type="rmtree" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete Recursively</a></li>
-						% else:
-						<li><a class="contextItem delete" delete-type="remove" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
-						<li><a class="contextItem" href="${url('filebrowser.views.view', path=urlencode(path))}">View File</a></li>
-						<li><a class="contextItem" href="${url('filebrowser.views.edit', path=urlencode(path))}">Edit File</a></li>
-						<li><a class="contextItem" href="${url('filebrowser.views.download', path=urlencode(path))}" target="_blank">Download File</a></li>
-						% endif
-						<li><a class="contextItem rename" file-to-rename="${path}">Rename</a></li>
-						<li><a class="contextItem" onclick="openChownWindow('${path}','${file['stats']['user']}','${file['stats']['group']}','${current_request_path}')">Change Owner / Group</a></li>
-						<li><a class="contextItem" onclick="openChmodWindow('${path}','${stringformat(file['stats']['mode'], "o")}','${current_request_path}')">Change Permissions</a></li>
-						<li><a class="contextItem" onclick="openMoveModal('${path}','${stringformat(file['stats']['mode'], "o")}', '${current_request_path}')">Move</a></li>
-					</ul>
+					<div class="btn-group">
+				    	<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+							Options
+				    		<span class="caret"></span>
+				    	</a>
+				    	<ul class="dropdown-menu">
+				    		% if "dir" == file['type']:
+							<li><a class="delete" delete-type="rmdir" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
+							<li><a class="delete" delete-type="rmtree" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete Recursively</a></li>
+							% else:
+							<li><a class="delete" delete-type="remove" file-to-delete="${path}" data-backdrop="static" data-keyboard="true">Delete</a></li>
+							<li><a href="${url('filebrowser.views.view', path=urlencode(path))}">View File</a></li>
+							<li><a href="${url('filebrowser.views.edit', path=urlencode(path))}">Edit File</a></li>
+							<li><a href="${url('filebrowser.views.download', path=urlencode(path))}" target="_blank">Download File</a></li>
+							% endif
+							<li><a class="rename" file-to-rename="${path}">Rename</a></li>
+							<li><a  onclick="openChownWindow('${path}','${file['stats']['user']}','${file['stats']['group']}','${current_request_path}')">Change Owner / Group</a></li>
+							<li><a onclick="openChmodWindow('${path}','${stringformat(file['stats']['mode'], "o")}','${current_request_path}')">Change Permissions</a></li>
+							<li><a onclick="openMoveModal('${path}','${stringformat(file['stats']['mode'], "o")}', '${current_request_path}')">Move</a></li>
+				    	</ul>
+				    </div>
 					% endif
 				</td>
 			</tr>
@@ -144,22 +149,17 @@ from django.utils.encoding import smart_str
 
 <!-- rename modal -->
 <div id="renameModal" class="modal hide fade">
-    <form id="renameForm" action="/filebrowser/rename?next=${current_request_path}" method="POST" enctype="multipart/form-data" class="form-stacked form-padding-fix">
+    <form id="renameForm" action="/filebrowser/rename?next=${current_request_path}" method="POST" enctype="multipart/form-data" class="form-inline form-padding-fix">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>Renaming: <span id="renameFileName">file name</span></h3>
     </div>
     <div class="modal-body">
-        <div class="clearfix">
-            <label>New name</label>
-            <div class="input">
-                <input id="newNameInput" name="dest_path" value="" type="text" class="xlarge"/>
-            </div>
-        </div>
+		<label>New name <input id="newNameInput" name="dest_path" value="" type="text" class="input-xlarge"/></label>
     </div>
     <div class="modal-footer">
-        <div id="renameNameRequiredAlert" class="alert-message error hide" style="position: absolute; left: 10;">
-            <p><strong>Sorry, name is required.</strong>
+        <div id="renameNameRequiredAlert" class="hide" style="position: absolute; left: 10;">
+			<span class="label label-important">Sorry, name is required.</span>
         </div>
 
         <input id="renameSrcPath" type="hidden" name="src_path" type="text">
@@ -196,20 +196,14 @@ from django.utils.encoding import smart_str
 
 <!-- create directory modal -->
 <div id="createDirectoryModal" class="modal hide fade">
-    <form id="createDirectoryForm" action="/filebrowser/mkdir?next=${current_request_path}" method="POST" enctype="multipart/form-data" class="form-stacked form-padding-fix">
+    <form id="createDirectoryForm" action="/filebrowser/mkdir?next=${current_request_path}" method="POST" enctype="multipart/form-data" class="form-inline form-padding-fix">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>Create Directory</h3>
     </div>
     <div class="modal-body">
-        <div class="clearfix">
-            <label>Directory Name</label>
-            <div class="input">
-                <input id="newDirectoryNameInput" name="name" value="" type="text" class="xlarge"/>
-                <input type="hidden" name="path" type="text" value="${current_dir_path}"/>
-            </div>
-        </div>
-
+		<label>Directory Name <input id="newDirectoryNameInput" name="name" value="" type="text" class="input-xlarge"/></label>
+		<input type="hidden" name="path" type="text" value="${current_dir_path}"/>
     </div>
     <div class="modal-footer">
          <div id="directoryNameRequiredAlert" class="alert-message error hide" style="position: absolute; left: 10;">
@@ -432,8 +426,6 @@ from django.utils.encoding import smart_str
             $("#directoryNameRequiredAlert").hide();
         });
 
-        $(".contextEnabler").jHueContextMenu();
-
 	});
 
 

+ 7 - 7
apps/filebrowser/src/filebrowser/templates/move.mako

@@ -15,22 +15,22 @@
 ## limitations under the License.
 <%namespace name="edit" file="editor_components.mako" />
 
-<form id="moveForm" action="/filebrowser/move?next=${next|u}" method="POST" enctype="multipart/form-data" class="form-stacked form-padding-fix">
+<form id="moveForm" action="/filebrowser/move?next=${next|u}" method="POST" enctype="multipart/form-data" class="form-inline form-padding-fix">
     <div class="modal-header">
-        <a href="#" class="close">&times;</a>
+        <a href="#" class="close" data-dismiss="modal">&times;</a>
         <h3>Move: ${src_path}</h3>
     </div>
-    <div class="change-owner-modal-body clearfix" >
+    <div class="modal-body">
         <div style="padding-left: 15px;">
         ${edit.render_field(form["src_path"], hidden=True)}
-        ${edit.render_field(form["dest_path"], notitle=True, klass="xlarge")}
+        ${edit.render_field(form["dest_path"], notitle=True, klass="input-xlarge")}
         </div>
     </div>
     <div class="modal-footer">
-		<div id="moveNameRequiredAlert" class="alert-message error hide" style="position: absolute; left: 10;">
-        	<p><strong>Sorry, name is required.</strong>
+		<div id="moveNameRequiredAlert" class="hide" style="position: absolute; left: 10;">
+			<span class="label label-important">Sorry, name is required.</span>
     	</div>
         <input class="btn primary" type="submit" value="Submit"/>
         <a class="btn" onclick="$('#moveModal').modal('hide');">Cancel</a>
     </div>
-</form>
+</form>