Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-06-12 22:41:46 +0400
committerrandx <dmitriy.zaporozhets@gmail.com>2012-06-12 22:41:46 +0400
commit093159a8683c381a9f7aa80073ac94c4ed03e108 (patch)
tree4ed8134173a4d421259d53b19601044f76dd4ace /app
parentb96af79bb8a312e6870ad62637c0e3372eac32b7 (diff)
Styled snippets. Raw button for snippet
Diffstat (limited to 'app')
-rw-r--r--app/controllers/snippets_controller.rb12
-rw-r--r--app/views/snippets/_snippet.html.haml12
-rw-r--r--app/views/snippets/index.html.haml13
-rw-r--r--app/views/snippets/show.html.haml2
4 files changed, 33 insertions, 6 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index bfcfda0fc71..3d56bebe2fe 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -1,7 +1,7 @@
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
- before_filter :snippet, :only => [:show, :edit, :destroy, :update]
+ before_filter :snippet, :only => [:show, :edit, :destroy, :update, :raw]
layout "project"
# Authorize
@@ -67,7 +67,17 @@ class SnippetsController < ApplicationController
redirect_to project_snippets_path(@project)
end
+ def raw
+ send_data(
+ @snippet.content,
+ :type => "text/plain",
+ :disposition => 'inline',
+ :filename => @snippet.file_name
+ )
+ end
+
protected
+
def snippet
@snippet ||= @project.snippets.find(params[:id])
end
diff --git a/app/views/snippets/_snippet.html.haml b/app/views/snippets/_snippet.html.haml
index d6002362a15..0385d753207 100644
--- a/app/views/snippets/_snippet.html.haml
+++ b/app/views/snippets/_snippet.html.haml
@@ -1,6 +1,12 @@
%tr
%td
%a{:href => project_snippet_path(snippet.project, snippet)}
- = truncate(snippet.title, :length => 60)
- %span.right.cgray
- = snippet.file_name
+ %strong= truncate(snippet.title, :length => 60)
+ %td
+ = snippet.file_name
+ %td
+ %span.cgray
+ - if snippet.expires_at
+ = snippet.expires_at.to_date.to_s(:short)
+ - else
+ Never
diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml
index 53d6b57f728..a6b07716ccb 100644
--- a/app/views/snippets/index.html.haml
+++ b/app/views/snippets/index.html.haml
@@ -8,5 +8,14 @@
%br
To add new snippet - click on button.
-- unless @snippets.fresh.empty?
- %table.zebra-striped.borders= render @snippets.fresh
+%table.admin-table
+ %thead
+ %tr
+ %th Title
+ %th File Name
+ %th Expires At
+ = render @snippets.fresh
+ - if @snippets.fresh.empty?
+ %tr
+ %td{:colspan => 3}
+ %h3.nothing_here_message Nothing here.
diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml
index 2720e495011..c934e262488 100644
--- a/app/views/snippets/show.html.haml
+++ b/app/views/snippets/show.html.haml
@@ -13,6 +13,8 @@
.view_file_header
%i.icon-file
%strong= @snippet.file_name
+ %span.options
+ = link_to "raw", raw_project_snippet_path(@project, @snippet), :class => "btn very_small", :target => "_blank"
.view_file_content
%div{:class => current_user.dark_scheme ? "black" : ""}
= raw @snippet.colorize(options: { linenos: 'True'})