Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use new Serve 0.10.2 syntax

  • Loading branch information...
commit 30ee4fc0c3728dc7b11729cd9c91a0b6e153fd45 1 parent 460f70d
@jlong jlong authored
View
2  admin/acme/widgets/edit.haml
@@ -5,7 +5,7 @@
%form{:action =>"/admin/acme/widgets/"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/acme/widgets/new.haml
@@ -5,7 +5,7 @@
%form{:action =>"/admin/acme/widgets/edit/"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/javascripts/edit.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/javascripts/", "data-onsubmit_status"=>"Saving changes…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/javascripts/new.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/javascripts/", "data-onsubmit_status"=>"Creating javascript…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style => "clear: left"}
%input.button{:type=>"submit", :value=>"Create Javascript"}/
View
2  admin/layouts/edit.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/layouts/", "data-onsubmit_status"=>"Saving changes…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/layouts/new.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/layouts/", "data-onsubmit_status"=>"Creating layout…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Create Layout"}/
View
2  admin/login.haml
@@ -22,4 +22,4 @@
%p.buttons
%input.button{:type=>"submit", :value=>"Login"}/
-= render :partial => "version"
+= render "version"
View
2  admin/pages/edit.haml
@@ -6,7 +6,7 @@
%form{:enctype=>"multipart/form-data", :action=>"/admin/pages/", :method=>"post", "data-onsubmit_status"=>"Saving Changes…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:name=>"commit", :type=>"submit", :value=>"Save Changes"}/
View
2  admin/pages/new.haml
@@ -5,7 +5,7 @@
%form{:enctype=>"multipart/form-data", :action=>"/admin/pages/", :method=>"post", "data-onsubmit_status"=>"Creating page…"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:name=>"commit", :type=>"submit", :value=>"Create Page"}/
View
2  admin/password/change.haml
@@ -19,4 +19,4 @@
or
%a{:href=>"/admin/login"} Cancel
-= render :partial => "../version"
+= render "../version"
View
2  admin/password/confirm.haml
@@ -8,4 +8,4 @@
%p
Please allow a couple of minutes for message delivery.
-= render :partial => "../version"
+= render "../version"
View
2  admin/password/oops.haml
@@ -17,4 +17,4 @@
%p
We suggest that you try <a href="/admin/password/reset">resetting your password</a> again.
-= render :partial => "../version"
+= render "../version"
View
2  admin/password/reset.haml
@@ -24,4 +24,4 @@
or
%a{:href=>"/admin/login"} Cancel
-= render :partial => "../version"
+= render "../version"
View
8 admin/preferences/edit.haml
@@ -6,13 +6,13 @@
%form{:method=>"post", :action=>"/admin/settings/", "data-onsubmit_status"=>"Saving changes&#8230;"}
- = render :partial => "../users/avatar"
+ = render "../users/avatar"
- = render :partial => "../users/name_email_username_fields"
+ = render "../users/name_email_username_fields"
- = render :partial => "../users/password_fields"
+ = render "../users/password_fields"
- = render :partial => "../users/language_fields"
+ = render "../users/language_fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/snippets/edit.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/snippets/", "data-onsubmit_status"=>"Saving changes&#8230;"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/snippets/new.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/snippets/", "data-onsubmit_status"=>"Creating snippet&#8230;"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style => "clear: left"}
%input.button{:type=>"submit", :value=>"Create Snippet"}/
View
2  admin/stylesheets/edit.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/stylesheets/", "data-onsubmit_status"=>"Saving changes&#8230;"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style=>"clear: left"}
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/stylesheets/new.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/stylesheets/", "data-onsubmit_status"=>"Creating stylesheet&#8230;"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons{:style => "clear: left"}
%input.button{:type=>"submit", :value=>"Create Stylesheet"}/
View
6 admin/users/_fields.haml
@@ -1,8 +1,8 @@
-= render :partial => "name_email_username_fields"
+= render "name_email_username_fields"
-= render :partial => "password_fields"
+= render "password_fields"
-= render :partial => "language_fields"
+= render "language_fields"
%p
%label.optional{:for=>"user_notes"} Notes
View
4 admin/users/edit.haml
@@ -6,8 +6,8 @@
%form{:method=>"post", :action=>"/admin/users/", "data-onsubmit_status"=>"Saving changes&#8230;"}
- = render :partial => "avatar"
- = render :partial => "fields"
+ = render "avatar"
+ = render "fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Save Changes"}/
View
2  admin/users/new.haml
@@ -6,7 +6,7 @@
%form{:method=>"post", :action=>"/admin/users/", "data-onsubmit_status"=>"Creating user&#8230;"}
- = render :partial => "fields"
+ = render "fields"
%p.buttons
%input.button{:type=>"submit", :value=>"Create User"}/
View
185 view_helpers.rb
@@ -99,41 +99,6 @@ def gravatar_url(email, options={})
end
include GravatarHelper
- module EscapeHelper
- HTML_ESCAPE = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;' }
- JSON_ESCAPE = { '&' => '\u0026', '>' => '\u003E', '<' => '\u003C' }
-
- # A utility method for escaping HTML tag characters.
- # This method is also aliased as <tt>h</tt>.
- #
- # In your ERb templates, use this method to escape any unsafe content. For example:
- # <%=h @person.name %>
- #
- # ==== Example:
- # puts html_escape("is a > 0 & a < 10?")
- # # => is a &gt; 0 &amp; a &lt; 10?
- def html_escape(s)
- s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
- end
- alias h html_escape
-
- # A utility method for escaping HTML entities in JSON strings.
- # This method is also aliased as <tt>j</tt>.
- #
- # In your ERb templates, use this method to escape any HTML entities:
- # <%=j @person.to_json %>
- #
- # ==== Example:
- # puts json_escape("is a > 0 & a < 10?")
- # # => is a \u003E 0 \u0026 a \u003C 10?
- def json_escape(s)
- s.to_s.gsub(/[&"><]/) { |special| JSON_ESCAPE[special] }
- end
-
- alias j json_escape
- end
- include EscapeHelper
-
module FixtureHelper
@@fixture_count = 0
@@ -165,155 +130,5 @@ def fixture(hash={}, extensions=Module.new)
end
include FixtureHelper
- module FlashHelper
- def flash
- @flash ||= {}
- end
- end
- include FlashHelper
-
- module ParamsHelper
-
- # Key based access to query parameters. Keys can be strings or symbols.
- def params
- @params ||= begin
- q = request.query.dup
- q.each { |(k,v)| q[k.to_s.intern] = v }
- q
- end
- end
-
- # Extract the value for a bool param. Handy for rendering templates in
- # different states.
- def boolean_param(key, default = false)
- key = key.to_s.intern
- value = params[key]
- return default if value.nil?
- case value.strip.downcase
- when 'true'
- true
- when 'false'
- false
- else
- raise 'Invalid value'
- end
- end
-
- end
- include ParamsHelper
-
- module TagHelper
- def content_tag(name, content, html_options={})
- %{<#{name}#{html_attributes(html_options)}>#{content}</#{name}>}
- end
-
- def tag(name, html_options={})
- %{<#{name}#{html_attributes(html_options)} />}
- end
-
- def image_tag(src, html_options = {})
- tag(:img, html_options.merge({:src=>src}))
- end
-
- def image(name, options = {})
- image_tag(append_image_extension("/images/admin/#{name}"), options)
- end
-
- def javascript_tag(content = nil, html_options = {})
- content_tag(:script, javascript_cdata_section(content), html_options.merge(:type => "text/javascript"))
- end
-
- def link_to(name, href, html_options = {})
- html_options = html_options.stringify_keys
- confirm = html_options.delete("confirm")
- onclick = "if (!confirm('#{html_escape(confirm)}')) return false;" if confirm
- content_tag(:a, name, html_options.merge(:href => href, :onclick=>onclick))
- end
-
- def link_to_function(name, *args, &block)
- html_options = {}
- html_options = args.pop if args.last.is_a? Hash
- function = args[0] || ''
- onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
- href = html_options[:href] || '#'
- content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
- end
-
- def mail_to(email_address, name = nil, html_options = {})
- html_options = html_options.stringify_keys
- encode = html_options.delete("encode").to_s
- cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
-
- string = ''
- extras = ''
- extras << "cc=#{CGI.escape(cc).gsub("+", "%20")}&" unless cc.nil?
- extras << "bcc=#{CGI.escape(bcc).gsub("+", "%20")}&" unless bcc.nil?
- extras << "body=#{CGI.escape(body).gsub("+", "%20")}&" unless body.nil?
- extras << "subject=#{CGI.escape(subject).gsub("+", "%20")}&" unless subject.nil?
- extras = "?" << extras.gsub!(/&?$/,"") unless extras.empty?
-
- email_address = email_address.to_s
-
- email_address_obfuscated = email_address.dup
- email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.has_key?("replace_at")
- email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.has_key?("replace_dot")
-
- if encode == "javascript"
- "document.write('#{content_tag("a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');".each_byte do |c|
- string << sprintf("%%%x", c)
- end
- "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>"
- elsif encode == "hex"
- email_address_encoded = ''
- email_address_obfuscated.each_byte do |c|
- email_address_encoded << sprintf("&#%d;", c)
- end
-
- protocol = 'mailto:'
- protocol.each_byte { |c| string << sprintf("&#%d;", c) }
-
- email_address.each_byte do |c|
- char = c.chr
- string << (char =~ /\w/ ? sprintf("%%%x", c) : char)
- end
- content_tag "a", name || email_address_encoded, html_options.merge({ "href" => "#{string}#{extras}" })
- else
- content_tag "a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" })
- end
- end
-
- private
-
- def cdata_section(content)
- "<![CDATA[#{content}]]>"
- end
-
- def javascript_cdata_section(content) #:nodoc:
- "\n//#{cdata_section("\n#{content}\n//")}\n"
- end
-
- def html_attributes(options)
- unless options.blank?
- attrs = []
- options.each_pair do |key, value|
- if value == true
- attrs << %(#{key}="#{key}") if value
- else
- attrs << %(#{key}="#{value}") unless value.nil?
- end
- end
- " #{attrs.sort * ' '}" unless attrs.empty?
- end
- end
-
- def append_image_extension(name)
- unless name =~ /\.(.*?)$/
- name + '.png'
- else
- name
- end
- end
- end
- include TagHelper
end
Please sign in to comment.
Something went wrong with that request. Please try again.