From fb6baffd45899f30f7770a084c52cd23eb0b0d3c Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 21 Jan 2007 19:28:01 +0000 Subject: [PATCH] Haml-ize Scribbish git-svn-id: http://svn.typosphere.org/typo/trunk@1350 820eb932-12ee-0310-9ca8-eeb645f39767 --- themes/scribbish/views/articles/_article.haml | 31 ++++++++++++ .../scribbish/views/articles/_article.rhtml | 37 -------------- themes/scribbish/views/articles/_comment.haml | 14 ++++++ .../scribbish/views/articles/_comment.rhtml | 18 ------- .../views/articles/_comment_form.haml | 47 +++++++++++++++++ .../views/articles/_comment_form.rhtml | 50 ------------------- themes/scribbish/views/articles/_search.haml | 15 ++++++ themes/scribbish/views/articles/_search.rhtml | 16 ------ .../scribbish/views/articles/_trackback.haml | 8 +++ .../scribbish/views/articles/_trackback.rhtml | 9 ---- .../views/articles/comment_preview.haml | 7 +++ .../views/articles/comment_preview.rhtml | 10 ---- themes/scribbish/views/articles/index.haml | 6 +++ themes/scribbish/views/articles/index.rhtml | 5 -- themes/scribbish/views/articles/read.haml | 38 ++++++++++++++ themes/scribbish/views/articles/read.rhtml | 42 ---------------- 16 files changed, 166 insertions(+), 187 deletions(-) create mode 100644 themes/scribbish/views/articles/_article.haml delete mode 100644 themes/scribbish/views/articles/_article.rhtml create mode 100644 themes/scribbish/views/articles/_comment.haml delete mode 100644 themes/scribbish/views/articles/_comment.rhtml create mode 100644 themes/scribbish/views/articles/_comment_form.haml delete mode 100644 themes/scribbish/views/articles/_comment_form.rhtml create mode 100644 themes/scribbish/views/articles/_search.haml delete mode 100644 themes/scribbish/views/articles/_search.rhtml create mode 100644 themes/scribbish/views/articles/_trackback.haml delete mode 100644 themes/scribbish/views/articles/_trackback.rhtml create mode 100644 themes/scribbish/views/articles/comment_preview.haml delete mode 100644 themes/scribbish/views/articles/comment_preview.rhtml create mode 100644 themes/scribbish/views/articles/index.haml delete mode 100644 themes/scribbish/views/articles/index.rhtml create mode 100644 themes/scribbish/views/articles/read.haml delete mode 100644 themes/scribbish/views/articles/read.rhtml diff --git a/themes/scribbish/views/articles/_article.haml b/themes/scribbish/views/articles/_article.haml new file mode 100644 index 0000000000..e3d546e0ca --- /dev/null +++ b/themes/scribbish/views/articles/_article.haml @@ -0,0 +1,31 @@ +%div[article].atomentry + %h2.title + = (controller.action_name.include? 'permalink') ? article.title : link_to_permalink(article,article.title) + = content_tag(:span, article.published_comments.size, :class => 'comment_count') if article.published_comments.size > 0 + + %p.author + = preceed "Posted by " do + %cite= author_link(article) + %abbr.published{:title=>article.published_at.xmlschema}= js_distance_of_time_in_words_to_now article.published_at + + .content + = html article, :body + + - if article.extended? + .extended + - if controller.action_name == 'index' + %p= link_to_permalink article,"Continue reading..." + - else + = html article, :extended + + %ul.meta + = content_tag(:li, category_links(article), :class => 'categories') unless article.categories.empty? + = content_tag(:li, tag_links(article), :class => 'tags') unless article.tags.empty? + %li Meta + = trackbacks_link(article) << ',' if article.allow_pings? + = comments_link(article) << ',' if article.allow_comments? + = succeed "," do + %a{:href=>article.permalink_url, :rel=>"bookmark"} permalink + = succeed "," do + %a{:href=>url_for(:controller=>'xml', :action=>'feed', :type=>'article', :format=>'rss', :id=>article)} rss + %a{:href=>url_for(:controller=>'xml', :action=>'feed', :type=>'article', :format=>'atom', :id=>article)} atom diff --git a/themes/scribbish/views/articles/_article.rhtml b/themes/scribbish/views/articles/_article.rhtml deleted file mode 100644 index 27b68c3ed7..0000000000 --- a/themes/scribbish/views/articles/_article.rhtml +++ /dev/null @@ -1,37 +0,0 @@ -
-

- <%= (controller.action_name.include? 'permalink') ? article.title : link_to_permalink(article,article.title) %> - <%= content_tag(:span, article.published_comments.size, :class => 'comment_count') if article.published_comments.size > 0 %> -

- -

- Posted by <%= author_link(article) %> - <%= js_distance_of_time_in_words_to_now article.published_at %> -

- -
- <%= article.html(:body) %> - - <% if article.extended? -%> -
- <% if controller.action_name == 'index' -%> -

<%= link_to_permalink article,"Continue reading..." %>

- <% else -%> - <%= article.html(:extended) %> - <% end -%> -
- <% end -%> -
- - -
diff --git a/themes/scribbish/views/articles/_comment.haml b/themes/scribbish/views/articles/_comment.haml new file mode 100644 index 0000000000..bc5a03e9db --- /dev/null +++ b/themes/scribbish/views/articles/_comment.haml @@ -0,0 +1,14 @@ +%ol.comments#comments + - if @article.published_comments.any? + - for comment in @article.published_comments + %li[comment] + .author + = content_tag(:div, gravatar_tag(comment.email)) if this_blog.use_gravatar and comment.email + %cite= link_to_unless(comment.url.blank?, h(comment.author), comment.url) + %abbr{:title=>comment.created_at.xmlschema} + = succeed " later:" do + = distance_of_time_in_words comment.article.published_at, comment.created_at + .content + = html comment + - else + %li.dummy_comment{:style=>"display: none"} No comments diff --git a/themes/scribbish/views/articles/_comment.rhtml b/themes/scribbish/views/articles/_comment.rhtml deleted file mode 100644 index 484697dd3f..0000000000 --- a/themes/scribbish/views/articles/_comment.rhtml +++ /dev/null @@ -1,18 +0,0 @@ -
    - <% if @article.published_comments.any? -%> - <% for comment in @article.published_comments -%> -
  1. -
    - <%= content_tag(:div, gravatar_tag(comment.email)) if this_blog.use_gravatar and comment.email %> - <%= (comment.url.blank?) ? h(comment.author) : link_to(h(comment.author), comment.url) %> - <%= distance_of_time_in_words comment.article.published_at, comment.created_at %> later: -
    -
    - <%= comment.html %> -
    -
  2. - <% end -%> - <% else -%> - - <% end -%> -
diff --git a/themes/scribbish/views/articles/_comment_form.haml b/themes/scribbish/views/articles/_comment_form.haml new file mode 100644 index 0000000000..f541b186e9 --- /dev/null +++ b/themes/scribbish/views/articles/_comment_form.haml @@ -0,0 +1,47 @@ += form_remote_tag :url => {:action => 'comment', :id => @article}, | + :update => 'comments_div', | + :loading => 'commentLoading()', | + :complete => 'commentComplete()', | + :html => {:id => 'commentform', :class => 'comments' } | + +#preview{:style=>"display: none"} + +%fieldset + %legend Comments + %p + %label Name: + %br/ + = text_field "comment", "author" + %small + = surround "(", ")" do + = link_to_function("leave url/email »", "Effect.toggle('extra_fields', 'blind', {duration: .3})") + + #extra_fields{:style=>"display: none"} + %p + %label + = precede "Email: " do + = content_tag('small', "(#{link_to('gravatar', 'http://gravatar.com')} enabled)") if this_blog.use_gravatar + %br/ + = text_field "comment", "email" + %p + %label Url: + %br/ + = text_field "comment", "url" + + %p + %label + Comments: + = content_tag('small', link_to("Textile enabled", "http://hobix.com/textile/")) if this_blog.comment_text_filter.include? 'textile' + = content_tag('small', link_to("Markdown enabled", "http://daringfireball.net/projects/markdown/")) if this_blog.comment_text_filter.include? 'markdown' + %br/ + = text_area 'comment', 'body' + + %p + = submit_to_remote('preview', 'Preview!', | + :update => 'preview', | + :complete => "Element.show('preview')", | + :url => { :action => 'comment_preview' }) | + = submit_tag 'Submit', :onclick => "$('commentform').onsubmit();this.disabled=true;Element.hide('preview');return false;" + = image_tag '/images/theme/spinner.gif', :id => 'spinner', :style => 'display:none' + += end_form_tag diff --git a/themes/scribbish/views/articles/_comment_form.rhtml b/themes/scribbish/views/articles/_comment_form.rhtml deleted file mode 100644 index c61e05602d..0000000000 --- a/themes/scribbish/views/articles/_comment_form.rhtml +++ /dev/null @@ -1,50 +0,0 @@ -<%= form_remote_tag :url => {:action => 'comment', :id => @article}, - :update => 'comments_div', - :loading => 'commentLoading()', - :complete => 'commentComplete()', - :html => {:id => 'commentform', :class => 'comments' } %> - - - -
- Comments -

- -

- - - -

- -

- -

- <%= submit_to_remote('preview', 'Preview!', - :update => 'preview', - :complete => "Element.show('preview')", - :url => { :action => 'comment_preview' }) %> - <%= submit_tag 'Submit', :onclick => "$('commentform').onsubmit();this.disabled=true;Element.hide('preview');return false;" %> - <%= image_tag '/images/theme/spinner.gif', :id => 'spinner', :style => 'display:none' %> -

-
-<%= end_form_tag %> diff --git a/themes/scribbish/views/articles/_search.haml b/themes/scribbish/views/articles/_search.haml new file mode 100644 index 0000000000..92a09bc7cc --- /dev/null +++ b/themes/scribbish/views/articles/_search.haml @@ -0,0 +1,15 @@ +.search#search + - form_tag({ :controller => 'articles', :action => 'search' }, | + { :method => 'get', :id => 'sform' }) do | + %p + %input#q{:type=>"text", :name=>"q", :value=>""}/ + + .loading#loading{:style=>"display: none;"} Searching... + .results#results + = observe_field 'q', | + :url => { :controller => 'live', :action => 'search' }, | + :frequency => 1, | + :loading => "Element.show('loading')", | + :complete => "Element.hide('loading')", | + :update => 'results', | + :with => "'q=' + escape($F('q'))" | diff --git a/themes/scribbish/views/articles/_search.rhtml b/themes/scribbish/views/articles/_search.rhtml deleted file mode 100644 index f9e2d3c457..0000000000 --- a/themes/scribbish/views/articles/_search.rhtml +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/themes/scribbish/views/articles/_trackback.haml b/themes/scribbish/views/articles/_trackback.haml new file mode 100644 index 0000000000..634de90201 --- /dev/null +++ b/themes/scribbish/views/articles/_trackback.haml @@ -0,0 +1,8 @@ +%li[trackback] + .author + %a{:href=>trackback.url, :rel=>"nofollow"}= trackback.title + %abbr + = precede "From " do + %cite= trackback.blog_name + .content + = trackback.excerpt diff --git a/themes/scribbish/views/articles/_trackback.rhtml b/themes/scribbish/views/articles/_trackback.rhtml deleted file mode 100644 index ad356d3c9f..0000000000 --- a/themes/scribbish/views/articles/_trackback.rhtml +++ /dev/null @@ -1,9 +0,0 @@ -
  • -
    - <%= trackback.title %> - From <%= trackback.blog_name %> -
    -
    - <%= trackback.excerpt %> -
    -
  • \ No newline at end of file diff --git a/themes/scribbish/views/articles/comment_preview.haml b/themes/scribbish/views/articles/comment_preview.haml new file mode 100644 index 0000000000..5c9a443542 --- /dev/null +++ b/themes/scribbish/views/articles/comment_preview.haml @@ -0,0 +1,7 @@ +.comment.preview + .author + = content_tag(:div, gravatar_tag(@comment.email)) if this_blog.use_gravatar and @comment.email + %cite= link_to_unless(@comment.url.blank?, h(@comment.author), @comment.url) + %abbr is about to say + .content + = html @comment diff --git a/themes/scribbish/views/articles/comment_preview.rhtml b/themes/scribbish/views/articles/comment_preview.rhtml deleted file mode 100644 index 7dacd5ab56..0000000000 --- a/themes/scribbish/views/articles/comment_preview.rhtml +++ /dev/null @@ -1,10 +0,0 @@ -
    -
    - <%= content_tag(:div, gravatar_tag(@comment.email)) if this_blog.use_gravatar and @comment.email %> - <%= (@comment.url.blank?) ? h(@comment.author) : link_to(h(@comment.author), @comment.url) %> - is about to say -
    -
    - <%= @comment.html %> -
    -
    diff --git a/themes/scribbish/views/articles/index.haml b/themes/scribbish/views/articles/index.haml new file mode 100644 index 0000000000..22e27aea36 --- /dev/null +++ b/themes/scribbish/views/articles/index.haml @@ -0,0 +1,6 @@ += render :partial => 'article', :collection => @articles + +- unless @pages.item_count <= this_blog.limit_article_display + %p.pagination + = precede "Older posts: " do + = pagination_links @pages, :params => { :action => @controller.action_name } diff --git a/themes/scribbish/views/articles/index.rhtml b/themes/scribbish/views/articles/index.rhtml deleted file mode 100644 index 5a350bd7ee..0000000000 --- a/themes/scribbish/views/articles/index.rhtml +++ /dev/null @@ -1,5 +0,0 @@ -<%= render :partial => 'article', :collection => @articles %> - -<% unless @pages.item_count <= this_blog.limit_article_display -%> -

    Older posts: <%= pagination_links @pages, :params => { :action => @controller.action_name } %>

    -<% end -%> \ No newline at end of file diff --git a/themes/scribbish/views/articles/read.haml b/themes/scribbish/views/articles/read.haml new file mode 100644 index 0000000000..2dbff0de23 --- /dev/null +++ b/themes/scribbish/views/articles/read.haml @@ -0,0 +1,38 @@ +/ + %rdf:RDF{ | + :"xmlns:rdf"=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#", | + :"xmlns:trackback"=>"http://madskills.com/public/xml/rss/module/trackback/", | + :"xmlns:dc"=>"http://purl.org/dc/elements/1.1/"} | + %rdf:Description{ | + :"rdf:about"=>"", | + :"trackback:ping"=>@article.trackback_url, | + :"dc:title"=>h @article.title.gsub(/-+/, '-'), | + :"dc:identifier"=>@article.permalink_url, | + :"dc:description"=>h (@article.html.strip_html[0..255]).gsub(/-+/, '-'), | + :"dc:creator"=>h @article.author, | + :"dc:date"=>@article.updated_at.xmlschema}/ | + += render :partial => 'article', :object => @article + +- if @article.allow_pings? + %h5 + %a{:name=>"trackbacks"} Trackbacks + %p + Use the following link to trackback from your own site: + %br/ + = @article.trackback_url + + - unless @article.published_trackbacks.blank? + %ol.trackbacks#trackbacks + = render(:partial => "trackback", :collection => @article.published_trackbacks) + +- if @article.allow_comments? or @article.published_comments.size > 0 + %h5 + %a{:name=>"comments"} Comments + %p + %a{:href=>"#commentform"} Leave a response + + #comments_div + = render :partial => "comment" + += render :partial => 'comment_form' if @article.allow_comments? diff --git a/themes/scribbish/views/articles/read.rhtml b/themes/scribbish/views/articles/read.rhtml deleted file mode 100644 index 2828a14763..0000000000 --- a/themes/scribbish/views/articles/read.rhtml +++ /dev/null @@ -1,42 +0,0 @@ - - -<%= render :partial => 'article', :object => @article %> - -<% if @article.allow_pings? -%> -
    Trackbacks
    -

    - Use the following link to trackback from your own site:
    - <%= @article.trackback_url %> -

    - - <% unless @article.published_trackbacks.blank? -%> -
      - <%= render(:partial => "trackback", :collection => @article.published_trackbacks) %> -
    - <% end -%> -<% end -%> - -<% if @article.allow_comments? or @article.published_comments.size > 0 -%> -
    Comments
    -

    Leave a response

    - -
    - <%= render :partial => "comment" %> -
    -<% end -%> - -<%= render :partial => 'comment_form' if @article.allow_comments? %>