Issue 3126: Editing draft allows you to orphan it, sending the work into... #724

Merged
merged 4 commits into from Aug 9, 2012

Projects

None yet

2 participants

Member

... orphan_account's draft limbo

Resolves issue: http://code.google.com/p/otwarchive/issues/detail?id=3126

Added an if-else statement to check to see if the current work has been posted. If it hasn't (and is therefore a draft) the 'Orphan' button doesn't show up.

@sarken sarken commented on an outdated diff Jul 4, 2012
app/views/works/edit.html.erb
@@ -21,7 +21,10 @@
<% unless (@work.pseuds - current_user.pseuds).empty? %>
<li><%= link_to t('.remove_me_as_author', :default => 'Remove Me As Author'), { :action => "edit", :remove => "me"}, :confirm => 'This will remove you from all chapters as well. Are you sure?' %></li>
<% end %>
- <li><%= link_to t('.orphan_work', :default => 'Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id} %></li>
+ <% if @work.posted? %>
+ <li><%= link_to t('.orphan_work', :default => 'Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id} %></li>
sarken
sarken Jul 4, 2012 Owner

I think we can make this (and the others above and below it) a new style translation string, like link_to ts('Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id}

Member
scottsds commented Jul 5, 2012

That should so it.

@sarken sarken commented on an outdated diff Aug 4, 2012
app/views/works/edit.html.erb
@@ -16,13 +16,17 @@
<%= link_to h(chapter.position) + ts(" (Draft)"), [:edit, @work, chapter] %>
<% end %>
<% end %></li>
- <li><%= link_to t('.manage_chapters', :default => 'Manage Chapters'), manage_work_chapters_path(@work) %></li>
+ link_to ts('Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id}
sarken
sarken Aug 4, 2012 Owner

I don't think this line belongs here, since it also appears below on line 26. If it does belong here, it's missing the opening <=% and closing %>

@sarken sarken commented on an outdated diff Aug 4, 2012
app/views/works/edit.html.erb
<% end %>
- <li><%= link_to t('.orphan_work', :default => 'Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id} %></li>
- <li><%= link_to t('.delete_work', :default => 'Delete Work'), @work, :confirm => t('.links.are_you_sure', :default => 'Are you sure?'), :method => :delete %></li>
+ <% if @work.posted? %>
+ <li><%= link_to ts('Orphan Work'), {:controller => 'orphans', :action => 'new', :work_id => @work.id} %></li>
+ <% else %>
sarken
sarken Aug 4, 2012 Owner

We shouldn't need the else here, since we just want it to do nothing if the work is unposted.

@sarken sarken commented on an outdated diff Aug 5, 2012
app/views/works/edit.html.erb
@@ -1,14 +1,14 @@
<!--Descriptive page name, messages and instructions-->
-<h2 class="heading"><%=h t('.works.edit.edit_work', :default =>'Edit Work') %></h2>
+<h2 class="heading"><%=h ts('Edit Work') %></h2>
sarken
sarken Aug 5, 2012 Owner

Oh, sorry, one more thing! The h is part of the old translation format and can be removed.

@sarken sarken merged commit fedec59 into otwcode:master Aug 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment