Added Edit / Download context menu support for media library

This commit is contained in:
Matt@MBP13-PC
2012-07-31 13:31:31 -01:00
parent 4e1e7fe657
commit 69b3645e9c
5 changed files with 36 additions and 6 deletions

View File

@@ -327,9 +327,13 @@
<Content Include="umbraco\developer\RelationTypes\TreeMenu\ActionDeleteRelationType.js" />
<Content Include="umbraco\developer\RelationTypes\TreeMenu\ActionNewRelationType.js" />
<Content Include="umbraco\images\delete.gif" />
<Content Include="umbraco\images\delete.png" />
<Content Include="umbraco\images\download.png" />
<Content Include="umbraco\images\editor\doc.gif" />
<Content Include="umbraco\images\editor\documentType.gif" />
<Content Include="umbraco\images\information.png" />
<Content Include="umbraco\images\listItemOrange.gif" />
<Content Include="umbraco\images\pencil.png" />
<Content Include="umbraco\plugins\uGoLive\cog.png" />
<Content Include="umbraco\plugins\uGoLive\cross.png" />
<Content Include="umbraco\plugins\uGoLive\Dashboard.ascx" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@@ -61,6 +61,8 @@
.context-menu-separator {
padding-bottom:0;
height: 1px;
margin: 3px 0 3px 30px;
border-bottom: 1px solid #DDD;
}
@@ -104,13 +106,9 @@
.context-menu-item.icon:before {}
*/
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 4px; }
.context-menu-item.icon-edit { background-image: url(../../../umbraco/images/copy.small.png); }
.context-menu-item.icon-cut { background-image: url(images/cut.png); }
.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
.context-menu-item.icon-edit { background-image: url(../../../umbraco/images/pencil.png); }
.context-menu-item.icon-delete { background-image: url(../../../umbraco/images/delete.small.png); }
.context-menu-item.icon-add { background-image: url(images/page_white_add.png); }
.context-menu-item.icon-quit { background-image: url(images/door.png); }
.context-menu-item.icon-download { background-image: url(../../../umbraco/images/download.png); }
/* vertically align inside labels */
.context-menu-input > label > * { vertical-align: top; }

View File

@@ -36,6 +36,26 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
return results.length == 1 ? results[0] : null;
},
_editItem: function (id) {
var self = this;
var item = self._getItemById(id);
if (item === null)
throw Error("No item found with the id: " + id);
window.location.href = "editMedia.aspx?id="+ item.Id();
},
_downloadItem: function (id) {
var self = this;
var item = self._getItemById(id);
if (item === null)
throw Error("No item found with the id: " + id);
window.open(item.FileUrl(), "Download");
},
_deleteItem: function (id)
{
var self = this;
@@ -232,6 +252,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
callback: function (key, options) {
var id = options.$trigger.data("id");
switch (key) {
case "edit":
self._editItem(id);
break;
case "download":
self._downloadItem(id);
break;
case "delete":
self._deleteItem(id);
break;
@@ -239,6 +265,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
},
items: {
"edit": { name: "Edit", icon: "edit" },
"download": { name: "Download", icon: "download" },
"separator1": "-----",
"delete": { name: "Delete", icon: "delete" }
},
animation: { show: "fadeIn", hide: "fadeOut" }