spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[ljcom] r11931: LJSUP-11906: Userhead admin tool improve...

Committer: atyurin
LJSUP-11906: Userhead admin tool improvements
U   trunk/htdocs/admin/userheads/manage.bml
A   trunk/htdocs/js/admin/
A   trunk/htdocs/js/admin/userheads/
A   trunk/htdocs/js/admin/userheads/manage.js
Modified: trunk/htdocs/admin/userheads/manage.bml
===================================================================
--- trunk/htdocs/admin/userheads/manage.bml	2012-05-12 09:37:39 UTC (rev 11930)
+++ trunk/htdocs/admin/userheads/manage.bml	2012-05-12 10:53:47 UTC (rev 11931)
@@ -1,3 +1,6 @@
+<?page
+title=>LJ User Heads
+body<=
 <?_code
 
 use strict;
@@ -6,6 +9,8 @@
 use LJ::UserHead;
 use LJ::FileStore;
 
+LJ::need_res( 'js/admin/userheads/manage.js' );
+
 my $ret;
 
 my $remote = LJ::get_remote();
@@ -208,12 +213,12 @@
     $ret .= "</tr>\n";
 }
 $ret .= "<tr><td colspan='5'><input type='submit' name='save' value='Save'></td></tr>\n";
-$ret .= "</form>";
+$ret .= "</table></form>";
 
 $ret .= "<hr>";
 
 $ret .= "<form method='POST'>";
-$ret .= "<b>Set user head:&nbsp;<select name='uh_id'>";
+$ret .= "<b>Set user head:&nbsp;</b><select name='uh_id'>";
 foreach my $uh (@$uhs) {
     $ret .= "<option value=".$uh->get_uh_id.">".$uh->get_uh_id."</option>";
 }
@@ -223,6 +228,9 @@
 $ret .= "</form>";
 
 return $ret;
+#return "KKK";
 
 _code?>
+<=body
+page?>
 

Added: trunk/htdocs/js/admin/userheads/manage.js
===================================================================
--- trunk/htdocs/js/admin/userheads/manage.js	                        (rev 0)
+++ trunk/htdocs/js/admin/userheads/manage.js	2012-05-12 10:53:47 UTC (rev 11931)
@@ -0,0 +1,16 @@
+jQuery(function() {
+	var fields = ['buyer', 'expdate'],
+		condition = "I",
+		selector = fields.map(function(n) { return 'input[name$="' + n + '"]' }).join(',');
+
+	jQuery('[name$="-visibility"]').change(function() {
+		var $this = jQuery(this),
+			toDisable = $this.parent().siblings().children(selector);
+
+		if ($this.val() == condition) {
+			toDisable.removeAttr("disabled");
+		} else {
+			toDisable.attr("disabled", "disabled");
+		}
+	}).change();
+});

Tags: atyurin, bml, js, ljcom, spacevillain
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments