[#6495] Screenshot admin UI improvements
Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index 7a78ee4..5fb5bbd 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -138,10 +138,12 @@
name = ew.InputField(label='Name')
-class ScreenshotAdmin(ff.AdminForm):
+class ScreenshotAdmin(ff.ForgeForm):
defaults = dict(
- ff.AdminForm.defaults,
- enctype='multipart/form-data')
+ ff.ForgeForm.defaults,
+ enctype='multipart/form-data',
+ submit_text='Upload',
+ )
@property
def fields(self):
diff --git a/Allura/allura/lib/widgets/resources/css/screenshots.css b/Allura/allura/lib/widgets/resources/css/screenshots.css
index 7c28adf..5acbff5 100644
--- a/Allura/allura/lib/widgets/resources/css/screenshots.css
+++ b/Allura/allura/lib/widgets/resources/css/screenshots.css
@@ -17,23 +17,23 @@
under the License.
*/
.sortable {
- float: left;
+ margin: 0 1em;
}
.sortable .screenshot {
- margin: 0 0 10px 10px;
+ margin: 0 0 1em 0;
border: 1px solid #eee;
background: #fff;
- float: left;
+ padding: 1em;
+}
+.sortable .screenshot:hover {
+ border: 1px solid #ccc;
+ cursor: move;
}
.sortable .screenshot .image {
- margin-left: 0;
- float: left;
-}
-.sortable .screenshot .image img {
- display: block;
+ display: inline-block;
+ vertical-align: middle;
}
.sortable .screenshot .controls {
- margin: 50px 15px 0 20px;
- width: 190px;
- float: left;
+ display: inline-block;
+ margin-left: 1em;
}
diff --git a/Allura/allura/lib/widgets/resources/js/screenshots.js b/Allura/allura/lib/widgets/resources/js/screenshots.js
index 214393b..d2a3d33 100644
--- a/Allura/allura/lib/widgets/resources/js/screenshots.js
+++ b/Allura/allura/lib/widgets/resources/js/screenshots.js
@@ -22,7 +22,15 @@
$(this).find('.screenshot').each(function(i) {
params[$(this).data('ss-id')] = i;
});
- $.post('sort_screenshots', params);
+
+ $.post('sort_screenshots', params)
+ .done(function() {
+ flash('New sort order saved.', 'success');
+ })
+ .fail(function() {
+ flash('Sorting failed. Please refresh the page and try again.', 'error');
+ });
+
});
});
diff --git a/Allura/allura/templates/widgets/project_screenshots.html b/Allura/allura/templates/widgets/project_screenshots.html
index 94107c5..4bc1fc7 100644
--- a/Allura/allura/templates/widgets/project_screenshots.html
+++ b/Allura/allura/templates/widgets/project_screenshots.html
@@ -49,4 +49,4 @@
</div>
{% endfor %}
</div>
-<div style="clear:both"> </div>
+{% if screenshots.__len__() %}<hr>{% endif %}