From e28aa23e68bfeaf1a34a860ac456ee0a4e93bbde Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Tue, 3 Apr 2012 20:20:48 +0200 Subject: [PATCH] Edit title/desc links --- app/assets/stylesheets/asciicasts.css.scss | 16 ++++++++++++++-- app/views/asciicasts/show.html.erb | 22 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/asciicasts.css.scss b/app/assets/stylesheets/asciicasts.css.scss index 309d7fd..0fc58d1 100644 --- a/app/assets/stylesheets/asciicasts.css.scss +++ b/app/assets/stylesheets/asciicasts.css.scss @@ -1,11 +1,15 @@ +@mixin normal-text { + font-size: 14px; + font-weight: normal; +} + .asciicast-heading { // width: 100%; // background-color: #222; .meta { + @include normal-text; float: right; - font-size: 14px; - font-weight: normal; // .avatar { // width: 24px; // padding: 1px; @@ -14,6 +18,10 @@ // } } + .edit-title { + @include normal-text; + } + // .description { // color: #3e3e3e; // font-family: arial, helvetica; @@ -22,6 +30,10 @@ // } } +.asciicast-delete-link { + color: #d00; +} + .asciicast { .player { margin-bottom: 40px; diff --git a/app/views/asciicasts/show.html.erb b/app/views/asciicasts/show.html.erb index 2467a4a..f95691b 100644 --- a/app/views/asciicasts/show.html.erb +++ b/app/views/asciicasts/show.html.erb @@ -2,6 +2,16 @@

<%= asciicast_title(@asciicast) %> + <% if @asciicast.user == current_user %> + <% if @asciicast.title.blank? %> + <%= link_to 'Add a title', edit_asciicast_path(@asciicast), + :class => 'edit-title' %> + <% else %> + <%= link_to 'Edit title', edit_asciicast_path(@asciicast), + :class => 'edit-title' %> + <% end %> + <% end %> + Recorded by <%= profile_link(@asciicast, :avatar => false) %> @@ -13,9 +23,19 @@ <%= render :partial => 'asciicasts/asciicast', :object => @asciicast %> <% if @asciicast.user == current_user %> + <% if @asciicast.description.blank? %> + <%= link_to 'Add a description', edit_asciicast_path(@asciicast), + :class => 'edit-description' %> + <% else %> + <%= link_to 'Edit description', edit_asciicast_path(@asciicast), + :class => 'edit-description' %> + <% end %> + + | + <%= link_to 'Delete this asciicast', asciicast_path(@asciicast), :method => :delete, :confirm => 'U SHURE?', - :class => 'delete-link' %> + :class => 'asciicast-delete-link' %> <% end %>