[dw-free] Standardize classes for elements created through the form TT plugin
[commit: http://hg.dwscoalition.org/dw-free/rev/7d0d121da482]
http://bugs.dwscoalition.org/show_bug.cgi?id=4096
Default classes for input and label elements created using form.elementname
in .tt files.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4096
Default classes for input and label elements created using form.elementname
in .tt files.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/Template/Plugin/FormHTML.pm
- htdocs/stc/celerity/celerity.css
- htdocs/stc/gradation/gradation.css
- views/entry/form.tt
- views/entry/form.tt.text
- views/entry/module-access.tt
- views/entry/module-age_restriction.tt
- views/entry/module-comments.tt
- views/entry/module-crosspost.tt
- views/entry/module-currents.tt
- views/entry/module-displaydate.tt
- views/entry/module-icons.tt
- views/entry/module-journal.tt
-------------------------------------------------------------------------------- diff -r 15c9ff5272b1 -r 7d0d121da482 cgi-bin/DW/Template/Plugin/FormHTML.pm --- a/cgi-bin/DW/Template/Plugin/FormHTML.pm Mon Dec 05 23:26:21 2011 +0800 +++ b/cgi-bin/DW/Template/Plugin/FormHTML.pm Tue Dec 06 17:10:13 2011 +0800 @@ -92,6 +92,9 @@ $args->{selected} = $selected{$args->{value}}; } + $args->{labelclass} ||= "checkboxlabel"; + $args->{class} ||= "checkbox"; + # makes the form element use the default or an explicit value... my $label_html = $self->_process_value_and_label( $args, use_as_value => "selected", noautofill => 1 ); @@ -132,6 +135,9 @@ $args->{selected} = $selected{$args->{value}}; } + $args->{labelclass} ||= "radiolabel"; + $args->{class} ||= "radio"; + # makes the form element use the default or an explicit value... my $label_html = $self->_process_value_and_label( $args, use_as_value => "selected", noautofill => 1 ); @@ -152,6 +158,7 @@ my ( $self, $args ) = @_; my $items = delete $args->{items}; + $args->{class} ||= "select"; my $ret = ""; $ret .= $self->_process_value_and_label( $args, use_as_value => "selected" ); @@ -168,6 +175,8 @@ sub submit { my ( $self, $args ) = @_; + $args->{class} ||= "submit"; + $self->_process_value_and_label( $args ); return LJ::html_submit( delete $args->{name}, delete $args->{value}, $args ); } @@ -182,6 +191,8 @@ sub textarea { my ( $self, $args ) = @_; + $args->{class} ||= "text"; + my $ret = ""; $ret .= $self->_process_value_and_label( $args ); $ret .= LJ::html_textarea( $args ); @@ -200,6 +211,8 @@ sub textbox { my ( $self, $args ) = @_; + $args->{class} ||= "text"; + my $ret = ""; $ret .= $self->_process_value_and_label( $args ); $ret .= LJ::html_text( $args ); @@ -216,6 +229,7 @@ my ( $self, $args ) = @_; $args->{type} = "password"; + $args->{class} ||= "text"; my $ret = ""; $ret .= $self->_process_value_and_label( $args, noautofill => 1 ); diff -r 15c9ff5272b1 -r 7d0d121da482 htdocs/stc/celerity/celerity.css --- a/htdocs/stc/celerity/celerity.css Mon Dec 05 23:26:21 2011 +0800 +++ b/htdocs/stc/celerity/celerity.css Tue Dec 06 17:10:13 2011 +0800 @@ -370,7 +370,7 @@ background-color: #DDDDAA; } -.select-list input, input.submit { +.select-list input { color: #222; background-color: #DDDDAA; border: 2px solid #999966; diff -r 15c9ff5272b1 -r 7d0d121da482 htdocs/stc/gradation/gradation.css --- a/htdocs/stc/gradation/gradation.css Mon Dec 05 23:26:21 2011 +0800 +++ b/htdocs/stc/gradation/gradation.css Tue Dec 06 17:10:13 2011 +0800 @@ -462,7 +462,7 @@ background-color: #333333; } -.select-list input, input.submit { +.select-list input { background: #444444; color: #fff; border: 2px solid #444; diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/form.tt --- a/views/entry/form.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/form.tt Tue Dec 06 17:10:13 2011 +0800 @@ -270,7 +270,11 @@ <div class="submit action-bar"> <span id="actions"> - <input type="submit" name="action:post" id="submit_entry" value="Post Entry" /> + [%- post_label = '.button.post' | ml; + form.submit( value = post_label + name = "action:post" + id = "submit_entry" ) + -%] </span> <!-- TODO: diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/form.tt.text --- a/views/entry/form.tt.text Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/form.tt.text Tue Dec 06 17:10:13 2011 +0800 @@ -3,6 +3,8 @@ .beta.off=You need to enable beta testing to use the new Create Entries page. <a [[aopts]]>Enable beta testing?</a>. +.button.post=Post Entry + .error.header=Error .event.label=Entry diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-access.tt --- a/views/entry/module-access.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-access.tt Tue Dec 06 17:10:13 2011 +0800 @@ -26,8 +26,6 @@ name = "security" id = "security" - class = "select" - items = securitylist ) -%] </div> @@ -41,8 +39,6 @@ name = "custom_bit" id = "custom_bit_$group.value" - labelclass = "checkboxlabel" - value = group.value ) -%]</li> [% END %] diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-age_restriction.tt --- a/views/entry/module-age_restriction.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-age_restriction.tt Tue Dec 06 17:10:13 2011 +0800 @@ -36,8 +36,6 @@ name = "age_restriction" id = "age_restriction" - class = "select" - items = levelselect ) -%] </p> diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-comments.tt --- a/views/entry/module-comments.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-comments.tt Tue Dec 06 17:10:13 2011 +0800 @@ -21,8 +21,6 @@ name = "comment_settings" id = "comment_settings" - class ="select" - items = [ "" "Journal Default" "nocomments" "Disabled" @@ -35,8 +33,6 @@ name = "opt_screening" id = "opt_screening" - class = "select" - items = [ "" "Journal Default" "N" "Disabled" diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-crosspost.tt --- a/views/entry/module-crosspost.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-crosspost.tt Tue Dec 06 17:10:13 2011 +0800 @@ -29,8 +29,6 @@ name ="crosspost_entry" id = "crosspost_entry" - labelclass = "checkboxlabel" - value = 1 default = crosspost_entry ) -%] @@ -46,8 +44,6 @@ name = "crosspost" id = "crosspost_$account.id" - labelclass = "checkboxlabel" - value = account.id default = account.selected ) -%] diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-currents.tt --- a/views/entry/module-currents.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-currents.tt Tue Dec 06 17:10:13 2011 +0800 @@ -25,8 +25,6 @@ name = "current_mood" id = "current_mood" - class = "select" - items = moodselect ) -%] </p> diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-displaydate.tt --- a/views/entry/module-displaydate.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-displaydate.tt Tue Dec 06 17:10:13 2011 +0800 @@ -72,8 +72,6 @@ name ="update_displaydate" id = "entrytime_auto_update" - labelclass = "radiolabel" - value = "1" ) -%] </p> @@ -95,8 +93,6 @@ name ="entrytime_outoforder" id = "entrytime_outoforder" - labelclass = "radiolabel" - value = "1" ) -%] </p> diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-icons.tt --- a/views/entry/module-icons.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-icons.tt Tue Dec 06 17:10:13 2011 +0800 @@ -44,8 +44,6 @@ name = "icon" id = "iconselect" - class = "select" - items = iconselect ) -%] [% END %] diff -r 15c9ff5272b1 -r 7d0d121da482 views/entry/module-journal.tt --- a/views/entry/module-journal.tt Mon Dec 05 23:26:21 2011 +0800 +++ b/views/entry/module-journal.tt Tue Dec 06 17:10:13 2011 +0800 @@ -25,8 +25,6 @@ name = "post_as" id = "post_as_remote" - labelclass = "radiolabel" - value = "remote" default = ( post_as == "remote" ) ) -%] @@ -35,8 +33,6 @@ name = "post_as" id = "post_as_other" - labelclass = "radiolabel" - value = "other" default = ( post_as == "other" ) ) -%] @@ -70,8 +66,6 @@ name = "usejournal" id = "usejournal" - class = "select" - items = journalselect ) -%] [% ELSE %] --------------------------------------------------------------------------------