Font-Awesomed Settings

pull/4/head
Mark McDowall 12 years ago
parent 665e4b9fbf
commit b5bdda1c63

@ -1,8 +1,6 @@
.gridImage, .gridAction, .grid-icon .gridImage, .gridAction, .grid-icon
{ {
width: 17px; width: 17px;
/*height: 18px;
margin: 0px;*/
padding: 3px 1px; padding: 3px 1px;
vertical-align: middle; vertical-align: middle;
border: none; border: none;

@ -14,6 +14,12 @@
font-size:16px; font-size:16px;
color: black; color: black;
font-weight:bold; font-weight:bold;
vertical-align: middle;
}
#addProfile > i {
color: green;
font-size: 20px;
} }
#profileHeader #profileHeader
@ -97,11 +103,17 @@
padding-left: 5px; padding-left: 5px;
} }
.deleteProfile .delete-profile {
{
position: absolute; position: absolute;
top: 0px; top: 0px;
right: 0px; right: 0px;
font-size: 16px;
color: #000000;
text-decoration: none;
}
.delete-profile > i[class*="icon-"]:hover {
cursor: pointer !important;
} }
.titleText .titleText

@ -288,6 +288,7 @@ namespace NzbDrone.Web.Controllers
return PartialView("QualityProfileItem", model); return PartialView("QualityProfileItem", model);
} }
[HttpPost]
[JsonErrorFilter] [JsonErrorFilter]
public JsonResult DeleteQualityProfile(int profileId) public JsonResult DeleteQualityProfile(int profileId)
{ {
@ -296,7 +297,7 @@ namespace NzbDrone.Web.Controllers
_qualityProvider.Delete(profileId); _qualityProvider.Delete(profileId);
return new JsonResult(); return Json("ok");
} }
public PartialViewResult AddNewznabProvider() public PartialViewResult AddNewznabProvider()

@ -12,11 +12,22 @@ $(document).on("click", "#addProfile", function (event) {
event.preventDefault(); event.preventDefault();
}); });
function deleteProfile(id) { $(document).on('click', '.delete-profile', function (e) {
sendToServer(id); var container = $(this).closest('.profileSection');
var profileDiv = '#profile_' + id; var id = $(container).attr('data-profile-id');
$(profileDiv).remove();
} $.ajax({
type: "POST",
url: deleteQualityProfileUrl,
data: jQuery.param({ profileId: id }),
success: function (data, textStatus, jqXHR) {
$(container).remove();
removeOption(id);
}
});
e.preventDefault();
});
function renameOption(text, value) { function renameOption(text, value) {
$("#DefaultQualityProfileId option[value='" + value + "']").html(text); $("#DefaultQualityProfileId option[value='" + value + "']").html(text);
@ -35,23 +46,9 @@ function removeOption(value) {
$("#DefaultQualityProfileId option[value='" + value + "']").remove(); $("#DefaultQualityProfileId option[value='" + value + "']").remove();
} }
function sendToServer(id) {
$.ajax({
type: "POST",
url: deleteQualityProfileUrl,
data: jQuery.param({ profileId: id }),
success: function (data, textStatus, jqXHR) {
if (data == "ok") {
$("#profile_" + id).remove();
removeOption(id);
}
}
});
}
function getProfileId(obj) { function getProfileId(obj) {
var parentProfileSection = $(obj).parents('.profileSection'); var parentProfileSection = $(obj).closest('.profileSection');
return parentProfileSection.children('.qualityProfileId').val(); return parentProfileSection.attr('data-profile-id');
} }
function getCleanId(obj) { function getCleanId(obj) {
@ -61,8 +58,10 @@ function getCleanId(obj) {
$(document).on('keyup', '.profileName_textbox', function () { $(document).on('keyup', '.profileName_textbox', function () {
var value = $(this).val(); var value = $(this).val();
$(this).closest('.profileSection').find('.titleText').text(value);
var profileId = getProfileId(this); var profileId = getProfileId(this);
$("#title_" + profileId).text(value);
renameOption(value, profileId); renameOption(value, profileId);
}).keyup(); }).keyup();

@ -18,8 +18,9 @@
<div id="profileContainer"> <div id="profileContainer">
<div id="profileHeader"> <div id="profileHeader">
<a id="addProfile" href="@Url.Action("AddProfile", "Settings")"> <a id="addProfile" href="@Url.Action("AddProfile", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" /> <i class="icon-plus icon-large"></i>
Add New Profile</a> Add New Profile
</a>
</div> </div>
<div id="profiles"> <div id="profiles">
@foreach (var item in (List<QualityProfile>)ViewData["Profiles"]) @foreach (var item in (List<QualityProfile>)ViewData["Profiles"])

@ -7,12 +7,14 @@
{ {
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
<div class="profileSection" id="profile_@(Model.QualityProfileId)"> <div class="profileSection" data-profile-id="@Model.QualityProfileId">
<div class="qualityHeader"> <div class="qualityHeader">
<span class="titleText" id="title_@(Model.QualityProfileId)"> <span class="titleText">
@Model.Name @Model.Name
</span><a href="#" id="@Model.QualityProfileId" class="deleteProfile" onclick=" deleteProfile('@(Model.QualityProfileId)'); return false;"> </span>
<img src="../../Content/Images/close.png" alt="Delete" width="22px" height="22px" /></a> <a href="@Url.Action("DeleteQualityProfile", "Settings", new { profileId = @Model.QualityProfileId })" class="delete-profile">
<i class="icon-remove"></i>
</a>
</div> </div>
<div class="profileOptions"> <div class="profileOptions">
@Html.LabelFor(x => x.Name) @Html.LabelFor(x => x.Name)

Loading…
Cancel
Save