Skip to content
Snippets Groups Projects
Commit 093159a8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Styled snippets. Raw button for snippet

parent b96af79b
No related branches found
No related tags found
No related merge requests found
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
Loading
Loading
@@ -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
Loading
Loading
%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
Loading
Loading
@@ -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.
Loading
Loading
@@ -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'})
Loading
Loading
Loading
Loading
@@ -119,7 +119,12 @@ Gitlab::Application.routes.draw do
end
end
resources :snippets
resources :snippets do
member do
get "raw"
end
end
resources :hooks, :only => [:index, :create, :destroy] do
member do
get :test
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment