From 1f4d8eac24a0feb18331fb18c67227d2175c8cd1 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas <riyad@informatik.uni-bremen.de> Date: Mon, 15 Oct 2012 20:51:03 +0200 Subject: [PATCH] Extract tree/readme partial --- app/views/tree/_readme.html.haml | 10 ++++++++++ app/views/tree/_tree.html.haml | 15 +++------------ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 app/views/tree/_readme.html.haml diff --git a/app/views/tree/_readme.html.haml b/app/views/tree/_readme.html.haml new file mode 100644 index 00000000000..4e5f4b403c5 --- /dev/null +++ b/app/views/tree/_readme.html.haml @@ -0,0 +1,10 @@ +.file_holder#README + .file_title + %i.icon-file + = readme.name + .file_content.wiki + - if gitlab_markdown?(readme.name) + = preserve do + = markdown(readme.data) + - else + = raw GitHub::Markup.render(readme.name, readme.data) \ No newline at end of file diff --git a/app/views/tree/_tree.html.haml b/app/views/tree/_tree.html.haml index 57d04071205..08a83b9b272 100644 --- a/app/views/tree/_tree.html.haml +++ b/app/views/tree/_tree.html.haml @@ -12,7 +12,7 @@ %div#tree-content-holder.tree-content-holder - if tree.is_blob? - = render partial: "tree/blob", object: tree + = render "tree/blob", blob: tree - else %table#tree-slider{class: "table_#{@hex_path} tree-table" } %thead @@ -32,17 +32,8 @@ = render_tree(tree.contents) - - if content = tree.contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i } - .file_holder#README - .file_title - %i.icon-file - = content.name - .file_content.wiki - - if gitlab_markdown?(content.name) - = preserve do - = markdown(content.data) - - else - = raw GitHub::Markup.render(content.name, content.data) + - if readme = tree.contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i } + = render "tree/readme", readme: readme - unless tree.is_blob? :javascript -- GitLab