Skip to content

Commit 82c90ed

Browse files
committed
Widget title textbox moved to popup header
1 parent 271ea42 commit 82c90ed

9 files changed

Lines changed: 69 additions & 37 deletions

File tree

BlogEngine/BlogEngine.NET/Custom/Widgets/CommentList/edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</style>
3333
</head>
3434
<body>
35-
<form method="post" onsubmit="window.parent.updateTitle()">
35+
<form method="post">
3636
<div class="form-group">
3737
<label>@Resources.labels.numberOfComments</label>
3838
<input type="text" class="form-control" id="txtNumberOfComments" name="txtNumberOfComments" value="@NumberOfComments" />

BlogEngine/BlogEngine.NET/Custom/Widgets/LinkList/edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
</style>
8383
</head>
8484
<body>
85-
<form id="frmTitle" method="post" onsubmit="window.parent.updateTitle()">
85+
<form method="post">
8686
<div class="form-group">
8787
<label>@Resources.labels.numberOfDisplayedItems</label>
8888
<input type="text" class="form-control" id="txtNumberOfLinks" name="txtNumberOfLinks" value="@NumberOfLinks" />

BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</script>
2929
</head>
3030
<body>
31-
<form id="frmNewsletter" name="frmNewsletter" method="post" onsubmit="window.parent.updateTitle()">
31+
<form id="frmNewsletter" name="frmNewsletter" method="post">
3232
<div class="form-group">
3333
<h3>Subscriptions</h3>
3434
@foreach (var email in Newsletter.LoadEmails())

BlogEngine/BlogEngine.NET/Custom/Widgets/PostList/edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
body { background-color: #fff; }
6969
.field-validation-error { background-color: #d9534f; border-color: #d9534f; color: #fff; padding: 5px 15px; display: block; }
7070
</style>
71-
<form method="post" onsubmit="window.parent.updateTitle()">
71+
<form method="post">
7272
<div class="form-group">
7373
<label for="txtNumberOfPosts">@Resources.labels.numberOfPosts</label>
7474
@Html.TextBox("txtNumberOfPosts", numberOfPosts, new { @class = "form-control" })

BlogEngine/BlogEngine.NET/Custom/Widgets/TagCloud/edit.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
settings["minimumposts"] = Request.Form["ddMinPosts"];
1212
settings["tagcloudsize"] = Request.Form["ddCloudSize"];
1313
Common.SaveSettings(settings, widgetId);
14+
@:<script type="text/javascript">window.parent.toastr.success("Completed");</script>
1415
}
1516
if (settings != null && settings.Count > 0)
1617
{

BlogEngine/BlogEngine.NET/Custom/Widgets/TextBox/edit.cshtml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
<link rel="stylesheet" href="~/Content/bootstrap.min.css">
1919
<link rel="stylesheet" href="~/admin/themes/standard/css/styles.css">
2020
<style>
21-
body {
22-
background-color: #fff;
23-
}
21+
body { background-color: #fff; }
2422
</style>
2523
<script src="~/admin/editors/tinymce/tinymce.min.js"></script>
2624
<script>
@@ -35,7 +33,7 @@
3533
autosave_ask_before_unload: false,
3634
max_height: 500,
3735
min_height: 100,
38-
height: 100,
36+
height: 195,
3937
menubar: false,
4038
relative_urls: false,
4139
browser_spellcheck: true,
@@ -44,8 +42,8 @@
4442
});
4543
</script>
4644
<form method="post">
47-
<textarea style="opacity:0; height:180px; width:100%;" id="txtContent" name="txtContent" class="post">@txt</textarea>
48-
<div>
45+
<textarea style="opacity:0; height:300px; width:100%;" id="txtContent" name="txtContent" class="post">@txt</textarea>
46+
<div style="margin-top: 15px">
4947
<button type="submit" onclick="window.parent.updateTitle()" class="btn btn-success btn-sm pull-left">
5048
Save
5149
</button>
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<link rel="stylesheet" href="~/Content/bootstrap.min.css">
5-
<link rel="stylesheet" href="~/admin/themes/standard/css/styles.css">
6-
<style>body { background-color: #fff; }</style>
4+
<title>Widget editor</title>
75
</head>
86
<body>
9-
<form method="post" onsubmit="window.parent.updateTitle()">
10-
<div>
11-
<button type="submit" class="btn btn-success btn-sm pull-left">
12-
@Resources.labels.save
13-
</button>
14-
</div>
15-
</form>
167
</body>
178
</html>

BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$scope.editSrc = {};
55
$scope.editId = {};
66
$scope.editTitle = {};
7+
$scope.editZone = {};
78

89
$scope.load = function () {
910
spinOn();
@@ -12,6 +13,7 @@
1213
list1: [], list2: [], list3: []
1314
};
1415
$scope.vm = {};
16+
$("#txtWidgetTitle").removeClass("red-border");
1517

1618
dataService.getItems('/api/widgets', { })
1719
.success(function (data) {
@@ -32,23 +34,27 @@
3234
});
3335
}
3436

35-
$scope.loadEditForm = function (id, name, title) {
37+
$scope.loadEditForm = function (id, name, title, zone) {
3638
var sharedSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/common.cshtml";
3739
var customSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/" + name + "/edit.cshtml";
40+
3841
$scope.editId = id;
3942
$scope.editTitle = title;
43+
$scope.editZone = zone;
44+
45+
$("#txtWidgetTitle").removeClass("red-border");
4046
$("#txtWidgetTitle").val(title);
41-
$("#titleValidation").hide();
4247
$("#settingsFrame").contents().find('.field-validation-error').hide();
48+
4349
$.ajax({
4450
type: 'HEAD',
4551
url: customSrc,
4652
async: false,
4753
success: function () {
48-
$scope.editSrc = customSrc + "?id=" + id;
54+
$scope.editSrc = customSrc + "?id=" + id + "&zone=" + zone;
4955
},
5056
error: function () {
51-
$scope.editSrc = sharedSrc + "?id=" + id;
57+
$scope.editSrc = sharedSrc + "?id=" + id + "&zone=" + zone;
5258
}
5359
});
5460
$("#edit-widget").modal();
@@ -107,7 +113,7 @@
107113
return false;
108114
}
109115
else {
110-
$("#titleValidation").show();
116+
$("#txtWidgetTitle").addClass("red-border");
111117
$("#txtWidgetTitle").focus();
112118
return false;
113119
}
@@ -117,7 +123,6 @@
117123

118124
$(document).ready(function () {
119125
bindCommon();
120-
$("#titleValidation").hide();
121126
});
122127
}]);
123128

BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetView.html

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<div data-ng-controller="CustomWidgetsController">
22
<style>
3+
.red-border { border: 1px solid red !important; }
4+
.modal .modal-body { padding: 10px 40px !important; height: 320px; }
5+
#settingsFrame { height: 300px; }
6+
.header-txt { border: 1px solid #e5e5e5; line-height: 32px; margin-top: 10px 10px 0 0; width: 400px; padding: 0 10px; }
37
.sortable-empty { border: 3px dashed #b4b9be; padding: 15px; }
48
.field-validation-error { background-color: #d9534f; border-color: #d9534f; color: #ffffff; padding: 5px 15px; display: block; }
59
</style>
@@ -15,16 +19,12 @@ <h2 class="page-title pull-left">{{lbl.widgets}}</h2>
1519
<div class="modal-content">
1620
<div class="modal-header">
1721
<button type="button" class="close" ng-click="closeEditForm()">&times;</button>
18-
<h4 class="modal-title">{{editTitle}}</h4>
22+
<div>
23+
<input type="text" class="header-txt" id="txtWidgetTitle" name="txtWidgetTitle" value="xxx" />
24+
<button type="button" class="btn btn-success btn-sm" ng-click="updateTitle()">{{lbl.save}}</button>
25+
</div>
1926
</div>
2027
<div class="modal-body">
21-
<div class="form-group">
22-
<label for="txtWidgetTitle">{{lbl.title}}</label>
23-
<input type="text" value="{{editTitle}}" name="txtWidgetTitle" id="txtWidgetTitle" class="form-control">
24-
<span id="titleValidation" class="field-validation-error">
25-
Field is required
26-
</span>
27-
</div>
2828
<iframe id="settingsFrame" ng-src="{{editSrc}}"></iframe>
2929
</div>
3030
<div class="modal-footer">
@@ -56,7 +56,7 @@ <h3>{{widgetZones.titles[0]}}</h3>
5656
<div class="panel-body">
5757
{{item.Title}}
5858
<div class="btn-group pull-right">
59-
<button ng-click="loadEditForm(item.Id, item.Name, item.Title)" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
59+
<button ng-click="loadEditForm(item.Id, item.Name, item.Title, widgetZones.titles[0])" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
6060
<button type="button" ng-click='deleteItem(item.Id, widgetZones.list1, widgetZones.titles[0])' class="btn btn-danger btn-sm">X</button>
6161
</div>
6262
</div>
@@ -74,7 +74,7 @@ <h3>{{widgetZones.titles[1]}}</h3>
7474
<div class="panel-body">
7575
{{ item.Title }}
7676
<div class="btn-group pull-right">
77-
<button ng-click="loadEditForm(item.Id, item.Name, item.Title)" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
77+
<button ng-click="loadEditForm(item.Id, item.Name, item.Title, widgetZones.titles[1])" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
7878
<button type="button" ng-click='deleteItem(item.Id, widgetZones.list2, widgetZones.titles[1])' class="btn btn-danger btn-sm">X</button>
7979
</div>
8080
</div>
@@ -92,14 +92,51 @@ <h3>{{widgetZones.titles[2]}}</h3>
9292
<div class="panel-body">
9393
{{ item.Title }}
9494
<div class="btn-group pull-right">
95-
<button ng-click="loadEditForm(item.Id, item.Name, item.Title)" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
95+
<button ng-click="loadEditForm(item.Id, item.Name, item.Title, widgetZones.titles[2])" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
9696
<button type="button" ng-click='deleteItem(item.Id, widgetZones.list3, widgetZones.titles[2])' class="btn btn-danger btn-sm">X</button>
9797
</div>
9898
</div>
9999
</div>
100100
</div>
101101
</div>
102102
</div>
103+
<div ng-if="widgetZones.titles && widgetZones.titles.length > 3">
104+
<h3>{{widgetZones.titles[3]}}</h3>
105+
<div droppable='widgetZones.list4' ng-move='moveObject(from, to, fromList, toList)'
106+
ng-create='createObject(object, to, list)' id="list4" class="sortable">
107+
<div ng-if="widgetZones.list4.length < 1" class="sortable-empty">Drag widget here</div>
108+
<div class="ui-state-default" ng-repeat="item in widgetZones.list4 track by item.Id">
109+
<div class="panel panel-primary">
110+
<div class="panel-body">
111+
{{ item.Title }}
112+
<div class="btn-group pull-right">
113+
<button ng-click="loadEditForm(item.Id, item.Name, item.Title, widgetZones.titles[3])" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
114+
<button type="button" ng-click='deleteItem(item.Id, widgetZones.list4, widgetZones.titles[3])' class="btn btn-danger btn-sm">X</button>
115+
</div>
116+
</div>
117+
</div>
118+
</div>
119+
</div>
120+
</div>
121+
<div ng-if="widgetZones.titles && widgetZones.titles.length > 4">
122+
<h3>{{widgetZones.titles[4]}}</h3>
123+
<div droppable='widgetZones.list5' ng-move='moveObject(from, to, fromList, toList)'
124+
ng-create='createObject(object, to, list)' id="list5" class="sortable">
125+
<div ng-if="widgetZones.list5.length < 1" class="sortable-empty">Drag widget here</div>
126+
<div class="ui-state-default" ng-repeat="item in widgetZones.list5 track by item.Id">
127+
<div class="panel panel-primary">
128+
<div class="panel-body">
129+
{{ item.Title }}
130+
<div class="btn-group pull-right">
131+
<button ng-click="loadEditForm(item.Id, item.Name, item.Title, widgetZones.titles[4])" class="btn btn-default btn-sm" type="button">{{lbl.edit}}</button>
132+
<button type="button" ng-click='deleteItem(item.Id, widgetZones.list5, widgetZones.titles[4])' class="btn btn-danger btn-sm">X</button>
133+
</div>
134+
</div>
135+
</div>
136+
</div>
137+
</div>
138+
</div>
139+
103140
</div>
104141
</div>
105142

0 commit comments

Comments
 (0)