Commit 9710e42d authored by Andrew8xx8's avatar Andrew8xx8
Browse files

Layuot and templates for personal snippets added

parent a51f6666dc2d
......@@ -3,7 +3,7 @@
%i.icon-file
%strong= @snippet.file_name
%span.options
= link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank"
= link_to "raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank"
.file_content.code
- unless @snippet.content.empty?
%div{class: user_color_scheme_class}
......
......@@ -2,7 +2,7 @@
= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
%hr
.snippet-form-holder
= form_for [@project, @snippet] do |f|
= form_for @snippet, as: :personal_snippet, url: url do |f|
-if @snippet.errors.any?
.alert.alert-error
%ul
......@@ -12,6 +12,9 @@
.clearfix
= f.label :title
.input= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true
.clearfix
= f.label "Private?"
.input= f.check_box :private, {class: ''}
.clearfix
= f.label "Lifetime"
.input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'}
......@@ -28,9 +31,9 @@
.form-actions
= f.submit 'Save', class: "btn-save btn"
= link_to "Cancel", project_snippets_path(@project), class: " btn"
= link_to "Cancel", snippets_path(@project), class: " btn"
- unless @snippet.new_record?
.pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
.pull-right= link_to 'Destroy', snippet_path(@snippet), confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}"
:javascript
......
%tr
%td
- if snippet.private?
%i.icon-lock
- else
%i.icon-globe
= image_tag gravatar_icon(snippet.author_email), class: "avatar s24"
%a{href: project_snippet_path(snippet.project, snippet)}
%strong= truncate(snippet.title, length: 60)
- if snippet.project_id?
%a{href: project_snippet_path(snippet.project, snippet)}
%strong= truncate(snippet.title, length: 60)
- else
%a{href: snippet_path(snippet)}
%strong= truncate(snippet.title, length: 60)
%td
= snippet.file_name
%td
......@@ -11,3 +19,6 @@
= snippet.expires_at.to_date.to_s(:short)
- else
Never
%td
- if snippet.project_id?
= link_to snippet.project.name, project_path(snippet.project)
%table
%thead
%tr
%th Title
%th File Name
%th Expires At
%th Project
= render partial: 'snippet', collection: @snippets
- if @snippets.empty?
%tr
%td{colspan: 4}
%h3.nothing_here_message Nothing here.
= render "snippets/form"
= render "snippets/form", url: snippet_path(@snippet)
%h3.page_title
Snippets
%small share code pastes with others out of git repository
= link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
Add new snippet
- if can? current_user, :write_snippet, @project
= link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do
Add new snippet
%br
%table
%thead
%tr
%th Title
%th File Name
%th Expires At
= render @snippets
- if @snippets.empty?
%tr
%td{colspan: 3}
%h3.nothing_here_message Nothing here.
%hr
.row
.span3
%ul.nav.nav-pills.nav-stacked
= nav_tab :scope, nil do
= link_to "All", snippets_path
= nav_tab :scope, 'projects' do
= link_to "Projects", snippets_path(scope: 'projects')
.span9
= render 'snippets'
= render "snippets/form"
= render "snippets/form", url: snippets_path(@snippet)
%h3.page_title
- if @snippet.private?
%i.icon-lock
- else
%i.icon-globe
= @snippet.title
%small= @snippet.file_name
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user
= link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small pull-right", title: 'Edit Snippet'
- if @snippet.author == current_user
= link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-small pull-right", title: 'Edit Snippet'
%br
%div= render 'blob'
%div#notes= render "notes/notes_with_form"
%h3.page_title
Snippets by
= @user.name
%small share code pastes with others out of git repository
= link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
Add new snippet
%hr
.row
.span3
%ul.nav.nav-pills.nav-stacked
= nav_tab :scope, nil do
= link_to "All", user_snippets_path(@user)
= nav_tab :scope, 'private' do
= link_to "Private", user_snippets_path(@user, scope: 'private')
= nav_tab :scope, 'public' do
= link_to "Public", user_snippets_path(@user, scope: 'public')
.span9
= render 'snippets'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment