fix ePortfolio entry update bugs
fixes CNVS-5416 test plan: 0) make sure you can NOT reproduce the bug (see CNVS-5416 and http://screencast.com/t/Fvze4WFTMwmo) 1) click "Edit this Page" button on a ePortfolio page and ensure that you can edit the title and the title updates appropriately (as does the link on the right sidebar). optional info from bug report: Description) When you edit a page name in ePortfolio and refresh, all the content disappears and you cannot bring back the page via URL. Expected Behavior) It is expected that editing the name of a page in ePortfolio will change the page name and keep the content that was previously there. To Reproduce Bug (which should be impossible now)) 1. Go to ePortfolio 2. Create a page and put xyz in it. Save the page. 3. Using the "Organize/Manage Pages" link, edit the page name. 4. You have to refresh to save the page. 5. Note that the new page name is there, and the content is gone. 6. Try to go to the previous page name via URL. A green bar comes up with a check mark and says "Can't find that page." Change-Id: I11b2c0c4c2278edb5349a61b6cf9af7fd74d8cae Reviewed-on: https://gerrit.instructure.com/21945 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com> Product-Review: Marc LeGendre <marc@instructure.com> QA-Review: Marc LeGendre <marc@instructure.com>
This commit is contained in:
parent
7a6ccef2b9
commit
db1b2de8ff
|
@ -69,7 +69,7 @@ class EportfolioEntriesController < ApplicationController
|
|||
@portfolio = Eportfolio.find(params[:eportfolio_id])
|
||||
if authorized_action(@portfolio, @current_user, :update)
|
||||
@entry = @portfolio.eportfolio_entries.find(params[:id])
|
||||
@entry.parse_content(params)
|
||||
@entry.parse_content(params) if params[:section_count]
|
||||
category_id = params[:eportfolio_entry].delete(:eportfolio_category_id)
|
||||
if category_id && category_id.to_i != @entry.eportfolio_category_id
|
||||
category = @portfolio.eportfolio_categories.find(category_id)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<a href="#" class="edit_page_link" title="<%= t('titles.rename_page', "Rename Page") %>">
|
||||
<i class="icon-edit standalone-icon"></i>
|
||||
</a>
|
||||
<a class="page_url no-hover" href="<%= eportfolio_named_category_entry_path(@portfolio,@category.slug, e.slug) %>">
|
||||
<a class="page_url no-hover" href="<%= eportfolio_named_category_entry_path(@portfolio, @category.slug, e.slug) %>">
|
||||
<span class="name"><%= e.name %></span>
|
||||
</a>
|
||||
<a class="rename_page_url" href="<%= eportfolio_entry_path(@portfolio, e.id) %>" style="display: none;"> </a>
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
<% if can_do(@portfolio, @current_user, :manage) %>
|
||||
<div style="float: right; display: none;"><a href="#" class="edit_content_link icon-edit"><%= edit_link_text %></a></div>
|
||||
<% end %>
|
||||
<h2><%= @page.name %></h2>
|
||||
<h2 id="eportfolio_entry_<%= @page.id %>"><span class="name"><%= @page.name %></span></h2>
|
||||
<% idx = 1 %>
|
||||
<% form_for @page, :url => eportfolio_entry_url(@portfolio, @page), :html => {:id => "edit_page_form" } do |f| %>
|
||||
<div class="form_content">
|
||||
|
|
|
@ -188,6 +188,7 @@ define([
|
|||
$(this).loadingImage();
|
||||
},
|
||||
success: function(data) {
|
||||
$(document).triggerHandler('page_updated', data);
|
||||
$(".edit_content_link_holder").show();
|
||||
if(data.eportfolio_entry.allow_comments) {
|
||||
$("#page_comments_holder").slideDown('fast');
|
||||
|
@ -604,6 +605,15 @@ define([
|
|||
id: 'page_' + entry.id,
|
||||
hrefValues: ['id', 'slug']
|
||||
});
|
||||
// update links (unable to take advantage of fillTemplateData's hrefValues for updates)
|
||||
if(event.type == "page_updated"){
|
||||
var page_url = $("#page_blank .page_url").attr('href');
|
||||
var rename_page_url = $("#page_blank .rename_page_url").attr('href');
|
||||
page_url = $.replaceTags(page_url, 'slug', entry.slug);
|
||||
rename_page_url = $.replaceTags(page_url, 'id', entry.id);
|
||||
$page.find(".page_url").attr('href', page_url);
|
||||
$page.find(".rename_page_url").attr('href', rename_page_url);
|
||||
}
|
||||
var $entry = $("#structure_entry_" + entry.id);
|
||||
if($entry.length === 0) {
|
||||
$entry = $("#structure_entry_blank").clone(true).removeAttr('id');
|
||||
|
@ -613,6 +623,13 @@ define([
|
|||
id: 'structure_entry_' + entry.id,
|
||||
data: entry
|
||||
});
|
||||
var $activePage = $("#eportfolio_entry_" + entry.id);
|
||||
if($activePage.length) {
|
||||
$activePage.fillTemplateData({
|
||||
id: 'eportfolio_entry_' + entry.id,
|
||||
data: entry
|
||||
});
|
||||
}
|
||||
countObjects('page');
|
||||
});
|
||||
$(".manage_pages_link,#section_pages .done_editing_button").click(function(event) {
|
||||
|
|
Loading…
Reference in New Issue