Commit 9710e42d authored by Andrew8xx8's avatar Andrew8xx8

Layuot and templates for personal snippets added

parent b3dc4fb7
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%i.icon-file %i.icon-file
%strong= @snippet.file_name %strong= @snippet.file_name
%span.options %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 .file_content.code
- unless @snippet.content.empty? - unless @snippet.content.empty?
%div{class: user_color_scheme_class} %div{class: user_color_scheme_class}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}" = @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}"
%hr %hr
.snippet-form-holder .snippet-form-holder
= form_for [@project, @snippet] do |f| = form_for @snippet, as: :personal_snippet, url: url do |f|
-if @snippet.errors.any? -if @snippet.errors.any?
.alert.alert-error .alert.alert-error
%ul %ul
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
.clearfix .clearfix
= f.label :title = f.label :title
.input= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true .input= f.text_field :title, placeholder: "Example Snippet", class: 'input-xlarge', required: true
.clearfix
= f.label "Private?"
.input= f.check_box :private, {class: ''}
.clearfix .clearfix
= f.label "Lifetime" = f.label "Lifetime"
.input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'} .input= f.select :expires_at, lifetime_select_options, {}, {class: 'chosen span2'}
...@@ -28,9 +31,9 @@ ...@@ -28,9 +31,9 @@
.form-actions .form-actions
= f.submit 'Save', class: "btn-save btn" = 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? - 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 :javascript
......
%tr %tr
%td %td
- if snippet.private?
%i.icon-lock
- else
%i.icon-globe
= image_tag gravatar_icon(snippet.author_email), class: "avatar s24" = image_tag gravatar_icon(snippet.author_email), class: "avatar s24"
- if snippet.project_id?
%a{href: project_snippet_path(snippet.project, snippet)} %a{href: project_snippet_path(snippet.project, snippet)}
%strong= truncate(snippet.title, length: 60) %strong= truncate(snippet.title, length: 60)
- else
%a{href: snippet_path(snippet)}
%strong= truncate(snippet.title, length: 60)
%td %td
= snippet.file_name = snippet.file_name
%td %td
...@@ -11,3 +19,6 @@ ...@@ -11,3 +19,6 @@
= snippet.expires_at.to_date.to_s(:short) = snippet.expires_at.to_date.to_s(:short)
- else - else
Never 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 %h3.page_title
Snippets Snippets
%small share code pastes with others out of git repository %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
- 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 Add new snippet
%br
%table %hr
%thead .row
%tr .span3
%th Title %ul.nav.nav-pills.nav-stacked
%th File Name = nav_tab :scope, nil do
%th Expires At = link_to "All", snippets_path
= render @snippets = nav_tab :scope, 'projects' do
- if @snippets.empty? = link_to "Projects", snippets_path(scope: 'projects')
%tr
%td{colspan: 3} .span9
%h3.nothing_here_message Nothing here. = render 'snippets'
= render "snippets/form" = render "snippets/form", url: snippets_path(@snippet)
%h3.page_title %h3.page_title
- if @snippet.private?
%i.icon-lock
- else
%i.icon-globe
= @snippet.title = @snippet.title
%small= @snippet.file_name %small= @snippet.file_name
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - if @snippet.author == current_user
= link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small pull-right", title: 'Edit Snippet' = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-small pull-right", title: 'Edit Snippet'
%br %br
%div= render 'blob' %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