Changeset 96 for trunk/trax/vendor/trax/action_view
- Timestamp:
- 12/14/05 01:42:40 (6 years ago)
- Location:
- trunk/trax/vendor/trax/action_view
- Files:
-
- 3 modified
-
helpers.php (modified) (3 diffs)
-
helpers/form_helper.php (modified) (1 diff)
-
helpers/url_helper.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/action_view/helpers.php
r82 r96 1 1 <? 2 2 3 # $Id$ 3 4 # … … 43 44 44 45 # Examples: 45 # * <tt>tag("br") => <br /></tt>46 # * <tt>tag("input", { "type" => "text"}) => <input type="text" /></tt>46 # tag("br") => <br /> 47 # tag("input", array("type" => "text")) => <input type="text" /> 47 48 function tag($name, $options = array(), $open = false) { 48 49 $html = "<$name "; … … 53 54 54 55 # Examples: 55 # * <tt>content_tag("p", "Hello world!") => <p>Hello world!</p></tt>56 # * <tt>content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") => </tt>57 # <tt><div class="strong"><p>Hello world!</p></div></tt>56 # content_tag("p", "Hello world!") => <p>Hello world!</p> 57 # content_tag("div", content_tag("p", "Hello world!"), array("class" => "strong")) => 58 # <div class="strong"><p>Hello world!</p></div> 58 59 function content_tag($name, $content, $options = array()) { 59 60 $html .= "<$name "; -
trunk/trax/vendor/trax/action_view/helpers/form_helper.php
r82 r96 1 1 <? 2 3 # $Id$ 4 # 5 # Copyright (c) 2005 John Peterson 6 # 7 # Permission is hereby granted, free of charge, to any person obtaining 8 # a copy of this software and associated documentation files (the 9 # "Software"), to deal in the Software without restriction, including 10 # without limitation the rights to use, copy, modify, merge, publish, 11 # distribute, sublicense, and/or sell copies of the Software, and to 12 # permit persons to whom the Software is furnished to do so, subject to 13 # the following conditions: 14 # 15 # The above copyright notice and this permission notice shall be 16 # included in all copies or substantial portions of the Software. 17 # 18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2 25 3 26 class FormHelper extends Helpers { -
trunk/trax/vendor/trax/action_view/helpers/url_helper.php
r82 r96 1 1 <? 2 3 # $Id$ 4 # 5 # Copyright (c) 2005 John Peterson 6 # 7 # Permission is hereby granted, free of charge, to any person obtaining 8 # a copy of this software and associated documentation files (the 9 # "Software"), to deal in the Software without restriction, including 10 # without limitation the rights to use, copy, modify, merge, publish, 11 # distribute, sublicense, and/or sell copies of the Software, and to 12 # permit persons to whom the Software is furnished to do so, subject to 13 # the following conditions: 14 # 15 # The above copyright notice and this permission notice shall be 16 # included in all copies or substantial portions of the Software. 17 # 18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2 25 3 26 class UrlHelper extends Helpers { 4 27 5 # Creates a link tag of the given +name+ using an URL created by the set of +options+. See the valid options in6 # link:classes/ActionController/Base.html#M000021.It's also possible to pass a string instead of an options hash to7 # get a link tag that just points without consideration. If n il is passed as a name, the link itself will become the name.8 # The html_options have a special feature for creating javascript confirm alerts where if you pass :confirm=> 'Are you sure?',28 # Creates a link tag of the given +name+ using an URL created by the set of +options+. 29 # It's also possible to pass a string instead of an options hash to 30 # get a link tag that just points without consideration. If null is passed as a name, the link itself will become the name. 31 # The $html_options have a special feature for creating javascript confirm alerts where if you pass ":confirm" => 'Are you sure?', 9 32 # the link will be guarded with a JS popup asking that question. If the user accepts, the link is processed, otherwise not. 10 33 # 11 34 # Example: 12 # link_to "Delete this page", { :action => "destroy", :id => @page.id }, :confirm => "Are you sure?"35 # link_to("Delete this page", array(":action" => "delete", ":id" => $page->id), array(":confirm" => "Are you sure?")) 13 36 function link_to($name, $options = array(), $html_options = array()) { 14 37 $html_options = $this->convert_confirm_option_to_javascript($html_options); … … 40 63 } 41 64 42 # Returns the URL for the set of +options+ provided. This takes the same options 43 # as url_for. For a list, see the url_for documentation in link:classes/ActionController/Base.html#M000079. 65 # Returns the URL for the set of +options+ provided. 44 66 function url_for($options = array()) { 45 67 $url = array();
