Skip to content

Commit

Permalink
[webui] switch to HTML5, xhtml1.1 is a dead end
Browse files Browse the repository at this point in the history
While at it, I cleaned up the neutral theme. bento overwrites now what it changes,
everything else is theme less. This makes it way more transparent what happens
  • Loading branch information
coolo committed Oct 10, 2012
1 parent d905855 commit 8836d68
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 36 deletions.
2 changes: 0 additions & 2 deletions src/webui/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
restility (0.0.5)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
Expand Down Expand Up @@ -159,7 +158,6 @@ DEPENDENCIES
pry (>= 0.9.8.4)
rails (~> 3.2.8)
rdoc
restility (~> 0.0.4)
sass-rails
simplecov-rcov
sqlite3
Expand Down
6 changes: 4 additions & 2 deletions src/webui/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,17 @@ def put_body_to_tempfile(xmlbody)
def validate_xhtml
return if request.xhr?
return unless (response.status.to_i == 200 && response.content_type =~ /text\/html/i)
response.headers['Content-Type'] = 'application/xhtml+xml; charset=utf-8'
return if Rails.env.production? or Rails.env.stage?

errors = []
xmlbody = String.new response.body
xmlbody.gsub!(/[\n\r]/, "\n")
xmlbody.gsub!(/&[^;]*sp;/, '')
# rails kind of invented their own html ;(

# now to something fancy - patch HTML5 to look like xhtml 1.1
xmlbody.gsub!(%r{ data-\S+=\"[^\"]*\"}, ' ')
xmlbody.gsub!('<!DOCTYPE html>', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
xmlbody.gsub!('<html>', '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">')

begin
document = Nokogiri::XML::Document.parse(xmlbody, nil, nil, Nokogiri::XML::ParseOptions::STRICT)
Expand Down
3 changes: 0 additions & 3 deletions src/webui/app/controllers/package_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,8 @@ def each
begin
chunk = @frontend.get_log_chunk(@project, @package, @repository, @arch, @offset, @offset + @maxsize )
rescue ActiveXML::Transport::Error
puts "error!"
return
end
puts "chunk #{chunk.length}"
if chunk.length == 0
return
end
Expand Down Expand Up @@ -923,7 +921,6 @@ def live_build_log
end
end
@initiallog.encode!('UTF-8', invalid: :replace, xml: :text, undef: :replace, cr_newline: true)
puts @initiallog
end


Expand Down
2 changes: 1 addition & 1 deletion src/webui/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def sprite_tag(icon, opts = {})
else
opts[:class] = "icons-#{icon} inlineblock"
end
tag("span", opts)
content_tag(:span, '', opts)
end

end
Expand Down
11 changes: 3 additions & 8 deletions src/webui/app/views/layouts/_sponsor.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<%#
# Don't show sponsor box
%>

<%# render a single add on all pages but the frontpage %>
<% if controller.controller_name != 'main' -%>

<strong class="grey-medium spacer1">Sponsor</strong>
<p>
<%= link_to( sprite_tag( get_random_sponsor_image ), 'http://en.opensuse.org/Sponsors' )%>
</p>
<% end -%>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
Expand Down
11 changes: 3 additions & 8 deletions src/webui/app/views/main/_feeds.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<div class="box box-shadow">
<h2 class="box-header">Feeds</h2>
<ul class="feedbox">
<li><%= sprite_tag('feeds') + link_to('Commits in openSUSE:Factory', 'https://hermes.opensuse.org/feeds/25549.rdf') %></li>
<li><%= sprite_tag('feeds') + link_to('New projects created', 'https://hermes.opensuse.org/feeds/25546.rdf') %></li>
<li><%= sprite_tag('feeds') + link_to('New packages created', 'https://hermes.opensuse.org/feeds/25545.rdf') %></li>
</ul>
</div>
<%#
# Don't show feeds box
%>
File renamed without changes.
9 changes: 9 additions & 0 deletions src/webui/app/views/vendor/bento/layouts/_sponsor.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%# render a single add on all pages but the frontpage %>
<% if controller.controller_name != 'main' -%>

<strong class="grey-medium spacer1">Sponsor</strong>
<p>
<%= link_to( sprite_tag( get_random_sponsor_image ), 'http://en.opensuse.org/Sponsors' )%>
</p>
<% end -%>
8 changes: 8 additions & 0 deletions src/webui/app/views/vendor/bento/main/_feeds.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="box box-shadow">
<h2 class="box-header">Feeds</h2>
<ul class="feedbox">
<li><%= sprite_tag('feeds') + link_to('Commits in openSUSE:Factory', 'https://hermes.opensuse.org/feeds/25549.rdf') %></li>
<li><%= sprite_tag('feeds') + link_to('New projects created', 'https://hermes.opensuse.org/feeds/25546.rdf') %></li>
<li><%= sprite_tag('feeds') + link_to('New packages created', 'https://hermes.opensuse.org/feeds/25545.rdf') %></li>
</ul>
</div>
4 changes: 0 additions & 4 deletions src/webui/app/views/vendor/neutral/layouts/_sponsor.html.erb

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/webui/app/views/vendor/neutral/main/_feeds.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion src/webui/test/functional/spider_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def do_spider( body, uri )
@stacktraces[next_link.uri] = response_body
end
content_type = last_response.headers["Content-Type"].split(';')[0]
if %w{text/xml text/html}.include? content_type
if %w{text/html}.include? content_type
consume_page( response_body, next_link.uri )
end
@visited_urls[next_link.uri] = true
Expand Down

0 comments on commit 8836d68

Please sign in to comment.